diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-05-28 22:38:24 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-05-28 22:38:24 -0400 |
commit | 156e8386329eb032ae7e9fef4de49595e225248b (patch) | |
tree | a63e1ee8cf694b71f7a56b5f23d069b20ac48a56 | |
parent | 5f587c8985c8fe9d1ef60d1ca975f5c44ca46ebd (diff) | |
download | sigen-156e8386329eb032ae7e9fef4de49595e225248b.tar.gz sigen-156e8386329eb032ae7e9fef4de49595e225248b.tar.xz sigen-156e8386329eb032ae7e9fef4de49595e225248b.zip |
Remove the context menu from the widgets and use a button instead
-rw-r--r-- | sigmodr/SigmodrUI.cpp | 2 | ||||
-rw-r--r-- | sigmodr/sigmodr.ui | 19 | ||||
-rw-r--r-- | sigmodr/widgets/ObjectUI.cpp | 34 | ||||
-rw-r--r-- | sigmodr/widgets/ObjectUI.h | 4 |
4 files changed, 31 insertions, 28 deletions
diff --git a/sigmodr/SigmodrUI.cpp b/sigmodr/SigmodrUI.cpp index aad5d75b..6d11f34e 100644 --- a/sigmodr/SigmodrUI.cpp +++ b/sigmodr/SigmodrUI.cpp @@ -75,6 +75,7 @@ SigmodrUI::SigmodrUI(QWidget* parent) : setAcceptDrops(true); buttonApply->setIcon(KIcon("dialog-ok-apply")); buttonReset->setIcon(KIcon("edit-undo")); + buttonValidate->setIcon(KIcon("script-error")); splitter->setSizes(QList<int>() << SigmodrPreferences::treeWidth() << SigmodrPreferences::panelWidth()); connect(buttonApply, SIGNAL(clicked()), this, SLOT(update())); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); @@ -490,6 +491,7 @@ void SigmodrUI::on_treeSigmod_clicked(const QModelIndex& index) connect(editor, SIGNAL(saved()), treeSigmod, SLOT(doItemsLayout())); connect(buttonApply, SIGNAL(clicked()), editor, SLOT(apply())); connect(buttonReset, SIGNAL(clicked()), editor, SLOT(discard())); + connect(buttonValidate, SIGNAL(clicked()), editor, SLOT(validate())); m_editedIndex = index; setChangedTitle(treeSigmod->dirty(treeSigmod->game(index))); formPanel->setWidget(editor); diff --git a/sigmodr/sigmodr.ui b/sigmodr/sigmodr.ui index 968a4bef..bd42563c 100644 --- a/sigmodr/sigmodr.ui +++ b/sigmodr/sigmodr.ui @@ -83,7 +83,23 @@ </layout> </widget> </item> - <item row="1" column="0"> + <item row="1" column="0" colspan="2"> + <widget class="KPushButton" name="buttonValidate"> + <property name="toolTip"> + <string>Validate the object</string> + </property> + <property name="statusTip"> + <string>Validate the object</string> + </property> + <property name="whatsThis"> + <string>Validate the object</string> + </property> + <property name="text"> + <string>Validate</string> + </property> + </widget> + </item> + <item row="2" column="0"> <widget class="QScrollArea" name="formPanel"> <property name="toolTip"> <string>Area where the editor panes show up</string> @@ -132,6 +148,7 @@ <tabstop>treeSigmod</tabstop> <tabstop>buttonApply</tabstop> <tabstop>buttonDiscard</tabstop> + <tabstop>buttonValidate</tabstop> <tabstop>formPanel</tabstop> </tabstops> </ui> diff --git a/sigmodr/widgets/ObjectUI.cpp b/sigmodr/widgets/ObjectUI.cpp index 3c40c8be..aed2a052 100644 --- a/sigmodr/widgets/ObjectUI.cpp +++ b/sigmodr/widgets/ObjectUI.cpp @@ -42,7 +42,6 @@ ObjectUI::ObjectUI(Object* object, QWidget* parent) : { setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(changed(bool)), SLOT(setChanged(bool))); - connect(this, SIGNAL(customContextMenuRequested(QPoint)), SLOT(contextMenu(QPoint))); emit(changed(false)); } @@ -71,6 +70,16 @@ void ObjectUI::discard() emit(changed(false)); } +void ObjectUI::validate() +{ + if (m_changed) + apply(); + if (m_validator) + delete m_validator; + m_validator = new ValidationDialog(m_object, this); + m_validator->show(); +} + void ObjectUI::setPrivate(ObjectUIPrivate* priv) { QVBoxLayout* layout = new QVBoxLayout; @@ -83,26 +92,3 @@ void ObjectUI::setChanged(const bool changed) { m_changed = changed; } - -void ObjectUI::contextMenu(const QPoint& pos) -{ - KMenu* menu = new KMenu; - menu->addAction("&Apply", this, SLOT(apply())); - menu->addAction("&Discard", this, SLOT(discard())); - menu->addSeparator(); - KAction* validate = new KAction("&Validate", this); - connect(validate, SIGNAL(triggered()), this, SLOT(validate())); - validate->setEnabled(!m_changed); - menu->addAction(validate); - menu->popup(mapToGlobal(pos)); -} - -void ObjectUI::validate() -{ - if (m_changed) - apply(); - if (m_validator) - delete m_validator; - m_validator = new ValidationDialog(m_object, this); - m_validator->show(); -} diff --git a/sigmodr/widgets/ObjectUI.h b/sigmodr/widgets/ObjectUI.h index 248a16b8..b909fa0e 100644 --- a/sigmodr/widgets/ObjectUI.h +++ b/sigmodr/widgets/ObjectUI.h @@ -51,6 +51,7 @@ class SIGMODRWIDGETS_EXPORT ObjectUI : public QWidget public slots: virtual void apply(); virtual void discard(); + void validate(); signals: void saved(); void changed(const bool changed = true); @@ -64,9 +65,6 @@ class SIGMODRWIDGETS_EXPORT ObjectUI : public QWidget ValidationDialog* m_validator; private slots: void setChanged(const bool changed = true); - - void contextMenu(const QPoint& pos); - void validate(); }; } } |