From 47750e70ba9171c10e32a1033b68ae2b614799fa Mon Sep 17 00:00:00 2001 From: senator Date: Wed, 22 Aug 2007 10:23:33 +0000 Subject: name have moved to widget in all classes. combobox is a dummy so far --- client/widgets/checkbox.cc | 10 ++-------- client/widgets/checkbox.h | 2 +- client/widgets/combobox.cc | 4 +++- client/widgets/combobox.h | 5 +++-- client/widgets/frame.cc | 20 ++++++++++++++------ client/widgets/frame.h | 2 +- client/widgets/label.cc | 14 ++++++++------ client/widgets/lineedit.cc | 10 ++-------- client/widgets/pushbutton.cc | 10 ++-------- client/widgets/radiobutton.cc | 10 ++-------- client/widgets/radiobutton.h | 2 +- client/widgets/textedit.cc | 10 ++-------- client/widgets/widget.cc | 12 ++++++++++++ client/widgets/widget.h | 2 ++ client/widgets/window.cc | 10 ++-------- client/widgets/window.h | 2 +- 16 files changed, 58 insertions(+), 67 deletions(-) (limited to 'client/widgets') diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc index c04b104..1bb1cfe 100644 --- a/client/widgets/checkbox.cc +++ b/client/widgets/checkbox.cc @@ -26,17 +26,11 @@ */ #include "checkbox.h" -CheckBox::CheckBox(QDomNode node) : QCheckBox() +CheckBox::CheckBox(QDomNode node) + : QCheckBox(), Widget(node) { QDomElement elem = node.toElement(); - 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 { diff --git a/client/widgets/checkbox.h b/client/widgets/checkbox.h index 94905f2..fb796cf 100644 --- a/client/widgets/checkbox.h +++ b/client/widgets/checkbox.h @@ -31,7 +31,7 @@ #include #include -class CheckBox : public Widget, public QCheckBox +class CheckBox : public QCheckBox, public Widget { public: diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index 6a4d8df..5499d09 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -26,8 +26,10 @@ */ #include "combobox.h" -ComboBox::ComboBox(QWidget *parent) : QComboBox(parent) +ComboBox::ComboBox(QDomNode node) + : QComboBox(), Widget(node) { + QDomElement elem = node.toElement(); } QString ComboBox::getValue() diff --git a/client/widgets/combobox.h b/client/widgets/combobox.h index 7b705ad..eb7d72e 100644 --- a/client/widgets/combobox.h +++ b/client/widgets/combobox.h @@ -29,12 +29,13 @@ #include "widget.h" #include +#include -class ComboBox : public Widget, public QComboBox +class ComboBox : public QComboBox, public Widget { public: - ComboBox(QWidget *parent); + ComboBox(QDomNode node); public slots: QString getValue(); diff --git a/client/widgets/frame.cc b/client/widgets/frame.cc index d700b1b..00f1930 100644 --- a/client/widgets/frame.cc +++ b/client/widgets/frame.cc @@ -26,18 +26,26 @@ */ #include "frame.h" -Frame::Frame(QDomNode node) : QGroupBox() +Frame::Frame(QDomNode node) + : QGroupBox(), Widget(node) { QDomElement elem = node.toElement(); - if(elem.hasAttribute("name")) { - widget_name = elem.attribute("name"); + if(elem.hasAttribute("caption")) { + setTitle(elem.attribute("caption")); } else { - printf("XML ERROR!! Unnamed widget of type: %s\n", - elem.tagName().toStdString().c_str()); + setTitle(elem.attribute("")); } - setTitle(elem.attribute("caption")); + if(elem.hasAttribute("border")) { + if(elem.attribute("border") == "true") { + setFlat(false); + } else { + setFlat(true); + } + } else { + setFlat(true); + } } QString Frame::getValue() diff --git a/client/widgets/frame.h b/client/widgets/frame.h index f934269..fed9b1f 100644 --- a/client/widgets/frame.h +++ b/client/widgets/frame.h @@ -31,7 +31,7 @@ #include #include -class Frame : public Widget, public QGroupBox +class Frame : public QGroupBox, public Widget { public: diff --git a/client/widgets/label.cc b/client/widgets/label.cc index b1875e4..dd658d3 100644 --- a/client/widgets/label.cc +++ b/client/widgets/label.cc @@ -27,17 +27,19 @@ #include "label.h" #include -Label::Label(QDomNode node) : QLabel() +Label::Label(QDomNode node) + : QLabel(), Widget(node) { QDomElement elem = node.toElement(); - 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("width")) { + setMinimumWidth(elem.attribute("width").toInt()); } + if(elem.hasAttribute("height")) { + setMinimumWidth(elem.attribute("height").toInt()); + } + if(elem.hasAttribute("caption")) { setText(elem.attribute("caption")); } else { diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc index 62e1aa8..6c3264b 100644 --- a/client/widgets/lineedit.cc +++ b/client/widgets/lineedit.cc @@ -27,17 +27,11 @@ #include "lineedit.h" #include -LineEdit::LineEdit(QDomNode node) : QLineEdit() +LineEdit::LineEdit(QDomNode node) + : QLineEdit(), Widget(node) { QDomElement elem = node.toElement(); - 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("regexp")) { rx = QRegExp(elem.attribute("regexp")); connect(this, SIGNAL(textChanged(QString)), this, SLOT(changed(QString))); diff --git a/client/widgets/pushbutton.cc b/client/widgets/pushbutton.cc index 7c78cfd..5b424a5 100644 --- a/client/widgets/pushbutton.cc +++ b/client/widgets/pushbutton.cc @@ -27,17 +27,11 @@ #include "pushbutton.h" #include -PushButton::PushButton(QDomNode node) : QPushButton() +PushButton::PushButton(QDomNode node) + : QPushButton(), Widget(node) { QDomElement elem = node.toElement(); - 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 { diff --git a/client/widgets/radiobutton.cc b/client/widgets/radiobutton.cc index af34de6..0645745 100644 --- a/client/widgets/radiobutton.cc +++ b/client/widgets/radiobutton.cc @@ -26,17 +26,11 @@ */ #include "radiobutton.h" -RadioButton::RadioButton(QDomNode node) : QRadioButton() +RadioButton::RadioButton(QDomNode node) + : QRadioButton(), Widget(node) { QDomElement elem = node.toElement(); - 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 { diff --git a/client/widgets/radiobutton.h b/client/widgets/radiobutton.h index 6239c3f..a2f06c5 100644 --- a/client/widgets/radiobutton.h +++ b/client/widgets/radiobutton.h @@ -31,7 +31,7 @@ #include #include -class RadioButton : public Widget, public QRadioButton +class RadioButton : public QRadioButton, public Widget { public: diff --git a/client/widgets/textedit.cc b/client/widgets/textedit.cc index 1d1babe..d1bd6e4 100644 --- a/client/widgets/textedit.cc +++ b/client/widgets/textedit.cc @@ -27,19 +27,13 @@ #include "textedit.h" #include -TextEdit::TextEdit(QDomNode node) : QTextEdit() +TextEdit::TextEdit(QDomNode node) + : QTextEdit(), Widget(node) { setAutoFillBackground(true); /* Default is false, which disables background color manipulation.*/ QDomElement elem = node.toElement(); - - 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("regexp")) { rx = QRegExp(elem.attribute("regexp")); diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index 8bbb3a8..910d80b 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -26,6 +26,18 @@ */ #include "widget.h" +Widget::Widget(QDomNode node) +{ + QDomElement elem = node.toElement(); + + if(elem.hasAttribute("name")) { + widget_name = elem.attribute("name"); + } else { + printf("XML ERROR!! Unnamed widget of type: %s\n", + elem.tagName().toStdString().c_str()); + } +} + QString Widget::getName() { return widget_name; diff --git a/client/widgets/widget.h b/client/widgets/widget.h index beefdab..d8a0b2d 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -28,10 +28,12 @@ #define __PRACRO_WIDGET_H__ #include +#include class Widget { public: + Widget(QDomNode node); virtual ~Widget(){} virtual QString getValue() = 0; QString getName(); diff --git a/client/widgets/window.cc b/client/widgets/window.cc index 217bf21..31f51bf 100644 --- a/client/widgets/window.cc +++ b/client/widgets/window.cc @@ -26,17 +26,11 @@ */ #include "window.h" -Window::Window(QDomNode node) : QWidget(NULL) +Window::Window(QDomNode node) + : QWidget(NULL), Widget(node) { QDomElement elem = node.toElement(); - 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("width")) { setMinimumWidth(elem.attribute("width").toInt()); } diff --git a/client/widgets/window.h b/client/widgets/window.h index 560c094..0640c7b 100644 --- a/client/widgets/window.h +++ b/client/widgets/window.h @@ -31,7 +31,7 @@ #include #include -class Window : public Widget, public QWidget +class Window : public QWidget, public Widget { public: -- cgit v1.2.3