summaryrefslogtreecommitdiff
path: root/client/viewer.cc
diff options
context:
space:
mode:
authordeva <deva>2010-06-10 07:03:06 +0000
committerdeva <deva>2010-06-10 07:03:06 +0000
commit198b0d886817f2c5bc97cfd11857d4b314dffae3 (patch)
tree4fc2d51de46ab69b9e67149abf0ab6a332032f27 /client/viewer.cc
parent730eb796bbce6f124be9194f1565b7dda1daddf1 (diff)
Add transaction support on database pr. pracro session. Makes it possible to discard all edited macros.
Diffstat (limited to 'client/viewer.cc')
-rw-r--r--client/viewer.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/client/viewer.cc b/client/viewer.cc
index c4bd3f5..eabcf16 100644
--- a/client/viewer.cc
+++ b/client/viewer.cc
@@ -35,6 +35,7 @@
#include <QSettings>
#include <QTextCodec>
+#ifdef WITH_FROGS
Status::Status()
{
QVBoxLayout *vl = new QVBoxLayout();
@@ -73,6 +74,9 @@ void Status::setStatus(QString macro, QString caption, bool done)
icons[macro]->setPixmap(QPixmap(done?":/icons/done.png":":icons/undone.png"));
}
+#endif
+
+extern QFont *fixedfont; // Defined in pracro.cc
Viewer::Viewer(QString cpr, QString templs, QString host, quint16 port,
QString user, QString journalpath)
@@ -81,11 +85,14 @@ Viewer::Viewer(QString cpr, QString templs, QString host, quint16 port,
this->templs = templs.split(QRegExp("\\W+"), QString::SkipEmptyParts);
connect(&updatetimer, SIGNAL(timeout()), this, SLOT(update()));
+
+#ifdef WITH_FROGS
netcom = new NetCom(host, port);
netcom->user = user;
netcom->patientid = cpr;
netcom->sessionid = "";
netcom->initConnection();
+#endif
host = host; port = port; user = user;
this->cpr = cpr;
@@ -95,6 +102,7 @@ Viewer::Viewer(QString cpr, QString templs, QString host, quint16 port,
QVBoxLayout *l = new QVBoxLayout();
setLayout(l);
+#ifdef WITH_FROGS
QStringList::iterator ti = this->templs.begin();
while(ti != this->templs.end()) {
Status *s = new Status();
@@ -102,10 +110,11 @@ Viewer::Viewer(QString cpr, QString templs, QString host, quint16 port,
statuses[*ti] = s;
ti++;
}
+#endif
journal = new QTextEdit();
journal->setReadOnly(true);
- journal->setFontFamily("Courier New");
+ journal->setFont(*fixedfont);
l->addWidget(journal);
init();
@@ -114,12 +123,13 @@ Viewer::Viewer(QString cpr, QString templs, QString host, quint16 port,
Viewer::~Viewer()
{
- updatetimer.stop();
- netcom->discard(); // Make sure sessionid is removed.
+#ifdef WITH_FROGS
delete netcom;
+#endif
delete journal;
}
+extern QWidget *viewer;
void Viewer::closeEvent(QCloseEvent *)
{
QSettings settings("Aasimon.org", "Pracro");
@@ -128,6 +138,13 @@ void Viewer::closeEvent(QCloseEvent *)
settings.setValue("size", size());
settings.setValue("pos", pos());
settings.endGroup();
+ viewer = NULL;
+
+ updatetimer.stop();
+
+#ifdef WITH_FROGS
+ netcom->discard(); // Make sure sessionid is removed.
+#endif
}
void Viewer::init()
@@ -143,6 +160,7 @@ void Viewer::init()
void Viewer::update()
{
+#ifdef WITH_FROGS
QStringList::iterator ti = templs.begin();
while(ti != templs.end()) {
QDomDocument xml_doc = netcom->send(*ti, "", false);
@@ -171,6 +189,7 @@ void Viewer::update()
ti++;
}
+#endif
// re-read journal file:
QString crypt;