diff options
| -rw-r--r-- | client/macrowindow.cc | 2 | ||||
| -rw-r--r-- | client/widgetbuilder.cc | 11 | ||||
| -rw-r--r-- | client/widgets/widget.cc | 10 | ||||
| -rw-r--r-- | client/widgets/widget.h | 3 | 
4 files changed, 24 insertions, 2 deletions
| diff --git a/client/macrowindow.cc b/client/macrowindow.cc index 16ccf53..98262fd 100644 --- a/client/macrowindow.cc +++ b/client/macrowindow.cc @@ -124,6 +124,8 @@ void MacroWindow::initMacro(QDomNode &node)        setValues(child, this);      } +    if(waschanged == true) macroChanged(); +      return;    } diff --git a/client/widgetbuilder.cc b/client/widgetbuilder.cc index 144b2a1..0c9f3b3 100644 --- a/client/widgetbuilder.cc +++ b/client/widgetbuilder.cc @@ -35,6 +35,11 @@ QVector< Widget* > widgetBuilder(QDomNode xml_node, QWidget *parent,    QDomElement xml_elem = xml_node.toElement(); +  if(xml_elem.hasAttribute("prefilled") && +     xml_elem.attribute("prefilled") != "pracro") { +    macrowindow->macroChanged(); +  } +    QWidget *widget = NULL;    if(xml_elem.tagName() == "spacer") {      if(parent && parent->layout()) {  @@ -179,11 +184,13 @@ void setValues(QDomNode xml_node, MacroWindow *macrowindow)  {    QDomElement xml_elem = xml_node.toElement(); -  if(xml_elem.tagName() == "item" || xml_elem.tagName() == "radiobutton") return; +  if(xml_elem.tagName() == "item" || +     xml_elem.tagName() == "radiobutton") return;    if(xml_elem.hasAttribute("name") && xml_elem.hasAttribute("value")) {      Widget *widget = macrowindow->getWidget(xml_elem.attribute("name")); -    if(widget) widget->setValue(xml_elem.attribute("value"), xml_elem.attribute("prefilled", "")); +    if(widget && widget->hasInitialValue() == false) // Don't set the value if it is already set indirectly (altcombobox) +      widget->setValue(xml_elem.attribute("value"), xml_elem.attribute("prefilled", ""));    }    QDomNodeList children = xml_node.childNodes(); diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index 14d8c34..5899839 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -41,6 +41,10 @@ Widget::Widget(QDomNode &node, MacroWindow *macrowindow)               elem.tagName().toStdString().c_str());    } +  if(elem.hasAttribute("prefilled")) { +    prefilled = elem.attribute("prefilled"); +  } +    if(elem.hasAttribute("script")) {      luaprogram = elem.attribute("script");      hasluaprogram = true; @@ -96,6 +100,12 @@ void Widget::setInitialValue(QString value)    }  } +bool Widget::hasInitialValue() +{ +  return has_initial_value; +} + +  void Widget::reset()  {    setValue(initial_value); diff --git a/client/widgets/widget.h b/client/widgets/widget.h index 2977e3a..bd84705 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -65,6 +65,7 @@ public:    virtual bool setKeyboardFocus() { return false; }    void setInitialValue(QString value); +  bool hasInitialValue();    virtual void reset();  protected: @@ -85,6 +86,8 @@ private:    QString initial_value;    bool has_initial_value; + +  QString prefilled;  };  #endif/*__PRACRO_WIDGET_H__*/ | 
