From e0e3d5fa10f80a88fa3b194b2a09cf89c8fced18 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 17 Aug 2009 14:59:42 +0000 Subject: A new journal watcher and pracro progressbar. --- client/pracro.cc | 66 ++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 18 deletions(-) (limited to 'client/pracro.cc') diff --git a/client/pracro.cc b/client/pracro.cc index 6d9c574..eacdeb1 100644 --- a/client/pracro.cc +++ b/client/pracro.cc @@ -35,6 +35,7 @@ #include "netcom.h" #include "mainwindow.h" +#include "viewer.h" #define CPR_DEFAULT "" #define MACRO_DEFAULT "" @@ -54,10 +55,6 @@ static void print_usage() printf("Executes the requested Pracro MACRO using supplied CPR and USER.\n"); printf("\n"); printf(" -h, --help Displays this help text.\n"); - /* - printf(" -m, --macro MACRO Requests macro MACRO from the Pracro \n" - " Server, defaults to \""MACRO_DEFAULT"\".\n"); - */ printf(" -t, --template TEMPLATE Requests template TEMPLATE from the Pracro \n" " Server, defaults to \""TEMPLATE_DEFAULT"\".\n"); printf(" -C, --cpr CPR Defines the cpr for use with the macro,\n" @@ -65,8 +62,10 @@ static void print_usage() printf(" -c, --config FILE The configfile to use. Default is \""CONFIG_DEFAULT"\"\n"); printf(" -u, -U, --user USER Defines the requesting user(not the patient),\n" " defaults to \""USER_DEFAULT"\"\n"); - // printf(" -t, --test macro Run client in testmode, i.e. run without contactig any\n" - // " servers. The macro must be a local xml file.\n"); + printf(" -v, --version Print version information and exit.\n"); + printf(" -V, --viewer TEMPLATES Show the viewer with TEMPLATES.\n"); + printf(" -O, --viewer-only TEMPLATES\n"); + printf(" Show the viewer only (no pracro editor window) with TEMPLATES.\n"); } static void print_version() @@ -90,6 +89,9 @@ int main(int argc, char *argv[]) QString macro = MACRO_DEFAULT; QString templ = TEMPLATE_DEFAULT; + bool show_viewer = false; + bool show_editor = true; + QString templs; QStringList args = app.arguments(); QStringList::iterator arg = args.begin(); @@ -99,22 +101,18 @@ int main(int argc, char *argv[]) if(*arg == "--help" || *arg == "-h") { print_usage(); + return 0; } else if(*arg == "--version" || *arg == "-v") { print_version(); + return 0; } else if(*arg == "--user" || *arg == "-U" || *arg == "-u") { user = getParam(args,arg); } - /* - else if(*arg == "--macro" || - *arg == "-m") { - macro = getParam(args, arg); - } - */ else if(*arg == "--template" || *arg == "-t") { templ = getParam(args, arg); @@ -127,6 +125,17 @@ int main(int argc, char *argv[]) *arg == "-c") { config = getParam(args, arg); } + else if(*arg == "--viewer" || + *arg == "-V") { + templs = getParam(args, arg); + show_viewer = true; + } + else if(*arg == "--viewer-only" || + *arg == "-O") { + templs = getParam(args, arg); + show_viewer = true; + show_editor = false; + } else { print_version(); print_usage(); @@ -141,16 +150,37 @@ int main(int argc, char *argv[]) settings.beginGroup("server"); host = settings.value("host").toString(); port = settings.value("port").toInt(); + QString journalpath = settings.value("journalpath").toString(); settings.endGroup(); QTranslator translator; - translator.load("pracro_dk"); - app.installTranslator(&translator); + if(translator.load("pracro_dk")) { + app.installTranslator(&translator); + } + + if(show_editor && show_viewer) { + MainWindow mainwindow(cpr, templ, host, port, user); + mainwindow.show(); + + Viewer viewer(cpr, templs, host, port, user, journalpath); + viewer.show(); - MainWindow mainwindow(cpr, templ, host, port, user); - mainwindow.show(); + return app.exec(); + } + + if(show_editor) { + MainWindow mainwindow(cpr, templ, host, port, user); + mainwindow.show(); + + return app.exec(); + } + + if(show_viewer) { + Viewer viewer(cpr, templs, host, port, user, journalpath); + viewer.show(); - int ret = app.exec(); + return app.exec(); + } - return ret; + return 1; } -- cgit v1.2.3