Commit 03d7baf6 authored by schurade's avatar schurade
Browse files

[CHANGE] change for properties to keep their order of insertion

parent a6c4e5a6
......@@ -105,22 +105,24 @@ void WQtDatasetBrowser::selectTreeItem()
{
if ( m_treeWidget->selectedItems().size() == 0 || m_treeWidget->selectedItems().at( 0 )->type() != 1 )
{
m_tabWidget->clear();
return;
}
boost::shared_ptr< WModule >module =( ( WQtDatasetTreeItem* ) m_treeWidget->selectedItems().at( 0 ) )->getModule();
std::map < std::string, WProperty* >*props = module->getProperties()->getProperties();
std::map < std::string, WProperty* >::const_iterator propIt = props->begin();
std::vector < WProperty* >*props = module->getProperties()->getPropertyVector();
WQtDSBWidget* tab1 = new WQtDSBWidget( "settings" );
while ( propIt != props->end() )
for ( size_t i = 0; i < props->size(); ++i )
{
switch ( propIt->second->getType() )
switch ( props->at(i)->getType() )
{
case P_BOOL:
{
WQtCheckBox* box = tab1->addCheckBox( propIt->second->getName(), propIt->second->getValue<bool>() );
WQtCheckBox* box = tab1->addCheckBox( props->at(i)->getName(), props->at(i)->getValue<bool>() );
connect( box, SIGNAL( checkBoxStateChanged( std::string, bool ) ),
this, SLOT( slotSetBoolProperty( std::string, bool ) ) );
break;
......@@ -131,8 +133,8 @@ void WQtDatasetBrowser::selectTreeItem()
break;
case P_INT:
{
WQtSliderWithEdit* slider = tab1->addSliderInt( propIt->second->getName(), propIt->second->getValue<int>(),
propIt->second->getMin<int>(), propIt->second->getMax<int>() );
WQtSliderWithEdit* slider = tab1->addSliderInt( props->at(i)->getName(), props->at(i)->getValue<int>(),
props->at(i)->getMin<int>(), props->at(i)->getMax<int>() );
connect( slider, SIGNAL( signalNumberWithName( std::string, int ) ),
this, SLOT( slotSetIntProperty( std::string, int ) ) );
break;
......@@ -145,7 +147,7 @@ void WQtDatasetBrowser::selectTreeItem()
break;
case P_STRING:
{
WQtLineEdit* edit = tab1->addLineEdit( propIt->second->getName(), propIt->second->getValue<std::string>() );
WQtLineEdit* edit = tab1->addLineEdit( props->at(i)->getName(), props->at(i)->getValue<std::string>() );
connect( edit, SIGNAL( lineEditStateChanged( std::string, std::string ) ),
this, SLOT( slotSetStringProperty( std::string, std::string ) ) );
break;
......@@ -153,7 +155,6 @@ void WQtDatasetBrowser::selectTreeItem()
default:
break;
}
++propIt;
}
// TODO(schurade): qt doc says clear() doesn't delete tabs so this is possibly a memory leak
m_tabWidget->clear();
......
......@@ -292,8 +292,8 @@ void WKernel::slotFinishLoadData( boost::shared_ptr< WDataSet > dataSet )
{
boost::shared_ptr< WModule > module = boost::shared_ptr< WModule >( new WDataModule<int>( dataSet ) );
module->getProperties()->addBool( "interpolation", true );
module->getProperties()->addBool( "active", true );
module->getProperties()->addBool( "interpolation", true );
module->getProperties()->addInt( "threshold", 0 );
module->getProperties()->addInt( "alpha", 100 );
module->getProperties()->setMax( "alpha", 100 );
......
......@@ -43,6 +43,7 @@ boost::signal1< void, std::string >* WProperties::addBool( std::string name, boo
{
WProperty* prop = new WProperty( name, value, shortDesc, longDesc );
m_propertyList[name] = prop;
m_propertyVector.push_back( prop );
return prop->getSignalValueChanged();
}
......@@ -50,6 +51,7 @@ boost::signal1< void, std::string >* WProperties::addChar( std::string name, cha
{
WProperty* prop = new WProperty( name, value, shortDesc, longDesc );
m_propertyList[name] = prop;
m_propertyVector.push_back( prop );
return prop->getSignalValueChanged();
}
......@@ -58,6 +60,7 @@ boost::signal1< void, std::string >* WProperties::addInt( std::string name, int
{
WProperty* prop = new WProperty( name, value, shortDesc, longDesc );
m_propertyList[name] = prop;
m_propertyVector.push_back( prop );
return prop->getSignalValueChanged();
}
......@@ -66,6 +69,7 @@ boost::signal1< void, std::string >* WProperties::addFloat( std::string name, fl
{
WProperty* prop = new WProperty( name, value, shortDesc, longDesc );
m_propertyList[name] = prop;
m_propertyVector.push_back( prop );
return prop->getSignalValueChanged();
}
......@@ -74,6 +78,7 @@ boost::signal1< void, std::string >* WProperties::addDouble( std::string name, d
{
WProperty* prop = new WProperty( name, value, shortDesc, longDesc );
m_propertyList[name] = prop;
m_propertyVector.push_back( prop );
return prop->getSignalValueChanged();
}
......@@ -82,6 +87,7 @@ boost::signal1< void, std::string >* WProperties::addString( std::string name, s
{
WProperty* prop = new WProperty( name, value, shortDesc, longDesc );
m_propertyList[name] = prop;
m_propertyVector.push_back( prop );
return prop->getSignalValueChanged();
}
......@@ -113,3 +119,8 @@ std::map < std::string, WProperty* >* WProperties::getProperties()
{
return &m_propertyList;
}
std::vector< WProperty* >* WProperties::getPropertyVector()
{
return &m_propertyVector;
}
......@@ -48,6 +48,7 @@ public:
virtual ~WProperties();
std::map < std::string, WProperty* >* getProperties();
std::vector< WProperty* >* getPropertyVector();
boost::signal1< void, std::string >* addBool( std::string name, bool value = false, std::string shortDesc = "", std::string longDesc = "" );
boost::signal1< void, std::string >* addChar( std::string name, char value = 0, std::string shortDesc = "", std::string longDesc = "" );
......@@ -114,6 +115,8 @@ private:
WProperty* findProp( std::string name );
std::map < std::string, WProperty* >m_propertyList;
std::vector< WProperty* >m_propertyVector;
};
#endif // WPROPERTIES_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment