Commit 36f82683 authored by Erwan Tulou's avatar Erwan Tulou

skins2(playlist): cosmetics + avoid objects passed as value if not needed

parent 7647873a
......@@ -39,8 +39,7 @@ VarTree::VarTree( intf_thread_t *pIntf )
VarTree::VarTree( intf_thread_t *pIntf, VarTree *pParent, int id,
const UStringPtr &rcString, bool selected, bool playing,
bool expanded, bool readonly,
void *pData )
bool expanded, bool readonly, void *pData )
: Variable( pIntf ), m_id( id ), m_cString( rcString ),
m_selected( selected ), m_playing( playing ), m_expanded( expanded ),
m_deleted( false ), m_pData( pData ), m_pParent( pParent ),
......@@ -57,8 +56,7 @@ VarTree::~VarTree()
}
void VarTree::add( int id, const UStringPtr &rcString, bool selected,
bool playing, bool expanded, bool readonly,
void *pData )
bool playing, bool expanded, bool readonly, void *pData )
{
m_children.push_back( VarTree( getIntf(), this, id, rcString, selected,
playing, expanded, readonly,
......@@ -268,7 +266,7 @@ VarTree::Iterator VarTree::getNextVisibleItem( Iterator it )
}
else
{
VarTree::Iterator it_old = it;
Iterator it_old = it;
++it;
// Was 'it' the last brother? If so, look for uncles
if( it_old->parent() && it_old->parent()->end() == it )
......@@ -281,7 +279,7 @@ VarTree::Iterator VarTree::getNextVisibleItem( Iterator it )
VarTree::Iterator VarTree::getPrevVisibleItem( Iterator it )
{
VarTree::Iterator it_old = it;
Iterator it_old = it;
if( it == root()->begin() || it == ++(root()->begin()) ) return it;
/* Was it the first child of its parent ? */
......@@ -310,7 +308,7 @@ VarTree::Iterator VarTree::getNextItem( Iterator it )
}
else
{
VarTree::Iterator it_old = it;
Iterator it_old = it;
++it;
// Was 'it' the last brother? If so, look for uncles
if( it_old->parent() && it_old->parent()->end() == it )
......@@ -323,7 +321,7 @@ VarTree::Iterator VarTree::getNextItem( Iterator it )
VarTree::Iterator VarTree::getPrevItem( Iterator it )
{
VarTree::Iterator it_old = it;
Iterator it_old = it;
if( it == root()->begin() || it == ++(root()->begin()) ) return it;
/* Was it the first child of its parent ? */
......@@ -380,7 +378,7 @@ VarTree::Iterator VarTree::findById( int id )
}
void VarTree::ensureExpanded( VarTree::Iterator it )
void VarTree::ensureExpanded( const Iterator& it )
{
/// Don't expand ourselves, only our parents
VarTree *current = &(*it);
......@@ -422,7 +420,7 @@ void VarTree::cascadeDelete()
}
}
int VarTree::getRank( Iterator item, bool flat )
int VarTree::getRank( const Iterator& item, bool flat )
{
int index = 1;
Iterator it;
......
......@@ -57,7 +57,7 @@ public:
VarTree( intf_thread_t *pIntf, VarTree *pParent, int id,
const UStringPtr &rcString, bool selected, bool playing,
bool expanded,bool readonly, void *pData );
bool expanded, bool readonly, void *pData );
virtual ~VarTree();
......@@ -66,8 +66,7 @@ public:
/// Add a pointer on string in the children's list
virtual void add( int id, const UStringPtr &rcString, bool selected,
bool playing, bool expanded, bool readonly,
void *pData );
bool playing, bool expanded, bool readonly, void *pData );
/// Remove the selected item from the children's list
virtual void delSelected();
......@@ -128,10 +127,8 @@ public:
/// Get first leaf
Iterator firstLeaf();
void removeChild( VarTree::Iterator item )
{
m_children.erase( item );
}
/// Remove a child
void removeChild( Iterator it ) { m_children.erase( it ); }
/// Execute the action associated to this item
virtual void action( VarTree *pItem ) { }
......@@ -175,13 +172,13 @@ public:
Iterator getPrevLeaf( Iterator it );
/// return rank of visible item starting from 1
int getRank( Iterator it, bool flat );
int getRank( const Iterator& it, bool flat );
/// Find a children node with the given id
Iterator findById( int id );
/// Ensure an item is expanded
void ensureExpanded( VarTree::Iterator );
void ensureExpanded( const Iterator& it );
/// flag a whole subtree for deletion
void cascadeDelete();
......
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