summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2010-05-27 10:34:08 +0000
committerdeva <deva>2010-05-27 10:34:08 +0000
commit2846c88debd537159898339d2a55dcdccdbab45b (patch)
tree5ce7205f3a6697721d1e1cb1bd4435c89e3de67f
parentf92dd279a1e26dad7507d5d6944567c23834d440 (diff)
Added icons to the toolbar. Added messageboxes to discard and closeNoCommit.
-rw-r--r--client/client.qrc4
-rw-r--r--client/icons/icon_close_commit.pngbin0 -> 1834 bytes
-rw-r--r--client/icons/icon_close_no_commit.pngbin0 -> 1520 bytes
-rw-r--r--client/icons/icon_current_sessions.pngbin0 -> 1646 bytes
-rw-r--r--client/icons/icon_discard.pngbin0 -> 1654 bytes
-rw-r--r--client/mainwindow.cc34
-rw-r--r--client/sessions.cc5
-rw-r--r--client/sessions.h2
8 files changed, 41 insertions, 4 deletions
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 @@
<file>icons/padlock.png</file>
<file>icons/done.png</file>
<file>icons/undone.png</file>
+ <file>icons/icon_close_commit.png</file>
+ <file>icons/icon_current_sessions.png</file>
+ <file>icons/icon_close_no_commit.png</file>
+ <file>icons/icon_discard.png</file>
</qresource>
</RCC>
diff --git a/client/icons/icon_close_commit.png b/client/icons/icon_close_commit.png
new file mode 100644
index 0000000..2da7b33
--- /dev/null
+++ b/client/icons/icon_close_commit.png
Binary files 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
--- /dev/null
+++ b/client/icons/icon_close_no_commit.png
Binary files differ
diff --git a/client/icons/icon_current_sessions.png b/client/icons/icon_current_sessions.png
new file mode 100644
index 0000000..6881af2
--- /dev/null
+++ b/client/icons/icon_current_sessions.png
Binary files differ
diff --git a/client/icons/icon_discard.png b/client/icons/icon_discard.png
new file mode 100644
index 0000000..5cfa574
--- /dev/null
+++ b/client/icons/icon_discard.png
Binary files 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 <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()
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<QString, QVariant > s;
// QMap<QString, QList<QString> > sessions;