From d4585aea4d5cf95a4d002e337eb37a8127701526 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 18 Aug 2014 19:49:32 +0200 Subject: [PATCH] Save changes. --- .../studio/src/plugins/georges_editor/browser_ctrl.cpp | 6 ++++++ code/studio/src/plugins/georges_editor/browser_ctrl.h | 2 ++ .../src/plugins/georges_editor/browser_ctrl_pvt.cpp | 3 +++ .../src/plugins/georges_editor/browser_ctrl_pvt.h | 1 + .../src/plugins/georges_editor/georges_editor_form.cpp | 10 ++++++++-- .../plugins/georges_editor/georges_treeview_dialog.cpp | 2 ++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl.cpp b/code/studio/src/plugins/georges_editor/browser_ctrl.cpp index d881f42a2..aa431b45c 100644 --- a/code/studio/src/plugins/georges_editor/browser_ctrl.cpp +++ b/code/studio/src/plugins/georges_editor/browser_ctrl.cpp @@ -16,6 +16,7 @@ QObject( browser ) m_pvt->setBrowser( browser ); connect( m_pvt, SIGNAL( arrayResized( const QString&, int ) ), this, SLOT( onArrayResized( const QString&, int ) ) ); + connect( m_pvt, SIGNAL( modified() ), this, SLOT( onModified() ) ); } BrowserCtrl::~BrowserCtrl() @@ -57,6 +58,11 @@ void BrowserCtrl::onArrayResized( const QString &name, int size ) Q_EMIT arrayResized( name, size ); } +void BrowserCtrl::onModified() +{ + Q_EMIT modified(); +} + void BrowserCtrl::enableMgrConnections() { QtVariantPropertyManager *mgr = m_pvt->manager(); diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl.h b/code/studio/src/plugins/georges_editor/browser_ctrl.h index 6014b0419..9c70f51bb 100644 --- a/code/studio/src/plugins/georges_editor/browser_ctrl.h +++ b/code/studio/src/plugins/georges_editor/browser_ctrl.h @@ -28,10 +28,12 @@ public Q_SLOTS: Q_SIGNALS: void arrayResized( const QString &name, int size ); + void modified(); private Q_SLOTS: void onValueChanged( QtProperty *p, const QVariant &value ); void onArrayResized( const QString &name, int size ); + void onModified(); private: void enableMgrConnections(); diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp index 52eaabfa6..0e22765da 100644 --- a/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp +++ b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp @@ -132,6 +132,8 @@ void BrowserCtrlPvt::onStructValueChanged( QtProperty *p, const QVariant &value bool created = false; m_currentNode->setValueByName( v.c_str(), k.c_str(), &created ); + + Q_EMIT modified(); } void BrowserCtrlPvt::onArrayValueChanged( QtProperty *p, const QVariant &value ) @@ -185,6 +187,7 @@ void BrowserCtrlPvt::onArrayValueChanged( QtProperty *p, const QVariant &value ) QString name = formName.c_str(); Q_EMIT arrayResized( name, newSize ); + Q_EMIT modified(); } void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value ) diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.h b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.h index 5bf93da4a..0d0363c1f 100644 --- a/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.h +++ b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.h @@ -33,6 +33,7 @@ public: Q_SIGNALS: void arrayResized( const QString &name, int size ); + void modified(); private: void setupStruct( NLGEORGES::UFormElm *node ); diff --git a/code/studio/src/plugins/georges_editor/georges_editor_form.cpp b/code/studio/src/plugins/georges_editor/georges_editor_form.cpp index a0240eef8..dc0ca409d 100644 --- a/code/studio/src/plugins/georges_editor/georges_editor_form.cpp +++ b/code/studio/src/plugins/georges_editor/georges_editor_form.cpp @@ -271,10 +271,16 @@ namespace GeorgesQt void GeorgesEditorForm::setModified () { qDebug() << "setModified"; + bool saveEnabled = false; if (m_lastActiveDock) - m_saveAction->setEnabled(m_lastActiveDock->isModified()); + saveEnabled = m_lastActiveDock->isModified(); else - m_saveAction->setEnabled(false); + saveEnabled = false; + + m_saveAction->setEnabled( saveEnabled ); + + QAction *saveAction = Core::ICore::instance()->menuManager()->action( Core::Constants::SAVE ); + saveAction->setEnabled( saveEnabled ); } void GeorgesEditorForm::focusChanged ( QWidget * old, QWidget * now ) diff --git a/code/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp b/code/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp index 838fa8cc2..3ecc73045 100644 --- a/code/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp +++ b/code/studio/src/plugins/georges_editor/georges_treeview_dialog.cpp @@ -89,6 +89,8 @@ namespace GeorgesQt connect(m_header, SIGNAL(headerClicked(int)), this, SLOT(headerClicked(int))); connect(m_browserCtrl, SIGNAL(arrayResized(const QString&,int)), this, SLOT(onArrayResized(const QString&,int))); + + connect(m_browserCtrl, SIGNAL(modified()), this, SLOT(modifiedFile())); } CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()