mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
Move WhatsHot viewpage into its own plugin
This commit is contained in:
@@ -163,7 +163,6 @@ set( libGuiSources
|
|||||||
widgets/SourceTreePopupDialog.cpp
|
widgets/SourceTreePopupDialog.cpp
|
||||||
widgets/StatsGauge.cpp
|
widgets/StatsGauge.cpp
|
||||||
widgets/ToggleButton.cpp
|
widgets/ToggleButton.cpp
|
||||||
widgets/WhatsHotWidget.cpp
|
|
||||||
widgets/infowidgets/SourceInfoWidget.cpp
|
widgets/infowidgets/SourceInfoWidget.cpp
|
||||||
widgets/infowidgets/ArtistInfoWidget.cpp
|
widgets/infowidgets/ArtistInfoWidget.cpp
|
||||||
widgets/infowidgets/AlbumInfoWidget.cpp
|
widgets/infowidgets/AlbumInfoWidget.cpp
|
||||||
@@ -389,7 +388,6 @@ set( libUI ${libUI}
|
|||||||
widgets/PlaylistTypeSelectorDialog.ui
|
widgets/PlaylistTypeSelectorDialog.ui
|
||||||
widgets/NewPlaylistWidget.ui
|
widgets/NewPlaylistWidget.ui
|
||||||
widgets/SearchWidget.ui
|
widgets/SearchWidget.ui
|
||||||
widgets/WhatsHotWidget.ui
|
|
||||||
widgets/NewReleasesWidget.ui
|
widgets/NewReleasesWidget.ui
|
||||||
widgets/infowidgets/SourceInfoWidget.ui
|
widgets/infowidgets/SourceInfoWidget.ui
|
||||||
widgets/infowidgets/ArtistInfoWidget.ui
|
widgets/infowidgets/ArtistInfoWidget.ui
|
||||||
|
@@ -47,7 +47,6 @@
|
|||||||
#include "playlist/dynamic/widgets/DynamicWidget.h"
|
#include "playlist/dynamic/widgets/DynamicWidget.h"
|
||||||
|
|
||||||
#include "widgets/NewReleasesWidget.h"
|
#include "widgets/NewReleasesWidget.h"
|
||||||
#include "widgets/WhatsHotWidget.h"
|
|
||||||
#include "widgets/infowidgets/SourceInfoWidget.h"
|
#include "widgets/infowidgets/SourceInfoWidget.h"
|
||||||
#include "widgets/infowidgets/ArtistInfoWidget.h"
|
#include "widgets/infowidgets/ArtistInfoWidget.h"
|
||||||
#include "widgets/infowidgets/AlbumInfoWidget.h"
|
#include "widgets/infowidgets/AlbumInfoWidget.h"
|
||||||
@@ -79,7 +78,6 @@ ViewManager::instance()
|
|||||||
ViewManager::ViewManager( QObject* parent )
|
ViewManager::ViewManager( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_widget( new QWidget() )
|
, m_widget( new QWidget() )
|
||||||
, m_whatsHotWidget( 0 )
|
|
||||||
, m_newReleasesWidget( 0 )
|
, m_newReleasesWidget( 0 )
|
||||||
, m_recentPlaysWidget( 0 )
|
, m_recentPlaysWidget( 0 )
|
||||||
, m_inboxWidget( 0 )
|
, m_inboxWidget( 0 )
|
||||||
@@ -127,7 +125,6 @@ ViewManager::ViewManager( QObject* parent )
|
|||||||
|
|
||||||
ViewManager::~ViewManager()
|
ViewManager::~ViewManager()
|
||||||
{
|
{
|
||||||
delete m_whatsHotWidget;
|
|
||||||
delete m_newReleasesWidget;
|
delete m_newReleasesWidget;
|
||||||
delete m_recentPlaysWidget;
|
delete m_recentPlaysWidget;
|
||||||
delete m_inboxWidget;
|
delete m_inboxWidget;
|
||||||
@@ -398,19 +395,6 @@ ViewManager::playlistInterfaceChanged( Tomahawk::playlistinterface_ptr interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::ViewPage*
|
|
||||||
ViewManager::showWhatsHotPage()
|
|
||||||
{
|
|
||||||
if ( !m_whatsHotWidget )
|
|
||||||
{
|
|
||||||
m_whatsHotWidget = new WhatsHotWidget();
|
|
||||||
m_whatsHotWidget->fetchData();
|
|
||||||
}
|
|
||||||
|
|
||||||
return show( m_whatsHotWidget );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::ViewPage*
|
Tomahawk::ViewPage*
|
||||||
ViewManager::showNewReleasesPage()
|
ViewManager::showNewReleasesPage()
|
||||||
{
|
{
|
||||||
@@ -850,13 +834,6 @@ ViewManager::showCurrentTrack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::ViewPage*
|
|
||||||
ViewManager::whatsHotWidget() const
|
|
||||||
{
|
|
||||||
return m_whatsHotWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Tomahawk::ViewPage*
|
Tomahawk::ViewPage*
|
||||||
ViewManager::newReleasesWidget() const
|
ViewManager::newReleasesWidget() const
|
||||||
{
|
{
|
||||||
|
@@ -57,7 +57,6 @@ class SourceInfoWidget;
|
|||||||
class InfoBar;
|
class InfoBar;
|
||||||
class TrackInfoWidget;
|
class TrackInfoWidget;
|
||||||
class NewReleasesWidget;
|
class NewReleasesWidget;
|
||||||
class WhatsHotWidget;
|
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class InboxModel;
|
class InboxModel;
|
||||||
|
|
||||||
@@ -92,7 +91,6 @@ public:
|
|||||||
|
|
||||||
Tomahawk::ViewPage* show( Tomahawk::ViewPage* page );
|
Tomahawk::ViewPage* show( Tomahawk::ViewPage* page );
|
||||||
|
|
||||||
Tomahawk::ViewPage* whatsHotWidget() const;
|
|
||||||
Tomahawk::ViewPage* newReleasesWidget() const;
|
Tomahawk::ViewPage* newReleasesWidget() const;
|
||||||
Tomahawk::ViewPage* recentPlaysWidget() const;
|
Tomahawk::ViewPage* recentPlaysWidget() const;
|
||||||
Tomahawk::ViewPage* superCollectionView() const;
|
Tomahawk::ViewPage* superCollectionView() const;
|
||||||
@@ -139,7 +137,6 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Tomahawk::ViewPage* showSuperCollection();
|
Tomahawk::ViewPage* showSuperCollection();
|
||||||
Tomahawk::ViewPage* showWhatsHotPage();
|
|
||||||
Tomahawk::ViewPage* showNewReleasesPage();
|
Tomahawk::ViewPage* showNewReleasesPage();
|
||||||
Tomahawk::ViewPage* showRecentPlaysPage();
|
Tomahawk::ViewPage* showRecentPlaysPage();
|
||||||
Tomahawk::ViewPage* showInboxPage();
|
Tomahawk::ViewPage* showInboxPage();
|
||||||
@@ -193,7 +190,6 @@ private:
|
|||||||
TreeModel* m_superCollectionModel;
|
TreeModel* m_superCollectionModel;
|
||||||
TreeWidget* m_superCollectionView;
|
TreeWidget* m_superCollectionView;
|
||||||
QueueView* m_queue;
|
QueueView* m_queue;
|
||||||
WhatsHotWidget* m_whatsHotWidget;
|
|
||||||
NewReleasesWidget* m_newReleasesWidget;
|
NewReleasesWidget* m_newReleasesWidget;
|
||||||
Tomahawk::ViewPage* m_recentPlaysWidget;
|
Tomahawk::ViewPage* m_recentPlaysWidget;
|
||||||
Tomahawk::ViewPage* m_inboxWidget;
|
Tomahawk::ViewPage* m_inboxWidget;
|
||||||
|
@@ -33,7 +33,7 @@ namespace Tomahawk
|
|||||||
into their respective tomahawk types. Move this object to a thread
|
into their respective tomahawk types. Move this object to a thread
|
||||||
and listen to the result signals.
|
and listen to the result signals.
|
||||||
*/
|
*/
|
||||||
class ChartDataLoader : public QObject
|
class DLLEXPORT ChartDataLoader : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@@ -312,11 +312,6 @@ SourcesModel::appendGroups()
|
|||||||
boost::bind( &ViewManager::superCollectionView, ViewManager::instance() ) );
|
boost::bind( &ViewManager::superCollectionView, ViewManager::instance() ) );
|
||||||
sc->setSortValue( 4 );*/
|
sc->setSortValue( 4 );*/
|
||||||
|
|
||||||
GenericPageItem* hot = new GenericPageItem( this, m_browse, tr( "Charts" ), ImageRegistry::instance()->icon( RESPATH "images/charts.svg" ),
|
|
||||||
boost::bind( &ViewManager::showWhatsHotPage, ViewManager::instance() ),
|
|
||||||
boost::bind( &ViewManager::whatsHotWidget, ViewManager::instance() ) );
|
|
||||||
hot->setSortValue( 5 );
|
|
||||||
|
|
||||||
GenericPageItem* newReleases = new GenericPageItem( this, m_browse, tr( "New Releases" ), ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ),
|
GenericPageItem* newReleases = new GenericPageItem( this, m_browse, tr( "New Releases" ), ImageRegistry::instance()->icon( RESPATH "images/new-releases.svg" ),
|
||||||
boost::bind( &ViewManager::showNewReleasesPage, ViewManager::instance() ),
|
boost::bind( &ViewManager::showNewReleasesPage, ViewManager::instance() ),
|
||||||
boost::bind( &ViewManager::newReleasesWidget, ViewManager::instance() ) );
|
boost::bind( &ViewManager::newReleasesWidget, ViewManager::instance() ) );
|
||||||
|
10
src/viewpages/whatshot/CMakeLists.txt
Normal file
10
src/viewpages/whatshot/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
tomahawk_add_plugin(whatshot
|
||||||
|
TYPE viewpage
|
||||||
|
EXPORT_MACRO TOMAHAWK_VIEWPAGE_EXPORT_PRO
|
||||||
|
SOURCES
|
||||||
|
WhatsHotWidget.cpp
|
||||||
|
UI
|
||||||
|
WhatsHotWidget.ui
|
||||||
|
LINK_LIBRARIES
|
||||||
|
tomahawk-widgets
|
||||||
|
)
|
@@ -4,6 +4,7 @@
|
|||||||
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
||||||
* Copyright 2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
* Copyright 2012, Hugo Lindström <hugolm84@gmail.com>
|
* Copyright 2012, Hugo Lindström <hugolm84@gmail.com>
|
||||||
|
* Copyright 2014, Uwe L. Korn <uwelk@xhochy.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -25,9 +26,8 @@
|
|||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
#include "SourceList.h"
|
#include "SourceList.h"
|
||||||
#include "TomahawkSettings.h"
|
#include "TomahawkSettings.h"
|
||||||
#include "RecentPlaylistsModel.h"
|
|
||||||
#include "ChartDataLoader.h"
|
|
||||||
#include "MetaPlaylistInterface.h"
|
#include "MetaPlaylistInterface.h"
|
||||||
|
#include "Pipeline.h"
|
||||||
|
|
||||||
#include "audio/AudioEngine.h"
|
#include "audio/AudioEngine.h"
|
||||||
#include "playlist/dynamic/GeneratorInterface.h"
|
#include "playlist/dynamic/GeneratorInterface.h"
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
#include "playlist/PlaylistModel.h"
|
#include "playlist/PlaylistModel.h"
|
||||||
#include "playlist/TreeProxyModel.h"
|
#include "playlist/TreeProxyModel.h"
|
||||||
#include "playlist/PlaylistChartItemDelegate.h"
|
#include "playlist/PlaylistChartItemDelegate.h"
|
||||||
|
#include "widgets/ChartDataLoader.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "Pipeline.h"
|
|
||||||
#include "utils/AnimatedSpinner.h"
|
#include "utils/AnimatedSpinner.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
#define HISTORY_RESOLVING_TIMEOUT 2500
|
#define HISTORY_RESOLVING_TIMEOUT 2500
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
using namespace Tomahawk::Widgets;
|
||||||
|
|
||||||
static QString s_whatsHotIdentifier = QString( "WhatsHotWidget" );
|
static QString s_whatsHotIdentifier = QString( "WhatsHotWidget" );
|
||||||
|
|
||||||
@@ -119,6 +120,8 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
|
|||||||
ui->stackLeft->setCurrentIndex( 2 );
|
ui->stackLeft->setCurrentIndex( 2 );
|
||||||
m_spinner = new AnimatedSpinner( ui->albumsView );
|
m_spinner = new AnimatedSpinner( ui->albumsView );
|
||||||
m_spinner->fadeIn();
|
m_spinner->fadeIn();
|
||||||
|
|
||||||
|
fetchData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -622,3 +625,14 @@ WhatsHotWidget::chartAlbumsLoaded( ChartDataLoader* loader, const QList< album_p
|
|||||||
m_workers.remove( loader );
|
m_workers.remove( loader );
|
||||||
loader->deleteLater();
|
loader->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WhatsHot::WhatsHot( QWidget* parent )
|
||||||
|
{
|
||||||
|
Q_UNUSED( parent )
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WhatsHot::~WhatsHot()
|
||||||
|
{
|
||||||
|
}
|
@@ -3,6 +3,7 @@
|
|||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
||||||
* Copyright 2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
* Copyright 2011, Jeff Mitchell <jeff@tomahawk-player.org>
|
||||||
|
* Copyright 2014, Uwe L. Korn <uwelk@xhochy.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -23,13 +24,10 @@
|
|||||||
|
|
||||||
#include "PlaylistInterface.h"
|
#include "PlaylistInterface.h"
|
||||||
#include "infosystem/InfoSystem.h"
|
#include "infosystem/InfoSystem.h"
|
||||||
#include "ViewPage.h"
|
#include "../ViewPageDllMacro.h"
|
||||||
|
#include "ViewPagePlugin.h"
|
||||||
|
#include "ViewPageLazyLoader.h"
|
||||||
|
|
||||||
#include "DllMacro.h"
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QListWidgetItem>
|
|
||||||
#include <QStyledItemDelegate>
|
|
||||||
|
|
||||||
class QSortFilterProxyModel;
|
class QSortFilterProxyModel;
|
||||||
class QStandardItemModel;
|
class QStandardItemModel;
|
||||||
@@ -39,6 +37,7 @@ class PlaylistModel;
|
|||||||
class TreeProxyModel;
|
class TreeProxyModel;
|
||||||
class PlayableModel;
|
class PlayableModel;
|
||||||
class AnimatedSpinner;
|
class AnimatedSpinner;
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class WhatsHotWidget;
|
class WhatsHotWidget;
|
||||||
@@ -51,11 +50,17 @@ namespace Tomahawk
|
|||||||
class ChartDataLoader;
|
class ChartDataLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
namespace Widgets
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class
|
* \class
|
||||||
* \brief The tomahawk page that shows music charts.
|
* \brief The tomahawk page that shows music charts.
|
||||||
*/
|
*/
|
||||||
class DLLEXPORT WhatsHotWidget : public QWidget, public Tomahawk::ViewPage
|
class DLLEXPORT WhatsHotWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -63,16 +68,9 @@ public:
|
|||||||
WhatsHotWidget( QWidget* parent = 0 );
|
WhatsHotWidget( QWidget* parent = 0 );
|
||||||
~WhatsHotWidget();
|
~WhatsHotWidget();
|
||||||
|
|
||||||
virtual QWidget* widget() { return this; }
|
Tomahawk::playlistinterface_ptr playlistInterface() const;
|
||||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
|
bool isBeingPlayed() const;
|
||||||
|
bool jumpToCurrentTrack();
|
||||||
virtual QString title() const { return tr( "Charts" ); }
|
|
||||||
virtual QString description() const { return QString(); }
|
|
||||||
|
|
||||||
virtual bool showInfoBar() const { return false; }
|
|
||||||
virtual bool isBeingPlayed() const;
|
|
||||||
|
|
||||||
virtual bool jumpToCurrentTrack();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent( QEvent* e );
|
void changeEvent( QEvent* e );
|
||||||
@@ -125,4 +123,31 @@ private:
|
|||||||
friend class Tomahawk::ChartsPlaylistInterface;
|
friend class Tomahawk::ChartsPlaylistInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const QString WHATSHOT_VIEWPAGE_NAME = "whatshot";
|
||||||
|
|
||||||
|
class TOMAHAWK_VIEWPAGE_EXPORT WhatsHot : public Tomahawk::ViewPageLazyLoader< WhatsHotWidget >
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES( Tomahawk::ViewPagePlugin )
|
||||||
|
Q_PLUGIN_METADATA( IID "org.tomahawk-player.Player.ViewPagePlugin" )
|
||||||
|
|
||||||
|
public:
|
||||||
|
WhatsHot( QWidget* parent = 0 );
|
||||||
|
virtual ~WhatsHot();
|
||||||
|
|
||||||
|
const QString defaultName() Q_DECL_OVERRIDE { return WHATSHOT_VIEWPAGE_NAME; }
|
||||||
|
QString title() const Q_DECL_OVERRIDE { return tr( "Charts" ); }
|
||||||
|
QString description() const Q_DECL_OVERRIDE { return QString(); }
|
||||||
|
|
||||||
|
const QString pixmapPath() const Q_DECL_OVERRIDE { return ( RESPATH "images/charts.svg" ); }
|
||||||
|
|
||||||
|
int sortValue() Q_DECL_OVERRIDE { return 5; }
|
||||||
|
|
||||||
|
bool showInfoBar() const Q_DECL_OVERRIDE { return false; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
} // Widgets
|
||||||
|
} // Tomahawk
|
||||||
|
|
||||||
#endif // WHATSHOTWIDGET_H
|
#endif // WHATSHOTWIDGET_H
|
Reference in New Issue
Block a user