summaryrefslogtreecommitdiff
path: root/client/widgets/checkbox.cc
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 /client/widgets/checkbox.cc
parentdbbadfd389d2c9c7bb40e4edb9b85497da9435d4 (diff)
Added truevalue/falsevalue to the checkbox.
Diffstat (limited to 'client/widgets/checkbox.cc')
-rw-r--r--client/widgets/checkbox.cc24
1 files changed, 18 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();
}