summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2008-09-09 08:56:06 +0000
committerdeva <deva>2008-09-09 08:56:06 +0000
commit700fb8b935d6495f458e00d044aa69d893d9a695 (patch)
tree9072c2bb64b3bcce9d6d3fc0c50ff3a2d08b5496
parentdbbadfd389d2c9c7bb40e4edb9b85497da9435d4 (diff)
Added truevalue/falsevalue to the checkbox.
-rw-r--r--client/macrowindow.cc4
-rw-r--r--client/netcom.cc4
-rw-r--r--client/widgets/checkbox.cc24
-rw-r--r--client/widgets/checkbox.h4
4 files changed, 28 insertions, 8 deletions
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index 5ef342d..583a8a0 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -61,7 +61,7 @@ MacroWindow::MacroWindow(QDomNode &xml_doc)
MacroWindow::~MacroWindow()
{
delete lua;
-
+ /*
QVector< Widget* >::iterator i = widgets.begin();
while (i != widgets.end()) {
Widget* w = *i;
@@ -75,7 +75,7 @@ MacroWindow::~MacroWindow()
delete w;
j++;
}
-
+ */
}
void MacroWindow::initMacro(QDomNode &node)
diff --git a/client/netcom.cc b/client/netcom.cc
index 060517d..a4d1fb3 100644
--- a/client/netcom.cc
+++ b/client/netcom.cc
@@ -69,6 +69,10 @@ QDomDocument NetCom::send(QString course, QString macro)
buffer = "";
+ QDomElement elem = res_doc.documentElement();
+
+ printf(res_doc.toString().toStdString().c_str());
+
return res_doc;
}
diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc
index f2af188..e439159 100644
--- a/client/widgets/checkbox.cc
+++ b/client/widgets/checkbox.cc
@@ -38,24 +38,38 @@ CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow)
if(elem.hasAttribute("caption")) {
setText(elem.attribute("caption"));
}
+
+ if(elem.hasAttribute("truevalue")) {
+ truevalue = elem.attribute("truevalue");
+ } else {
+ truevalue = "true";
+ }
+
+ if(elem.hasAttribute("falsevalue")) {
+ falsevalue = elem.attribute("falsevalue");
+ } else {
+ falsevalue = "false";
+ }
connect(this, SIGNAL(stateChanged(int)), this, SLOT(state_change()));
}
QString CheckBox::getValue()
{
- if(isChecked()) return "true";
- return "false";
+ if(isChecked()) return truevalue;
+ return falsevalue;
}
void CheckBox::setValue(QString value)
{
bool old = isChecked();
- if(value == "true") {
+ if(value == truevalue) {
setChecked(true);
- } else {
+ } else if(value == falsevalue) {
setChecked(false);
+ } else {
+ printf("Unknown checkbox value: %s\n", value.toStdString().c_str());
}
// If set operation did not change the value we must invocate the code manually.
@@ -69,7 +83,5 @@ bool CheckBox::isValid()
void CheckBox::state_change()
{
- printf("state_change\n");
-
luaValidator();
}
diff --git a/client/widgets/checkbox.h b/client/widgets/checkbox.h
index 65a0356..dca42d1 100644
--- a/client/widgets/checkbox.h
+++ b/client/widgets/checkbox.h
@@ -44,6 +44,10 @@ public:
public slots:
void state_change();
+
+private:
+ QString truevalue;
+ QString falsevalue;
};
#endif/*__PRACRO_CHECKBOX_H__*/