Lv2ViewBase.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Lv2ViewBase.h - base class for Lv2 plugin views
  3. *
  4. * Copyright (c) 2018-2020 Johannes Lorenz <jlsf2013$users.sourceforge.net, $=@>
  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 LV2VIEWBASE_H
  25. #define LV2VIEWBASE_H
  26. #include "lmmsconfig.h"
  27. #ifdef LMMS_HAVE_LV2
  28. #include <QString>
  29. #include <QVector>
  30. #include "LinkedModelGroupViews.h"
  31. #include "lmms_export.h"
  32. #include "Lv2Basics.h"
  33. class Lv2Proc;
  34. class Lv2ControlBase;
  35. //! View for one processor, Lv2ViewBase contains 2 of those for mono plugins
  36. class Lv2ViewProc : public LinkedModelGroupView
  37. {
  38. public:
  39. //! @param colNum numbers of columns for the controls
  40. Lv2ViewProc(QWidget *parent, Lv2Proc *ctrlBase, int colNum);
  41. ~Lv2ViewProc();
  42. private:
  43. static AutoLilvNode uri(const char *uriStr);
  44. };
  45. //! Base class for view for one Lv2 plugin
  46. class LMMS_EXPORT Lv2ViewBase : public LinkedModelGroupsView
  47. {
  48. protected:
  49. //! @param pluginWidget A child class which inherits QWidget
  50. Lv2ViewBase(class QWidget *pluginWidget, Lv2ControlBase *ctrlBase);
  51. ~Lv2ViewBase();
  52. // these widgets must be connected by child widgets
  53. class QPushButton *m_reloadPluginButton = nullptr;
  54. class QPushButton *m_toggleUIButton = nullptr;
  55. class QPushButton *m_helpButton = nullptr;
  56. void toggleUI();
  57. void toggleHelp(bool visible);
  58. // to be called by child virtuals
  59. //! Reconnect models if model changed
  60. void modelChanged(Lv2ControlBase* ctrlBase);
  61. private:
  62. enum Rows
  63. {
  64. ButtonRow,
  65. ProcRow,
  66. LinkChannelsRow
  67. };
  68. static AutoLilvNode uri(const char *uriStr);
  69. LinkedModelGroupView* getGroupView() override { return m_procView; }
  70. Lv2ViewProc* m_procView;
  71. //! Numbers of controls per row; must be multiple of 2 for mono effects
  72. const int m_colNum = 6;
  73. class QMdiSubWindow* m_helpWindow = nullptr;
  74. class LedCheckBox *m_multiChannelLink;
  75. };
  76. #endif // LMMS_HAVE_LV2
  77. #endif // LV2VIEWBASE_H