/src/libtomahawk/ViewPage.h

http://github.com/tomahawk-player/tomahawk · C Header · 119 lines · 50 code · 27 blank · 42 comment · 0 complexity · ecee160df8f61f86388e22226b3d4bfb 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. #ifndef VIEWPAGE_H
  20. #define VIEWPAGE_H
  21. #include "Typedefs.h"
  22. #include "PlaylistInterface.h"
  23. #include "Artist.h"
  24. #include "Album.h"
  25. #include "Source.h"
  26. #include "utils/TomahawkUtils.h"
  27. #include "playlist/PlaylistUpdaterInterface.h"
  28. #include <QtGui/QPixmap>
  29. namespace Tomahawk
  30. {
  31. class DLLEXPORT ViewPage
  32. {
  33. public:
  34. enum DescriptionType {
  35. TextType = 0,
  36. ArtistType = 1,
  37. AlbumType = 2
  38. };
  39. ViewPage() {}
  40. virtual ~ViewPage();
  41. virtual QWidget* widget() = 0;
  42. virtual Tomahawk::playlistinterface_ptr playlistInterface() const = 0;
  43. virtual QString title() const = 0;
  44. virtual DescriptionType descriptionType() { return TextType; }
  45. virtual QString description() const = 0;
  46. virtual Tomahawk::artist_ptr descriptionArtist() const { return Tomahawk::artist_ptr(); }
  47. virtual Tomahawk::album_ptr descriptionAlbum() const { return Tomahawk::album_ptr(); }
  48. virtual QString longDescription() const { return QString(); }
  49. virtual QPixmap pixmap() const { return QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ); }
  50. virtual bool queueVisible() const { return true; }
  51. virtual QString filter() const { return m_filter; }
  52. virtual bool setFilter( const QString& filter );
  53. virtual bool willAcceptDrag( const QMimeData* data ) const;
  54. virtual bool dropMimeData( const QMimeData*, Qt::DropAction );
  55. virtual bool jumpToCurrentTrack() = 0;
  56. virtual bool isTemporaryPage() const { return false; }
  57. /**
  58. * Should we add a row in the SourceTreeView for this page.
  59. */
  60. virtual bool addPageItem() const;
  61. virtual bool isRemovable() const { return false; }
  62. /**
  63. * This page is actually a constant page that will be shown on every
  64. * restart of Tomahawk until the user selects it to be removed.
  65. *
  66. * The main distinction between this and isTemporaryPage() is that the
  67. * page will not be listed in the search history.
  68. */
  69. virtual bool isDeletable() const { return false; }
  70. /**
  71. * The ViewPage item in the SourcesModel was deleted.
  72. */
  73. virtual void onItemDeleted();
  74. virtual bool isBeingPlayed() const { return false; }
  75. virtual QList<PlaylistUpdaterInterface*> updaters() const { return QList<PlaylistUpdaterInterface*>(); }
  76. /** subclasses implementing ViewPage can emit the following signals:
  77. * nameChanged( const QString& )
  78. * descriptionChanged( const QString& )
  79. * descriptionChanged( const Tomahawk::artist_ptr& artist )
  80. * descriptionChanged( const Tomahawk::album_ptr& album )
  81. * longDescriptionChanged( const QString& )
  82. * pixmapChanged( const QPixmap& )
  83. * destroyed( QWidget* widget );
  84. *
  85. * See DynamicWidget for an example
  86. */
  87. private:
  88. QString m_filter;
  89. };
  90. } // ns
  91. Q_DECLARE_METATYPE( Tomahawk::ViewPage* )
  92. #endif //VIEWPAGE_H