From b681594b7e4f9a5375b555b152d661581c600a96 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 17 Jun 2008 14:57:56 +0000 Subject: Multilist is now showing as it should. No functionality yet though. --- client/macrowindow.cc | 23 ++++++++++++++ client/pracro.cc | 2 ++ client/widgets.h | 1 + client/widgets/multilist.cc | 77 ++++++++++++++++++++++++++++++++++++++++++++- client/widgets/multilist.h | 11 +++++-- 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; iinputcontainer); + } + 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 +#include +#include +#include + 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; iaddWidget(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 +#include #include -class MultiList : public QWidget, public Widget +#include + +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__*/ -- cgit v1.2.3