mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-19 07:27:59 +01:00
* Fixed TWK-703: Auto expand sidebar's groups per default.
This commit is contained in:
parent
be7b5babe9
commit
cdf7c11b29
@ -30,9 +30,8 @@ using namespace Tomahawk;
|
||||
GroupItem::GroupItem( SourcesModel* model, SourceTreeItem* parent, const QString& text, int peerSortValue )
|
||||
: SourceTreeItem( model, parent, SourcesModel::Group, peerSortValue )
|
||||
, m_text( text )
|
||||
, m_defaultExpanded( true )
|
||||
{
|
||||
// expand by default
|
||||
QTimer::singleShot( 0, this, SLOT( requestExpanding() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -55,6 +54,18 @@ GroupItem::requestExpanding()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GroupItem::checkExpandedState()
|
||||
{
|
||||
if ( m_defaultExpanded )
|
||||
{
|
||||
// only default expand once
|
||||
m_defaultExpanded = false;
|
||||
requestExpanding();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
GroupItem::text() const
|
||||
{
|
||||
|
@ -38,6 +38,9 @@ public:
|
||||
virtual QIcon icon() const { return QIcon(); }
|
||||
virtual bool isBeingPlayed() const { return false; }
|
||||
|
||||
void checkExpandedState();
|
||||
void setDefaultExpanded( bool b ) { m_defaultExpanded = b; }
|
||||
|
||||
public slots:
|
||||
virtual void activate();
|
||||
|
||||
@ -49,6 +52,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QString m_text;
|
||||
bool m_defaultExpanded;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -300,7 +300,7 @@ SourcesModel::appendGroups()
|
||||
void
|
||||
SourcesModel::appendItem( const Tomahawk::source_ptr& source )
|
||||
{
|
||||
SourceTreeItem* parent;
|
||||
GroupItem* parent;
|
||||
if ( !source.isNull() && source->isLocal() )
|
||||
{
|
||||
parent = m_myMusicGroup;
|
||||
@ -314,6 +314,8 @@ SourcesModel::appendItem( const Tomahawk::source_ptr& source )
|
||||
beginInsertRows( idx, rowCount( idx ), rowCount( idx ) );
|
||||
new SourceItem( this, parent, source );
|
||||
endInsertRows();
|
||||
|
||||
parent->checkExpandedState();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user