diff options
| author | senator <senator> | 2010-10-13 14:22:03 +0000 | 
|---|---|---|
| committer | senator <senator> | 2010-10-13 14:22:03 +0000 | 
| commit | d733a517a3a3abe21697090d1fbdedabdf483578 (patch) | |
| tree | e48ce5589fda058fc22cbf177110eb0efb74c32f /client/launcherwindow.cc | |
| parent | 0a2bc3a119bd105d5f338faedc96962ee9395212 (diff) | |
added a messagebox that appears when leaving trying to proceed without entering a patient id
Diffstat (limited to 'client/launcherwindow.cc')
| -rw-r--r-- | client/launcherwindow.cc | 38 | 
1 files changed, 24 insertions, 14 deletions
| diff --git a/client/launcherwindow.cc b/client/launcherwindow.cc index 68f8e50..35ee532 100644 --- a/client/launcherwindow.cc +++ b/client/launcherwindow.cc @@ -31,23 +31,27 @@  #include <QPushButton>  #include <QFileInfo>  #include <QSettings> +#include <QMessageBox>  #include "launcherwindow.h" -LauncherWindow::LauncherWindow(QString arg, QString cpr, QString templ, QWidget *parent) +LauncherWindow::LauncherWindow(QString arg, QString cpr, QString templ, +                               QWidget *parent)    : QDialog(parent)  {    setWindowTitle(tr("Pracro Launcher"));    resize(250,80); -  QSettings templateConfig(QFileInfo(arg). -absolutePath() + "/templates.ini", QSettings::IniFormat); +  QSettings templateConfig(QFileInfo(arg).absolutePath() + +                           "/templates.ini", QSettings::IniFormat);    QLabel *cprLabel = new QLabel(tr("Patient ID:"));    cprLineEdit = new QLineEdit(); -  cprLineEdit->setValidator(new QRegExpValidator(QRegExp("^[0-9]{10,10}$"), this)); +  cprLineEdit->setValidator(new QRegExpValidator(QRegExp("^[0-9]{10,10}$"), +                                                 this));    QLabel *templatesLabel = new QLabel(tr("Template:"));    templates = new QComboBox(); -  connect(templates, SIGNAL(currentIndexChanged(int)), this, SLOT(focusCpr(int))); +  connect(templates, SIGNAL(currentIndexChanged(int)), this, +          SLOT(focusCpr(int)));    QStringList groups = templateConfig.childGroups();    QStringList::iterator i = groups.begin();    while(i != groups.end()) { @@ -60,16 +64,9 @@ absolutePath() + "/templates.ini", QSettings::IniFormat);      }      i++;    } -  /* -  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())); +  connect(ok, SIGNAL(clicked()), this, SLOT(checkForCpr()));    QPushButton *cancel = new QPushButton(tr("Cancel"));    connect(cancel, SIGNAL(clicked()), this, SLOT(reject())); @@ -114,3 +111,16 @@ void LauncherWindow::focusCpr(int)  {    cprLineEdit->setFocus();  } + +void LauncherWindow::checkForCpr() +{ +  if(cprLineEdit->text().length() == 10) { +    emit accept(); +  } else { +    QMessageBox::critical(this, tr("Incorrect Patient ID"), +                          tr("You need to enter a 10 character\n" +                             "Patient ID in order to continue."), +                          QMessageBox::Ok); +    cprLineEdit->setFocus(); +  } +} | 
