summaryrefslogtreecommitdiff
path: root/client/launcherwindow.cc
diff options
context:
space:
mode:
authorsenator <senator>2010-10-12 12:53:31 +0000
committersenator <senator>2010-10-12 12:53:31 +0000
commitf3c83817a311c23df40f172b8561beede3d2d5e9 (patch)
treef54424bd4004db769525a845f995fd2eba07d022 /client/launcherwindow.cc
parente685e34c85319caca6608036f2c0150c2363577f (diff)
template functionality added to launcher but with hardcoded template list
Diffstat (limited to 'client/launcherwindow.cc')
-rw-r--r--client/launcherwindow.cc76
1 files changed, 38 insertions, 38 deletions
diff --git a/client/launcherwindow.cc b/client/launcherwindow.cc
index e939f00..f6657f7 100644
--- a/client/launcherwindow.cc
+++ b/client/launcherwindow.cc
@@ -32,49 +32,49 @@
#include "launcherwindow.h"
LauncherWindow::LauncherWindow(QString cpr, QString templ, QWidget *parent)
- : QDialog(parent)
+ : QDialog(parent)
{
setWindowTitle(tr("Pracro Launcher"));
- resize(250,80);
-/*
- QLabel *userLabel = new QLabel(tr("Username:"));
- QComboBox *user = new QComboBox();
- QFile file("users.txt");
- if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- while (!file.atEnd()) {
- QByteArray line = file.readLine();
- user->addItem(line, line);
- }
- file.close();
- }
-*/
- QLabel *cprLabel = new QLabel(tr("Patient ID:"));
- cprLineEdit = new QLineEdit();
- cprLineEdit->setValidator(new QRegExpValidator(QRegExp("^[0-9]{10,10}$"), this));
+ resize(250,80);
+
+ QLabel *cprLabel = new QLabel(tr("Patient ID:"));
+ cprLineEdit = new QLineEdit();
+ cprLineEdit->setValidator(new QRegExpValidator(QRegExp("^[0-9]{10,10}$"), this));
+
+ QLabel *templatesLabel = new QLabel(tr("Template:"));
+ templates = new QComboBox();
+ templates->addItem("Refraktiv kirurgi: Forundersøgelse",
+ "ref_forunders");
+ templates->addItem("Refraktiv kirurgi: Førstedagskontrol",
+ "ref_foerstedagskontrol");
+ templates->addItem("Refraktiv kirurgi: Efterkontrol",
+ "ref_efterkontrol");
- QLabel *templatesLabel = new QLabel("Template:");
- templates = new QComboBox();
- templates->addItem("Refraktiv kirurgi: Forundersøgelse",
- "ref_forunders");
- templates->addItem("Refraktiv kirurgi: Førstedagskontrol",
- "ref_foerstedagskontrol");
- templates->addItem("Refraktiv kirurgi: Efterkontrol",
- "ref_efterkontrol");
+ QPushButton *ok = new QPushButton(tr("Accept"));
+ connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
+ QPushButton *cancel = new QPushButton(tr("Cancel"));
+ connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
- QPushButton *ok = new QPushButton(tr("Accept"));
- connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
- QPushButton *cancel = new QPushButton(tr("Cancel"));
- connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
+ QGridLayout *layout = new QGridLayout();
+ layout->addWidget(templatesLabel, 1, 1);
+ layout->addWidget(templates, 1, 2, 1, 2);
+ layout->addWidget(cprLabel, 2, 1);
+ layout->addWidget(cprLineEdit, 2, 2, 1, 2);
+ layout->addWidget(ok, 3, 2);
+ layout->addWidget(cancel, 3, 3);
- QGridLayout *layout = new QGridLayout();
- layout->addWidget(templatesLabel, 1, 1);
- layout->addWidget(templates, 1, 2, 1, 2);
- layout->addWidget(cprLabel, 2, 1);
- layout->addWidget(cprLineEdit, 2, 2, 1, 2);
- layout->addWidget(ok, 3, 2);
- layout->addWidget(cancel, 3, 3);
+ if(cpr != "CPR_DEFAULT")
+ cprLineEdit->setText(cpr);
+
+ if(templ != "TEMPLATE_DEFAULT") {
+ long int i = 0;
+ for(i = 0; i < templates->count(); i++) {
+ if(templates->itemData(i).toString() == templ)
+ templates->setCurrentIndex(i);
+ }
+ }
- setLayout(layout);
+ setLayout(layout);
}
LauncherWindow::~LauncherWindow()
@@ -88,5 +88,5 @@ QString LauncherWindow::getCpr()
QString LauncherWindow::getTemplate()
{
- return templates->itemData(currentIndex());
+ return templates->itemData(templates->currentIndex()).toString();
}