mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-05 23:09:02 +00:00
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( modified() ), this, SLOT( onModified() ) );
|
||||
connect( m_pvt, SIGNAL( valueChanged( const QString&, const QString& ) ), this, SLOT( onValueChanged( const QString&, const QString& ) ) );
|
||||
}
|
||||
|
||||
BrowserCtrl::~BrowserCtrl()
|
||||
|
@ -43,6 +44,11 @@ void BrowserCtrl::onValueChanged( QtProperty *p, const QVariant &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 )
|
||||
{
|
||||
Q_EMIT arrayResized( name, size );
|
||||
|
|
|
@ -29,9 +29,11 @@ public Q_SLOTS:
|
|||
Q_SIGNALS:
|
||||
void arrayResized( const QString &name, int size );
|
||||
void modified();
|
||||
void valueChanged( const QString &key, const QString &value );
|
||||
|
||||
private Q_SLOTS:
|
||||
void onValueChanged( QtProperty *p, const QVariant &value );
|
||||
void onValueChanged( const QString &key, const QString &value );
|
||||
void onArrayResized( const QString &name, int size );
|
||||
void onModified();
|
||||
|
||||
|
|
|
@ -158,7 +158,10 @@ void BrowserCtrlPvt::onStructValueChanged( QtProperty *p, const QVariant &value
|
|||
bool created = false;
|
||||
m_currentNode.p->setValueByName( v.c_str(), k.c_str(), &created );
|
||||
|
||||
QString key = m_currentNode.name + "." + p->propertyName();
|
||||
|
||||
Q_EMIT modified();
|
||||
Q_EMIT valueChanged( key, value.toString() );
|
||||
}
|
||||
|
||||
void BrowserCtrlPvt::createArray()
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
Q_SIGNALS:
|
||||
void arrayResized( const QString &name, int size );
|
||||
void modified();
|
||||
void valueChanged( const QString &key, const QString &value );
|
||||
|
||||
private:
|
||||
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(modified()), this, SLOT(modifiedFile()));
|
||||
connect(m_browserCtrl, SIGNAL(valueChanged(const QString&,const QString&)), this, SLOT(onValueChanged(const QString&,const QString&)));
|
||||
}
|
||||
|
||||
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
|
||||
|
@ -470,12 +471,18 @@ namespace GeorgesQt
|
|||
if( !idx.isValid() )
|
||||
return;
|
||||
m_ui.treeView->setCurrentIndex( idx );
|
||||
|
||||
log( name + " resized = " + QString::number( size ) );
|
||||
}
|
||||
|
||||
void CGeorgesTreeViewDialog::onAppendArray()
|
||||
{
|
||||
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_ui.treeView->reset();
|
||||
|
@ -483,6 +490,8 @@ namespace GeorgesQt
|
|||
|
||||
m_ui.treeView->setCurrentIndex( idx );
|
||||
m_browserCtrl->clicked( idx );
|
||||
|
||||
log( formName + " resized = " + QString::number( size + 1 ) );
|
||||
}
|
||||
|
||||
void CGeorgesTreeViewDialog::onDeleteArrayEntry()
|
||||
|
@ -490,11 +499,21 @@ namespace GeorgesQt
|
|||
QModelIndex current = m_ui.treeView->currentIndex();
|
||||
QModelIndex parent = current.parent();
|
||||
|
||||
CFormItem *item = reinterpret_cast< CFormItem* >( current.internalPointer() );
|
||||
QString formName = item->formName().c_str();
|
||||
|
||||
m_model->deleteArrayEntry( current );
|
||||
|
||||
m_ui.treeView->expandAll();
|
||||
m_ui.treeView->setCurrentIndex( 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)
|
||||
|
@ -646,4 +665,34 @@ namespace GeorgesQt
|
|||
// 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 */
|
||||
|
|
|
@ -106,8 +106,11 @@ namespace GeorgesQt
|
|||
void onArrayResized( const QString &name, int size );
|
||||
void onAppendArray();
|
||||
void onDeleteArrayEntry();
|
||||
void onValueChanged( const QString &key, const QString &value );
|
||||
|
||||
private:
|
||||
void log( const QString &msg );
|
||||
|
||||
Ui::CGeorgesTreeViewDialog m_ui;
|
||||
ExpandableHeaderView *m_header;
|
||||
UForm *m_form;
|
||||
|
|
Loading…
Reference in a new issue