Commit 3e3ffcc1 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[FIX] - fixed ugly bug in WPropertyGroupBase. Now,...

[FIX] - fixed ugly bug in WPropertyGroupBase. Now, WPropertyBase::getUpdateCondition also fires on group changes.
parent 4ee3b8b9
......@@ -183,7 +183,7 @@ void WPropertyGroup::removeProperty( boost::shared_ptr< WPropertyBase > prop )
// lock, unlocked if l looses focus
PropertySharedContainerType::WriteTicket l = m_properties.getWriteTicket();
l->get().erase( std::remove( l->get().begin(), l->get().end(), prop ), l->get().end() );
m_childUpdateCondition->remove( prop->getUpdateCondition() );
m_updateCondition->remove( prop->getUpdateCondition() );
}
WPropGroup WPropertyGroup::addPropertyGroup( std::string name, std::string description, bool hide )
......
......@@ -41,11 +41,10 @@
WPropertyGroupBase::WPropertyGroupBase( std::string name, std::string description ):
WPropertyBase( name, description ),
m_properties(),
m_childUpdateCondition( new WConditionSet() )
m_properties()
{
// this groups update condition also fires upon group modification -> add WSharedObject condition
m_updateCondition->add( m_properties.getChangeCondition() );
m_childUpdateCondition->subscribeSignal( boost::bind( &WPropertyGroupBase::onChildUpdate, this ) );
}
WPropertyGroupBase::~WPropertyGroupBase()
......@@ -54,8 +53,7 @@ WPropertyGroupBase::~WPropertyGroupBase()
WPropertyGroupBase::WPropertyGroupBase( const WPropertyGroupBase& from ):
WPropertyBase( from ),
m_properties(),
m_childUpdateCondition( new WConditionSet() )
m_properties()
{
// copy the properties inside
......@@ -72,14 +70,8 @@ WPropertyGroupBase::WPropertyGroupBase( const WPropertyGroupBase& from ):
// unlock explicitly
l.reset();
// add the change condition of the prop list
// this groups update condition also fires upon group modification -> add WSharedObject condition
m_updateCondition->add( m_properties.getChangeCondition() );
m_childUpdateCondition->subscribeSignal( boost::bind( &WPropertyGroupBase::onChildUpdate, this ) );
}
boost::shared_ptr< WCondition > WPropertyGroupBase::getChildUpdateCondition() const
{
return m_childUpdateCondition;
}
bool WPropertyGroupBase::propNamePredicate( boost::shared_ptr< WPropertyBase > prop1, boost::shared_ptr< WPropertyBase > prop2 ) const
......@@ -196,7 +188,7 @@ void WPropertyGroupBase::addArbitraryProperty( WPropertyBase::SPtr prop )
l->get().push_back( prop );
// add the child's update condition to the list
m_childUpdateCondition->add( prop->getUpdateCondition() );
m_updateCondition->add( prop->getUpdateCondition() );
}
WPropertyGroupBase::PropertySharedContainerType::ReadTicket WPropertyGroupBase::getProperties() const
......@@ -209,6 +201,3 @@ WPropertyGroupBase::PropertySharedContainerType::ReadTicket WPropertyGroupBase::
return m_properties.getReadTicket();
}
void WPropertyGroupBase::onChildUpdate()
{
}
......@@ -117,13 +117,6 @@ public:
// The WPropertyGroupBase interface
///////////////////////////////////////////////////////////////////////////////////////////////////
/**
* This returns the condition fired whenever one children fires its update condition. Useful to get notified about all changes that happen.
*
* \return the condition fired if a child fires its update condition.
*/
virtual boost::shared_ptr< WCondition > getChildUpdateCondition() const;
/**
* Helper function that finds a property by its name. Use this method to find out whether the property exists or not, since
* findProperty throws an exception.
......@@ -184,19 +177,6 @@ protected:
*/
PropertySharedContainerType m_properties;
/**
* Condition notified whenever a property inside this group fires its WPropertyBase::m_updateCondition. This is especially useful to get a
* notification if something updates without further knowledge what changed. Useful if you want to listen for updates in modules for example.
*
* \see getChildUpdateCondition
*/
boost::shared_ptr< WConditionSet > m_childUpdateCondition;
/**
* Callback of m_childUpdateCondition. Overwrite this method to extend the default notification with some custom code.
*/
virtual void onChildUpdate();
/**
* Compares the names of two properties and returns true if they are equal.
*
......
......@@ -116,7 +116,7 @@ void WMDataCreatorScalar::moduleMain()
m_moduleState.setResetable( true, true );
m_moduleState.add( m_propCondition );
// we need to wake up if some strategy prop changed
m_moduleState.add( m_strategy.getProperties()->getChildUpdateCondition() );
m_moduleState.add( m_strategy.getProperties()->getUpdateCondition() );
// signal ready state
ready();
......
......@@ -117,7 +117,7 @@ void WMDataCreatorVector::moduleMain()
m_moduleState.setResetable( true, true );
m_moduleState.add( m_propCondition );
// we need to wake up if some strategy prop changed
m_moduleState.add( m_strategy.getProperties()->getChildUpdateCondition() );
m_moduleState.add( m_strategy.getProperties()->getUpdateCondition() );
// signal ready state
ready();
......
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