1
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
3
* Copyright 2012, Casey Link <unnamedrambler@gmail.com>
4
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
5
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
6
* Copyright 2011, Jeff Mitchell <jeff@tomahawk-player.org>
8
* Tomahawk is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* Tomahawk is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
22
#ifndef NEWRELEASESWIDGET_H
23
#define NEWRELEASESWIDGET_H
25
#include <QtGui/QWidget>
26
#include <QtGui/QListWidgetItem>
27
#include <QtGui/QStyledItemDelegate>
29
#include "PlaylistInterface.h"
30
#include "infosystem/InfoSystem.h"
35
class QSortFilterProxyModel;
36
class QStandardItemModel;
46
class NewReleasesWidget;
51
class ChartDataLoader;
52
class ChartsPlaylistInterface;
53
class ChartDataLoader;
58
* \brief The tomahawk page that shows music charts.
60
class DLLEXPORT NewReleasesWidget : public QWidget, public Tomahawk::ViewPage
65
NewReleasesWidget( QWidget* parent = 0 );
68
virtual QWidget* widget() { return this; }
69
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
71
virtual QString title() const { return tr( "New Releases" ); }
72
virtual QString description() const { return QString(); }
74
virtual bool showInfoBar() const { return false; }
75
virtual bool isBeingPlayed() const;
77
virtual bool jumpToCurrentTrack();
80
void changeEvent( QEvent* e );
83
void destroyed( QWidget* widget );
89
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
90
void infoSystemFinished( QString target );
91
void leftCrumbIndexChanged( QModelIndex );
93
void newReleasesLoaded( Tomahawk::ChartDataLoader*, const QList< Tomahawk::album_ptr >& );
96
void setLeftViewArtists( TreeModel* artistModel );
97
void setLeftViewAlbums( PlayableModel* albumModel );
98
void setLeftViewTracks( PlaylistModel* trackModel );
101
QStandardItem* parseNode( QStandardItem* parentItem, const QString &label, const QVariant &data );
102
Ui::NewReleasesWidget *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
QString m_queueItemToShow;
117
QSet< QString > m_queuedFetches;
120
friend class Tomahawk::ChartsPlaylistInterface;
123
#endif // NEWRELEASESWIDGET_H