Now logging changes.
This commit is contained in:
parent
14a5a81c60
commit
6cc882e95e
6 changed files with 64 additions and 0 deletions
|
@ -17,6 +17,7 @@ QObject( 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() ) );
|
connect( m_pvt, SIGNAL( modified() ), this, SLOT( onModified() ) );
|
||||||
|
connect( m_pvt, SIGNAL( valueChanged( const QString&, const QString& ) ), this, SLOT( onValueChanged( const QString&, const QString& ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
BrowserCtrl::~BrowserCtrl()
|
BrowserCtrl::~BrowserCtrl()
|
||||||
|
@ -43,6 +44,11 @@ void BrowserCtrl::onValueChanged( QtProperty *p, const QVariant &value )
|
||||||
m_pvt->onValueChanged( p, value );
|
m_pvt->onValueChanged( p, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserCtrl::onValueChanged( const QString &key, const QString &value )
|
||||||
|
{
|
||||||
|
Q_EMIT valueChanged( key, value );
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserCtrl::onArrayResized( const QString &name, int size )
|
void BrowserCtrl::onArrayResized( const QString &name, int size )
|
||||||
{
|
{
|
||||||
Q_EMIT arrayResized( name, size );
|
Q_EMIT arrayResized( name, size );
|
||||||
|
|
|
@ -29,9 +29,11 @@ public Q_SLOTS:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void arrayResized( const QString &name, int size );
|
void arrayResized( const QString &name, int size );
|
||||||
void modified();
|
void modified();
|
||||||
|
void valueChanged( const QString &key, const QString &value );
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onValueChanged( QtProperty *p, const QVariant &value );
|
void onValueChanged( QtProperty *p, const QVariant &value );
|
||||||
|
void onValueChanged( const QString &key, const QString &value );
|
||||||
void onArrayResized( const QString &name, int size );
|
void onArrayResized( const QString &name, int size );
|
||||||
void onModified();
|
void onModified();
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,10 @@ void BrowserCtrlPvt::onStructValueChanged( QtProperty *p, const QVariant &value
|
||||||
bool created = false;
|
bool created = false;
|
||||||
m_currentNode.p->setValueByName( v.c_str(), k.c_str(), &created );
|
m_currentNode.p->setValueByName( v.c_str(), k.c_str(), &created );
|
||||||
|
|
||||||
|
QString key = m_currentNode.name + "." + p->propertyName();
|
||||||
|
|
||||||
Q_EMIT modified();
|
Q_EMIT modified();
|
||||||
|
Q_EMIT valueChanged( key, value.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserCtrlPvt::createArray()
|
void BrowserCtrlPvt::createArray()
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void arrayResized( const QString &name, int size );
|
void arrayResized( const QString &name, int size );
|
||||||
void modified();
|
void modified();
|
||||||
|
void valueChanged( const QString &key, const QString &value );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupStruct( NLGEORGES::UFormElm *node );
|
void setupStruct( NLGEORGES::UFormElm *node );
|
||||||
|
|
|
@ -90,6 +90,7 @@ namespace GeorgesQt
|
||||||
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()));
|
connect(m_browserCtrl, SIGNAL(modified()), this, SLOT(modifiedFile()));
|
||||||
|
connect(m_browserCtrl, SIGNAL(valueChanged(const QString&,const QString&)), this, SLOT(onValueChanged(const QString&,const QString&)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
|
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
|
||||||
|
@ -470,12 +471,18 @@ namespace GeorgesQt
|
||||||
if( !idx.isValid() )
|
if( !idx.isValid() )
|
||||||
return;
|
return;
|
||||||
m_ui.treeView->setCurrentIndex( idx );
|
m_ui.treeView->setCurrentIndex( idx );
|
||||||
|
|
||||||
|
log( name + " resized = " + QString::number( size ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeorgesTreeViewDialog::onAppendArray()
|
void CGeorgesTreeViewDialog::onAppendArray()
|
||||||
{
|
{
|
||||||
QModelIndex idx = m_ui.treeView->currentIndex();
|
QModelIndex idx = m_ui.treeView->currentIndex();
|
||||||
|
|
||||||
|
CFormItem *item = reinterpret_cast< CFormItem* >( idx.internalPointer() );
|
||||||
|
QString formName = item->formName().c_str();
|
||||||
|
int size = item->childCount();
|
||||||
|
|
||||||
m_model->appendArray( idx );
|
m_model->appendArray( idx );
|
||||||
|
|
||||||
m_ui.treeView->reset();
|
m_ui.treeView->reset();
|
||||||
|
@ -483,6 +490,8 @@ namespace GeorgesQt
|
||||||
|
|
||||||
m_ui.treeView->setCurrentIndex( idx );
|
m_ui.treeView->setCurrentIndex( idx );
|
||||||
m_browserCtrl->clicked( idx );
|
m_browserCtrl->clicked( idx );
|
||||||
|
|
||||||
|
log( formName + " resized = " + QString::number( size + 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeorgesTreeViewDialog::onDeleteArrayEntry()
|
void CGeorgesTreeViewDialog::onDeleteArrayEntry()
|
||||||
|
@ -490,11 +499,21 @@ namespace GeorgesQt
|
||||||
QModelIndex current = m_ui.treeView->currentIndex();
|
QModelIndex current = m_ui.treeView->currentIndex();
|
||||||
QModelIndex parent = current.parent();
|
QModelIndex parent = current.parent();
|
||||||
|
|
||||||
|
CFormItem *item = reinterpret_cast< CFormItem* >( current.internalPointer() );
|
||||||
|
QString formName = item->formName().c_str();
|
||||||
|
|
||||||
m_model->deleteArrayEntry( current );
|
m_model->deleteArrayEntry( current );
|
||||||
|
|
||||||
m_ui.treeView->expandAll();
|
m_ui.treeView->expandAll();
|
||||||
m_ui.treeView->setCurrentIndex( parent );
|
m_ui.treeView->setCurrentIndex( parent );
|
||||||
m_browserCtrl->clicked( parent );
|
m_browserCtrl->clicked( parent );
|
||||||
|
|
||||||
|
log( "deleted " + formName );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGeorgesTreeViewDialog::onValueChanged( const QString &key, const QString &value )
|
||||||
|
{
|
||||||
|
log( key + " = " + value );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeorgesTreeViewDialog::closeEvent(QCloseEvent *event)
|
void CGeorgesTreeViewDialog::closeEvent(QCloseEvent *event)
|
||||||
|
@ -646,4 +665,34 @@ namespace GeorgesQt
|
||||||
// delete structContext;
|
// delete structContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGeorgesTreeViewDialog::log( const QString &msg )
|
||||||
|
{
|
||||||
|
QString user = getenv( "USER" );
|
||||||
|
if( user.isEmpty() )
|
||||||
|
user = getenv( "USERNAME" );
|
||||||
|
if( user.isEmpty() )
|
||||||
|
user = "anonymous";
|
||||||
|
|
||||||
|
QTime time = QTime::currentTime();
|
||||||
|
QDate date = QDate::currentDate();
|
||||||
|
|
||||||
|
QString dateString = date.toString( "ddd MMM dd" );
|
||||||
|
QString timeString = time.toString( "HH:mm:ss" );
|
||||||
|
|
||||||
|
QString logMsg;
|
||||||
|
logMsg += dateString;
|
||||||
|
logMsg += ' ';
|
||||||
|
logMsg += timeString;
|
||||||
|
logMsg += ' ';
|
||||||
|
logMsg += QString::number( date.year() );
|
||||||
|
logMsg += ' ';
|
||||||
|
logMsg += "(";
|
||||||
|
logMsg += user;
|
||||||
|
logMsg += ")";
|
||||||
|
logMsg += ' ';
|
||||||
|
logMsg += msg;
|
||||||
|
|
||||||
|
m_ui.logEdit->appendPlainText( logMsg );
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace GeorgesQt */
|
} /* namespace GeorgesQt */
|
||||||
|
|
|
@ -106,8 +106,11 @@ namespace GeorgesQt
|
||||||
void onArrayResized( const QString &name, int size );
|
void onArrayResized( const QString &name, int size );
|
||||||
void onAppendArray();
|
void onAppendArray();
|
||||||
void onDeleteArrayEntry();
|
void onDeleteArrayEntry();
|
||||||
|
void onValueChanged( const QString &key, const QString &value );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void log( const QString &msg );
|
||||||
|
|
||||||
Ui::CGeorgesTreeViewDialog m_ui;
|
Ui::CGeorgesTreeViewDialog m_ui;
|
||||||
ExpandableHeaderView *m_header;
|
ExpandableHeaderView *m_header;
|
||||||
UForm *m_form;
|
UForm *m_form;
|
||||||
|
|
Loading…
Reference in a new issue