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