summaryrefslogtreecommitdiff
path: root/client/widgetbuilder.cc
diff options
context:
space:
mode:
authordeva <deva>2009-01-13 09:59:22 +0000
committerdeva <deva>2009-01-13 09:59:22 +0000
commit9fcf15a06b9ec422dbad53508e8ce71d2d4145c3 (patch)
treed54147e52b1939ba9ebaf356e7047dfebea02887 /client/widgetbuilder.cc
parent9d982a5b4fc9c7efaa56c8f7a4130361f26b0302 (diff)
A huge amount of changes, based on the results of two usertest.
The changes are contained (but not limited to) in the following list: - Make disabled widgets ignored in validation test. - Do not commit values of disabled widgets to the database. - Make storechildren attribute on metawidget, that enables storing of the child widgets in the database. - Implement LUA resume generator. - Make language attribute on resume tag, and switch parser (format/LUA). - Case insensitive search in combobox. - Click on macro name or line, expands macro. - Greyed out widgets in AltComboBox should be hidden instead. - Keyboard 'delete' should delete item from multilist. - "Commit" button needs to be more visible? Icon? - Upon opening of a second macro, the first macro should indicate itself as 'not saved'. - After 'add' in multilist, the input widgets should be reset. - First widget in a macro should have keyboard focus after expansion. - "Endnu ikke udfyldt" needs to be more clear (darker). - Meta widgets must recurse the isValid() call to its children. - Greyed out widgets must be hidden. - Multilist should be read as a list prior to its input fields. - Visible field on widgets. Hides a widget without disabling it.
Diffstat (limited to 'client/widgetbuilder.cc')
-rw-r--r--client/widgetbuilder.cc53
1 files changed, 42 insertions, 11 deletions
diff --git a/client/widgetbuilder.cc b/client/widgetbuilder.cc
index 3d47d41..848157c 100644
--- a/client/widgetbuilder.cc
+++ b/client/widgetbuilder.cc
@@ -28,7 +28,8 @@
#include <QLayout>
#include "widgets.h"
-QVector< Widget* > widgetBuilder(QDomNode xml_node, QWidget *parent, MacroWindow *macrowindow)
+QVector< Widget* > widgetBuilder(QDomNode xml_node, QWidget *parent,
+ MacroWindow *macrowindow, bool watchChanges)
{
QVector< Widget* > widgets;
@@ -42,11 +43,11 @@ QVector< Widget* > widgetBuilder(QDomNode xml_node, QWidget *parent, MacroWindow
} else if(xml_elem.tagName() == "frame") {
if(xml_elem.hasAttribute("caption")) {
GroupBox *frame = new GroupBox(xml_elem, macrowindow);
- widgets.push_back(frame);
+ // widgets.push_back(frame);
widget = frame;
} else {
Frame *frame = new Frame(xml_elem, macrowindow);
- widgets.push_back(frame);
+ // widgets.push_back(frame);
widget = frame;
}
@@ -58,63 +59,91 @@ QVector< Widget* > widgetBuilder(QDomNode xml_node, QWidget *parent, MacroWindow
LineEdit *lineedit = new LineEdit(xml_elem, macrowindow);
widgets.push_back(lineedit);
widget = lineedit;
+ if(watchChanges)
+ lineedit->connectFrom(SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
+
+ } else if(xml_elem.tagName() == "datetime") {
+ DateTime *datetime = new DateTime(xml_elem, macrowindow);
+ widgets.push_back(datetime);
+ widget = datetime;
+ if(watchChanges)
+ datetime->connectFrom(SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
} else if(xml_elem.tagName() == "button") {
Button *button = new Button(xml_elem, macrowindow);
//macrowindow->connect(pushbutton, SIGNAL(act_continue()), main, SLOT(get_macro()));
- macrowindow->connect(button, SIGNAL(act_commit()), macrowindow, SLOT(commit()));
- macrowindow->connect(button, SIGNAL(act_reset()), macrowindow, SLOT(reset()));
- macrowindow->connect(button, SIGNAL(act_cancel()), macrowindow, SLOT(cancel()));
- macrowindow->connect(button, SIGNAL(act_continue(QString)), macrowindow, SLOT(cont(QString)));
- macrowindow->connect(button, SIGNAL(act_continue_nocommit(QString)),
- macrowindow, SLOT(cont_nocommit(QString)));
+ QObject::connect(button, SIGNAL(act_commit()), macrowindow, SLOT(commit()));
+ QObject::connect(button, SIGNAL(act_reset()), macrowindow, SLOT(reset()));
+ QObject::connect(button, SIGNAL(act_cancel()), macrowindow, SLOT(cancel()));
+ QObject::connect(button, SIGNAL(act_continue(QString)), macrowindow, SLOT(cont(QString)));
+ QObject::connect(button, SIGNAL(act_continue_nocommit(QString)),
+ macrowindow, SLOT(cont_nocommit(QString)));
+ QObject::connect(macrowindow, SIGNAL(macroHasChanged()), button, SLOT(do_enable()));
widget = button;
} else if(xml_elem.tagName() == "textedit") {
TextEdit *textedit = new TextEdit(xml_elem, macrowindow);
widgets.push_back(textedit);
widget = textedit;
+ if(watchChanges)
+ QObject::connect(textedit, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
} else if(xml_elem.tagName() == "checkbox") {
CheckBox *checkbox = new CheckBox(xml_elem, macrowindow);
widgets.push_back(checkbox);
widget = checkbox;
+ if(watchChanges)
+ QObject::connect(checkbox, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
} else if(xml_elem.tagName() == "radiobuttons") {
RadioButtons *radiobuttons = new RadioButtons(xml_elem, macrowindow);
widgets.push_back(radiobuttons);
widget = radiobuttons;
+ if(watchChanges)
+ QObject::connect(radiobuttons, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
//return; // Don't iterate children
} else if(xml_elem.tagName() == "combobox") {
ComboBox *combobox = new ComboBox(xml_elem, macrowindow);
widgets.push_back(combobox);
widget = combobox;
+ if(watchChanges)
+ QObject::connect(combobox, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
//return; // Don't iterate children
} else if(xml_elem.tagName() == "dbwidget") {
DBWidget *dbwidget = new DBWidget(xml_elem, macrowindow);
widgets.push_back(dbwidget);
widget = dbwidget;
+ if(watchChanges)
+ QObject::connect(dbwidget, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
} else if(xml_elem.tagName() == "listbox") {
ListBox *listbox = new ListBox(xml_elem, macrowindow);
widgets.push_back(listbox);
widget = listbox;
+ if(watchChanges)
+ QObject::connect(listbox, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
//return; // Don't iterate children
+
} else if(xml_elem.tagName() == "multilist") {
MultiList *multilist = new MultiList(xml_elem, macrowindow);
widgets.push_back(multilist);
widget = multilist;
+ if(watchChanges)
+ QObject::connect(multilist, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
if(parent && widget && parent->layout()) parent->layout()->addWidget(widget);
if(widget) widget->show();
return widgets; // Don't iterate children
+
} else if(xml_elem.tagName() == "altcombobox") {
AltComboBox *altcombobox = new AltComboBox(xml_elem, macrowindow);
widgets.push_back(altcombobox);
widget = altcombobox;
+ if(watchChanges)
+ QObject::connect(altcombobox, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
if(parent && widget && parent->layout()) parent->layout()->addWidget(widget);
if(widget) widget->show();
@@ -124,6 +153,8 @@ QVector< Widget* > widgetBuilder(QDomNode xml_node, QWidget *parent, MacroWindow
MetaWidget *metawidget = new MetaWidget(xml_elem, macrowindow);
widgets.push_back(metawidget);
widget = metawidget;
+ if(watchChanges)
+ QObject::connect(metawidget, SIGNAL(wasChanged()), macrowindow, SLOT(macroChanged()));
if(parent && widget && parent->layout()) parent->layout()->addWidget(widget);
if(widget) widget->show();
@@ -135,7 +166,7 @@ QVector< Widget* > widgetBuilder(QDomNode xml_node, QWidget *parent, MacroWindow
for (int i=0; i<children.count();i++) {
QDomNode child = children.at(i);
- widgets += widgetBuilder(child, widget, macrowindow);
+ widgets += widgetBuilder(child, widget, macrowindow, watchChanges);
}
if(parent && widget && parent->layout()) parent->layout()->addWidget(widget);
@@ -152,7 +183,7 @@ void setValues(QDomNode xml_node, MacroWindow *macrowindow)
if(xml_elem.hasAttribute("name") && xml_elem.hasAttribute("value")) {
Widget *widget = macrowindow->getWidget(xml_elem.attribute("name"));
- if(widget) widget->setValue(xml_elem.attribute("value"));
+ if(widget) widget->setValue(xml_elem.attribute("value"), xml_elem.attribute("prefilled", ""));
}
QDomNodeList children = xml_node.childNodes();