summaryrefslogtreecommitdiff
path: root/client/widgets/pushbutton.cc
diff options
context:
space:
mode:
authorsenator <senator>2007-07-26 13:10:25 +0000
committersenator <senator>2007-07-26 13:10:25 +0000
commite1bbdd89f09966a240e8a7b8007dc44895e0febd (patch)
tree0e990d7a9df1d7c2fc53aaee0bc52990a6607b60 /client/widgets/pushbutton.cc
parentce667bf4b2f3de7aab677ac7e7f23bc72d3db80f (diff)
added error check for unnamed widgets
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");
+}