summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/launcherwindow.cc76
-rw-r--r--client/pracro.cc2
2 files changed, 39 insertions, 39 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();
}
diff --git a/client/pracro.cc b/client/pracro.cc
index 3867507..337702e 100644
--- a/client/pracro.cc
+++ b/client/pracro.cc
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
QFont f = fontdb.font("Bitstream Vera Sans Mono", "", 8);
fixedfont = &f;
- if(cpr == CPR_DEFAULT || templ = TEMPLATE_DEFAULT) {
+ if(cpr == CPR_DEFAULT || templ == TEMPLATE_DEFAULT) {
LauncherWindow lwnd(cpr, templ);
if(lwnd.exec() == QDialog::Accepted && lwnd.getCpr() != "") {
cpr = lwnd.getCpr();