summaryrefslogtreecommitdiff
path: root/client/widgets/pushbutton.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/pushbutton.cc')
-rw-r--r--client/widgets/pushbutton.cc43
1 files changed, 40 insertions, 3 deletions
diff --git a/client/widgets/pushbutton.cc b/client/widgets/pushbutton.cc
index 5a1e305..7c78cfd 100644
--- a/client/widgets/pushbutton.cc
+++ b/client/widgets/pushbutton.cc
@@ -30,12 +30,49 @@
PushButton::PushButton(QDomNode node) : QPushButton()
{
QDomElement elem = node.toElement();
- widget_name = elem.attribute("name");
- setText(elem.attribute("caption"));
- //connect(this, SIGNAL(onClicked()), this, SLOT(clicked()));
+
+ if(elem.hasAttribute("name")) {
+ widget_name = elem.attribute("name");
+ } else {
+ printf("XML ERROR!! Unnamed widget of type: %s\n",
+ elem.tagName().toStdString().c_str());
+ }
+
+ if(elem.hasAttribute("caption")) {
+ setText(elem.attribute("caption"));
+ } else {
+ setText("");
+ }
+
+ if(elem.hasAttribute("action")) {
+ if(elem.attribute("action") == "commit") {
+ connect(this, SIGNAL(clicked()), this, SLOT(commit()));
+ } else if(elem.attribute("action") == "reset") {
+ connect(this, SIGNAL(clicked()), this, SLOT(reset()));
+ } else if(elem.attribute("action") == "cancel") {
+ connect(this, SIGNAL(clicked()), this, SLOT(cancel()));
+ }
+ } else {
+ setEnabled(false);
+ }
}
QString PushButton::getValue()
{
return text();
}
+
+void PushButton::commit()
+{
+ printf("committing...\n");
+}
+
+void PushButton::reset()
+{
+ printf("resetting...\n");
+}
+
+void PushButton::cancel()
+{
+ printf("cancelling...\n");
+}