1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 23:39:42 +01:00

Removed unused SocialPlaylistWidget.

This commit is contained in:
Christian Muehlhaeuser 2014-10-12 13:24:00 +02:00
parent 041b878233
commit bba643a63d
6 changed files with 2 additions and 400 deletions

View File

@ -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}

View File

@ -1,157 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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
* 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 <http://www.gnu.org/licenses/>.
*/
#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<DatabaseCommand_GenericSelect> albumsCmd = QSharedPointer<DatabaseCommand_GenericSelect>( new DatabaseCommand_GenericSelect( s_popularAlbumsQuery, DatabaseCommand_GenericSelect::Album, 30, 0 ) );
connect( albumsCmd.data(), SIGNAL( albums( QList<Tomahawk::album_ptr> ) ), this, SLOT( popularAlbumsFetched( QList<Tomahawk::album_ptr> ) ) );
Database::instance()->enqueue( Tomahawk::dbcmd_ptr( albumsCmd ) );
// QSharedPointer<DatabaseCommand_GenericSelect> plCmd = QSharedPointer<DatabaseCommand_GenericSelect>( new DatabaseCommand_GenericSelect( s_mostPlayedPlaylistsQuery, DatabaseCommand_GenericSelect::, 30, 0 ) );
// connect( albumsCmd.data(), SIGNAL( albums( QList<Tomahawk::album_ptr> ) ), this, SLOT( popularAlbumsFetched( QList<Tomahawk::album_ptr> ) ) );
// Database::instance()->enqueue( Tomahawk::dbcmd_ptr( albumsCmd ) );
QSharedPointer<DatabaseCommand_GenericSelect> trackCmd = QSharedPointer<DatabaseCommand_GenericSelect>( new DatabaseCommand_GenericSelect( s_topForeignTracksQuery, DatabaseCommand_GenericSelect::Track, 50, 0 ) );
connect( trackCmd.data(), SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( topForeignTracksFetched( QList<Tomahawk::query_ptr> ) ) );
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 );
}

View File

@ -1,102 +0,0 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.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
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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 <QWidget>
#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<Tomahawk::album_ptr> );
void topForeignTracksFetched( QList<Tomahawk::query_ptr> );
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

View File

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SocialPlaylistWidget</class>
<widget class="QWidget" name="SocialPlaylistWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>875</width>
<height>513</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QSplitter" name="splitter_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="handleWidth">
<number>1</number>
</property>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="handleWidth">
<number>1</number>
</property>
<widget class="QWidget" name="layoutWidget1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="HeaderLabel" name="label_4">
<property name="text">
<string>Popular New Albums From Your Friends</string>
</property>
</widget>
</item>
<item>
<widget class="GridView" name="newAlbumsView"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="HeaderLabel" name="label_2">
<property name="text">
<string>Most Played Playlists</string>
</property>
</widget>
</item>
<item>
<widget class="Tomahawk::Widgets::PlaylistWidget" name="mostPlayedPlaylists"/>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="HeaderLabel" name="label_3">
<property name="text">
<string>Most Played Tracks You Don't Have</string>
</property>
</widget>
</item>
<item>
<widget class="TrackView" name="newTracksView">
<property name="minimumSize">
<size>
<width>320</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>TrackView</class>
<extends>QTreeView</extends>
<header>playlist/TrackView.h</header>
</customwidget>
<customwidget>
<class>HeaderLabel</class>
<extends>QLabel</extends>
<header location="global">widgets/HeaderLabel.h</header>
</customwidget>
<customwidget>
<class>GridView</class>
<extends>QListView</extends>
<header location="global">playlist/GridView.h</header>
</customwidget>
<customwidget>
<class>Tomahawk::Widgets::PlaylistWidget</class>
<extends>QListWidget</extends>
<header>PlaylistWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -2,7 +2,7 @@
*
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@ -21,8 +21,6 @@
#include "SourceItem.h"
#include <libtomahawk-widgets/SocialPlaylistWidget.h>
#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()
{

View File

@ -2,7 +2,7 @@
*
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2010-2013, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2014, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
*
* 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;
};