initial multi-group support, still some work to do (e.g. the skin change does not work)

This commit is contained in:
Volker Fischer 2020-07-04 09:45:46 +02:00
parent 9af0ae13e9
commit dab63cda23
3 changed files with 75 additions and 5 deletions

View File

@ -60,6 +60,17 @@ CChannelFader::CChannelFader ( QWidget* pNW )
QVBoxLayout* pPanGrid = new QVBoxLayout ( );
QHBoxLayout* pPanInfoGrid = new QHBoxLayout ( );
// define the popup menu for the group checkbox
pGroupPopupMenu = new QMenu ( "", pcbGroup );
pGroupPopupMenu->addAction ( tr ( "No grouping" ), this, SLOT ( OnGroupMenuGrpNone() ) );
pGroupPopupMenu->addAction ( tr ( "Assign to group" ) + " 1", this, SLOT ( OnGroupMenuGrp1() ) );
pGroupPopupMenu->addAction ( tr ( "Assign to group" ) + " 2", this, SLOT ( OnGroupMenuGrp2() ) );
pGroupPopupMenu->addAction ( tr ( "Assign to group" ) + " 3", this, SLOT ( OnGroupMenuGrp3() ) );
pGroupPopupMenu->addAction ( tr ( "Assign to group" ) + " 4", this, SLOT ( OnGroupMenuGrp4() ) );
#if ( MAX_NUM_FADER_GROUPS != 4 )
# error "MAX_NUM_FADER_GROUPS must be set to 4, see implementation in CChannelFader()"
#endif
// setup channel level
plbrChannelLevel->setContentsMargins ( 0, 3, 2, 3 );
@ -183,6 +194,9 @@ CChannelFader::CChannelFader ( QWidget* pNW )
QObject::connect ( pcbSolo, &QCheckBox::stateChanged,
this, &CChannelFader::soloStateChanged );
QObject::connect ( pcbGroup, &QCheckBox::stateChanged,
this, &CChannelFader::OnGroupStateChanged );
}
void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
@ -319,7 +333,6 @@ void CChannelFader::Reset()
// reset mute/solo/group check boxes and level meter
pcbMute->setChecked ( false );
pcbSolo->setChecked ( false );
pcbGroup->setChecked ( false );
plbrChannelLevel->SetValue ( 0 );
plbrChannelLevel->ClipReset();
@ -341,6 +354,9 @@ void CChannelFader::Reset()
bOtherChannelIsSolo = false;
bIsMyOwnFader = false;
iGroupID = INVALID_INDEX;
UpdateGroupCheckState();
}
void CChannelFader::SetFaderLevel ( const double dLevel,
@ -441,6 +457,49 @@ void CChannelFader::OnMuteStateChanged ( int value )
SetMute ( static_cast<Qt::CheckState> ( value ) == Qt::Checked );
}
void CChannelFader::SetGroupID ( const int iNGroupID )
{
iGroupID = iNGroupID;
// 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::UpdateGroupCheckState()
{
// update the group checkbox according the current group ID setting
pcbGroup->blockSignals ( true ); // make sure no signals as fired
if ( iGroupID == INVALID_INDEX )
{
pcbGroup->setCheckState ( Qt::Unchecked );
}
else
{
pcbGroup->setCheckState ( Qt::Checked );
}
pcbGroup->blockSignals ( false );
}
void CChannelFader::OnGroupStateChanged ( int )
{
// we want a popup menu shown if the user presses the group checkbox but
// we want to make sure that the checkbox state represents the current group
// 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
// the checkobx state would be on an invalid state
UpdateGroupCheckState();
pGroupPopupMenu->popup ( QCursor::pos() );
}
void CChannelFader::SetMute ( const bool bState )
{
if ( bState )

View File

@ -36,6 +36,7 @@
#include <QSizePolicy>
#include <QHostAddress>
#include <QListWidget>
#include <QMenu>
#include "global.h"
#include "util.h"
#include "levelmeter.h"
@ -57,7 +58,7 @@ public:
bool IsVisible() { return !pFrame->isHidden(); }
bool IsSolo() { return pcbSolo->isChecked(); }
bool IsMute() { return pcbMute->isChecked(); }
int GetGroupID() { return pcbGroup->isChecked() ? 0 : INVALID_INDEX; }
int GetGroupID() { return iGroupID; }
void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetDisplayChannelLevel ( const bool eNDCL );
bool GetDisplayChannelLevel();
@ -67,7 +68,7 @@ public:
void SetPanValue ( const int iPan );
void SetFaderIsSolo ( const bool bIsSolo );
void SetFaderIsMute ( const bool bIsMute );
void SetGroupID ( const int iGroupID ) { pcbGroup->setChecked ( iGroupID != INVALID_INDEX ); }
void SetGroupID ( const int iNGroupID );
void SetRemoteFaderIsMute ( const bool bIsMute );
void SetFaderLevel ( const double dLevel,
const bool bIsGroupUpdate = false );
@ -81,6 +82,7 @@ public:
void UpdateSoloState ( const bool bNewOtherSoloState );
protected:
void UpdateGroupCheckState();
double CalcFaderGain ( const double dValue );
void SetMute ( const bool bState );
void SetupFaderTag ( const ESkillLevel eSkillLevel );
@ -103,6 +105,7 @@ protected:
QCheckBox* pcbMute;
QCheckBox* pcbSolo;
QCheckBox* pcbGroup;
QMenu* pGroupPopupMenu;
QGroupBox* pLabelInstBox;
QLabel* plblLabel;
@ -114,11 +117,19 @@ protected:
bool bOtherChannelIsSolo;
bool bIsMyOwnFader;
double dPreviousFaderLevel;
int iGroupID;
public slots:
void OnLevelValueChanged ( int value ) { SendFaderLevelToServer ( value, false ); }
void OnPanValueChanged ( int value ) { SendPanValueToServer ( value ); }
void OnMuteStateChanged ( int value );
void OnGroupStateChanged ( int );
void OnGroupMenuGrpNone() { SetGroupID ( INVALID_INDEX ); }
void OnGroupMenuGrp1() { SetGroupID ( 0 ); }
void OnGroupMenuGrp2() { SetGroupID ( 1 ); }
void OnGroupMenuGrp3() { SetGroupID ( 2 ); }
void OnGroupMenuGrp4() { SetGroupID ( 3 ); }
signals:
void gainValueChanged ( double value,

View File

@ -152,8 +152,8 @@ LED bar: lbr
#define AUD_MIX_FADER_MAX 100
#define AUD_MIX_PAN_MAX 100
// maximum number of fader groups
#define MAX_NUM_FADER_GROUPS 10
// maximum number of fader groups (must be consistent to audiomixerboard implementation)
#define MAX_NUM_FADER_GROUPS 4
// maximum number of recognized sound cards installed in the system
#define MAX_NUMBER_SOUND_CARDS 129 // e.g. 16 inputs, 8 outputs + default entry (MacOS)