/src/libtomahawk/context/ContextPage.h

http://github.com/tomahawk-player/tomahawk · C Header · 94 lines · 53 code · 23 blank · 18 comment · 0 complexity · 2c9b6f63eb20ede0c68cdf195f3441f9 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 CONTEXTPAGE_H
  20. #define CONTEXTPAGE_H
  21. #include <QGraphicsProxyWidget>
  22. #include <QGraphicsWebView>
  23. #include <QStyleOptionGraphicsItem>
  24. #include "Typedefs.h"
  25. #include "utils/TomahawkUtils.h"
  26. #include "DllMacro.h"
  27. #include <signal.h>
  28. class PlaylistInterface;
  29. namespace Tomahawk
  30. {
  31. class DLLEXPORT ContextPage : public QObject
  32. {
  33. Q_OBJECT
  34. public:
  35. ContextPage() {}
  36. virtual ~ContextPage() {}
  37. virtual QGraphicsWidget* widget() = 0;
  38. virtual Tomahawk::playlistinterface_ptr playlistInterface() const = 0;
  39. virtual QString title() const = 0;
  40. virtual QString description() const = 0;
  41. virtual QPixmap pixmap() const { return QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ); }
  42. virtual bool jumpToCurrentTrack() = 0;
  43. public slots:
  44. virtual void setArtist( const Tomahawk::artist_ptr& artist ) { Q_UNUSED( artist ); }
  45. virtual void setAlbum( const Tomahawk::album_ptr& album ) { Q_UNUSED( album ); }
  46. virtual void setQuery( const Tomahawk::query_ptr& query ) { Q_UNUSED( query ); }
  47. signals:
  48. void nameChanged( const QString& );
  49. void descriptionChanged( const QString& );
  50. void pixmapChanged( const QPixmap& );
  51. void destroyed( QWidget* widget );
  52. };
  53. class DLLEXPORT ContextProxyPage : public QGraphicsWidget
  54. {
  55. Q_OBJECT
  56. public:
  57. ContextProxyPage() : QGraphicsWidget()
  58. {}
  59. Tomahawk::ContextPage* page() const { return m_page; }
  60. void setPage( Tomahawk::ContextPage* page );
  61. virtual bool eventFilter( QObject* watched, QEvent* event );
  62. signals:
  63. void focused();
  64. protected:
  65. virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
  66. virtual bool sceneEvent( QEvent* event );
  67. private:
  68. Tomahawk::ContextPage* m_page;
  69. };
  70. }; // ns
  71. #endif //CONTEXTPAGE_H