/src/libtomahawk/playlist/dynamic/widgets/CollapsibleControls.h

http://github.com/tomahawk-player/tomahawk · C Header · 83 lines · 48 code · 16 blank · 19 comment · 0 complexity · 7b5a6add41cae6738abd7e3351130c1d 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 COLLAPSIBLE_CONTROLS_H
  20. #define COLLAPSIBLE_CONTROLS_H
  21. #include "Typedefs.h"
  22. #include <QWidget>
  23. class QPaintEvent;
  24. class QHBoxLayout;
  25. class QTimeLine;
  26. class QToolButton;
  27. class ElidedLabel;
  28. class QStackedLayout;
  29. namespace Tomahawk
  30. {
  31. class DynamicControlWrapper;
  32. class DynamicControlList;
  33. class CollapsibleControls : public QWidget
  34. {
  35. Q_OBJECT
  36. public:
  37. CollapsibleControls( QWidget* parent );
  38. CollapsibleControls( const dynplaylist_ptr& playlist, bool isLocal, QWidget* parent = 0 );
  39. virtual ~CollapsibleControls();
  40. void setControls( const dynplaylist_ptr& playlist, bool isLocal );
  41. QList< DynamicControlWrapper* > controls() const;
  42. virtual QSize sizeHint() const;
  43. signals:
  44. void controlsChanged( bool added );
  45. void controlChanged( const Tomahawk::dyncontrol_ptr& control );
  46. private slots:
  47. void toggleCollapse();
  48. void onAnimationStep( int );
  49. void onAnimationFinished();
  50. private:
  51. void init();
  52. dynplaylist_ptr m_dynplaylist;
  53. QStackedLayout* m_layout;
  54. DynamicControlList* m_controls;
  55. bool m_isLocal;
  56. QWidget* m_summaryWidget;
  57. QHBoxLayout* m_summaryLayout;
  58. ElidedLabel* m_summary;
  59. QStackedLayout* m_expandL;
  60. QToolButton* m_summaryExpand;
  61. // animations!
  62. QTimeLine* m_timeline;
  63. int m_animHeight;
  64. bool m_collapseAnimation;
  65. };
  66. }
  67. #endif