PageRenderTime 103ms CodeModel.GetById 40ms app.highlight 7ms RepoModel.GetById 53ms app.codeStats 0ms

/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 119 lines | 58 code | 26 blank | 35 comment | 2 complexity | e1a32fbbba48b3dfd7827b43b8218327 MD5 | raw file
  1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2 *
  3 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
  4 *   Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
  5 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
  6 *
  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.
 11 *
 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.
 16 *
 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/>.
 19 */
 20
 21/**
 22 * \class AlbumInfoWidget
 23 * \brief ViewPage, which displays an album for an artist and recommends others.
 24 *
 25 * This Tomahawk ViewPage displays the tracks of any given album
 26 * It is our default ViewPage when showing an artist via ViewManager.
 27 *
 28 */
 29
 30#ifndef ALBUMINFOWIDGET_H
 31#define ALBUMINFOWIDGET_H
 32
 33#include <QtGui/QWidget>
 34
 35#include "PlaylistInterface.h"
 36#include "ViewPage.h"
 37#include "infosystem/InfoSystem.h"
 38
 39#include "DllMacro.h"
 40#include "Typedefs.h"
 41
 42class PlayableModel;
 43class TreeModel;
 44class MetaAlbumInfoInterface;
 45
 46namespace Ui
 47{
 48    class AlbumInfoWidget;
 49}
 50
 51class DLLEXPORT AlbumInfoWidget : public QWidget, public Tomahawk::ViewPage
 52{
 53Q_OBJECT
 54
 55public:
 56    AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* parent = 0 );
 57    ~AlbumInfoWidget();
 58
 59    Tomahawk::album_ptr album() const { return m_album; }
 60
 61    virtual QWidget* widget() { return this; }
 62    virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
 63
 64    virtual QString title() const { return m_title; }
 65    virtual QString description() const { return m_description; }
 66    virtual QString longDescription() const { return m_longDescription; }
 67    virtual QPixmap pixmap() const { if ( m_pixmap.isNull() ) return Tomahawk::ViewPage::pixmap(); else return m_pixmap; }
 68
 69    virtual bool isTemporaryPage() const { return true; }
 70    virtual bool showInfoBar() const { return false; }
 71
 72    virtual bool isBeingPlayed() const;
 73    virtual bool jumpToCurrentTrack();
 74
 75public slots:
 76    /** \brief Loads information for a given album.
 77     *  \param album The album that you want to load information for.
 78     *
 79     *  Calling this method will make AlbumInfoWidget load information about
 80     *  an album, and related other albums. This method will be automatically
 81     *  called by the constructor, but you can use it to load another album's
 82     *  information at any point.
 83     */
 84    void load( const Tomahawk::album_ptr& album );
 85
 86signals:
 87    void longDescriptionChanged( const QString& description );
 88    void descriptionChanged( const Tomahawk::artist_ptr& artist );
 89    void pixmapChanged( const QPixmap& pixmap );
 90
 91protected:
 92    void changeEvent( QEvent* e );
 93
 94private slots:
 95    void loadAlbums( bool autoRefetch = false );
 96    void gotAlbums( const QList<Tomahawk::album_ptr>& albums );
 97
 98    void onArtistClicked();
 99    void onAlbumImageUpdated();
100
101private:
102    Ui::AlbumInfoWidget* ui;
103
104    Tomahawk::album_ptr m_album;
105
106    PlayableModel* m_albumsModel;
107    TreeModel* m_tracksModel;
108
109    Tomahawk::playlistinterface_ptr m_playlistInterface;
110
111    QString m_title;
112    QString m_description;
113    QString m_longDescription;
114    QPixmap m_pixmap;
115
116    friend class MetaAlbumInfoInterface;
117};
118
119#endif // ALBUMINFOWIDGET_H