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/client.qrc | 4 ++++ client/icons/icon_close_commit.png | Bin 0 -> 1834 bytes client/icons/icon_close_no_commit.png | Bin 0 -> 1520 bytes client/icons/icon_current_sessions.png | Bin 0 -> 1646 bytes client/icons/icon_discard.png | Bin 0 -> 1654 bytes client/mainwindow.cc | 34 +++++++++++++++++++++++++++++---- client/sessions.cc | 5 +++++ client/sessions.h | 2 ++ 8 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 client/icons/icon_close_commit.png create mode 100644 client/icons/icon_close_no_commit.png create mode 100644 client/icons/icon_current_sessions.png create mode 100644 client/icons/icon_discard.png (limited to 'client') diff --git a/client/client.qrc b/client/client.qrc index ffbbda0..7cb5361 100644 --- a/client/client.qrc +++ b/client/client.qrc @@ -9,5 +9,9 @@ icons/padlock.png icons/done.png icons/undone.png + icons/icon_close_commit.png + icons/icon_current_sessions.png + icons/icon_close_no_commit.png + icons/icon_discard.png diff --git a/client/icons/icon_close_commit.png b/client/icons/icon_close_commit.png new file mode 100644 index 0000000..2da7b33 Binary files /dev/null and b/client/icons/icon_close_commit.png differ diff --git a/client/icons/icon_close_no_commit.png b/client/icons/icon_close_no_commit.png new file mode 100644 index 0000000..70e5492 Binary files /dev/null and b/client/icons/icon_close_no_commit.png differ diff --git a/client/icons/icon_current_sessions.png b/client/icons/icon_current_sessions.png new file mode 100644 index 0000000..6881af2 Binary files /dev/null and b/client/icons/icon_current_sessions.png differ diff --git a/client/icons/icon_discard.png b/client/icons/icon_discard.png new file mode 100644 index 0000000..5cfa574 Binary files /dev/null and b/client/icons/icon_discard.png differ 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() diff --git a/client/sessions.cc b/client/sessions.cc index 50d7d6f..d663b65 100644 --- a/client/sessions.cc +++ b/client/sessions.cc @@ -84,6 +84,11 @@ void Sessions::show() dlg.exec(); } +bool Sessions::isEmpty() +{ + return s.size() == 0; +} + QVariant Sessions::toVariant() { return s; diff --git a/client/sessions.h b/client/sessions.h index e518044..b42d27b 100644 --- a/client/sessions.h +++ b/client/sessions.h @@ -47,6 +47,8 @@ public: QString getUser(QString cpr); QString getSessionID(QString cpr); + bool isEmpty(); + private: QMap s; // QMap > sessions; -- cgit v1.2.3