Save changes.

This commit is contained in:
dfighter1985 2014-08-18 19:49:32 +02:00
parent c8199efbf8
commit 591937500d
6 changed files with 22 additions and 2 deletions

View file

@ -16,6 +16,7 @@ QObject( browser )
m_pvt->setBrowser( browser ); m_pvt->setBrowser( browser );
connect( m_pvt, SIGNAL( arrayResized( const QString&, int ) ), this, SLOT( onArrayResized( const QString&, int ) ) ); connect( m_pvt, SIGNAL( arrayResized( const QString&, int ) ), this, SLOT( onArrayResized( const QString&, int ) ) );
connect( m_pvt, SIGNAL( modified() ), this, SLOT( onModified() ) );
} }
BrowserCtrl::~BrowserCtrl() BrowserCtrl::~BrowserCtrl()
@ -57,6 +58,11 @@ void BrowserCtrl::onArrayResized( const QString &name, int size )
Q_EMIT arrayResized( name, size ); Q_EMIT arrayResized( name, size );
} }
void BrowserCtrl::onModified()
{
Q_EMIT modified();
}
void BrowserCtrl::enableMgrConnections() void BrowserCtrl::enableMgrConnections()
{ {
QtVariantPropertyManager *mgr = m_pvt->manager(); QtVariantPropertyManager *mgr = m_pvt->manager();

View file

@ -28,10 +28,12 @@ public Q_SLOTS:
Q_SIGNALS: Q_SIGNALS:
void arrayResized( const QString &name, int size ); void arrayResized( const QString &name, int size );
void modified();
private Q_SLOTS: private Q_SLOTS:
void onValueChanged( QtProperty *p, const QVariant &value ); void onValueChanged( QtProperty *p, const QVariant &value );
void onArrayResized( const QString &name, int size ); void onArrayResized( const QString &name, int size );
void onModified();
private: private:
void enableMgrConnections(); void enableMgrConnections();

View file

@ -132,6 +132,8 @@ void BrowserCtrlPvt::onStructValueChanged( QtProperty *p, const QVariant &value
bool created = false; bool created = false;
m_currentNode->setValueByName( v.c_str(), k.c_str(), &created ); m_currentNode->setValueByName( v.c_str(), k.c_str(), &created );
Q_EMIT modified();
} }
void BrowserCtrlPvt::onArrayValueChanged( QtProperty *p, const QVariant &value ) 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(); QString name = formName.c_str();
Q_EMIT arrayResized( name, newSize ); Q_EMIT arrayResized( name, newSize );
Q_EMIT modified();
} }
void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value ) void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value )

View file

@ -33,6 +33,7 @@ public:
Q_SIGNALS: Q_SIGNALS:
void arrayResized( const QString &name, int size ); void arrayResized( const QString &name, int size );
void modified();
private: private:
void setupStruct( NLGEORGES::UFormElm *node ); void setupStruct( NLGEORGES::UFormElm *node );

View file

@ -271,10 +271,16 @@ namespace GeorgesQt
void GeorgesEditorForm::setModified () void GeorgesEditorForm::setModified ()
{ {
qDebug() << "setModified"; qDebug() << "setModified";
bool saveEnabled = false;
if (m_lastActiveDock) if (m_lastActiveDock)
m_saveAction->setEnabled(m_lastActiveDock->isModified()); saveEnabled = m_lastActiveDock->isModified();
else 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 ) void GeorgesEditorForm::focusChanged ( QWidget * old, QWidget * now )

View file

@ -89,6 +89,8 @@ namespace GeorgesQt
connect(m_header, SIGNAL(headerClicked(int)), connect(m_header, SIGNAL(headerClicked(int)),
this, SLOT(headerClicked(int))); this, SLOT(headerClicked(int)));
connect(m_browserCtrl, SIGNAL(arrayResized(const QString&,int)), this, SLOT(onArrayResized(const QString&,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() CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()