/src/libtomahawk/context/ContextWidget.h

http://github.com/tomahawk-player/tomahawk · C Header · 93 lines · 54 code · 22 blank · 17 comment · 0 complexity · d4f20dba1aedec598f8ff8a49e8642d4 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. *
  5. * Tomahawk is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Tomahawk is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef CONTEXTWIDGET_H
  19. #define CONTEXTWIDGET_H
  20. #include <QGraphicsView>
  21. #include "DllMacro.h"
  22. #include "Query.h"
  23. class QGraphicsScene;
  24. class QGraphicsWebView;
  25. class QGraphicsWidget;
  26. class QTimeLine;
  27. namespace Tomahawk
  28. {
  29. class ContextPage;
  30. class ContextProxyPage;
  31. }
  32. namespace Ui
  33. {
  34. class ContextWidget;
  35. }
  36. class DLLEXPORT ContextWidget : public QWidget
  37. {
  38. Q_OBJECT
  39. public:
  40. ContextWidget( QWidget* parent = 0 );
  41. ~ContextWidget();
  42. public slots:
  43. void setArtist( const Tomahawk::artist_ptr& artist );
  44. void setAlbum( const Tomahawk::album_ptr& album );
  45. void setQuery( const Tomahawk::query_ptr& query, bool force = false );
  46. void toggleSize();
  47. private slots:
  48. void onPageFocused();
  49. void onAnimationStep( int frame );
  50. void onAnimationFinished();
  51. protected:
  52. void paintEvent( QPaintEvent* e );
  53. void resizeEvent( QResizeEvent* e );
  54. void changeEvent( QEvent* e );
  55. private:
  56. void fadeOut( bool animate );
  57. void layoutViews( bool animate = true );
  58. Ui::ContextWidget* ui;
  59. int m_minHeight;
  60. int m_maxHeight;
  61. QTimeLine* m_timeLine;
  62. QGraphicsScene* m_scene;
  63. QList<Tomahawk::ContextPage*> m_views;
  64. QList<Tomahawk::ContextProxyPage*> m_pages;
  65. int m_currentView;
  66. Tomahawk::artist_ptr m_artist;
  67. Tomahawk::album_ptr m_album;
  68. Tomahawk::query_ptr m_query;
  69. bool m_visible;
  70. };
  71. #endif // CONTEXTWIDGET_H