PageRenderTime 83ms CodeModel.GetById 40ms app.highlight 6ms RepoModel.GetById 34ms app.codeStats 0ms

/src/libtomahawk/widgets/SocialPlaylistWidget.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 95 lines | 49 code | 19 blank | 27 comment | 2 complexity | 69248054edd6a06e955369c073e03d1b MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 4 *   Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
 5 *
 6 *   Tomahawk is free software: you can redistribute it and/or modify
 7 *   it under the terms of the GNU General Public License as published by
 8 *   the Free Software Foundation, either version 3 of the License, or
 9 *   (at your option) any later version.
10 *
11 *   Tomahawk is distributed in the hope that it will be useful,
12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *   GNU General Public License for more details.
15 *
16 *   You should have received a copy of the GNU General Public License
17 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/**
21 * \class SocialPlaylistWidget
22 * \brief ViewPage, which displays some interesting lists of songs mined from the database
23 *
24 * This Tomahawk ViewPage displays various interesting database searches that expose cool
25 *  lists of songs. It is accessed from the sidebar, and contains a few custom-created DatabaseGenerator-backed
26 *  playlists.
27 *
28 */
29
30#ifndef SOCIALPLAYLISTWIDGET_H
31#define SOCIALPLAYLISTWIDGET_H
32
33#include <QWidget>
34
35#include "ViewPage.h"
36#include "DllMacro.h"
37#include "Typedefs.h"
38#include "Album.h"
39#include "Query.h"
40
41class PlayableModel;
42class PlaylistModel;
43class TreeModel;
44
45class Ui_SocialPlaylistWidget;
46
47namespace Tomahawk
48{
49
50class DLLEXPORT SocialPlaylistWidget : public QWidget, public Tomahawk::ViewPage
51{
52    Q_OBJECT
53
54public:
55    SocialPlaylistWidget( QWidget* parent = 0 );
56    ~SocialPlaylistWidget();
57
58    virtual QWidget* widget() { return this; }
59    virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
60
61    virtual QString title() const { return m_title; }
62    virtual QString description() const { return m_description; }
63    virtual QString longDescription() const { return m_longDescription; }
64    virtual QPixmap pixmap() const { if ( m_pixmap.isNull() ) return Tomahawk::ViewPage::pixmap(); else return m_pixmap; }
65    virtual bool jumpToCurrentTrack() { return false; }
66
67signals:
68    void longDescriptionChanged( const QString& description );
69    void descriptionChanged( const QString& description );
70    void pixmapChanged( const QPixmap& pixmap );
71
72private slots:
73    void popularAlbumsFetched( QList<Tomahawk::album_ptr> );
74    void topForeignTracksFetched( QList<Tomahawk::query_ptr> );
75
76private:
77    void fetchFromDB();
78
79    Ui_SocialPlaylistWidget *ui;
80    PlaylistModel* m_topForeignTracksModel;
81    PlayableModel* m_popularNewAlbumsModel;
82
83    QString m_title;
84    QString m_description;
85    QString m_longDescription;
86    QPixmap m_pixmap;
87
88    static QString s_popularAlbumsQuery;
89    static QString s_mostPlayedPlaylistsQuery;
90    static QString s_topForeignTracksQuery;
91};
92
93}
94
95#endif // SOCIALPLAYLISTWIDGET_H