mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Remember FlexibleTreeView mode choice for all Collection views.
This commit is contained in:
parent
354c2d5bfb
commit
4890f69329
@ -323,6 +323,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
|
||||
{
|
||||
view = m_collectionViews.value( collection ).data();
|
||||
}
|
||||
view->restoreViewMode();
|
||||
|
||||
setPage( view );
|
||||
return view;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -32,6 +33,7 @@
|
||||
#include "playlist/ModeHeader.h"
|
||||
#include "playlist/PlaylistLargeItemDelegate.h"
|
||||
#include "PlayableProxyModelPlaylistInterface.h"
|
||||
#include "TomahawkSettings.h"
|
||||
#include "utils/TomahawkStyle.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "utils/Closure.h"
|
||||
@ -94,8 +96,6 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
|
||||
/* m_stack->addWidget( m_gridView );
|
||||
m_stack->addWidget( m_trackView );*/
|
||||
|
||||
setCurrentMode( Columns );
|
||||
|
||||
connect( m_header, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
|
||||
|
||||
NewClosure( m_modeHeader, SIGNAL( flatClicked() ), const_cast< FlexibleTreeView* >( this ), SLOT( setCurrentMode( FlexibleTreeViewMode ) ), FlexibleTreeView::Columns )->setAutoDelete( false );
|
||||
@ -198,7 +198,15 @@ FlexibleTreeView::setTreeModel( TreeModel* model )
|
||||
void
|
||||
FlexibleTreeView::setCurrentMode( FlexibleTreeViewMode mode )
|
||||
{
|
||||
m_mode = mode;
|
||||
if ( m_mode != mode )
|
||||
{
|
||||
TomahawkSettings::instance()->beginGroup( "ui" );
|
||||
TomahawkSettings::instance()->setValue( "flexibleTreeViewMode", mode );
|
||||
TomahawkSettings::instance()->endGroup();
|
||||
TomahawkSettings::instance()->sync();
|
||||
|
||||
m_mode = mode;
|
||||
}
|
||||
|
||||
switch ( mode )
|
||||
{
|
||||
@ -283,6 +291,28 @@ FlexibleTreeView::setFilter( const QString& pattern )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::restoreViewMode()
|
||||
{
|
||||
TomahawkSettings::instance()->beginGroup( "ui" );
|
||||
int modeNumber = TomahawkSettings::instance()->value( "flexibleTreeViewMode", Columns ).toInt();
|
||||
m_mode = static_cast< FlexibleTreeViewMode >( modeNumber );
|
||||
TomahawkSettings::instance()->endGroup();
|
||||
|
||||
switch ( m_mode )
|
||||
{
|
||||
case Columns:
|
||||
m_modeHeader->switchTo( 0 );
|
||||
break;
|
||||
case Flat:
|
||||
m_modeHeader->switchTo( 1 );
|
||||
break;
|
||||
case Albums:
|
||||
m_modeHeader->switchTo( 2 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FlexibleTreeView::setEmptyTip( const QString& tip )
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -76,6 +77,7 @@ public:
|
||||
public slots:
|
||||
void setCurrentMode( FlexibleTreeViewMode mode );
|
||||
virtual bool setFilter( const QString& pattern );
|
||||
void restoreViewMode(); //ViewManager calls this on every show
|
||||
|
||||
signals:
|
||||
void modeChanged( FlexibleTreeViewMode mode );
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2012-2013, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2012-2014, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -103,6 +103,24 @@ ModeHeader::~ModeHeader()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ModeHeader::switchTo( int buttonIndex )
|
||||
{
|
||||
switch ( buttonIndex )
|
||||
{
|
||||
case 0:
|
||||
m_radioNormal->click();
|
||||
break;
|
||||
case 1:
|
||||
m_radioDetailed->click();
|
||||
break;
|
||||
case 2:
|
||||
m_radioCloud->click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ModeHeader::changeEvent( QEvent* e )
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2012-2013, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2012-2014, Teo Mrnjavac <teo@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -34,6 +34,8 @@ public:
|
||||
ModeHeader( QWidget* parent );
|
||||
~ModeHeader();
|
||||
|
||||
void switchTo( int buttonIndex );
|
||||
|
||||
protected:
|
||||
void changeEvent( QEvent* e );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user