diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index ee0f0e27d..fa7b7607a 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -50,7 +50,6 @@ set( libGuiSources playlist/TreeProxyModelPlaylistInterface.cpp playlist/TreeHeader.cpp playlist/TreeItemDelegate.cpp - playlist/CollectionView.cpp playlist/PlaylistModel.cpp playlist/PlaylistView.cpp playlist/PlaylistItemDelegate.cpp diff --git a/src/libtomahawk/playlist/CollectionView.cpp b/src/libtomahawk/playlist/CollectionView.cpp deleted file mode 100644 index 5733f4d8f..000000000 --- a/src/libtomahawk/playlist/CollectionView.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2010-2011, Christian Muehlhaeuser - * Copyright 2010-2011, Jeff Mitchell - * - * Tomahawk is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Tomahawk is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Tomahawk. If not, see . - */ - -#include "CollectionView.h" - -#include -#include - -#include "PlayableModel.h" -#include "widgets/OverlayWidget.h" -#include "utils/Logger.h" -#include "Source.h" - -using namespace Tomahawk; - - -CollectionView::CollectionView( QWidget* parent ) - : TrackView( parent ) -{ - setProxyModel( new PlayableProxyModel( this ) ); - - setDragDropMode( QAbstractItemView::DragOnly ); -} - - -CollectionView::~CollectionView() -{ - qDebug() << Q_FUNC_INFO; -} - - -void -CollectionView::setModel( QAbstractItemModel* model ) -{ - Q_UNUSED( model ); - qDebug() << "Explicitly use setPlayableModel instead"; - Q_ASSERT( false ); -} - - -void -CollectionView::setPlayableModel( PlayableModel* model ) -{ - TrackView::setPlayableModel( model ); - - setColumnHidden( PlayableModel::Score, true ); // Hide score column per default - setColumnHidden( PlayableModel::Origin, true ); // Hide origin column per default - setColumnHidden( PlayableModel::Composer, true ); //Hide composer column per default - - setGuid( QString( "collectionview/%1" ).arg( model->columnCount() ) ); - sortByColumn( PlayableModel::Artist, Qt::AscendingOrder ); - - connect( model, SIGNAL( trackCountChanged( unsigned int ) ), SLOT( onTrackCountChanged( unsigned int ) ) ); -} - - -void -CollectionView::dragEnterEvent( QDragEnterEvent* event ) -{ - event->ignore(); -} - - -void -CollectionView::onTrackCountChanged( unsigned int tracks ) -{ - if ( tracks == 0 ) - { - overlay()->setText( tr( "This collection is empty." ) ); - overlay()->show(); - } - else - overlay()->hide(); -} - - -bool -CollectionView::jumpToCurrentTrack() -{ - scrollTo( proxyModel()->currentIndex(), QAbstractItemView::PositionAtCenter ); - return true; -} diff --git a/src/libtomahawk/playlist/CollectionView.h b/src/libtomahawk/playlist/CollectionView.h deleted file mode 100644 index 40f3ac76f..000000000 --- a/src/libtomahawk/playlist/CollectionView.h +++ /dev/null @@ -1,60 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2010-2011, Christian Muehlhaeuser - * Copyright 2010-2012, Jeff Mitchell - * - * Tomahawk is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Tomahawk is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Tomahawk. If not, see . - */ - -#ifndef COLLECTIONVIEW_H -#define COLLECTIONVIEW_H - -#include "PlayableModel.h" -#include "PlayableProxyModel.h" -#include "TrackView.h" -#include "ViewPage.h" - -#include "DllMacro.h" - -class DLLEXPORT CollectionView : public TrackView, public Tomahawk::ViewPage -{ -Q_OBJECT - -public: - explicit CollectionView( QWidget* parent = 0 ); - ~CollectionView(); - - virtual void setPlayableModel( PlayableModel* model ); - virtual void setModel( QAbstractItemModel* model ); - - virtual QWidget* widget() { return this; } - virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return proxyModel()->playlistInterface(); } - - virtual QString title() const { return model()->title(); } - virtual QString description() const { return model()->description(); } - virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/music-icon.png" ); } - - virtual bool showModes() const { return true; } - virtual bool showFilter() const { return true; } - - virtual bool jumpToCurrentTrack(); - -private slots: - void onTrackCountChanged( unsigned int tracks ); - -protected: - virtual void dragEnterEvent( QDragEnterEvent* event ); -}; - -#endif // COLLECTIONVIEW_H