summaryrefslogtreecommitdiff
path: root/client/pcpviewer/pcpviewer.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2011-11-03 10:40:04 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2011-11-03 10:40:04 +0100
commit82a2317dd87c0011717c0c29d3d171bb5ee81242 (patch)
treedd07e87d78d42b481c9fc1c98f7cbcc56a36fa15 /client/pcpviewer/pcpviewer.cc
parentacd0142e59047524302352e69332293655e6032c (diff)
Initial version of complete pcpraxis viewer, with patient info, journal view and docmenu.
Diffstat (limited to 'client/pcpviewer/pcpviewer.cc')
-rw-r--r--client/pcpviewer/pcpviewer.cc98
1 files changed, 80 insertions, 18 deletions
diff --git a/client/pcpviewer/pcpviewer.cc b/client/pcpviewer/pcpviewer.cc
index 739a681..5853e0a 100644
--- a/client/pcpviewer/pcpviewer.cc
+++ b/client/pcpviewer/pcpviewer.cc
@@ -27,40 +27,102 @@
*/
#include "pcpviewer.h"
-#include <stdio.h>
+#include <QVBoxLayout>
-PCPViewer::PCPViewer(QString patientid) : praxisd("localhost", 10000)
+#include <QTextCodec>
+
+#include "pcppatient.h"
+#include "pcpjournal.h"
+#include "pcpdocuments.h"
+#include "pcpdoc.h"
+#include "pcpimage.h"
+
+#include <QSplitter>
+#include <QSettings>
+
+PCPViewer::PCPViewer(QString patientid) : praxisd("sarge", 10000)
{
this->patientid = patientid;
+ setLayout(new QVBoxLayout());
+
connect(&praxisd, SIGNAL(networkError(QString)),
this, SLOT(networkError(QString)));
- /*
+ PCPPatient *patient = new PCPPatient();
+ layout()->addWidget(patient);
connect(&praxisd, SIGNAL(gotPatient(Patient)),
- this, SLOT(gotPatient(Patient)));
- */
+ patient, SLOT(setData(Patient)));
+
+ split = new QSplitter(Qt::Vertical);
+
+ PCPJournal *journal = new PCPJournal();
+ split->addWidget(journal);
+ connect(&praxisd, SIGNAL(gotJournal(QString)),
+ journal, SLOT(setData(QString)));
+
+ PCPDocuments *documents = new PCPDocuments();
+ split->addWidget(documents);
connect(&praxisd, SIGNAL(gotDokMenu(DokMenuVector)),
- this, SLOT(gotDokMenu(DokMenuVector)));
+ documents, SLOT(setData(DokMenuVector)));
+ connect(documents, SIGNAL(open(QString)),
+ this, SLOT(open(QString)));
+ connect(&praxisd, SIGNAL(gotDokMenuFile(QByteArray, QString)),
+ this, SLOT(gotDokMenuFile(QByteArray, QString)));
+
+ layout()->addWidget(split);
+
+ init();
+ praxisd.journal_get_by_cpr(patientid);
+ praxisd.patient_get_by_cpr(patientid);
praxisd.dokmenu_get_all_by_cpr(patientid);
}
-void PCPViewer::networkError(QString text)
+void PCPViewer::networkError(QString)
+{
+ // printf("ERROR: %s\n", text.toStdString().c_str());
+}
+
+void PCPViewer::open(QString name)
{
- printf("ERROR: %s\n", text.toStdString().c_str());
+ praxisd.dokmenu_get_by_cpr_and_name(patientid, name);
}
-void PCPViewer::gotDokMenu(DokMenuVector d)
+void PCPViewer::gotDokMenuFile(QByteArray data, QString mimetype)
{
- DokMenuVector::iterator di = d.begin();
- while(di != d.end()) {
- printf("%s %s %s %d %s\n",
- di->group.toStdString().c_str(),
- di->subject.toStdString().c_str(),
- di->filename.toStdString().c_str(),
- di->filesize,
- di->date.toStdString().c_str());
- di++;
+ if(mimetype == "image/jpeg; charset=binary") {
+ PCPImage *img = new PCPImage();
+ img->setData(data);
+ img->show();
}
+
+ if(mimetype == "text/plain; charset=cp850") {
+ PCPDoc *doc = new PCPDoc("cp850");
+ doc->setText(data);
+ doc->resize(600, 750);
+ doc->show();
+ }
+}
+
+void PCPViewer::closeEvent(QCloseEvent *event)
+{
+ QSettings settings("Aasimon.org", "PCPViewer");
+
+ settings.beginGroup("MainWindow");
+ settings.setValue("geometry", saveGeometry());
+ settings.setValue("split", split->saveState());
+ settings.endGroup();
+
+ event->accept();
+}
+
+void PCPViewer::init()
+{
+ QSettings settings("Aasimon.org", "PCPViewer");
+
+ settings.beginGroup("MainWindow");
+ restoreGeometry(settings.value("geometry").toByteArray());
+ split->restoreState(settings.value("split").toByteArray());
+ settings.endGroup();
}