ControllerRackView.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * ControllerRackView.h - view for song's controllers
  3. *
  4. * Copyright (c) 2008-2009 Paul Giblock <drfaygo/at/gmail.com>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef CONTROLLER_RACK_VIEW_H
  25. #define CONTROLLER_RACK_VIEW_H
  26. #include <QWidget>
  27. #include <QCloseEvent>
  28. #include "SerializingObject.h"
  29. #include "lmms_basics.h"
  30. class QPushButton;
  31. class QScrollArea;
  32. class QVBoxLayout;
  33. class ControllerView;
  34. class Controller;
  35. class ControllerRackView : public QWidget, public SerializingObject
  36. {
  37. Q_OBJECT
  38. public:
  39. ControllerRackView();
  40. virtual ~ControllerRackView();
  41. void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
  42. void loadSettings( const QDomElement & _this ) override;
  43. inline QString nodeName() const override
  44. {
  45. return "ControllerRackView";
  46. }
  47. public slots:
  48. void deleteController( ControllerView * _view );
  49. void onControllerAdded( Controller * );
  50. void onControllerRemoved( Controller * );
  51. protected:
  52. void closeEvent( QCloseEvent * _ce ) override;
  53. private slots:
  54. void addController();
  55. private:
  56. QVector<ControllerView *> m_controllerViews;
  57. QScrollArea * m_scrollArea;
  58. QVBoxLayout * m_scrollAreaLayout;
  59. QPushButton * m_addButton;
  60. // Stores the index of where to insert the next ControllerView.
  61. // Needed so that the StretchItem always stays at the last position.
  62. int m_nextIndex;
  63. } ;
  64. #endif