PageRenderTime 209ms CodeModel.GetById 70ms app.highlight 80ms RepoModel.GetById 51ms app.codeStats 1ms

/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 119 lines | 58 code | 26 blank | 35 comment | 2 complexity | c1bc3012c4ec13850cee7ad4256aecc8 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 *
  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 ArtistInfoWidget
 22 * \brief ViewPage, which displays top-hits, related artists and albums for an artist.
 23 *
 24 * This Tomahawk ViewPage displays top-hits, related artists and known albums
 25 * for any given artist. It is our default ViewPage when showing an artist
 26 * via ViewManager.
 27 *
 28 */
 29
 30#ifndef ARTISTINFOWIDGET_H
 31#define ARTISTINFOWIDGET_H
 32
 33#include <QWidget>
 34
 35#include "Typedefs.h"
 36#include "PlaylistInterface.h"
 37#include "ViewPage.h"
 38
 39#include "DllMacro.h"
 40
 41class PlayableModel;
 42class PlaylistModel;
 43
 44namespace Ui
 45{
 46    class ArtistInfoWidget;
 47}
 48
 49class MetaArtistInfoInterface;
 50
 51class DLLEXPORT ArtistInfoWidget : public QWidget, public Tomahawk::ViewPage
 52{
 53Q_OBJECT
 54
 55public:
 56    ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* parent = 0 );
 57    ~ArtistInfoWidget();
 58
 59    /** \brief Loads information for a given artist.
 60     *  \param artist The artist that you want to load information for.
 61     *
 62     *  Calling this method will make ArtistInfoWidget load information about
 63     *  an artist's top hits, related artists and all available albums. It is
 64     *  automatically called by the constructor, but you can use it to load
 65     *  another artist's information at any point.
 66     */
 67    void load( const Tomahawk::artist_ptr& artist );
 68
 69    Tomahawk::artist_ptr artist() const { return m_artist; }
 70
 71    virtual QWidget* widget() { return this; }
 72    virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
 73
 74    virtual QString title() const { return m_title; }
 75    virtual QString description() const { return m_description; }
 76    virtual QString longDescription() const { return m_longDescription; }
 77    virtual QPixmap pixmap() const { if ( m_pixmap.isNull() ) return Tomahawk::ViewPage::pixmap(); else return m_pixmap; }
 78
 79    virtual bool isTemporaryPage() const { return true; }
 80    virtual bool showInfoBar() const { return false; }
 81
 82    virtual bool jumpToCurrentTrack();
 83    virtual bool isBeingPlayed() const;
 84
 85signals:
 86    void longDescriptionChanged( const QString& description );
 87    void descriptionChanged( const QString& description );
 88    void pixmapChanged( const QPixmap& pixmap );
 89
 90protected:
 91    void changeEvent( QEvent* e );
 92
 93private slots:
 94    void onArtistImageUpdated();
 95    void onBiographyLoaded();
 96
 97    void onAlbumsFound( const QList<Tomahawk::album_ptr>& albums, Tomahawk::ModelMode mode );
 98    void onTracksFound( const QList<Tomahawk::query_ptr>& queries, Tomahawk::ModelMode mode );
 99    void onSimilarArtistsLoaded();
100
101private:
102    Ui::ArtistInfoWidget *ui;
103
104    Tomahawk::artist_ptr m_artist;
105
106    PlayableModel* m_relatedModel;
107    PlayableModel* m_albumsModel;
108    PlaylistModel* m_topHitsModel;
109    Tomahawk::playlistinterface_ptr m_plInterface;
110
111    QString m_title;
112    QString m_description;
113    QString m_longDescription;
114    QPixmap m_pixmap;
115
116    friend class ::MetaArtistInfoInterface;
117};
118
119#endif // ARTISTINFOWIDGET_H