diff --git a/src/libtomahawk-widgets/CMakeLists.txt b/src/libtomahawk-widgets/CMakeLists.txt index 6b94e218e..ecb77f473 100644 --- a/src/libtomahawk-widgets/CMakeLists.txt +++ b/src/libtomahawk-widgets/CMakeLists.txt @@ -4,11 +4,9 @@ set(TOMAHAWK_WIDGETS_LIBRARY_TARGET tomahawk-widgets) list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_SOURCES PlaylistDelegate.cpp PlaylistWidget.cpp - SocialPlaylistWidget.cpp ) list(APPEND ${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_UI - SocialPlaylistWidget.ui ) tomahawk_add_library(${TOMAHAWK_WIDGETS_LIBRARY_TARGET} diff --git a/src/libtomahawk-widgets/SocialPlaylistWidget.cpp b/src/libtomahawk-widgets/SocialPlaylistWidget.cpp deleted file mode 100644 index 7ddd28bbf..000000000 --- a/src/libtomahawk-widgets/SocialPlaylistWidget.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2010-2011, Leo Franchi - * 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 "SocialPlaylistWidget.h" -#include "ui_SocialPlaylistWidget.h" - -#include "database/DatabaseCommand_LoadDynamicPlaylist.h" -#include "database/Database.h" -#include "SourceList.h" -#include "playlist/PlayableModel.h" -#include "playlist/PlaylistModel.h" -#include "playlist/dynamic/GeneratorInterface.h" -#include "playlist/dynamic/database/DatabaseGenerator.h" -#include "utils/Logger.h" -#include "database/DatabaseCommand_GenericSelect.h" -#include "widgets/OverlayWidget.h" - -#include "utils/TomahawkUtilsGui.h" - -using namespace Tomahawk; -using namespace Tomahawk::Widgets; - -QString SocialPlaylistWidget::s_popularAlbumsQuery = "SELECT * from album"; -QString SocialPlaylistWidget::s_mostPlayedPlaylistsQuery = "asd"; -QString SocialPlaylistWidget::s_topForeignTracksQuery = "select track.name, artist.name, count(*) as counter from (select track from playback_log group by track, source), track, artist where track not in (select track from playback_log where source is null group by track) and track.id = track and artist.id = track.artist group by track order by counter desc"; - -SocialPlaylistWidget::SocialPlaylistWidget ( QWidget* parent ) - : QWidget( parent ) - , ui( new Ui_SocialPlaylistWidget ) - , m_topForeignTracksModel( 0 ) - , m_popularNewAlbumsModel( 0 ) -{ - ui->setupUi( this ); - - ui->splitter_2->setStretchFactor( 0, 2 ); - ui->splitter_2->setStretchFactor( 0, 1 ); - - /* - WelcomePlaylistModel* model = new WelcomePlaylistModel( this ); - model->setMaxPlaylists( HISTORY_PLAYLIST_ITEMS ); - */ - - ui->mostPlayedPlaylists->setFrameShape( QFrame::NoFrame ); - ui->mostPlayedPlaylists->setAttribute( Qt::WA_MacShowFocusRect, 0 ); - - TomahawkUtils::unmarginLayout( layout() ); - TomahawkUtils::unmarginLayout( ui->verticalLayout->layout() ); - TomahawkUtils::unmarginLayout( ui->verticalLayout_2->layout() ); - TomahawkUtils::unmarginLayout( ui->verticalLayout_3->layout() ); - TomahawkUtils::unmarginLayout( ui->verticalLayout_4->layout() ); - -// ui->mostPlayedPlaylists->setItemDelegate( new PlaylistDelegate() ); -// ui->mostPlayedPlaylists->setModel( model ); -// ui->mostPlayedPlaylists->overlay()->resize( 380, 86 ); - -// connect( model, SIGNAL( emptinessChanged( bool) ), this, SLOT( updatePlaylists() ) ); - - m_topForeignTracksModel = new PlaylistModel( ui->newTracksView ); - ui->newTracksView->setPlayableModel( m_topForeignTracksModel ); - ui->newTracksView->proxyModel()->setStyle( PlayableProxyModel::Fancy ); - ui->newTracksView->overlay()->setEnabled( false ); - - m_popularNewAlbumsModel = new PlayableModel( ui->newAlbumsView ); - ui->newAlbumsView->setPlayableModel( m_popularNewAlbumsModel ); - // TODO run the genericselect command -// m_recentAlbumsModel->addFilteredCollection( collection_ptr(), 20, DatabaseCommand_AllAlbums::ModificationTime ); -/* - m_timer = new QTimer( this ); - connect( m_timer, SIGNAL( timeout() ), SLOT( checkQueries() ) ); - - connect( SourceList::instance(), SIGNAL( ready() ), SLOT( updateRecentTracks() ) ); - connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) ); - connect( ui->playlistWidget, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) ); - connect( AudioEngine::instance() ,SIGNAL( playlistChanged( Tomahawk::playlistinterface_ptr ) ), this, SLOT( updatePlaylists() ), Qt::QueuedConnection ); -*/ - fetchFromDB(); -} - - -SocialPlaylistWidget::~SocialPlaylistWidget() -{ -} - - -void -SocialPlaylistWidget::fetchFromDB() -{ - // Load the pre-baked custom playlists that we are going to show. - QSharedPointer albumsCmd = QSharedPointer( new DatabaseCommand_GenericSelect( s_popularAlbumsQuery, DatabaseCommand_GenericSelect::Album, 30, 0 ) ); - connect( albumsCmd.data(), SIGNAL( albums( QList ) ), this, SLOT( popularAlbumsFetched( QList ) ) ); - Database::instance()->enqueue( Tomahawk::dbcmd_ptr( albumsCmd ) ); - -// QSharedPointer plCmd = QSharedPointer( new DatabaseCommand_GenericSelect( s_mostPlayedPlaylistsQuery, DatabaseCommand_GenericSelect::, 30, 0 ) ); -// connect( albumsCmd.data(), SIGNAL( albums( QList ) ), this, SLOT( popularAlbumsFetched( QList ) ) ); -// Database::instance()->enqueue( Tomahawk::dbcmd_ptr( albumsCmd ) ); - - QSharedPointer trackCmd = QSharedPointer( new DatabaseCommand_GenericSelect( s_topForeignTracksQuery, DatabaseCommand_GenericSelect::Track, 50, 0 ) ); - connect( trackCmd.data(), SIGNAL( tracks( QList ) ), this, SLOT( topForeignTracksFetched( QList ) ) ); - Database::instance()->enqueue( Tomahawk::dbcmd_ptr( trackCmd ) ); -} - - -Tomahawk::playlistinterface_ptr -SocialPlaylistWidget::playlistInterface() const -{ - return Tomahawk::playlistinterface_ptr(); -} - - -/* -void -SocialPlaylistWidget::createPlaylist() -{ - // Ok, lets create our playlist - - * select count(*) as counter, track.name, artist.name from (select track from playback_log group by track, source), track, artist where track.id = track and artist.id = track.artist group by track order by counter desc limit 0,20; - s elect count(*) as counter, playback_log.track, track.name, artist.name from playback_log, track, artist where track.id = playback_log.track and artist.id = track.artist group by playback_log.track order by counter desc limit 0,10; * - select count(*) as counter, track.name, artist.name from (select track from playback_log group by track, source), track, artist where track not in (select track from playback_log where source is null group by track) and track.id = track and artist.id = track.artist group by track order by counter desc limit 0,20; - select count(*) as counter, track.name, artist.name from (select track from playback_log where source > 0 group by track, source), track, artist where track.id = track and artist.id = track.artist group by track order by counter desc limit 0,20; - - m_coolQuery1 = DynamicPlaylist::create( SourceList::instance()->getLocal(), COOLPLAYLIST_GUID, "Cool Playlist!", QString(), QString(), Static, false, "database", false ); - connect( m_coolQuery1.data(), SIGNAL( created() ), this, SLOT( playlist1Created() ) ); -}*/ - - -void -SocialPlaylistWidget::popularAlbumsFetched( QList< album_ptr > albums ) -{ - m_popularNewAlbumsModel->clear(); - - m_popularNewAlbumsModel->appendAlbums( albums ); -} - - -void -SocialPlaylistWidget::topForeignTracksFetched( QList< query_ptr > tracks ) -{ - m_topForeignTracksModel->clear(); - - m_topForeignTracksModel->appendQueries( tracks ); -} diff --git a/src/libtomahawk-widgets/SocialPlaylistWidget.h b/src/libtomahawk-widgets/SocialPlaylistWidget.h deleted file mode 100644 index 271505111..000000000 --- a/src/libtomahawk-widgets/SocialPlaylistWidget.h +++ /dev/null @@ -1,102 +0,0 @@ -/* === This file is part of Tomahawk Player - === - * - * Copyright 2010-2011, Leo Franchi - * 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 . - */ - -/** - * \class SocialPlaylistWidget - * \brief ViewPage, which displays some interesting lists of songs mined from the database - * - * This Tomahawk ViewPage displays various interesting database searches that expose cool - * lists of songs. It is accessed from the sidebar, and contains a few custom-created DatabaseGenerator-backed - * playlists. - * - */ - -#ifndef TOMAHAWK_WIDGETS_SOCIALPLAYLISTWIDGET_H -#define TOMAHAWK_WIDGETS_SOCIALPLAYLISTWIDGET_H - -#include "ViewPage.h" -#include "Typedefs.h" -#include "Album.h" -#include "Query.h" - -#include - -#include "WidgetsDllMacro.h" - - -class PlayableModel; -class PlaylistModel; -class TreeModel; - -class Ui_SocialPlaylistWidget; - -namespace Tomahawk -{ - -namespace Widgets -{ - -class TOMAHAWK_WIDGETS_EXPORT SocialPlaylistWidget : public QWidget, public Tomahawk::ViewPage -{ - Q_OBJECT - -public: - SocialPlaylistWidget( QWidget* parent = 0 ); - ~SocialPlaylistWidget(); - - virtual QWidget* widget() { return this; } - virtual Tomahawk::playlistinterface_ptr playlistInterface() const; - - virtual QString title() const { return m_title; } - virtual QString description() const { return m_description; } - virtual QString longDescription() const { return m_longDescription; } - virtual QPixmap pixmap() const { if ( m_pixmap.isNull() ) return Tomahawk::ViewPage::pixmap(); else return m_pixmap; } - virtual bool jumpToCurrentTrack() { return false; } - -signals: - void longDescriptionChanged( const QString& description ); - void descriptionChanged( const QString& description ); - void pixmapChanged( const QPixmap& pixmap ); - -private slots: - void popularAlbumsFetched( QList ); - void topForeignTracksFetched( QList ); - -private: - void fetchFromDB(); - - Ui_SocialPlaylistWidget *ui; - PlaylistModel* m_topForeignTracksModel; - PlayableModel* m_popularNewAlbumsModel; - - QString m_title; - QString m_description; - QString m_longDescription; - QPixmap m_pixmap; - - static QString s_popularAlbumsQuery; - static QString s_mostPlayedPlaylistsQuery; - static QString s_topForeignTracksQuery; -}; - -} // Widgets - -} // Tomahawk - -#endif // TOMAHAWK_WIDGETS_SOCIALPLAYLISTWIDGET_H diff --git a/src/libtomahawk-widgets/SocialPlaylistWidget.ui b/src/libtomahawk-widgets/SocialPlaylistWidget.ui deleted file mode 100644 index c3d79415a..000000000 --- a/src/libtomahawk-widgets/SocialPlaylistWidget.ui +++ /dev/null @@ -1,107 +0,0 @@ - - - SocialPlaylistWidget - - - - 0 - 0 - 875 - 513 - - - - - - - Qt::Horizontal - - - 1 - - - - Qt::Vertical - - - 1 - - - - - - - Popular New Albums From Your Friends - - - - - - - - - - - - - - Most Played Playlists - - - - - - - - - - - - - - - Most Played Tracks You Don't Have - - - - - - - - 320 - 0 - - - - - - - - - - - - - TrackView - QTreeView -
playlist/TrackView.h
-
- - HeaderLabel - QLabel -
widgets/HeaderLabel.h
-
- - GridView - QListView -
playlist/GridView.h
-
- - Tomahawk::Widgets::PlaylistWidget - QListWidget -
PlaylistWidget.h
-
-
- - -
diff --git a/src/tomahawk/sourcetree/items/SourceItem.cpp b/src/tomahawk/sourcetree/items/SourceItem.cpp index 775ff28f1..3a7b28003 100644 --- a/src/tomahawk/sourcetree/items/SourceItem.cpp +++ b/src/tomahawk/sourcetree/items/SourceItem.cpp @@ -2,7 +2,7 @@ * * Copyright 2010-2011, Leo Franchi * Copyright 2010-2012, Jeff Mitchell - * Copyright 2010-2013, Christian Muehlhaeuser + * Copyright 2010-2014, Christian Muehlhaeuser * Copyright 2013, Teo Mrnjavac * * Tomahawk is free software: you can redistribute it and/or modify @@ -21,8 +21,6 @@ #include "SourceItem.h" -#include - #include "CategoryItems.h" #include "database/Database.h" #include "DropJob.h" @@ -59,9 +57,7 @@ SourceItem::SourceItem( SourcesModel* mdl, SourceTreeItem* parent, const Tomahaw , m_stations( 0 ) , m_latchedOn( false ) , m_sourceInfoItem( 0 ) - , m_coolPlaylistsItem( 0 ) , m_sourceInfoPage( 0 ) - , m_coolPlaylistsPage( 0 ) , m_latestAdditionsPage( 0 ) , m_recentPlaysPage( 0 ) { @@ -574,27 +570,6 @@ SourceItem::getCollectionPage( const Tomahawk::collection_ptr& collection ) cons } -ViewPage* -SourceItem::coolPlaylistsClicked() -{ - if ( !m_source.isNull() ) - return 0; - - if ( !m_coolPlaylistsPage ) - m_coolPlaylistsPage = new Tomahawk::Widgets::SocialPlaylistWidget( ViewManager::instance()->widget() ); - - ViewManager::instance()->show( m_coolPlaylistsPage ); - return m_coolPlaylistsPage; -} - - -ViewPage* -SourceItem::getCoolPlaylistsPage() const -{ - return m_coolPlaylistsPage; -} - - ViewPage* SourceItem::latestAdditionsClicked() { diff --git a/src/tomahawk/sourcetree/items/SourceItem.h b/src/tomahawk/sourcetree/items/SourceItem.h index c3fdcc635..db9943f2c 100644 --- a/src/tomahawk/sourcetree/items/SourceItem.h +++ b/src/tomahawk/sourcetree/items/SourceItem.h @@ -2,7 +2,7 @@ * * Copyright 2010-2011, Leo Franchi * Copyright 2010-2012, Jeff Mitchell - * Copyright 2010-2013, Christian Muehlhaeuser + * Copyright 2010-2014, Christian Muehlhaeuser * Copyright 2013, Teo Mrnjavac * * Tomahawk is free software: you can redistribute it and/or modify @@ -87,9 +87,6 @@ private slots: Tomahawk::ViewPage* collectionClicked( const Tomahawk::collection_ptr& collection ); Tomahawk::ViewPage* getCollectionPage( const Tomahawk::collection_ptr& collection ) const; - Tomahawk::ViewPage* coolPlaylistsClicked(); - Tomahawk::ViewPage* getCoolPlaylistsPage() const; - Tomahawk::ViewPage* latestAdditionsClicked(); Tomahawk::ViewPage* getLatestAdditionsPage() const; @@ -115,12 +112,10 @@ private: QMap< Tomahawk::collection_ptr, Tomahawk::ViewPage* > m_collectionPages; GenericPageItem* m_sourceInfoItem; - GenericPageItem* m_coolPlaylistsItem; GenericPageItem* m_latestAdditionsItem; GenericPageItem* m_recentPlaysItem; Tomahawk::ViewPage* m_sourceInfoPage; - Tomahawk::ViewPage* m_coolPlaylistsPage; Tomahawk::ViewPage* m_latestAdditionsPage; Tomahawk::ViewPage* m_recentPlaysPage; };