scale instrument picture to a small size if Compact skin is chosen

This commit is contained in:
Volker Fischer 2020-07-05 09:01:32 +02:00
parent 174740fa47
commit 0466ff6210
2 changed files with 19 additions and 3 deletions

View file

@ -129,6 +129,7 @@ CChannelFader::CChannelFader ( QWidget* pNW )
// reset current fader // reset current fader
strGroupBaseText = "Grp"; // this will most probably overwritten by SetGUIDesign() strGroupBaseText = "Grp"; // this will most probably overwritten by SetGUIDesign()
iInstrPicFixedWidth = INVALID_INDEX; // this will most probably overwritten by SetGUIDesign()
Reset(); Reset();
// add help text to controls // add help text to controls
@ -227,11 +228,12 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
pcbSolo->setText ( tr ( "SOLO" ) ); pcbSolo->setText ( tr ( "SOLO" ) );
strGroupBaseText = tr ( "GRP" ); strGroupBaseText = tr ( "GRP" );
plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_LED ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_LED );
iInstrPicFixedWidth = INVALID_INDEX; // no instrument picture scaling
break; break;
case GD_SLIMFADER: case GD_SLIMFADER:
pLabelPictGrid->addWidget ( plblLabel, 0, Qt::AlignHCenter ); // label below icons pLabelPictGrid->addWidget ( plblLabel, 0, Qt::AlignHCenter ); // label below icons
pLabelInstBox->setMinimumHeight ( 84 ); // maximum height of the instrument+flag+label pLabelInstBox->setMinimumHeight ( 94 ); // maximum height of the instrument+flag+label
pFader->setMinimumHeight ( 85 ); pFader->setMinimumHeight ( 85 );
pPan->setFixedSize ( 28, 28 ); pPan->setFixedSize ( 28, 28 );
pFader->setTickPosition ( QSlider::NoTicks ); pFader->setTickPosition ( QSlider::NoTicks );
@ -241,6 +243,7 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
pcbSolo->setText ( tr ( "S" ) ); pcbSolo->setText ( tr ( "S" ) );
strGroupBaseText = tr ( "G" ); strGroupBaseText = tr ( "G" );
plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_SLIM_BAR ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_SLIM_BAR );
iInstrPicFixedWidth = 18; // scale instrument picture to avoid enlarging the width by the picture
break; break;
default: default:
@ -256,11 +259,15 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
pcbSolo->setText ( tr ( "Solo" ) ); pcbSolo->setText ( tr ( "Solo" ) );
strGroupBaseText = tr ( "Grp" ); strGroupBaseText = tr ( "Grp" );
plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_BAR ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_BAR );
iInstrPicFixedWidth = INVALID_INDEX; // no instrument picture scaling
break; break;
} }
// we need to update since we changed the checkbox text // we need to update since we changed the checkbox text
UpdateGroupIDDependencies(); UpdateGroupIDDependencies();
// the instrument picture might need scaling after a style change
SetChannelInfos ( cReceivedChanInfo );
} }
void CChannelFader::SetDisplayChannelLevel ( const bool eNDCL ) void CChannelFader::SetDisplayChannelLevel ( const bool eNDCL )
@ -607,7 +614,15 @@ void CChannelFader::SetChannelInfos ( const CChannelInfo& cChanInfo )
else else
{ {
// set correct picture // set correct picture
if ( iInstrPicFixedWidth != INVALID_INDEX )
{
// scale instrument picture on request (scale to the width with correct aspect ratio)
plblInstrument->setPixmap ( QPixmap ( strCurResourceRef ).scaledToWidth ( iInstrPicFixedWidth, Qt::SmoothTransformation ) );
}
else
{
plblInstrument->setPixmap ( QPixmap ( strCurResourceRef ) ); plblInstrument->setPixmap ( QPixmap ( strCurResourceRef ) );
}
iTTInstrument = cChanInfo.iInstrument; iTTInstrument = cChanInfo.iInstrument;
// enable instrument picture // enable instrument picture

View file

@ -119,6 +119,7 @@ protected:
double dPreviousFaderLevel; double dPreviousFaderLevel;
int iGroupID; int iGroupID;
QString strGroupBaseText; QString strGroupBaseText;
int iInstrPicFixedWidth;
public slots: public slots:
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); } void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); }