1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-01-17 14:28:24 +01:00

Renamed and moved FlexibleTreeView to CollectionViewPage.

This commit is contained in:
Christian Muehlhaeuser 2014-10-20 02:20:52 +02:00
parent 5d9b42182b
commit 51fe1aa0df
5 changed files with 47 additions and 47 deletions

View File

@ -38,7 +38,6 @@ set( libGuiSources
playlist/InboxModel.cpp
playlist/InboxView.cpp
playlist/ContextView.cpp
playlist/FlexibleTreeView.cpp
playlist/TreeModel.cpp
playlist/TreeProxyModel.cpp
playlist/TreeProxyModelPlaylistInterface.cpp
@ -121,6 +120,7 @@ set( libGuiSources
viewpages/AlbumViewPage.cpp
viewpages/TrackViewPage.cpp
viewpages/PlaylistViewPage.cpp
viewpages/CollectionViewPage.cpp
widgets/AnimatedSplitter.cpp
widgets/BasicHeader.cpp

View File

@ -27,7 +27,6 @@
#include "audio/AudioEngine.h"
#include "playlist/ContextView.h"
#include "playlist/FlexibleTreeView.h"
#include "playlist/TreeModel.h"
#include "playlist/PlaylistModel.h"
#include "playlist/TrackView.h"
@ -49,6 +48,7 @@
#include "viewpages/ArtistViewPage.h"
#include "viewpages/AlbumViewPage.h"
#include "viewpages/TrackViewPage.h"
#include "viewpages/CollectionViewPage.h"
#include "utils/Logger.h"
#include "utils/TomahawkUtilsGui.h"
@ -261,10 +261,10 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
{
m_currentCollection = collection;
FlexibleTreeView* view;
CollectionViewPage* view;
if ( !m_collectionViews.contains( collection ) || m_collectionViews.value( collection ).isNull() )
{
view = new FlexibleTreeView();
view = new CollectionViewPage();
view->columnView()->proxyModel()->setStyle( PlayableProxyModel::Collection );
TreeModel* model = new TreeModel();

View File

@ -42,7 +42,7 @@ class AlbumInfoWidget;
class ArtistInfoWidget;
class CollectionModel;
class PlaylistViewPage;
class FlexibleTreeView;
class CollectionViewPage;
class PlaylistModel;
class TrackProxyModel;
class TrackModel;
@ -164,7 +164,7 @@ private:
QHash< QString, boost::function< Tomahawk::ViewPage*() > > m_dynamicPagesInstanceLoaders;
QHash< Tomahawk::dynplaylist_ptr, QPointer<Tomahawk::DynamicWidget> > m_dynamicWidgets;
QHash< Tomahawk::collection_ptr, QPointer<FlexibleTreeView> > m_collectionViews;
QHash< Tomahawk::collection_ptr, QPointer<CollectionViewPage> > m_collectionViews;
QHash< Tomahawk::artist_ptr, QPointer<ArtistInfoWidget> > m_artistViews;
QHash< Tomahawk::album_ptr, QPointer<AlbumInfoWidget> > m_albumViews;
QHash< Tomahawk::query_ptr, QPointer<TrackInfoWidget> > m_trackViews;

View File

@ -17,7 +17,7 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#include "FlexibleTreeView.h"
#include "CollectionViewPage.h"
#include <QRadioButton>
#include <QStackedWidget>
@ -29,7 +29,7 @@
#include "playlist/ColumnView.h"
#include "playlist/TrackView.h"
#include "playlist/GridView.h"
#include "PlayableProxyModelPlaylistInterface.h"
#include "playlist/PlayableProxyModelPlaylistInterface.h"
#include "TomahawkSettings.h"
#include "utils/ImageRegistry.h"
#include "utils/TomahawkStyle.h"
@ -40,7 +40,7 @@
using namespace Tomahawk;
FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
CollectionViewPage::CollectionViewPage( QWidget* parent, QWidget* extraHeader )
: QWidget( parent )
, m_header( new FilterHeader( this ) )
, m_columnView( new ColumnView() )
@ -50,7 +50,7 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
, m_flatModel( 0 )
, m_temporary( false )
{
qRegisterMetaType< FlexibleTreeViewMode >( "FlexibleTreeViewMode" );
qRegisterMetaType< CollectionViewPageMode >( "CollectionViewPageMode" );
m_header->setBackgroundColor( Qt::black );
m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background.png", QSize( 0, 0 ) ), false );
@ -105,9 +105,9 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
m_header->ui->anchor2Label->setFixedWidth( fm.width( m_header->ui->anchor2Label->text() ) + 16 );
m_header->ui->anchor3Label->setFixedWidth( fm.width( m_header->ui->anchor3Label->text() ) + 16 );
NewClosure( m_header->ui->anchor1Label, SIGNAL( clicked() ), const_cast< FlexibleTreeView* >( this ), SLOT( setCurrentMode( FlexibleTreeViewMode ) ), FlexibleTreeView::Columns )->setAutoDelete( false );
NewClosure( m_header->ui->anchor2Label, SIGNAL( clicked() ), const_cast< FlexibleTreeView* >( this ), SLOT( setCurrentMode( FlexibleTreeViewMode ) ), FlexibleTreeView::Albums )->setAutoDelete( false );
NewClosure( m_header->ui->anchor3Label, SIGNAL( clicked() ), const_cast< FlexibleTreeView* >( this ), SLOT( setCurrentMode( FlexibleTreeViewMode ) ), FlexibleTreeView::Flat )->setAutoDelete( false );
NewClosure( m_header->ui->anchor1Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Columns )->setAutoDelete( false );
NewClosure( m_header->ui->anchor2Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Albums )->setAutoDelete( false );
NewClosure( m_header->ui->anchor3Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Flat )->setAutoDelete( false );
}
layout()->addWidget( m_header );
@ -123,14 +123,14 @@ FlexibleTreeView::FlexibleTreeView( QWidget* parent, QWidget* extraHeader )
}
FlexibleTreeView::~FlexibleTreeView()
CollectionViewPage::~CollectionViewPage()
{
tDebug() << Q_FUNC_INFO;
}
void
FlexibleTreeView::setTrackView( TrackView* view )
CollectionViewPage::setTrackView( TrackView* view )
{
if ( m_trackView )
{
@ -146,7 +146,7 @@ FlexibleTreeView::setTrackView( TrackView* view )
void
FlexibleTreeView::setColumnView( ColumnView* view )
CollectionViewPage::setColumnView( ColumnView* view )
{
if ( m_columnView )
{
@ -164,7 +164,7 @@ FlexibleTreeView::setColumnView( ColumnView* view )
void
FlexibleTreeView::setTreeModel( TreeModel* model )
CollectionViewPage::setTreeModel( TreeModel* model )
{
if ( m_model )
{
@ -189,7 +189,7 @@ FlexibleTreeView::setTreeModel( TreeModel* model )
void
FlexibleTreeView::setFlatModel( PlayableModel* model )
CollectionViewPage::setFlatModel( PlayableModel* model )
{
if ( m_flatModel )
{
@ -210,7 +210,7 @@ FlexibleTreeView::setFlatModel( PlayableModel* model )
void
FlexibleTreeView::setAlbumModel( PlayableModel* model )
CollectionViewPage::setAlbumModel( PlayableModel* model )
{
m_albumModel = model;
m_albumView->setPlayableModel( model );
@ -221,7 +221,7 @@ FlexibleTreeView::setAlbumModel( PlayableModel* model )
void
FlexibleTreeView::setCurrentMode( FlexibleTreeViewMode mode )
CollectionViewPage::setCurrentMode( CollectionViewPageMode mode )
{
if ( m_mode != mode )
{
@ -289,35 +289,35 @@ FlexibleTreeView::setCurrentMode( FlexibleTreeViewMode mode )
Tomahawk::playlistinterface_ptr
FlexibleTreeView::playlistInterface() const
CollectionViewPage::playlistInterface() const
{
return m_columnView->proxyModel()->playlistInterface();
}
QString
FlexibleTreeView::title() const
CollectionViewPage::title() const
{
return m_model->title();
}
QString
FlexibleTreeView::description() const
CollectionViewPage::description() const
{
return m_model->description();
}
QPixmap
FlexibleTreeView::pixmap() const
CollectionViewPage::pixmap() const
{
return m_pixmap;
}
bool
FlexibleTreeView::jumpToCurrentTrack()
CollectionViewPage::jumpToCurrentTrack()
{
tDebug() << Q_FUNC_INFO;
@ -333,7 +333,7 @@ FlexibleTreeView::jumpToCurrentTrack()
bool
FlexibleTreeView::setFilter( const QString& pattern )
CollectionViewPage::setFilter( const QString& pattern )
{
ViewPage::setFilter( pattern );
@ -346,19 +346,19 @@ FlexibleTreeView::setFilter( const QString& pattern )
void
FlexibleTreeView::restoreViewMode()
CollectionViewPage::restoreViewMode()
{
TomahawkSettings::instance()->beginGroup( "ui" );
int modeNumber = TomahawkSettings::instance()->value( "flexibleTreeViewMode", Columns ).toInt();
m_mode = static_cast< FlexibleTreeViewMode >( modeNumber );
m_mode = static_cast< CollectionViewPageMode >( modeNumber );
TomahawkSettings::instance()->endGroup();
setCurrentMode( (FlexibleTreeViewMode)modeNumber );
setCurrentMode( (CollectionViewPageMode)modeNumber );
}
void
FlexibleTreeView::setEmptyTip( const QString& tip )
CollectionViewPage::setEmptyTip( const QString& tip )
{
m_columnView->setEmptyTip( tip );
m_albumView->setEmptyTip( tip );
@ -367,7 +367,7 @@ FlexibleTreeView::setEmptyTip( const QString& tip )
void
FlexibleTreeView::setPixmap( const QPixmap& pixmap, bool tinted )
CollectionViewPage::setPixmap( const QPixmap& pixmap, bool tinted )
{
m_pixmap = pixmap;
m_header->setPixmap( pixmap, tinted );
@ -375,7 +375,7 @@ FlexibleTreeView::setPixmap( const QPixmap& pixmap, bool tinted )
void
FlexibleTreeView::onModelChanged()
CollectionViewPage::onModelChanged()
{
setPixmap( m_model->icon(), false );
m_header->setCaption( m_model->title() );
@ -386,7 +386,7 @@ FlexibleTreeView::onModelChanged()
void
FlexibleTreeView::onWidgetDestroyed( QWidget* widget )
CollectionViewPage::onWidgetDestroyed( QWidget* widget )
{
Q_UNUSED( widget );
emit destroyed( this );
@ -394,21 +394,21 @@ FlexibleTreeView::onWidgetDestroyed( QWidget* widget )
bool
FlexibleTreeView::isTemporaryPage() const
CollectionViewPage::isTemporaryPage() const
{
return m_temporary;
}
void
FlexibleTreeView::setTemporaryPage( bool b )
CollectionViewPage::setTemporaryPage( bool b )
{
m_temporary = b;
}
bool
FlexibleTreeView::isBeingPlayed() const
CollectionViewPage::isBeingPlayed() const
{
if ( !playlistInterface() )
return false;

View File

@ -17,8 +17,8 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FLEXIBLETREEVIEW_H
#define FLEXIBLETREEVIEW_H
#ifndef COLLECTIONVIEWPAGE_H
#define COLLECTIONVIEWPAGE_H
#include "ViewPage.h"
#include "PlaylistInterface.h"
@ -34,16 +34,16 @@ class PlayableModel;
class PlaylistModel;
class FilterHeader;
class DLLEXPORT FlexibleTreeView : public QWidget, public Tomahawk::ViewPage
class DLLEXPORT CollectionViewPage : public QWidget, public Tomahawk::ViewPage
{
Q_OBJECT
public:
enum FlexibleTreeViewMode
enum CollectionViewPageMode
{ Columns = 0, Albums = 1, Flat = 2 };
explicit FlexibleTreeView( QWidget* parent = 0, QWidget* extraHeader = 0 );
~FlexibleTreeView();
explicit CollectionViewPage( QWidget* parent = 0, QWidget* extraHeader = 0 );
~CollectionViewPage();
virtual QWidget* widget() { return this; }
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
@ -71,12 +71,12 @@ public:
void setEmptyTip( const QString& tip );
public slots:
void setCurrentMode( FlexibleTreeViewMode mode );
void setCurrentMode( CollectionViewPageMode mode );
virtual bool setFilter( const QString& pattern );
void restoreViewMode(); //ViewManager calls this on every show
signals:
void modeChanged( FlexibleTreeViewMode mode );
void modeChanged( CollectionViewPageMode mode );
void destroyed( QWidget* widget );
private slots:
@ -96,10 +96,10 @@ private:
PlayableModel* m_albumModel;
QStackedWidget* m_stack;
FlexibleTreeViewMode m_mode;
CollectionViewPageMode m_mode;
bool m_temporary;
};
Q_DECLARE_METATYPE( FlexibleTreeView::FlexibleTreeViewMode );
Q_DECLARE_METATYPE( CollectionViewPage::CollectionViewPageMode );
#endif // FLEXIBLETREEVIEW_H
#endif // COLLECTIONVIEWPAGE_H