MicrotunerConfig.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * MicrotunerConfig.h - configuration widget for scales and keymaps
  3. *
  4. * Copyright (c) 2020 Martin Pavelek <he29.HS/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 MICROTUNER_CONFIG_H
  25. #define MICROTUNER_CONFIG_H
  26. #include <QCloseEvent>
  27. #include <QLineEdit>
  28. #include <QMainWindow>
  29. #include <QPlainTextEdit>
  30. #include "AutomatableModel.h"
  31. #include "ComboBoxModel.h"
  32. #include "LcdFloatSpinBox.h"
  33. #include "LcdSpinBox.h"
  34. #include "SerializingObject.h"
  35. class LMMS_EXPORT MicrotunerConfig : public QWidget, public SerializingObject
  36. {
  37. Q_OBJECT
  38. public:
  39. MicrotunerConfig();
  40. void saveSettings(QDomDocument &document, QDomElement &element) override;
  41. void loadSettings(const QDomElement &element) override;
  42. inline QString nodeName() const override
  43. {
  44. return "MicrotunerConfig";
  45. }
  46. QSize sizeHint() const override {return QSize(300, 400);}
  47. public slots:
  48. void updateScaleList(int index);
  49. void updateKeymapList(int index);
  50. void updateScaleForm();
  51. void updateKeymapForm();
  52. protected:
  53. void closeEvent(QCloseEvent *ce) override;
  54. private slots:
  55. bool loadScaleFromFile();
  56. bool loadKeymapFromFile();
  57. bool saveScaleToFile();
  58. bool saveKeymapToFile();
  59. private:
  60. bool validateScaleForm();
  61. bool validateKeymapForm();
  62. bool applyScale();
  63. bool applyKeymap();
  64. ComboBoxModel m_scaleComboModel; //!< ID of scale currently selected for editing
  65. ComboBoxModel m_keymapComboModel; //!< ID of keymap currently selected for editing
  66. QLineEdit *m_scaleNameEdit; //!< edit field for the scale name or description
  67. QLineEdit *m_keymapNameEdit; //!< edit field for the keymap name or description
  68. QPlainTextEdit *m_scaleTextEdit; //!< text editor field for interval definitions
  69. QPlainTextEdit *m_keymapTextEdit; //!< text editor field for key mappings
  70. IntModel m_firstKeyModel; //!< model for spinbox of currently edited first key
  71. IntModel m_lastKeyModel; //!< model for spinbox of currently edited last key
  72. IntModel m_middleKeyModel; //!< model for spinbox of currently edited middle key
  73. IntModel m_baseKeyModel; //!< model for spinbox of currently edited base key
  74. FloatModel m_baseFreqModel; //!< model for spinbox of currently edited base note frequency
  75. };
  76. #endif