From 159d4a25168090718d30965f8ab3d9eadb701c46 Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 12 Oct 2010 12:18:26 +0000 Subject: added template functionality, not done but i need to continue work on a windows pc so i will commit anyways --- client/launcherwindow.cc | 24 ++++++++++++++++++------ client/launcherwindow.h | 7 +++++-- client/pracro.cc | 9 +++++---- 3 files changed, 28 insertions(+), 12 deletions(-) (limited to 'client') diff --git a/client/launcherwindow.cc b/client/launcherwindow.cc index d2d5436..cea9b72 100644 --- a/client/launcherwindow.cc +++ b/client/launcherwindow.cc @@ -31,7 +31,7 @@ #include #include "launcherwindow.h" -LauncherWindow::LauncherWindow(QWidget *parent) +LauncherWindow::LauncherWindow(QString cpr, QString templ, QWidget *parent) : QDialog(parent) { setWindowTitle("Pracro Starter"); @@ -52,16 +52,23 @@ LauncherWindow::LauncherWindow(QWidget *parent) cprLineEdit = new QLineEdit(); cprLineEdit->setValidator(new QRegExpValidator(QRegExp("^[0-9]{10,10}$"), this)); + 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("Ok"); connect(ok, SIGNAL(clicked()), this, SLOT(accept())); QPushButton *cancel = new QPushButton("Annuller"); connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); QGridLayout *layout = new QGridLayout(); - /* - layout->addWidget(userLabel, 1, 1); - layout->addWidget(user, 1, 2, 1, 2); - */ + 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); @@ -74,7 +81,12 @@ LauncherWindow::~LauncherWindow() { } -QString LauncherWindow::cpr() +QString LauncherWindow::getCpr() { return cprLineEdit->text(); } + +QString LauncherWindow::getTemplate() +{ + return templates->itemData(currentIndex()); +} diff --git a/client/launcherwindow.h b/client/launcherwindow.h index 0bb9d88..038bb20 100644 --- a/client/launcherwindow.h +++ b/client/launcherwindow.h @@ -30,18 +30,21 @@ #include #include +#include class LauncherWindow : public QDialog { Q_OBJECT public: - LauncherWindow(QWidget *parent = 0); + LauncherWindow(QString, QString, QWidget *parent = 0); ~LauncherWindow(); - QString cpr(); + QString getCpr(); + QString getTemplate(); private: QLineEdit *cprLineEdit; + QComboBox *templates; }; diff --git a/client/pracro.cc b/client/pracro.cc index c02af93..3867507 100644 --- a/client/pracro.cc +++ b/client/pracro.cc @@ -178,10 +178,11 @@ int main(int argc, char *argv[]) QFont f = fontdb.font("Bitstream Vera Sans Mono", "", 8); fixedfont = &f; - if(cpr == CPR_DEFAULT) { - LauncherWindow lwnd; - if(lwnd.exec() == QDialog::Accepted) { - cpr = lwnd.cpr(); + if(cpr == CPR_DEFAULT || templ = TEMPLATE_DEFAULT) { + LauncherWindow lwnd(cpr, templ); + if(lwnd.exec() == QDialog::Accepted && lwnd.getCpr() != "") { + cpr = lwnd.getCpr(); + templ = lwnd.getTemplate(); } else { return 1; } -- cgit v1.2.3