VecControlsDialog.cpp 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * VecControlsDialog.cpp - definition of VecControlsDialog class.
  3. *
  4. * Copyright (c) 2019 Martin Pavelek <he29/dot/HS/at/gmail/dot/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. #include "VecControlsDialog.h"
  25. #include <QGridLayout>
  26. #include <QLabel>
  27. #include <QResizeEvent>
  28. #include <QSizePolicy>
  29. #include <QWidget>
  30. #include "embed.h"
  31. #include "LedCheckbox.h"
  32. #include "VecControls.h"
  33. #include "Vectorscope.h"
  34. #include "VectorView.h"
  35. // The entire GUI layout is built here.
  36. VecControlsDialog::VecControlsDialog(VecControls *controls) :
  37. EffectControlDialog(controls),
  38. m_controls(controls)
  39. {
  40. QVBoxLayout *master_layout = new QVBoxLayout;
  41. master_layout->setContentsMargins(0, 2, 0, 0);
  42. setLayout(master_layout);
  43. // Visualizer widget
  44. // The size of 768 pixels seems to offer a good balance of speed, accuracy and trace thickness.
  45. VectorView *display = new VectorView(controls, m_controls->m_effect->getBuffer(), 768, this);
  46. master_layout->addWidget(display);
  47. // Config area located inside visualizer
  48. QVBoxLayout *internal_layout = new QVBoxLayout(display);
  49. QHBoxLayout *config_layout = new QHBoxLayout();
  50. QVBoxLayout *switch_layout = new QVBoxLayout();
  51. internal_layout->addStretch();
  52. internal_layout->addLayout(config_layout);
  53. config_layout->addLayout(switch_layout);
  54. // High-quality switch
  55. LedCheckBox *highQualityButton = new LedCheckBox(tr("HQ"), this);
  56. highQualityButton->setToolTip(tr("Double the resolution and simulate continuous analog-like trace."));
  57. highQualityButton->setCheckable(true);
  58. highQualityButton->setMinimumSize(70, 12);
  59. highQualityButton->setModel(&controls->m_highQualityModel);
  60. switch_layout->addWidget(highQualityButton);
  61. // Log. scale switch
  62. LedCheckBox *logarithmicButton = new LedCheckBox(tr("Log. scale"), this);
  63. logarithmicButton->setToolTip(tr("Display amplitude on logarithmic scale to better see small values."));
  64. logarithmicButton->setCheckable(true);
  65. logarithmicButton->setMinimumSize(70, 12);
  66. logarithmicButton->setModel(&controls->m_logarithmicModel);
  67. switch_layout->addWidget(logarithmicButton);
  68. config_layout->addStretch();
  69. // Persistence knob
  70. Knob *persistenceKnob = new Knob(knobSmall_17, this);
  71. persistenceKnob->setModel(&controls->m_persistenceModel);
  72. persistenceKnob->setLabel(tr("Persist."));
  73. persistenceKnob->setToolTip(tr("Trace persistence: higher amount means the trace will stay bright for longer time."));
  74. persistenceKnob->setHintText(tr("Trace persistence"), "");
  75. config_layout->addWidget(persistenceKnob);
  76. }
  77. // Suggest the best widget size.
  78. QSize VecControlsDialog::sizeHint() const
  79. {
  80. return QSize(275, 300);
  81. }