diff options
Diffstat (limited to 'client/widgets')
-rw-r--r-- | client/widgets/checkbox.cc | 24 | ||||
-rw-r--r-- | client/widgets/checkbox.h | 4 |
2 files changed, 22 insertions, 6 deletions
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__*/ |