/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. * \class SocialPlaylistWidget
  21. * \brief ViewPage, which displays some interesting lists of songs mined from the database
  22. *
  23. * This Tomahawk ViewPage displays various interesting database searches that expose cool
  24. * lists of songs. It is accessed from the sidebar, and contains a few custom-created DatabaseGenerator-backed
  25. * playlists.
  26. *
  27. */
  28. #ifndef SOCIALPLAYLISTWIDGET_H
  29. #define SOCIALPLAYLISTWIDGET_H
  30. #include <QWidget>
  31. #include "ViewPage.h"
  32. #include "DllMacro.h"
  33. #include "Typedefs.h"
  34. #include "Album.h"
  35. #include "Query.h"
  36. class PlayableModel;
  37. class PlaylistModel;
  38. class TreeModel;
  39. class Ui_SocialPlaylistWidget;
  40. namespace Tomahawk
  41. {
  42. class DLLEXPORT SocialPlaylistWidget : public QWidget, public Tomahawk::ViewPage
  43. {
  44. Q_OBJECT
  45. public:
  46. SocialPlaylistWidget( QWidget* parent = 0 );
  47. ~SocialPlaylistWidget();
  48. virtual QWidget* widget() { return this; }
  49. virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
  50. virtual QString title() const { return m_title; }
  51. virtual QString description() const { return m_description; }
  52. virtual QString longDescription() const { return m_longDescription; }
  53. virtual QPixmap pixmap() const { if ( m_pixmap.isNull() ) return Tomahawk::ViewPage::pixmap(); else return m_pixmap; }
  54. virtual bool jumpToCurrentTrack() { return false; }
  55. signals:
  56. void longDescriptionChanged( const QString& description );
  57. void descriptionChanged( const QString& description );
  58. void pixmapChanged( const QPixmap& pixmap );
  59. private slots:
  60. void popularAlbumsFetched( QList<Tomahawk::album_ptr> );
  61. void topForeignTracksFetched( QList<Tomahawk::query_ptr> );
  62. private:
  63. void fetchFromDB();
  64. Ui_SocialPlaylistWidget *ui;
  65. PlaylistModel* m_topForeignTracksModel;
  66. PlayableModel* m_popularNewAlbumsModel;
  67. QString m_title;
  68. QString m_description;
  69. QString m_longDescription;
  70. QPixmap m_pixmap;
  71. static QString s_popularAlbumsQuery;
  72. static QString s_mostPlayedPlaylistsQuery;
  73. static QString s_topForeignTracksQuery;
  74. };
  75. }
  76. #endif // SOCIALPLAYLISTWIDGET_H