mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 21:27:58 +02:00
Remember FlexibleTreeView mode choice for all Collection views.
This commit is contained in:
@@ -323,6 +323,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
|
|||||||
{
|
{
|
||||||
view = m_collectionViews.value( collection ).data();
|
view = m_collectionViews.value( collection ).data();
|
||||||
}
|
}
|
||||||
|
view->restoreViewMode();
|
||||||
|
|
||||||
setPage( view );
|
setPage( view );
|
||||||
return view;
|
return view;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2013, Christian Muehlhaeuser <muesli@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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -32,6 +33,7 @@
|
|||||||
#include "playlist/ModeHeader.h"
|
#include "playlist/ModeHeader.h"
|
||||||
#include "playlist/PlaylistLargeItemDelegate.h"
|
#include "playlist/PlaylistLargeItemDelegate.h"
|
||||||
#include "PlayableProxyModelPlaylistInterface.h"
|
#include "PlayableProxyModelPlaylistInterface.h"
|
||||||
|
#include "TomahawkSettings.h"
|
||||||
#include "utils/TomahawkStyle.h"
|
#include "utils/TomahawkStyle.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
#include "utils/Closure.h"
|
#include "utils/Closure.h"
|
||||||
@@ -94,8 +96,6 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
|
|||||||
/* m_stack->addWidget( m_gridView );
|
/* m_stack->addWidget( m_gridView );
|
||||||
m_stack->addWidget( m_trackView );*/
|
m_stack->addWidget( m_trackView );*/
|
||||||
|
|
||||||
setCurrentMode( Columns );
|
|
||||||
|
|
||||||
connect( m_header, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );
|
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 );
|
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
|
void
|
||||||
FlexibleTreeView::setCurrentMode( FlexibleTreeViewMode mode )
|
FlexibleTreeView::setCurrentMode( FlexibleTreeViewMode mode )
|
||||||
{
|
{
|
||||||
|
if ( m_mode != mode )
|
||||||
|
{
|
||||||
|
TomahawkSettings::instance()->beginGroup( "ui" );
|
||||||
|
TomahawkSettings::instance()->setValue( "flexibleTreeViewMode", mode );
|
||||||
|
TomahawkSettings::instance()->endGroup();
|
||||||
|
TomahawkSettings::instance()->sync();
|
||||||
|
|
||||||
m_mode = mode;
|
m_mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
switch ( 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
|
void
|
||||||
FlexibleTreeView::setEmptyTip( const QString& tip )
|
FlexibleTreeView::setEmptyTip( const QString& tip )
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2012, Christian Muehlhaeuser <muesli@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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -76,6 +77,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void setCurrentMode( FlexibleTreeViewMode mode );
|
void setCurrentMode( FlexibleTreeViewMode mode );
|
||||||
virtual bool setFilter( const QString& pattern );
|
virtual bool setFilter( const QString& pattern );
|
||||||
|
void restoreViewMode(); //ViewManager calls this on every show
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void modeChanged( FlexibleTreeViewMode mode );
|
void modeChanged( FlexibleTreeViewMode mode );
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* 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
|
void
|
||||||
ModeHeader::changeEvent( QEvent* e )
|
ModeHeader::changeEvent( QEvent* e )
|
||||||
{
|
{
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@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
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -34,6 +34,8 @@ public:
|
|||||||
ModeHeader( QWidget* parent );
|
ModeHeader( QWidget* parent );
|
||||||
~ModeHeader();
|
~ModeHeader();
|
||||||
|
|
||||||
|
void switchTo( int buttonIndex );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent( QEvent* e );
|
void changeEvent( QEvent* e );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user