diff options
author | deva <deva> | 2010-05-27 10:34:08 +0000 |
---|---|---|
committer | deva <deva> | 2010-05-27 10:34:08 +0000 |
commit | 2846c88debd537159898339d2a55dcdccdbab45b (patch) | |
tree | 5ce7205f3a6697721d1e1cb1bd4435c89e3de67f /client/mainwindow.cc | |
parent | f92dd279a1e26dad7507d5d6944567c23834d440 (diff) |
Added icons to the toolbar. Added messageboxes to discard and closeNoCommit.
Diffstat (limited to 'client/mainwindow.cc')
-rw-r--r-- | client/mainwindow.cc | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 46662fa..9634f24 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -59,10 +59,21 @@ MainWindow::MainWindow(QString cpr, QString templ, QString host, status->addPermanentWidget(new QLabel("Pracro v."VERSION)); QToolBar *toolbar = addToolBar("controls"); + toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); QAction *close_commit = toolbar->addAction("Close and commit"); + close_commit->setIcon(QPixmap(":icons/icon_close_commit.png")); + QAction *close_no_commit = toolbar->addAction("Close no commit"); + close_no_commit->setIcon(QPixmap(":icons/icon_close_no_commit.png")); + QAction *close_discard = toolbar->addAction("Close discard"); + close_discard->setIcon(QPixmap(":icons/icon_discard.png")); + + toolbar->addSeparator(); + QAction *show_sessions = toolbar->addAction("Show sessions"); + show_sessions->setIcon(QPixmap(":icons/icon_current_sessions.png")); + connect(close_commit, SIGNAL(triggered()), this, SLOT(closeCommit())); connect(close_no_commit, SIGNAL(triggered()), this, SLOT(closeNoCommit())); connect(close_discard, SIGNAL(triggered()), this, SLOT(closeDiscard())); @@ -78,8 +89,12 @@ MainWindow::MainWindow(QString cpr, QString templ, QString host, this->templ = templ; setStatusBar(status); - + init(); + + if(sessions.isEmpty()) { + show_sessions->setEnabled(false); + } } MainWindow::~MainWindow() @@ -95,15 +110,26 @@ void MainWindow::closeCommit() void MainWindow::closeNoCommit() { + QMessageBox::information(this, + "Closing without commit", + "This session will be stored on this computer only." + " To reopen it at a later time, simply open the same patient again."); sessions.add(cpr, user, netcom.sessionid); close(); } void MainWindow::closeDiscard() { - netcom.discard(); - sessions.remove(cpr); - close(); + if(QMessageBox::question(this, + "Discard", + "This session will <strong>NOT</strong> be stored in the journal.<br/>" + "Are you sure you want to continue?", + QMessageBox::Yes | QMessageBox::Abort) + == QMessageBox::Yes) { + netcom.discard(); + sessions.remove(cpr); + close(); + } } void MainWindow::showSessions() |