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 ( ); QVBoxLayout* pPanGrid = new QVBoxLayout ( );
QHBoxLayout* pPanInfoGrid = new QHBoxLayout ( ); 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 // setup channel level
plbrChannelLevel->setContentsMargins ( 0, 3, 2, 3 ); plbrChannelLevel->setContentsMargins ( 0, 3, 2, 3 );
@ -183,6 +194,9 @@ CChannelFader::CChannelFader ( QWidget* pNW )
QObject::connect ( pcbSolo, &QCheckBox::stateChanged, QObject::connect ( pcbSolo, &QCheckBox::stateChanged,
this, &CChannelFader::soloStateChanged ); this, &CChannelFader::soloStateChanged );
QObject::connect ( pcbGroup, &QCheckBox::stateChanged,
this, &CChannelFader::OnGroupStateChanged );
} }
void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign ) void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign )
@ -319,7 +333,6 @@ void CChannelFader::Reset()
// reset mute/solo/group check boxes and level meter // reset mute/solo/group check boxes and level meter
pcbMute->setChecked ( false ); pcbMute->setChecked ( false );
pcbSolo->setChecked ( false ); pcbSolo->setChecked ( false );
pcbGroup->setChecked ( false );
plbrChannelLevel->SetValue ( 0 ); plbrChannelLevel->SetValue ( 0 );
plbrChannelLevel->ClipReset(); plbrChannelLevel->ClipReset();
@ -341,6 +354,9 @@ void CChannelFader::Reset()
bOtherChannelIsSolo = false; bOtherChannelIsSolo = false;
bIsMyOwnFader = false; bIsMyOwnFader = false;
iGroupID = INVALID_INDEX;
UpdateGroupCheckState();
} }
void CChannelFader::SetFaderLevel ( const double dLevel, void CChannelFader::SetFaderLevel ( const double dLevel,
@ -441,6 +457,49 @@ void CChannelFader::OnMuteStateChanged ( int value )
SetMute ( static_cast<Qt::CheckState> ( value ) == Qt::Checked ); 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 ) void CChannelFader::SetMute ( const bool bState )
{ {
if ( bState ) if ( bState )

View file

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

View file

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