mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-14 03:09:08 +00:00
A little refactoring
This commit is contained in:
parent
698478a7fb
commit
0fcfbafa1e
2 changed files with 23 additions and 19 deletions
|
@ -75,12 +75,8 @@ namespace GUIEditor
|
||||||
|
|
||||||
void CPropBrowserCtrl::clear()
|
void CPropBrowserCtrl::clear()
|
||||||
{
|
{
|
||||||
|
disablePropertyWatchers();
|
||||||
browser->clear();
|
browser->clear();
|
||||||
disconnect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
|
||||||
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
|
||||||
|
|
||||||
disconnect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
|
||||||
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropBrowserCtrl::onSelectionChanged( std::string &id )
|
void CPropBrowserCtrl::onSelectionChanged( std::string &id )
|
||||||
|
@ -88,21 +84,13 @@ namespace GUIEditor
|
||||||
if( browser == NULL )
|
if( browser == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disconnect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
disablePropertyWatchers();
|
||||||
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
|
||||||
disconnect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
|
||||||
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
|
||||||
|
|
||||||
browser->clear();
|
browser->clear();
|
||||||
|
|
||||||
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( id );
|
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( id );
|
||||||
if( e == NULL )
|
if( e == NULL )
|
||||||
{
|
{
|
||||||
connect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
enablePropertyWatchers();
|
||||||
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
|
||||||
connect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
|
||||||
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,10 +99,7 @@ namespace GUIEditor
|
||||||
std::string n = e->getClassName();
|
std::string n = e->getClassName();
|
||||||
|
|
||||||
setupProperties( n, e );
|
setupProperties( n, e );
|
||||||
connect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
enablePropertyWatchers();
|
||||||
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
|
||||||
connect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
|
||||||
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPropBrowserCtrl::onPropertyChanged( QtProperty *prop, const QVariant &v )
|
void CPropBrowserCtrl::onPropertyChanged( QtProperty *prop, const QVariant &v )
|
||||||
|
@ -176,6 +161,22 @@ namespace GUIEditor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPropBrowserCtrl::enablePropertyWatchers()
|
||||||
|
{
|
||||||
|
connect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
||||||
|
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
||||||
|
connect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
||||||
|
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPropBrowserCtrl::disablePropertyWatchers()
|
||||||
|
{
|
||||||
|
disconnect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
||||||
|
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
||||||
|
disconnect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
||||||
|
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
void CPropBrowserCtrl::setupProperties( const std::string &type, const CInterfaceElement *element )
|
void CPropBrowserCtrl::setupProperties( const std::string &type, const CInterfaceElement *element )
|
||||||
{
|
{
|
||||||
std::map< std::string, SWidgetInfo >::iterator itr = widgetInfo.find( type );
|
std::map< std::string, SWidgetInfo >::iterator itr = widgetInfo.find( type );
|
||||||
|
|
|
@ -59,6 +59,9 @@ namespace GUIEditor
|
||||||
void onEnumPropertyChanged( QtProperty *prop, int value );
|
void onEnumPropertyChanged( QtProperty *prop, int value );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void enablePropertyWatchers();
|
||||||
|
void disablePropertyWatchers();
|
||||||
|
|
||||||
void setupProperties( const std::string &type, const NLGUI::CInterfaceElement *element );
|
void setupProperties( const std::string &type, const NLGUI::CInterfaceElement *element );
|
||||||
void setupProperty( const SPropEntry &prop, const NLGUI::CInterfaceElement *element );
|
void setupProperty( const SPropEntry &prop, const NLGUI::CInterfaceElement *element );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue