DualFilterControlDialog.cpp 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * DualFilterControlDialog.cpp - control dialog for dual filter effect
  3. *
  4. * Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
  5. * Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #include <QLayout>
  26. #include "DualFilterControlDialog.h"
  27. #include "DualFilterControls.h"
  28. #include "embed.h"
  29. #include "LedCheckbox.h"
  30. #include "ComboBox.h"
  31. #include "ToolTip.h"
  32. #include "gui_templates.h"
  33. #define makeknob( name, x, y, model, label, hint, unit ) \
  34. Knob * name = new Knob( knobBright_26, this); \
  35. name -> move( x, y ); \
  36. name ->setModel( &controls-> model ); \
  37. name ->setLabel( label ); \
  38. name ->setHintText( hint, unit );
  39. DualFilterControlDialog::DualFilterControlDialog( DualFilterControls* controls ) :
  40. EffectControlDialog( controls )
  41. {
  42. setAutoFillBackground( true );
  43. QPalette pal;
  44. pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) );
  45. setPalette( pal );
  46. setFixedSize( 373, 109 );
  47. makeknob( cut1Knob, 24, 26, m_cut1Model, tr( "FREQ" ), tr( "Cutoff frequency" ), "Hz" )
  48. makeknob( res1Knob, 74, 26, m_res1Model, tr( "RESO" ), tr( "Resonance" ), "" )
  49. makeknob( gain1Knob, 124, 26, m_gain1Model, tr( "GAIN" ), tr( "Gain" ), "%" )
  50. makeknob( mixKnob, 173, 37, m_mixModel, tr( "MIX" ), tr( "Mix" ), "" )
  51. makeknob( cut2Knob, 222, 26, m_cut2Model, tr( "FREQ" ), tr( "Cutoff frequency" ), "Hz" )
  52. makeknob( res2Knob, 272, 26, m_res2Model, tr( "RESO" ), tr( "Resonance" ), "" )
  53. makeknob( gain2Knob, 322, 26, m_gain2Model, tr( "GAIN" ), tr( "Gain" ), "%" )
  54. gain1Knob-> setVolumeKnob( true );
  55. gain2Knob-> setVolumeKnob( true );
  56. LedCheckBox * enabled1Toggle = new LedCheckBox( "", this,
  57. tr( "Filter 1 enabled" ), LedCheckBox::Green );
  58. LedCheckBox * enabled2Toggle = new LedCheckBox( "", this,
  59. tr( "Filter 2 enabled" ), LedCheckBox::Green );
  60. enabled1Toggle -> move( 12, 11 );
  61. enabled1Toggle -> setModel( &controls -> m_enabled1Model );
  62. ToolTip::add( enabled1Toggle, tr( "Enable/disable filter 1" ) );
  63. enabled2Toggle -> move( 210, 11 );
  64. enabled2Toggle -> setModel( &controls -> m_enabled2Model );
  65. ToolTip::add( enabled2Toggle, tr( "Enable/disable filter 2" ) );
  66. ComboBox * m_filter1ComboBox = new ComboBox( this );
  67. m_filter1ComboBox->setGeometry( 19, 70, 137, ComboBox::DEFAULT_HEIGHT );
  68. m_filter1ComboBox->setFont( pointSize<8>( m_filter1ComboBox->font() ) );
  69. m_filter1ComboBox->setModel( &controls->m_filter1Model );
  70. ComboBox * m_filter2ComboBox = new ComboBox( this );
  71. m_filter2ComboBox->setGeometry( 217, 70, 137, ComboBox::DEFAULT_HEIGHT );
  72. m_filter2ComboBox->setFont( pointSize<8>( m_filter2ComboBox->font() ) );
  73. m_filter2ComboBox->setModel( &controls->m_filter2Model );
  74. }