diff options
Diffstat (limited to 'client/widgets/button.cc')
| -rw-r--r-- | client/widgets/button.cc | 53 | 
1 files changed, 51 insertions, 2 deletions
diff --git a/client/widgets/button.cc b/client/widgets/button.cc index c524084..6032678 100644 --- a/client/widgets/button.cc +++ b/client/widgets/button.cc @@ -32,6 +32,7 @@  Button::Button(QDomNode &node, MacroWindow *macrowindow)    : QPushButton(), Widget(node, macrowindow)  { +  resetToDisabled = false;    setCommonAttributes(this, node);    QDomElement elem = node.toElement(); @@ -49,12 +50,27 @@ Button::Button(QDomNode &node, MacroWindow *macrowindow)    if(elem.hasAttribute("action")) {      if(elem.attribute("action") == "commit") {        connect(this, SIGNAL(clicked()), this, SLOT(commit())); +      setIcon(QPixmap(":icons/add.png")); +      setEnabled(false); + +      // +      // Hack to re-disable the commit button when the macro is reset. +      // +      resetToDisabled = true; +      widget_name = "commit_button_" + QString::number((int)this); +      QVector< Widget* > ws; +      ws.push_back(this); +      macrowindow->addAuxWidgets(ws); +      } else if(elem.attribute("action") == "reset") { -      connect(this, SIGNAL(clicked()), this, SLOT(reset())); +      connect(this, SIGNAL(clicked()), this, SLOT(_reset())); +      setIcon(QPixmap(":icons/del.png"));      } else if(elem.attribute("action") == "cancel") {        connect(this, SIGNAL(clicked()), this, SLOT(cancel())); +      setIcon(QPixmap(":icons/del.png"));      } else if(elem.attribute("action") == "continue") {        connect(this, SIGNAL(clicked()), this, SLOT(cont())); +      setIcon(QPixmap(":icons/add.png"));      } else if(elem.attribute("action") == "continue_nocommit") {        connect(this, SIGNAL(clicked()), this, SLOT(cont_nocommit()));      }  @@ -69,7 +85,7 @@ void Button::commit()    printf("Emit: commit\n");  } -void Button::reset() +void Button::_reset()  {    emit act_reset();    printf("Emit: reset\n"); @@ -92,3 +108,36 @@ void Button::cont_nocommit()    emit act_continue_nocommit(field);    printf("Emit: continue_nocommit\n");  } + +void Button::do_enable() +{ +  setEnabled(true); +} + +void Button::connectFrom(const char *signal, +                           const QObject *receiver, const char *method) +{ +  connect(this, signal, receiver, method); +} + +void Button::connectTo(const QObject *sender, const char *signal, +                         const char *method) +{ +  connect(sender, signal, this, method); +} + +void Button::setVisibility(bool visible) +{ +  setVisible(visible); +} + +bool Button::setKeyboardFocus() +{ +  setFocus(); +  return true; +} + +void Button::reset() +{ +  if(resetToDisabled) setEnabled(false); +}  | 
