Rewrite Amplifier plugin code (#6989)

* rewrite amplifier plugin style

* pomelo

* oroblanco

* grapefruit

* calamlamondin
This commit is contained in:
Lost Robot
2023-11-23 13:30:40 -08:00
committed by GitHub
parent dc8c49a539
commit ced1f18eca
6 changed files with 87 additions and 175 deletions

View File

@@ -23,53 +23,38 @@
*
*/
#include "AmplifierControlDialog.h"
#include "AmplifierControls.h"
#include "embed.h"
#include "Knob.h"
namespace lmms::gui
{
AmplifierControlDialog::AmplifierControlDialog( AmplifierControls* controls ) :
EffectControlDialog( controls )
AmplifierControlDialog::AmplifierControlDialog(AmplifierControls* controls) :
EffectControlDialog(controls)
{
setAutoFillBackground( true );
setAutoFillBackground(true);
QPalette pal;
pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) );
setPalette( pal );
setFixedSize( 100, 110 );
pal.setBrush(backgroundRole(), PLUGIN_NAME::getIconPixmap("artwork"));
setPalette(pal);
setFixedSize(100, 110);
auto makeKnob = [this](int x, int y, const QString& label, const QString& hintText, const QString& unit, FloatModel* model, bool isVolume)
{
Knob* newKnob = new Knob(KnobType::Bright26, this);
newKnob->move(x, y);
newKnob->setModel(model);
newKnob->setLabel(label);
newKnob->setHintText(hintText, unit);
newKnob->setVolumeKnob(isVolume);
return newKnob;
};
auto volumeKnob = new Knob(KnobType::Bright26, this);
volumeKnob -> move( 16, 10 );
volumeKnob -> setVolumeKnob( true );
volumeKnob->setModel( &controls->m_volumeModel );
volumeKnob->setLabel( tr( "VOL" ) );
volumeKnob->setHintText( tr( "Volume:" ) , "%" );
auto panKnob = new Knob(KnobType::Bright26, this);
panKnob -> move( 57, 10 );
panKnob->setModel( &controls->m_panModel );
panKnob->setLabel( tr( "PAN" ) );
panKnob->setHintText( tr( "Panning:" ) , "" );
auto leftKnob = new Knob(KnobType::Bright26, this);
leftKnob -> move( 16, 65 );
leftKnob -> setVolumeKnob( true );
leftKnob->setModel( &controls->m_leftModel );
leftKnob->setLabel( tr( "LEFT" ) );
leftKnob->setHintText( tr( "Left gain:" ) , "%" );
auto rightKnob = new Knob(KnobType::Bright26, this);
rightKnob -> move( 57, 65 );
rightKnob -> setVolumeKnob( true );
rightKnob->setModel( &controls->m_rightModel );
rightKnob->setLabel( tr( "RIGHT" ) );
rightKnob->setHintText( tr( "Right gain:" ) , "%" );
makeKnob(16, 10, tr("VOL"), tr("Volume:"), "%", &controls->m_volumeModel, true);
makeKnob(57, 10, tr("PAN"), tr("Panning:"), "%", &controls->m_panModel, false);
makeKnob(16, 65, tr("LEFT"), tr("Left gain:"), "%", &controls->m_leftModel, true);
makeKnob(57, 65, tr("RIGHT"), tr("Right gain:"), "%", &controls->m_rightModel, true);
}
} // namespace lmms::gui
} // namespace lmms::gui