/src/libtomahawk/playlist/dynamic/DynamicView.h

http://github.com/tomahawk-player/tomahawk · C Header · 96 lines · 53 code · 20 blank · 23 comment · 0 complexity · 105c59c1a3c0ea97e9810d1e36f85e3a 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. #ifndef DYNAMIC_VIEW_H
  20. #define DYNAMIC_VIEW_H
  21. #include "playlist/TrackView.h"
  22. #include <QTimer>
  23. #include <QPropertyAnimation>
  24. #include <QTimeLine>
  25. #include <QMutex>
  26. class PlaylistModel;
  27. class TrackModel;
  28. namespace Tomahawk
  29. {
  30. class DynamicModel;
  31. class DynamicView : public TrackView
  32. {
  33. Q_OBJECT
  34. public:
  35. explicit DynamicView( QWidget* parent = 0 );
  36. virtual ~DynamicView();
  37. virtual void setDynamicModel( DynamicModel* model );
  38. void setOnDemand( bool onDemand );
  39. void setReadOnly( bool readOnly );
  40. void setDynamicWorking( bool working );
  41. virtual void paintEvent( QPaintEvent* event );
  42. public slots:
  43. void showMessageTimeout( const QString& title, const QString& body );
  44. void showMessage( const QString& message );
  45. // collapse and animate the transition
  46. // there MUST be a row *after* startRow + num. that is, you can't collapse
  47. // entries unless there is at least one entry after the last collapsed row
  48. // optionally you can specify how many rows are past the block of collapsed rows
  49. void collapseEntries( int startRow, int num, int numToKeep = 1 );
  50. private slots:
  51. void onTrackCountChanged( unsigned int );
  52. void checkForOverflow();
  53. void animFinished();
  54. private:
  55. QPixmap backgroundBetween( QRect rect, int rowStart );
  56. DynamicModel* m_model;
  57. QString m_title;
  58. QString m_body;
  59. bool m_onDemand;
  60. bool m_readOnly;
  61. bool m_checkOnCollapse;
  62. bool m_working;
  63. // for collapsing animation
  64. QPoint m_fadingPointAnchor;
  65. QPoint m_bottomAnchor;
  66. QPoint m_bottomOfAnim;
  67. QPixmap m_fadingIndexes;
  68. QPixmap m_slidingIndex;
  69. QPixmap m_bg;
  70. bool m_fadebg;
  71. bool m_fadeOnly;
  72. QTimeLine m_fadeOutAnim;
  73. QTimeLine m_slideAnim;
  74. };
  75. };
  76. #endif