summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--client/docgen/docgen.pro15
-rw-r--r--client/docgen/genimage.cc3
-rw-r--r--client/praxisd.cc14
-rw-r--r--client/widgets/common.cc27
-rw-r--r--client/widgets/textedit.cc6
-rw-r--r--client/widgets/textedit.h4
-rw-r--r--client/widgets/widget.cc53
-rw-r--r--client/widgets/widget.h41
9 files changed, 145 insertions, 20 deletions
diff --git a/VERSION b/VERSION
index 17b9e92..52b6a1f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-VERSION=2.1.0 \ No newline at end of file
+VERSION=2.2.0 \ No newline at end of file
diff --git a/client/docgen/docgen.pro b/client/docgen/docgen.pro
index a99c43a..4521347 100644
--- a/client/docgen/docgen.pro
+++ b/client/docgen/docgen.pro
@@ -15,13 +15,10 @@ win32 {
INCLUDEPATH += lua/include
LIBS += -llua51
DEFINES += HOST_WIN32
- LIBS += -lcurl -lexpat
}
unix {
LIBS += -llua
- LIBS += -lqjson
- LIBS += -lcurl -lexpat
}
# Input
@@ -31,13 +28,14 @@ SOURCES += \
generate.cc \
parse.cc \
highlight.cc \
+ ../expandbutton.cc \
+ ../template.cc \
../debug.cc \
../lua.cc \
../luawidget.cc \
../luadb.cc \
../luapraxisd.cc \
- ../../server/src/praxisd.cc \
- ../../server/src/saxparser.cc \
+ ../praxisd.cc \
../messagebox.cc \
../macrowindow.cc \
../collapser.cc \
@@ -46,8 +44,8 @@ SOURCES += \
../mainwindow.cc \
../macro.cc \
../header.cc \
- ../viewer.cc \
../macrodrawer.cc \
+ ../aboutbox.cc \
../widgets/common.cc \
../widgets/widget.cc \
../widgets/label.cc \
@@ -74,6 +72,9 @@ HEADERS += \
parse.h \
doc.h \
highlight.h \
+ ../expandbutton.h \
+ ../praxisd.h \
+ ../template.h \
../debug.h \
../lua.h \
../luawidget.h \
@@ -87,8 +88,8 @@ HEADERS += \
../entity.h \
../macro.h \
../header.h \
- ../viewer.h \
../macrodrawer.h \
+ ../aboutbox.h \
../widgets.h \
../widgets/common.h \
../widgets/widget.h \
diff --git a/client/docgen/genimage.cc b/client/docgen/genimage.cc
index 02f1243..5e6ad95 100644
--- a/client/docgen/genimage.cc
+++ b/client/docgen/genimage.cc
@@ -33,15 +33,12 @@
#include <QDir>
#include <QDomDocument>
-#include <viewer.h>
#include <widgets.h>
QString cpr;
QString user;
QFont fixedfont;
-Viewer *viewer = NULL;
-
extern QString output;
QString genImage(QString xml, int idx)
diff --git a/client/praxisd.cc b/client/praxisd.cc
index a77e287..001eb90 100644
--- a/client/praxisd.cc
+++ b/client/praxisd.cc
@@ -297,6 +297,9 @@ PraxisdSync::PraxisdSync(QString host, unsigned short int port)
this->port = port;
this->running = true;
+ error = false;
+ errorStr = "";
+
start();
}
@@ -367,7 +370,7 @@ QString PraxisdSync::errorString()
void PraxisdSync::networkError(QString err)
{
error = true;
- errorStr = err;
+ errorStr = "Network error: " + err;
rsem.release();
quit();
}
@@ -411,8 +414,13 @@ CaveVector PraxisdSync::diverse_get_cave(QString sogenr)
Patient PraxisdSync::patient_get_by_cpr(QString cpr)
{
- cpr = "";
- return Patient();
+ request_type = Praxisd::patient;
+ request_cpr = cpr;
+
+ wsem.release();
+ rsem.acquire();
+
+ return patient;
}
DokMenuVector PraxisdSync::dokmenu_get_all_by_cpr(QString cpr)
diff --git a/client/widgets/common.cc b/client/widgets/common.cc
index 2262074..3cf0d54 100644
--- a/client/widgets/common.cc
+++ b/client/widgets/common.cc
@@ -31,6 +31,8 @@
#include <QDomElement>
#include <QString>
+#include <stdio.h>
+
//#define LINEWIDTH 80
static QString reformatHelpString(QString help)
@@ -74,6 +76,31 @@ void setCommonAttributes(QWidget *widget, QDomNode &node)
widget->setWhatsThis(helptext);
// widget->setToolTip(helptext);
}
+
+ if(elem.hasAttribute("colour") &&
+ elem.attribute("colour").length() == 6) {
+ unsigned int r, g, b;
+ sscanf(elem.attribute("colour").toStdString().c_str(),
+ "%02x%02x%02x", &r, &g, &b);
+
+ char style[128];
+ sprintf(style, "* { color: #%02x%02x%02x; }",
+ r, g, b);
+ widget->setStyleSheet(style);
+ }
+
+ if(elem.hasAttribute("bgcolour") &&
+ elem.attribute("bgcolour").length() == 6) {
+ unsigned int r, g, b;
+ sscanf(elem.attribute("bgcolour").toStdString().c_str(),
+ "%02x%02x%02x", &r, &g, &b);
+
+ char style[128];
+ sprintf(style, "* { background-color: #%02x%02x%02x; }",
+ r, g, b);
+ widget->setStyleSheet(style);
+ }
+
}
void setCommonLayout(QWidget *widget, QDomNode &node)
diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc
index 757a353..96783d9 100644
--- a/client/widgets/textedit.cc
+++ b/client/widgets/textedit.cc
@@ -27,7 +27,7 @@
#include "textedit.h"
#include <QPalette>
-#include <QTextEdit>
+#include <QPlainTextEdit>
#include <stdio.h>
#include "common.h"
@@ -35,7 +35,7 @@
TextEdit::TextEdit(QDomNode &node, MacroWindow *macrowindow)
: Widget(node, macrowindow)
{
- textedit = new QTextEdit();
+ textedit = new QPlainTextEdit();
widget = textedit;
setCommonAttributes(textedit, node);
@@ -77,7 +77,7 @@ QString TextEdit::value()
void TextEdit::setValue(QString value, QString source)
{
if(isUserSource(source)) emit wasChanged();
- textedit->setText(value);
+ textedit->setPlainText(value);
// setInitialValue(value);
}
diff --git a/client/widgets/textedit.h b/client/widgets/textedit.h
index bfe7374..542dd6f 100644
--- a/client/widgets/textedit.h
+++ b/client/widgets/textedit.h
@@ -45,7 +45,7 @@
* still able to select and copy text.
*/
-class QTextEdit;
+class QPlainTextEdit;
class TextEdit : public Widget
{
Q_OBJECT
@@ -66,7 +66,7 @@ protected:
bool eventFilter(QObject *obj, QEvent *event);
private:
- QTextEdit *textedit;
+ QPlainTextEdit *textedit;
};
#endif/*__PRACRO_TEXTEDIT_H__*/
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc
index 2374c6f..ac90ef2 100644
--- a/client/widgets/widget.cc
+++ b/client/widgets/widget.cc
@@ -401,6 +401,26 @@ void Widget::setValues()
else emit eventOnChange(); // Make sure we run validation on the unset widget.
}
+void Widget::setForegroundColour(unsigned char red,
+ unsigned char green,
+ unsigned char blue)
+{
+ char style[128];
+ sprintf(style, "* { color: #%02x%02x%02x; }",
+ red, green, blue);
+ qwidget()->setStyleSheet(style);
+}
+
+void Widget::setBackgroundColour(unsigned char red,
+ unsigned char green,
+ unsigned char blue)
+{
+ char style[128];
+ sprintf(style, "* { background-color: #%02x%02x%02x; }",
+ red, green, blue);
+ qwidget()->setStyleSheet(style);
+}
+
void Widget::createWidget(QDomNode &xml_node, QLayout *layout)
{
QDomElement xml_elem = xml_node.toElement();
@@ -655,3 +675,36 @@ int wdg_set_valid(lua_State *L)
return 0;
}
+
+int wdg_set_bgcol(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)lua_touserdata(L, 1);
+ luaL_argcheck(L, wdgu, 1, "widget expected");
+
+ int r = luaL_checknumber(L, 2);
+ int g = luaL_checknumber(L, 3);
+ int b = luaL_checknumber(L, 4);
+
+ wdgu->widget->setBackgroundColour((unsigned char)r, (unsigned char)g, (unsigned char)b);
+
+ return 0;
+}
+
+int wdg_set_fgcol(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)lua_touserdata(L, 1);
+ luaL_argcheck(L, wdgu, 1, "widget expected");
+
+ int r = luaL_checknumber(L, 2);
+ int g = luaL_checknumber(L, 3);
+ int b = luaL_checknumber(L, 4);
+
+ wdgu->widget->setForegroundColour((unsigned char)r, (unsigned char)g, (unsigned char)b);
+
+ return 0;
+}
+
diff --git a/client/widgets/widget.h b/client/widgets/widget.h
index d0f1799..4f23790 100644
--- a/client/widgets/widget.h
+++ b/client/widgets/widget.h
@@ -61,6 +61,12 @@
* @att local This attribute is a boolean telling wether the field can be stored
* in the database on commits. It can be either 'true' or 'false'. The default
* is 'false'.
+ * @att colour The foreground (text) colour of the widget. The value must be a
+ * 6 byte hexadecimal string with each 2 byte pair describing the colour
+ * channels in order: Red, green blue. Example: '0f1a3b'.
+ * @att bgcolour The background colour of the widget. The value must be a
+ * 6 byte hexadecimal string with each 2 byte pair describing the colour
+ * channels in order: Red, green blue. Example: '0f1a3b'.
*/
class QLayout;
@@ -106,6 +112,13 @@ public:
virtual bool setKeyboardFocus();
+ virtual void setForegroundColour(unsigned char red,
+ unsigned char green,
+ unsigned char blue);
+ virtual void setBackgroundColour(unsigned char red,
+ unsigned char green,
+ unsigned char blue);
+
virtual QWidget *qwidget() { return widget; }
// Set deep to true to search through inner widgets.
@@ -278,6 +291,30 @@ int wdg_valid(lua_State *L);
*/
int wdg_set_valid(lua_State *L);
+/***
+ * @method nil setBackgroundColour(integer red, integer green, integer blue)
+ * This method is used to change to background colour of the widget.
+ * @param red An integer value in the range 0-255. This is the red component of
+ * the RGB colour value.
+ * @param green An integer value in the range 0-255. This is the green component
+ * of the RGB colour value.
+ * @param blue An integer value in the range 0-255. This is the blue component
+ * of the RGB colour value.
+ */
+int wdg_set_bgcol(lua_State *L);
+
+/***
+ * @method nil setForegroundColour(integer red, integer green, integer blue)
+ * This method is used to change to foreground (text) colour of the widget.
+ * @param red An integer value in the range 0-255. This is the red component of
+ * the RGB colour value.
+ * @param green An integer value in the range 0-255. This is the green component
+ * of the RGB colour value.
+ * @param blue An integer value in the range 0-255. This is the blue component
+ * of the RGB colour value.
+ */
+int wdg_set_fgcol(lua_State *L);
+
#define WDG_METHS \
{"name", wdg_name},\
{"type", wdg_type},\
@@ -290,7 +327,9 @@ int wdg_set_valid(lua_State *L);
{"hidden", wdg_hidden},\
{"setHidden", wdg_set_hidden},\
{"valid", wdg_valid},\
- {"setValid", wdg_set_valid}
+ {"setValid", wdg_set_valid},\
+ {"setForegroundColour", wdg_set_fgcol},\
+ {"setBackgroundColour", wdg_set_bgcol}
const struct luaL_Reg wdg_meths[] =
{ WDG_METHS, {NULL, NULL} };