summaryrefslogtreecommitdiff
path: root/client/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets')
-rw-r--r--client/widgets/combobox.cc7
-rw-r--r--client/widgets/combobox.h1
-rw-r--r--client/widgets/radiobuttons.cc14
-rw-r--r--client/widgets/radiobuttons.h1
4 files changed, 21 insertions, 2 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index e60ea8e..29bf253 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -63,9 +63,14 @@ ComboBox::ComboBox(QDomNode node)
if(default_found == 0) setCurrentIndex(-1); // -1 is default for none selected
}
+bool ComboBox::isValid()
+{
+ return currentIndex() != -1;
+}
+
QString ComboBox::getValue()
{
- QString value = "none";
+ QString value;
if(currentIndex() != -1) value = itemData(currentIndex()).toString();
return value;
}
diff --git a/client/widgets/combobox.h b/client/widgets/combobox.h
index f6baa67..a7f16c8 100644
--- a/client/widgets/combobox.h
+++ b/client/widgets/combobox.h
@@ -38,6 +38,7 @@ public:
ComboBox(QDomNode);
public slots:
+ bool isValid();
QString getValue();
private:
diff --git a/client/widgets/radiobuttons.cc b/client/widgets/radiobuttons.cc
index dc79831..ccc5506 100644
--- a/client/widgets/radiobuttons.cc
+++ b/client/widgets/radiobuttons.cc
@@ -75,10 +75,22 @@ RadioButtons::RadioButtons(QDomNode node)
}
+bool RadioButtons::isValid()
+{
+ QVector< RadioButton* >::iterator i;
+ for (i = radiobutton_list.begin(); i != radiobutton_list.end(); ++i) {
+ RadioButton *widget = *i;
+ if(widget->isChecked()) {
+ return true;
+ }
+ }
+ return false;
+}
+
QString RadioButtons::getValue()
{
QVector< RadioButton* >::iterator i;
- QString value = "none";
+ QString value;
for (i = radiobutton_list.begin(); i != radiobutton_list.end(); ++i) {
RadioButton *widget = *i;
if(widget->isChecked()) {
diff --git a/client/widgets/radiobuttons.h b/client/widgets/radiobuttons.h
index 34e90ce..f84555f 100644
--- a/client/widgets/radiobuttons.h
+++ b/client/widgets/radiobuttons.h
@@ -41,6 +41,7 @@ public:
RadioButtons(QDomNode);
public slots:
+ bool isValid();
QString getValue();
private: