From 2846c88debd537159898339d2a55dcdccdbab45b Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 27 May 2010 10:34:08 +0000 Subject: Added icons to the toolbar. Added messageboxes to discard and closeNoCommit. --- client/mainwindow.cc | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'client/mainwindow.cc') 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 NOT be stored in the journal.
" + "Are you sure you want to continue?", + QMessageBox::Yes | QMessageBox::Abort) + == QMessageBox::Yes) { + netcom.discard(); + sessions.remove(cpr); + close(); + } } void MainWindow::showSessions() -- cgit v1.2.3