1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

* Renamed WhatsHotWidget/-Page to ChartsWidget/-Page.

This commit is contained in:
Christian Muehlhaeuser
2014-09-20 06:21:33 +02:00
parent 0cc1948f1c
commit 2d6db9b7b4
3 changed files with 51 additions and 52 deletions

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2010-2014, 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 2012, Hugo Lindström <hugolm84@gmail.com> * Copyright 2012, Hugo Lindström <hugolm84@gmail.com>
@@ -44,12 +44,12 @@
using namespace Tomahawk; using namespace Tomahawk;
using namespace Tomahawk::Widgets; using namespace Tomahawk::Widgets;
static QString s_whatsHotIdentifier = QString( "WhatsHotWidget" ); static QString s_chartsIdentifier = QString( "ChartsWidget" );
WhatsHotWidget::WhatsHotWidget( QWidget* parent ) ChartsWidget::ChartsWidget( QWidget* parent )
: QWidget( parent ) : QWidget( parent )
, ui( new Ui::WhatsHotWidget ) , ui( new Ui::ChartsWidget )
, m_sortedProxy( 0 ) , m_sortedProxy( 0 )
, m_workerThread( 0 ) , m_workerThread( 0 )
, m_spinner( 0 ) , m_spinner( 0 )
@@ -117,7 +117,7 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
} }
WhatsHotWidget::~WhatsHotWidget() ChartsWidget::~ChartsWidget()
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
@@ -134,14 +134,14 @@ WhatsHotWidget::~WhatsHotWidget()
Tomahawk::playlistinterface_ptr Tomahawk::playlistinterface_ptr
WhatsHotWidget::playlistInterface() const ChartsWidget::playlistInterface() const
{ {
return m_playlistInterface; return m_playlistInterface;
} }
bool bool
WhatsHotWidget::isBeingPlayed() const ChartsWidget::isBeingPlayed() const
{ {
if ( AudioEngine::instance()->currentTrackPlaylist() == ui->artistsViewLeft->proxyModel()->playlistInterface() ) if ( AudioEngine::instance()->currentTrackPlaylist() == ui->artistsViewLeft->proxyModel()->playlistInterface() )
return true; return true;
@@ -149,7 +149,7 @@ WhatsHotWidget::isBeingPlayed() const
if ( AudioEngine::instance()->currentTrackPlaylist() == ui->tracksViewLeft->playlistInterface() ) if ( AudioEngine::instance()->currentTrackPlaylist() == ui->tracksViewLeft->playlistInterface() )
return true; return true;
if ( ui->albumsView->isBeingPlayed() ) if ( AudioEngine::instance()->currentTrackPlaylist() == ui->albumsView->playlistInterface() )
return true; return true;
return false; return false;
@@ -157,7 +157,7 @@ WhatsHotWidget::isBeingPlayed() const
bool bool
WhatsHotWidget::jumpToCurrentTrack() ChartsWidget::jumpToCurrentTrack()
{ {
if ( ui->artistsViewLeft->model() && ui->artistsViewLeft->jumpToCurrentTrack() ) if ( ui->artistsViewLeft->model() && ui->artistsViewLeft->jumpToCurrentTrack() )
return true; return true;
@@ -173,12 +173,12 @@ WhatsHotWidget::jumpToCurrentTrack()
void void
WhatsHotWidget::fetchData() ChartsWidget::fetchData()
{ {
Tomahawk::InfoSystem::InfoStringHash criteria; Tomahawk::InfoSystem::InfoStringHash criteria;
Tomahawk::InfoSystem::InfoRequestData requestData; Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = s_whatsHotIdentifier; requestData.caller = s_chartsIdentifier;
requestData.customData = QVariantMap(); requestData.customData = QVariantMap();
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( criteria ); requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( criteria );
requestData.type = Tomahawk::InfoSystem::InfoChartCapabilities; requestData.type = Tomahawk::InfoSystem::InfoChartCapabilities;
@@ -186,14 +186,14 @@ WhatsHotWidget::fetchData()
requestData.allSources = true; requestData.allSources = true;
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData ); Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
tDebug( LOGVERBOSE ) << "WhatsHot: requested InfoChartCapabilities"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "requested InfoChartCapabilities";
} }
void void
WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output ) ChartsWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output )
{ {
if ( requestData.caller != s_whatsHotIdentifier ) if ( requestData.caller != s_chartsIdentifier )
return; return;
if ( output.isNull() ) if ( output.isNull() )
@@ -204,7 +204,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
if ( !output.canConvert< QVariantMap >() ) if ( !output.canConvert< QVariantMap >() )
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "WhatsHot: Could not parse output into a map"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Could not parse output into a map";
return; return;
} }
@@ -225,7 +225,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
criteria.insert( "chart_refetch", returnedData[ "chart_source" ].value< QString >() ); criteria.insert( "chart_refetch", returnedData[ "chart_source" ].value< QString >() );
Tomahawk::InfoSystem::InfoRequestData requestData; Tomahawk::InfoSystem::InfoRequestData requestData;
requestData.caller = s_whatsHotIdentifier; requestData.caller = s_chartsIdentifier;
requestData.customData = QVariantMap(); requestData.customData = QVariantMap();
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( criteria ); requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( criteria );
requestData.type = Tomahawk::InfoSystem::InfoChartCapabilities; requestData.type = Tomahawk::InfoSystem::InfoChartCapabilities;
@@ -233,7 +233,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
requestData.allSources = false; requestData.allSources = false;
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData ); Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
tDebug( LOGVERBOSE ) << "WhatsHot: re-requesting InfoChartCapabilities"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "re-requesting InfoChartCapabilities";
break; break;
} }
@@ -311,7 +311,7 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
void void
WhatsHotWidget::setViewData( const QVariantMap& data ) ChartsWidget::setViewData( const QVariantMap& data )
{ {
QStandardItem* rootItem = m_crumbModelLeft->invisibleRootItem(); QStandardItem* rootItem = m_crumbModelLeft->invisibleRootItem();
QVariantMap returnedData = data; QVariantMap returnedData = data;
@@ -365,11 +365,11 @@ WhatsHotWidget::setViewData( const QVariantMap& data )
void void
WhatsHotWidget::infoSystemFinished( QString target ) ChartsWidget::infoSystemFinished( QString target )
{ {
if ( m_loading ) if ( m_loading )
{ {
if ( target != s_whatsHotIdentifier ) if ( target != s_chartsIdentifier )
{ {
return; return;
} }
@@ -386,9 +386,9 @@ WhatsHotWidget::infoSystemFinished( QString target )
void void
WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index ) ChartsWidget::leftCrumbIndexChanged( QModelIndex index )
{ {
tDebug( LOGVERBOSE ) << "WhatsHot: left crumb changed" << index.data(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "left crumb changed" << index.data();
QStandardItem* item = m_crumbModelLeft->itemFromIndex( m_sortedProxy->mapToSource( index ) ); QStandardItem* item = m_crumbModelLeft->itemFromIndex( m_sortedProxy->mapToSource( index ) );
if ( !item ) if ( !item )
return; return;
@@ -447,7 +447,7 @@ WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
Tomahawk::InfoSystem::InfoRequestData requestData; Tomahawk::InfoSystem::InfoRequestData requestData;
QVariantMap customData; QVariantMap customData;
customData.insert( "whatshot_side", "left" ); customData.insert( "whatshot_side", "left" );
requestData.caller = s_whatsHotIdentifier; requestData.caller = s_chartsIdentifier;
requestData.customData = customData; requestData.customData = customData;
requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( criteria ); requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( criteria );
requestData.type = Tomahawk::InfoSystem::InfoChart; requestData.type = Tomahawk::InfoSystem::InfoChart;
@@ -463,7 +463,7 @@ WhatsHotWidget::leftCrumbIndexChanged( QModelIndex index )
void void
WhatsHotWidget::changeEvent( QEvent* e ) ChartsWidget::changeEvent( QEvent* e )
{ {
QWidget::changeEvent( e ); QWidget::changeEvent( e );
switch ( e->type() ) switch ( e->type() )
@@ -479,10 +479,10 @@ WhatsHotWidget::changeEvent( QEvent* e )
QStandardItem* QStandardItem*
WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString& label, const QVariant& data ) ChartsWidget::parseNode( QStandardItem* parentItem, const QString& label, const QVariant& data )
{ {
Q_UNUSED( parentItem ); Q_UNUSED( parentItem );
// tDebug( LOGVERBOSE ) << "WhatsHot: parsing" << label; // tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "parsing" << label;
QStandardItem* sourceItem = new QStandardItem( label ); QStandardItem* sourceItem = new QStandardItem( label );
@@ -536,7 +536,7 @@ WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString& label, cons
void void
WhatsHotWidget::setLeftViewAlbums( PlayableModel* model ) ChartsWidget::setLeftViewAlbums( PlayableModel* model )
{ {
ui->albumsView->setPlayableModel( model ); ui->albumsView->setPlayableModel( model );
ui->albumsView->proxyModel()->sort( -1 ); // disable sorting, must be called after artistsViewLeft->setTreeModel ui->albumsView->proxyModel()->sort( -1 ); // disable sorting, must be called after artistsViewLeft->setTreeModel
@@ -545,7 +545,7 @@ WhatsHotWidget::setLeftViewAlbums( PlayableModel* model )
void void
WhatsHotWidget::setLeftViewArtists( TreeModel* model ) ChartsWidget::setLeftViewArtists( TreeModel* model )
{ {
ui->artistsViewLeft->proxyModel()->setStyle( PlayableProxyModel::Collection ); ui->artistsViewLeft->proxyModel()->setStyle( PlayableProxyModel::Collection );
ui->artistsViewLeft->setTreeModel( model ); ui->artistsViewLeft->setTreeModel( model );
@@ -555,7 +555,7 @@ WhatsHotWidget::setLeftViewArtists( TreeModel* model )
void void
WhatsHotWidget::setLeftViewTracks( PlaylistModel* model ) ChartsWidget::setLeftViewTracks( PlaylistModel* model )
{ {
ui->tracksViewLeft->proxyModel()->setStyle( PlayableProxyModel::Large ); ui->tracksViewLeft->proxyModel()->setStyle( PlayableProxyModel::Large );
ui->tracksViewLeft->setPlaylistModel( model ); ui->tracksViewLeft->setPlaylistModel( model );
@@ -565,7 +565,7 @@ WhatsHotWidget::setLeftViewTracks( PlaylistModel* model )
void void
WhatsHotWidget::chartArtistsLoaded( ChartDataLoader* loader, const QList< artist_ptr >& artists ) ChartsWidget::chartArtistsLoaded( ChartDataLoader* loader, const QList< artist_ptr >& artists )
{ {
QString chartId = loader->property( "chartid" ).toString(); QString chartId = loader->property( "chartid" ).toString();
Q_ASSERT( m_artistModels.contains( chartId ) ); Q_ASSERT( m_artistModels.contains( chartId ) );
@@ -585,7 +585,7 @@ WhatsHotWidget::chartArtistsLoaded( ChartDataLoader* loader, const QList< artist
void void
WhatsHotWidget::chartTracksLoaded( ChartDataLoader* loader, const QList< query_ptr >& tracks ) ChartsWidget::chartTracksLoaded( ChartDataLoader* loader, const QList< query_ptr >& tracks )
{ {
QString chartId = loader->property( "chartid" ).toString(); QString chartId = loader->property( "chartid" ).toString();
Q_ASSERT( m_trackModels.contains( chartId ) ); Q_ASSERT( m_trackModels.contains( chartId ) );
@@ -603,7 +603,7 @@ WhatsHotWidget::chartTracksLoaded( ChartDataLoader* loader, const QList< query_p
void void
WhatsHotWidget::chartAlbumsLoaded( ChartDataLoader* loader, const QList< album_ptr >& albums ) ChartsWidget::chartAlbumsLoaded( ChartDataLoader* loader, const QList< album_ptr >& albums )
{ {
QString chartId = loader->property( "chartid" ).toString(); QString chartId = loader->property( "chartid" ).toString();
Q_ASSERT( m_albumModels.contains( chartId ) ); Q_ASSERT( m_albumModels.contains( chartId ) );
@@ -619,14 +619,14 @@ WhatsHotWidget::chartAlbumsLoaded( ChartDataLoader* loader, const QList< album_p
} }
WhatsHot::WhatsHot( QWidget* parent ) ChartsPage::ChartsPage( QWidget* parent )
{ {
Q_UNUSED( parent ) Q_UNUSED( parent )
} }
WhatsHot::~WhatsHot() ChartsPage::~ChartsPage()
{ {
} }
Q_EXPORT_PLUGIN2( ViewPagePlugin, WhatsHot ) Q_EXPORT_PLUGIN2( ViewPagePlugin, ChartsPage )

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2010-2014, 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> * Copyright 2014, Uwe L. Korn <uwelk@xhochy.com>
@@ -19,14 +19,13 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef WHATSHOTWIDGET_H #ifndef TOMAHAWK_CHARTSWIDGET_H
#define WHATSHOTWIDGET_H #define TOMAHAWK_CHARTSWIDGET_H
#include "../ViewPageDllMacro.h" #include "../ViewPageDllMacro.h"
#include "ViewPagePlugin.h" #include "ViewPagePlugin.h"
#include "ViewPageLazyLoader.h" #include "ViewPageLazyLoader.h"
class AnimatedSpinner; class AnimatedSpinner;
class PlayableModel; class PlayableModel;
class QSortFilterProxyModel; class QSortFilterProxyModel;
@@ -36,7 +35,7 @@ class TreeModel;
namespace Ui namespace Ui
{ {
class WhatsHotWidget; class ChartsWidget;
} }
namespace Tomahawk namespace Tomahawk
@@ -55,13 +54,13 @@ namespace Widgets
* \class * \class
* \brief The tomahawk page that shows music charts. * \brief The tomahawk page that shows music charts.
*/ */
class WhatsHotWidget : public QWidget class ChartsWidget : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
WhatsHotWidget( QWidget* parent = 0 ); ChartsWidget( QWidget* parent = 0 );
~WhatsHotWidget(); ~ChartsWidget();
Tomahawk::playlistinterface_ptr playlistInterface() const; Tomahawk::playlistinterface_ptr playlistInterface() const;
bool isBeingPlayed() const; bool isBeingPlayed() const;
@@ -93,7 +92,7 @@ private:
QStandardItem* parseNode( QStandardItem* parentItem, const QString& label, const QVariant& data ); QStandardItem* parseNode( QStandardItem* parentItem, const QString& label, const QVariant& data );
Ui::WhatsHotWidget* ui; Ui::ChartsWidget* ui;
Tomahawk::playlistinterface_ptr m_playlistInterface; Tomahawk::playlistinterface_ptr m_playlistInterface;
QStandardItemModel* m_crumbModelLeft; QStandardItemModel* m_crumbModelLeft;
@@ -118,19 +117,19 @@ private:
friend class Tomahawk::ChartsPlaylistInterface; friend class Tomahawk::ChartsPlaylistInterface;
}; };
const QString WHATSHOT_VIEWPAGE_NAME = "whatshot"; const QString CHARTS_VIEWPAGE_NAME = "charts";
class TOMAHAWK_VIEWPAGE_EXPORT WhatsHot : public Tomahawk::ViewPageLazyLoader< WhatsHotWidget > class TOMAHAWK_VIEWPAGE_EXPORT ChartsPage : public Tomahawk::ViewPageLazyLoader< ChartsWidget >
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES( Tomahawk::ViewPagePlugin ) Q_INTERFACES( Tomahawk::ViewPagePlugin )
Q_PLUGIN_METADATA( IID "org.tomahawk-player.Player.ViewPagePlugin" ) Q_PLUGIN_METADATA( IID "org.tomahawk-player.Player.ViewPagePlugin" )
public: public:
WhatsHot( QWidget* parent = 0 ); ChartsPage( QWidget* parent = 0 );
virtual ~WhatsHot(); virtual ~ChartsPage();
const QString defaultName() Q_DECL_OVERRIDE { return WHATSHOT_VIEWPAGE_NAME; } const QString defaultName() Q_DECL_OVERRIDE { return CHARTS_VIEWPAGE_NAME; }
QString title() const Q_DECL_OVERRIDE { return tr( "Charts" ); } QString title() const Q_DECL_OVERRIDE { return tr( "Charts" ); }
QString description() const Q_DECL_OVERRIDE { return QString(); } QString description() const Q_DECL_OVERRIDE { return QString(); }
@@ -145,4 +144,4 @@ public:
} // Widgets } // Widgets
} // Tomahawk } // Tomahawk
#endif // WHATSHOTWIDGET_H #endif // TOMAHAWK_CHARTSWIDGET_H

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>WhatsHotWidget</class> <class>ChartsWidget</class>
<widget class="QWidget" name="WhatsHotWidget"> <widget class="QWidget" name="ChartsWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>