1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
3
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
4
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
5
* Copyright 2011, Jeff Mitchell <jeff@tomahawk-player.org>
7
* Tomahawk is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* Tomahawk is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
21
#ifndef WHATSHOTWIDGET_H
22
#define WHATSHOTWIDGET_H
24
#include <QtGui/QWidget>
25
#include <QtGui/QListWidgetItem>
26
#include <QtGui/QStyledItemDelegate>
28
#include "PlaylistInterface.h"
29
#include "infosystem/InfoSystem.h"
34
class QSortFilterProxyModel;
35
class QStandardItemModel;
41
class AnimatedSpinner;
49
class ChartDataLoader;
50
class ChartsPlaylistInterface;
51
class ChartDataLoader;
56
* \brief The tomahawk page that shows music charts.
58
class DLLEXPORT WhatsHotWidget : public QWidget, public Tomahawk::ViewPage
63
WhatsHotWidget( QWidget* parent = 0 );
66
virtual QWidget* widget() { return this; }
67
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
69
virtual QString title() const { return tr( "Charts" ); }
70
virtual QString description() const { return QString(); }
72
virtual bool showInfoBar() const { return false; }
73
virtual bool isBeingPlayed() const;
75
virtual bool jumpToCurrentTrack();
78
void changeEvent( QEvent* e );
81
void destroyed( QWidget* widget );
87
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
88
void infoSystemFinished( QString target );
89
void leftCrumbIndexChanged( QModelIndex );
91
void chartArtistsLoaded( Tomahawk::ChartDataLoader*, const QList< Tomahawk::artist_ptr >& );
92
void chartAlbumsLoaded( Tomahawk::ChartDataLoader*, const QList< Tomahawk::album_ptr >& );
93
void chartTracksLoaded( Tomahawk::ChartDataLoader*, const QList< Tomahawk::query_ptr >& );
96
void setLeftViewArtists( TreeModel* artistModel );
97
void setLeftViewAlbums( PlayableModel* albumModel );
98
void setLeftViewTracks( PlaylistModel* trackModel );
100
QStandardItem* parseNode( QStandardItem* parentItem, const QString &label, const QVariant &data );
102
Ui::WhatsHotWidget *ui;
103
Tomahawk::playlistinterface_ptr m_playlistInterface;
105
QStandardItemModel* m_crumbModelLeft;
106
QSortFilterProxyModel* m_sortedProxy;
108
// Load artist, album, and track objects in a thread
109
// {Artist,Album,Track}::get() calls are all synchronous db calls
110
// and we don't want to lock up out UI in case the db is busy (e.g. on startup)
111
QThread* m_workerThread;
112
QSet< Tomahawk::ChartDataLoader* > m_workers;
114
// Cache our model data
115
QHash< QString, PlayableModel* > m_albumModels;
116
QHash< QString, TreeModel* > m_artistModels;
117
QHash< QString, PlaylistModel* > m_trackModels;
118
QString m_queueItemToShow;
119
QSet< QString > m_queuedFetches;
121
QMap<QString, QVariant> m_currentVIds;
122
AnimatedSpinner* m_loadingSpinner;
123
friend class Tomahawk::ChartsPlaylistInterface;
126
#endif // WHATSHOTWIDGET_H