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