mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 05:36:13 +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()
|
||||
{
|
||||
disablePropertyWatchers();
|
||||
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 )
|
||||
|
@ -88,21 +84,13 @@ namespace GUIEditor
|
|||
if( browser == NULL )
|
||||
return;
|
||||
|
||||
disconnect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
||||
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
||||
disconnect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
||||
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
||||
|
||||
disablePropertyWatchers();
|
||||
browser->clear();
|
||||
|
||||
CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( id );
|
||||
if( e == NULL )
|
||||
{
|
||||
connect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
||||
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
||||
connect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
||||
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
||||
|
||||
enablePropertyWatchers();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -111,10 +99,7 @@ namespace GUIEditor
|
|||
std::string n = e->getClassName();
|
||||
|
||||
setupProperties( n, e );
|
||||
connect( propertyMgr, SIGNAL( valueChanged( QtProperty*, const QVariant& ) ),
|
||||
this, SLOT( onPropertyChanged( QtProperty*, const QVariant& ) ) );
|
||||
connect( enumMgr, SIGNAL( valueChanged( QtProperty*, int ) ),
|
||||
this, SLOT( onEnumPropertyChanged( QtProperty*, int ) ) );
|
||||
enablePropertyWatchers();
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
std::map< std::string, SWidgetInfo >::iterator itr = widgetInfo.find( type );
|
||||
|
|
|
@ -59,6 +59,9 @@ namespace GUIEditor
|
|||
void onEnumPropertyChanged( QtProperty *prop, int value );
|
||||
|
||||
private:
|
||||
void enablePropertyWatchers();
|
||||
void disablePropertyWatchers();
|
||||
|
||||
void setupProperties( const std::string &type, const NLGUI::CInterfaceElement *element );
|
||||
void setupProperty( const SPropEntry &prop, const NLGUI::CInterfaceElement *element );
|
||||
|
||||
|
|
Loading…
Reference in a new issue