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

http://github.com/tomahawk-player/tomahawk · C Header · 85 lines · 45 code · 18 blank · 22 comment · 0 complexity · b5d2329165673b6f16bc9cceb01b5d0e 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. *
  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 DYNAMIC_CONTROL_WRAPPER_H
  19. #define DYNAMIC_CONTROL_WRAPPER_H
  20. #include <QWidget>
  21. #include <QPointer>
  22. #include "Typedefs.h"
  23. class QGridLayout;
  24. class QStackedLayout;
  25. class QEvent;
  26. class QToolButton;
  27. class QHBoxLayout;
  28. class QComboBox;
  29. class QLabel;;
  30. namespace Tomahawk
  31. {
  32. /**
  33. * This abstraction object manages the widgets for 1 dynamic playlist control, laid out in the desired layout
  34. */
  35. class DynamicControlWrapper : public QObject
  36. {
  37. Q_OBJECT
  38. public:
  39. explicit DynamicControlWrapper( const dyncontrol_ptr& control, QGridLayout* layout, int row, QWidget* parent = 0 );
  40. virtual ~DynamicControlWrapper();
  41. // virtual void enterEvent(QEvent* );
  42. // virtual void leaveEvent(QEvent* );
  43. dyncontrol_ptr control() const;
  44. void removeFromLayout();
  45. static QToolButton* initButton( QWidget* parent );
  46. static QWidget* createDummy( QWidget* fromW, QWidget* parent );
  47. signals:
  48. void collapse();
  49. void removeControl();
  50. void changed();
  51. private slots:
  52. void typeSelectorChanged( int selectedTypeIndex, bool firstLoad = false );
  53. private:
  54. QWidget* m_parent;
  55. int m_row;
  56. QStackedLayout* m_plusL;
  57. QToolButton* m_minusButton;
  58. dyncontrol_ptr m_control;
  59. QComboBox* m_typeSelector;
  60. QPointer<QWidget> m_matchSelector;
  61. QPointer<QWidget> m_entryWidget;
  62. QPointer<QGridLayout> m_layout;
  63. };
  64. };
  65. #endif
  66. class QPaintEvent;
  67. class QMouseEvent;