Skip to content

Commit

Permalink
Use static QPixmap's
Browse files Browse the repository at this point in the history
The QPixmap's need to be created within the constructor, and not outside
where they are defined, since it can't find them otherwise.
I'm not too sure why.
  • Loading branch information
sakertooth committed Sep 21, 2023
1 parent c52553b commit 96745ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
19 changes: 11 additions & 8 deletions plugins/Eq/EqControlsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@

namespace lmms::gui
{
QPixmap EqControlsDialog::s_faderBg;
QPixmap EqControlsDialog::s_faderLeds;
QPixmap EqControlsDialog::s_faderKnob;


EqControlsDialog::EqControlsDialog( EqControls *controls ) :
Expand Down Expand Up @@ -72,17 +75,17 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
setBand( 6, &controls->m_highShelfActiveModel, &controls->m_highShelfFreqModel, &controls->m_highShelfResModel, &controls->m_highShelfGainModel, QColor(255 ,255, 255), tr( "High-shelf" ), &controls->m_highShelfPeakL, &controls->m_highShelfPeakR,0,0,0,0,0,0 );
setBand( 7, &controls->m_lpActiveModel, &controls->m_lpFreqModel, &controls->m_lpResModel, 0, QColor(255 ,255, 255), tr( "LP" ) ,0,0,0,0,0, &controls->m_lp12Model, &controls->m_lp24Model, &controls->m_lp48Model);

auto faderBg = QPixmap(PLUGIN_NAME::getIconPixmap("faderback"));
auto faderLeds = QPixmap(PLUGIN_NAME::getIconPixmap("faderleds"));
auto faderKnob = QPixmap(PLUGIN_NAME::getIconPixmap("faderknob"));
if (s_faderBg.isNull()) { s_faderBg = QPixmap(PLUGIN_NAME::getIconPixmap("faderback")); }
if (s_faderLeds.isNull()) { s_faderLeds = QPixmap(PLUGIN_NAME::getIconPixmap("faderleds")); }
if (s_faderKnob.isNull()) { s_faderKnob = QPixmap(PLUGIN_NAME::getIconPixmap("faderknob")); }

auto GainFaderIn = new EqFader(&controls->m_inGainModel, tr("Input gain"), this, &faderBg, &faderLeds, &faderKnob,
&controls->m_inPeakL, &controls->m_inPeakR);
auto GainFaderIn = new EqFader(&controls->m_inGainModel, tr("Input gain"), this, &s_faderBg, &s_faderLeds,
&s_faderKnob, &controls->m_inPeakL, &controls->m_inPeakR);
GainFaderIn->move( 23, 295 );
GainFaderIn->setDisplayConversion( false );
GainFaderIn->setHintText( tr( "Gain" ), "dBv");

auto GainFaderOut = new EqFader(&controls->m_outGainModel, tr("Output gain"), this, &faderBg, &faderLeds, &faderKnob,
auto GainFaderOut = new EqFader(&controls->m_outGainModel, tr("Output gain"), this, &s_faderBg, &s_faderLeds, &s_faderKnob,
&controls->m_outPeakL, &controls->m_outPeakR);
GainFaderOut->move( 453, 295);
GainFaderOut->setDisplayConversion( false );
Expand All @@ -92,8 +95,8 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
int distance = 126;
for( int i = 1; i < m_parameterWidget->bandCount() - 1; i++ )
{
auto gainFader = new EqFader(m_parameterWidget->getBandModels(i)->gain, tr(""), this, &faderBg, &faderLeds,
&faderKnob, m_parameterWidget->getBandModels(i)->peakL, m_parameterWidget->getBandModels(i)->peakR);
auto gainFader = new EqFader(m_parameterWidget->getBandModels(i)->gain, tr(""), this, &s_faderBg, &s_faderLeds,
&s_faderKnob, m_parameterWidget->getBandModels(i)->peakL, m_parameterWidget->getBandModels(i)->peakR);
gainFader->move( distance, 295 );
distance += 44;
gainFader->setMinimumHeight(80);
Expand Down
3 changes: 3 additions & 0 deletions plugins/Eq/EqControlsDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class EqControlsDialog : public EffectControlDialog
EqBand *setBand( int index, BoolModel *active, FloatModel *freq, FloatModel *res, FloatModel *gain, QColor color, QString name, float *peakL, float *peakR, BoolModel *hp12, BoolModel *hp24, BoolModel *hp48, BoolModel *lp12, BoolModel *lp24, BoolModel *lp48 );

int m_originalHeight;
static QPixmap s_faderBg;
static QPixmap s_faderLeds;
static QPixmap s_faderKnob;
};


Expand Down

0 comments on commit 96745ef

Please sign in to comment.