summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/macrowindow.cc23
-rw-r--r--client/pracro.cc2
-rw-r--r--client/widgets.h1
-rw-r--r--client/widgets/multilist.cc77
-rw-r--r--client/widgets/multilist.h11
5 files changed, 111 insertions, 3 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index 69df7f1..b799d31 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -135,6 +135,29 @@ void MacroWindow::recurser(QDomNode xml_node, QWidget *parent)
widgets.push_back(listbox);
widget = listbox;
//return; // Don't iterate children
+ } else if(xml_elem.tagName() == "multilist") {
+
+ MultiList *multilist = new MultiList(xml_elem, this);
+ widgets.push_back(multilist);
+ if(parent) parent->layout()->addWidget(multilist);
+
+ QDomNodeList children = xml_node.childNodes();
+ for (int i=0; i<children.count();i++) {
+ QDomNode child = children.at(i);
+ if(child.nodeName() == "input") {
+ QDomNodeList children = child.childNodes();
+
+ for (int i=0; i<children.count();i++) {
+ QDomNode child = children.at(i);
+ recurser(child, multilist->inputcontainer);
+ }
+ break;
+ }
+ }
+
+ multilist->inputcontainer->show();
+ multilist->show();
+ return; // Don't iterate children
}
QDomNodeList children = xml_node.childNodes();
diff --git a/client/pracro.cc b/client/pracro.cc
index 2b5c6c2..754dff2 100644
--- a/client/pracro.cc
+++ b/client/pracro.cc
@@ -61,6 +61,8 @@ 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");
}
static void print_version()
diff --git a/client/widgets.h b/client/widgets.h
index 49dbf72..97f5962 100644
--- a/client/widgets.h
+++ b/client/widgets.h
@@ -34,6 +34,7 @@
#include "widgets/pushbutton.h"
#include "widgets/combobox.h"
#include "widgets/listbox.h"
+#include "widgets/multilist.h"
#include "widgets/frame.h"
#include "widgets/groupbox.h"
#include "widgets/radiobuttons.h"
diff --git a/client/widgets/multilist.cc b/client/widgets/multilist.cc
index 7b08394..73a9747 100644
--- a/client/widgets/multilist.cc
+++ b/client/widgets/multilist.cc
@@ -26,9 +26,84 @@
*/
#include "multilist.h"
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QGridLayout>
+#include <QPushButton>
+
MultiList::MultiList(QDomNode &node, MacroWindow *macrowindow)
- : QWidget(), Widget(node, macrowindow)
+ : QFrame(), Widget(node, macrowindow)
{
+ /*
+ QDomElement elem = node.toElement();
+
+ if(elem.hasAttribute("width")) {
+ //resize(elem.attribute("width").toInt(), height());
+ setMinimumWidth(elem.attribute("width").toInt());
+ }
+
+ if(elem.hasAttribute("height")) {
+ //resize(width(), elem.attribute("height").toInt());
+ setMinimumHeight(elem.attribute("height").toInt());
+ }
+ */
+
+ QGridLayout *layout = new QGridLayout();
+ setLayout(layout);
+
+ QWidget *inputbox = new QWidget(this);
+ inputbox->setContentsMargins(0,0,0,0);
+ inputbox->setLayout(new QHBoxLayout());
+ inputbox->layout()->setContentsMargins(0,0,0,0);
+ layout->addWidget(inputbox, 0, 0, Qt::AlignTop);
+
+ QPushButton *add = new QPushButton(this);
+ add->setText("Add");
+ layout->addWidget(add, 0, 1, Qt::AlignTop);
+
+ // QFrame *listbox = new QFrame(this);
+ // listbox->setLayout(new QHBoxLayout());
+ // layout()->addWidget(listbox);
+
+ list = new QListWidget(this);
+ layout->addWidget(list, 1, 0, Qt::AlignTop);
+
+ QPushButton *rem = new QPushButton(this);
+ rem->setText("Remove");
+ layout->addWidget(rem, 1, 1, Qt::AlignTop);
+
+ inputcontainer = inputbox;
+
+ /*
+ if(elem.hasAttribute("layout")) {
+ if(elem.attribute("layout") == "hbox") {
+ QHBoxLayout *layout = new QHBoxLayout();
+ setLayout(layout);
+ } else if (elem.attribute("layout") == "vbox") {
+ QVBoxLayout *layout = new QVBoxLayout();
+ setLayout(layout);
+ }
+ }
+
+ QDomNodeList children = node.childNodes();
+
+ for (int i=0; i<children.count();i++) {
+ QDomNode child = children.at(i);
+ QDomElement radio_elem = child.toElement();
+ bool radio_bool = false;
+ if(elem.hasAttribute("value")) {
+ if(elem.attribute("value") == radio_elem.attribute("value")) {
+ radio_bool = true;
+ }
+ }
+ RadioButton *radiobutton = new RadioButton(child, radio_bool);
+
+ // Create radiobutton from child, insert in this
+ layout()->addWidget(radiobutton);
+ radiobutton_list.push_back(radiobutton);
+ }
+ */
+
}
void MultiList::changed()
diff --git a/client/widgets/multilist.h b/client/widgets/multilist.h
index 832e4c8..6057677 100644
--- a/client/widgets/multilist.h
+++ b/client/widgets/multilist.h
@@ -28,19 +28,26 @@
#define __PRACRO_MULTILIST_H__
#include "widget.h"
-#include <QWidget>
+#include <QFrame>
#include <QDomNode>
-class MultiList : public QWidget, public Widget
+#include <QListWidget>
+
+class MultiList : public QFrame, public Widget
{
Q_OBJECT
public:
MultiList(QDomNode &node, MacroWindow *macrowindow);
+ QWidget *inputcontainer;
+
public slots:
void changed();
QString getValue();
void setValue(QString value);
+
+private:
+ QListWidget *list;
};
#endif/*__PRACRO_MULTILIST_H__*/