fixed issue with group checkbox and different skins

This commit is contained in:
Volker Fischer 2020-07-04 10:46:31 +02:00
parent dab63cda23
commit dc577891b4
3 changed files with 26 additions and 20 deletions

View file

@ -22,6 +22,8 @@ TODO improve settings management -> move settings class in client/server classes
TODO add new register message which contains version and, e.g., max number of clients TODO add new register message which contains version and, e.g., max number of clients
TODO Inconsistency between Input meter and Audio mixer meter #423
TODO https://github.com/corrados/jamulus/issues/341#issuecomment-647172946 TODO https://github.com/corrados/jamulus/issues/341#issuecomment-647172946
- generate .qm on compile time with lrelease - generate .qm on compile time with lrelease

View file

@ -45,7 +45,7 @@ CChannelFader::CChannelFader ( QWidget* pNW )
pMuteSoloBox = new QWidget ( pFrame ); pMuteSoloBox = new QWidget ( pFrame );
pcbMute = new QCheckBox ( tr ( "Mute" ), pMuteSoloBox ); pcbMute = new QCheckBox ( tr ( "Mute" ), pMuteSoloBox );
pcbSolo = new QCheckBox ( tr ( "Solo" ), pMuteSoloBox ); pcbSolo = new QCheckBox ( tr ( "Solo" ), pMuteSoloBox );
pcbGroup = new QCheckBox ( tr ( "Grp" ), pMuteSoloBox ); pcbGroup = new QCheckBox ( "", pMuteSoloBox );
pLabelInstBox = new QGroupBox ( pFrame ); pLabelInstBox = new QGroupBox ( pFrame );
plblLabel = new QLabel ( "", pFrame ); plblLabel = new QLabel ( "", pFrame );
@ -128,6 +128,7 @@ CChannelFader::CChannelFader ( QWidget* pNW )
pMainGrid->addWidget ( pLabelInstBox ); pMainGrid->addWidget ( pLabelInstBox );
// reset current fader // reset current fader
strGroupBaseText = "Grp"; // this will most probably overwritten by SetGUIDesign()
Reset(); Reset();
// add help text to controls // add help text to controls
@ -224,7 +225,7 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
pPanLabel->setText ( tr ( "PAN" ) ); pPanLabel->setText ( tr ( "PAN" ) );
pcbMute->setText ( tr ( "MUTE" ) ); pcbMute->setText ( tr ( "MUTE" ) );
pcbSolo->setText ( tr ( "SOLO" ) ); pcbSolo->setText ( tr ( "SOLO" ) );
pcbGroup->setText ( tr ( "GRP" ) ); strGroupBaseText = tr ( "GRP" );
plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_LED ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_LED );
break; break;
@ -238,7 +239,7 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
pPanLabel->setText ( tr ( "Pan" ) ); pPanLabel->setText ( tr ( "Pan" ) );
pcbMute->setText ( tr ( "M" ) ); pcbMute->setText ( tr ( "M" ) );
pcbSolo->setText ( tr ( "S" ) ); pcbSolo->setText ( tr ( "S" ) );
pcbGroup->setText ( tr ( "G" ) ); strGroupBaseText = tr ( "G" );
plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_SLIM_BAR ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_SLIM_BAR );
break; break;
@ -253,10 +254,13 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
pPanLabel->setText ( tr ( "Pan" ) ); pPanLabel->setText ( tr ( "Pan" ) );
pcbMute->setText ( tr ( "Mute" ) ); pcbMute->setText ( tr ( "Mute" ) );
pcbSolo->setText ( tr ( "Solo" ) ); pcbSolo->setText ( tr ( "Solo" ) );
pcbGroup->setText ( tr ( "Grp" ) ); strGroupBaseText = tr ( "Grp" );
plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_BAR ); plbrChannelLevel->SetLevelMeterType ( CLevelMeter::MT_BAR );
break; break;
} }
// we need to update since we changed the checkbox text
UpdateGroupIDDependencies();
} }
void CChannelFader::SetDisplayChannelLevel ( const bool eNDCL ) void CChannelFader::SetDisplayChannelLevel ( const bool eNDCL )
@ -356,7 +360,7 @@ void CChannelFader::Reset()
bIsMyOwnFader = false; bIsMyOwnFader = false;
iGroupID = INVALID_INDEX; iGroupID = INVALID_INDEX;
UpdateGroupCheckState(); UpdateGroupIDDependencies();
} }
void CChannelFader::SetFaderLevel ( const double dLevel, void CChannelFader::SetFaderLevel ( const double dLevel,
@ -460,21 +464,10 @@ void CChannelFader::OnMuteStateChanged ( int value )
void CChannelFader::SetGroupID ( const int iNGroupID ) void CChannelFader::SetGroupID ( const int iNGroupID )
{ {
iGroupID = iNGroupID; iGroupID = iNGroupID;
UpdateGroupIDDependencies();
// TODO different skins, different text; also prolem with skin update
if ( iNGroupID != INVALID_INDEX )
{
pcbGroup->setText ( tr ( "Grp" ) + QString::number ( iNGroupID + 1 ) );
}
else
{
pcbGroup->setText ( tr ( "Grp" ) );
} }
UpdateGroupCheckState(); void CChannelFader::UpdateGroupIDDependencies()
}
void CChannelFader::UpdateGroupCheckState()
{ {
// update the group checkbox according the current group ID setting // update the group checkbox according the current group ID setting
pcbGroup->blockSignals ( true ); // make sure no signals as fired pcbGroup->blockSignals ( true ); // make sure no signals as fired
@ -487,6 +480,16 @@ void CChannelFader::UpdateGroupCheckState()
pcbGroup->setCheckState ( Qt::Checked ); pcbGroup->setCheckState ( Qt::Checked );
} }
pcbGroup->blockSignals ( false ); pcbGroup->blockSignals ( false );
// update group checkbox text
if ( iGroupID != INVALID_INDEX )
{
pcbGroup->setText ( strGroupBaseText + QString::number ( iGroupID + 1 ) );
}
else
{
pcbGroup->setText ( strGroupBaseText );
}
} }
void CChannelFader::OnGroupStateChanged ( int ) void CChannelFader::OnGroupStateChanged ( int )
@ -496,7 +499,7 @@ void CChannelFader::OnGroupStateChanged ( int )
// setting and not the current click state since the user might not click // setting and not the current click state since the user might not click
// on the menu but at one other place and then the popup menu disappears but // on the menu but at one other place and then the popup menu disappears but
// the checkobx state would be on an invalid state // the checkobx state would be on an invalid state
UpdateGroupCheckState(); UpdateGroupIDDependencies();
pGroupPopupMenu->popup ( QCursor::pos() ); pGroupPopupMenu->popup ( QCursor::pos() );
} }

View file

@ -82,7 +82,7 @@ public:
void UpdateSoloState ( const bool bNewOtherSoloState ); void UpdateSoloState ( const bool bNewOtherSoloState );
protected: protected:
void UpdateGroupCheckState(); void UpdateGroupIDDependencies();
double CalcFaderGain ( const double dValue ); double CalcFaderGain ( const double dValue );
void SetMute ( const bool bState ); void SetMute ( const bool bState );
void SetupFaderTag ( const ESkillLevel eSkillLevel ); void SetupFaderTag ( const ESkillLevel eSkillLevel );
@ -118,6 +118,7 @@ protected:
bool bIsMyOwnFader; bool bIsMyOwnFader;
double dPreviousFaderLevel; double dPreviousFaderLevel;
int iGroupID; int iGroupID;
QString strGroupBaseText;
public slots: public slots:
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); } void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); }