Save changes.

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

View file

@ -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();

View file

@ -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();

View file

@ -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 )

View file

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

View file

@ -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 )

View file

@ -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()