From cf7a01d231a5b9a910a58732e990a211de6fa360 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 11 Jun 2020 16:42:50 +0200 Subject: [PATCH] add new "slim channel" skin, intended for large ensembles (#339) --- ChangeLog | 1 + src/audiomixerboard.cpp | 46 ++++++++++++++++++------------ src/audiomixerboard.h | 2 ++ src/clientdlg.h | 4 +-- src/clientsettingsdlg.cpp | 54 +++++++++++++++--------------------- src/clientsettingsdlg.h | 2 +- src/clientsettingsdlgbase.ui | 33 +++++++++++----------- src/multicolorledbar.cpp | 43 ++++++++++++++++++---------- src/multicolorledbar.h | 4 +-- src/settings.cpp | 2 +- src/util.h | 3 +- 11 files changed, 104 insertions(+), 90 deletions(-) diff --git a/ChangeLog b/ChangeLog index a28892d3..6df598ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ 3.5.7git +- add new "slim channel" skin, intended for large ensembles (#339) diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 4beaaab7..85036207 100644 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -54,8 +54,8 @@ CChannelFader::CChannelFader ( QWidget* pNW ) QVBoxLayout* pMainGrid = new QVBoxLayout ( pFrame ); QHBoxLayout* pLevelsGrid = new QHBoxLayout ( pLevelsBox ); QVBoxLayout* pMuteSoloGrid = new QVBoxLayout ( pMuteSoloBox ); - QHBoxLayout* pLabelGrid = new QHBoxLayout ( pLabelInstBox ); - QVBoxLayout* pLabelPictGrid = new QVBoxLayout ( ); + pLabelGrid = new QHBoxLayout ( pLabelInstBox ); + pLabelPictGrid = new QVBoxLayout ( ); QVBoxLayout* pPanGrid = new QVBoxLayout ( ); QHBoxLayout* pPanInfoGrid = new QHBoxLayout ( ); @@ -64,7 +64,6 @@ CChannelFader::CChannelFader ( QWidget* pNW ) // setup slider pFader->setPageStep ( 1 ); - pFader->setTickPosition ( QSlider::TicksBothSides ); pFader->setRange ( 0, AUD_MIX_FADER_MAX ); pFader->setTickInterval ( AUD_MIX_FADER_MAX / 9 ); pFader->setMinimumHeight ( 85 ); // if this value is too small, the fader might not be movable with the mouse for fancy skin (#292) @@ -72,7 +71,6 @@ CChannelFader::CChannelFader ( QWidget* pNW ) // setup panning control pPan->setRange ( 0, AUD_MIX_PAN_MAX ); pPan->setValue ( AUD_MIX_PAN_MAX / 2 ); - pPan->setFixedSize ( 50, 50 ); pPan->setNotchesVisible ( true ); pPanInfoGrid->addWidget ( pPanLabel, 0, Qt::AlignLeft ); pPanInfoGrid->addWidget ( pInfoLabel ); @@ -80,12 +78,9 @@ CChannelFader::CChannelFader ( QWidget* pNW ) pPanGrid->addWidget ( pPan, 0, Qt::AlignHCenter ); // setup fader tag label (black bold text which is centered) - plblLabel->setTextFormat ( Qt::PlainText ); - plblLabel->setAlignment ( Qt::AlignHCenter | Qt::AlignVCenter ); - plblLabel->setMinimumHeight ( 40 ); // maximum hight of the instrument+flag pictures - plblLabel->setStyleSheet ( - "QLabel { color: black;" - " font: bold; }" ); + plblLabel->setTextFormat ( Qt::PlainText ); + plblLabel->setAlignment ( Qt::AlignHCenter | Qt::AlignVCenter ); + plblLabel->setStyleSheet ( "QLabel { color: black; font: bold; }" ); // set margins of the layouts to zero to get maximum space for the controls pMainGrid->setContentsMargins ( 0, 0, 0, 0 ); @@ -106,7 +101,7 @@ CChannelFader::CChannelFader ( QWidget* pNW ) pLabelPictGrid->addWidget ( plblInstrument, 0, Qt::AlignHCenter ); pLabelGrid->addLayout ( pLabelPictGrid ); - pLabelGrid->addWidget ( plblLabel, 0, Qt::AlignVCenter ); + pLabelGrid->addWidget ( plblLabel, 0, Qt::AlignVCenter ); // note: just initial add, may be changed later pLevelsGrid->addWidget ( plbrChannelLevel, 0, Qt::AlignRight ); pLevelsGrid->addWidget ( pFader, 0, Qt::AlignLeft ); @@ -188,7 +183,6 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign ) switch ( eNewDesign ) { case GD_ORIGINAL: - // fader pFader->setStyleSheet ( "QSlider { width: 45px;" " border-image: url(:/png/fader/res/faderbackground.png) repeat;" @@ -202,15 +196,34 @@ void CChannelFader::SetGUIDesign ( const EGUIDesign eNewDesign ) " padding-bottom: -15px; }" "QSlider::handle { image: url(:/png/fader/res/faderhandle.png); }" ); + pLabelGrid->addWidget ( plblLabel, 0, Qt::AlignVCenter ); // label next to icons + pLabelInstBox->setMinimumHeight ( 52 ); // maximum hight of the instrument+flag pictures + pPan->setFixedSize ( 50, 50 ); pPanLabel->setText ( tr ( "PAN" ) ); pcbMute->setText ( tr ( "MUTE" ) ); pcbSolo->setText ( tr ( "SOLO" ) ); plbrChannelLevel->SetLevelMeterType ( CMultiColorLEDBar::MT_LED ); break; + case GD_SLIMFADER: + pLabelPictGrid->addWidget ( plblLabel, 0, Qt::AlignHCenter ); // label below icons + pLabelInstBox->setMinimumHeight ( 80 ); // maximum hight of the instrument+flag+label + pPan->setFixedSize ( 28, 28 ); + pFader->setTickPosition ( QSlider::NoTicks ); + pFader->setStyleSheet ( "" ); + pPanLabel->setText ( tr ( "Pan" ) ); + pcbMute->setText ( tr ( "M" ) ); + pcbSolo->setText ( tr ( "S" ) ); + plbrChannelLevel->SetLevelMeterType ( CMultiColorLEDBar::MT_SLIM_BAR ); + break; + default: // reset style sheet and set original paramters + pFader->setTickPosition ( QSlider::TicksBothSides ); pFader->setStyleSheet ( "" ); + pLabelGrid->addWidget ( plblLabel, 0, Qt::AlignVCenter ); // label next to icons + pLabelInstBox->setMinimumHeight ( 52 ); // maximum hight of the instrument+flag pictures + pPan->setFixedSize ( 50, 50 ); pPanLabel->setText ( tr ( "Pan" ) ); pcbMute->setText ( tr ( "Mute" ) ); pcbSolo->setText ( tr ( "Solo" ) ); @@ -241,9 +254,9 @@ void CChannelFader::SetupFaderTag ( const ESkillLevel eSkillLevel ) // setup group box for label/instrument picture: set a thick black border // with nice round edges QString strStile = - "QGroupBox { border: 2px solid black;" - " border-radius: 4px;" - " padding: 3px;"; + "QGroupBox { border: 2px solid black;" + " border-radius: 4px;" + " padding: 3px;"; // the background color depends on the skill level switch ( eSkillLevel ) @@ -356,13 +369,10 @@ void CChannelFader::SetRemoteFaderIsMute ( const bool bIsMute ) { // show orange utf8 SPEAKER WITH CANCELLATION STROKE (U+1F507) pInfoLabel->setText ( "🔇" ); -//QPixmap CancelledSpeakerPixmap ( QString::fromUtf8 ( ":/png/main/res/speakerwithcancellationstroke.png" ) ); -//pInfoLabel->setPixmap ( CancelledSpeakerPixmap.scaled ( 15, 15, Qt::KeepAspectRatio ) ); } else { pInfoLabel->setText ( "" ); -//pInfoLabel->setPixmap ( QPixmap() ); } } diff --git a/src/audiomixerboard.h b/src/audiomixerboard.h index dbfbf5d0..1e955ccd 100644 --- a/src/audiomixerboard.h +++ b/src/audiomixerboard.h @@ -90,6 +90,8 @@ protected: QDial* pPan; QLabel* pPanLabel; QLabel* pInfoLabel; + QHBoxLayout* pLabelGrid; + QVBoxLayout* pLabelPictGrid; QCheckBox* pcbMute; QCheckBox* pcbSolo; diff --git a/src/clientdlg.h b/src/clientdlg.h index 4dbec0b9..2489ed33 100755 --- a/src/clientdlg.h +++ b/src/clientdlg.h @@ -215,9 +215,7 @@ public slots: void OnConnectDlgAccepted(); void OnDisconnected() { Disconnect(); } void OnCentralServerAddressTypeChanged(); - - void OnGUIDesignChanged() - { SetGUIDesign ( pClient->GetGUIDesign() ); } + void OnGUIDesignChanged() { SetGUIDesign ( pClient->GetGUIDesign() ); } void OnDisplayChannelLevelsChanged() { MainMixerBoard->SetDisplayChannelLevels ( pClient->GetDisplayChannelLevels() ); } diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index 084bc4fa..0f0ce05f 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -183,10 +183,10 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, butDriverSetup->setToolTip ( strSndCrdBufDelayTT ); // fancy skin - chbGUIDesignFancy->setWhatsThis ( "" + tr ( "Fancy Skin" ) + ": " + tr ( - "If enabled, a fancy skin will be applied to the main window." ) ); + cbxSkin->setWhatsThis ( "" + tr ( "Skin" ) + ": " + tr ( + "Select the skin to be used for the main window." ) ); - chbGUIDesignFancy->setAccessibleName ( tr ( "Fancy skin check box" ) ); + cbxSkin->setAccessibleName ( tr ( "Skin combo box" ) ); // display channel levels chbDisplayChannelLevels->setWhatsThis ( "" + tr ( "Display Channel Levels" ) + ": " + @@ -312,33 +312,30 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, // init sound card channel selection frame UpdateSoundChannelSelectionFrame(); - // fancy GUI design check box - if ( pClient->GetGUIDesign() == GD_STANDARD ) - { - chbGUIDesignFancy->setCheckState ( Qt::Unchecked ); - } - else - { - chbGUIDesignFancy->setCheckState ( Qt::Checked ); - } - // Display Channel Levels check box chbDisplayChannelLevels->setCheckState ( pClient->GetDisplayChannelLevels() ? Qt::Checked : Qt::Unchecked ); - // "Audio Channels" combo box + // Audio Channels combo box cbxAudioChannels->clear(); cbxAudioChannels->addItem ( tr ( "Mono" ) ); // CC_MONO cbxAudioChannels->addItem ( tr ( "Mono-in/Stereo-out" ) ); // CC_MONO_IN_STEREO_OUT cbxAudioChannels->addItem ( tr ( "Stereo" ) ); // CC_STEREO cbxAudioChannels->setCurrentIndex ( static_cast ( pClient->GetAudioChannels() ) ); - // "Audio Quality" combo box + // Audio Quality combo box cbxAudioQuality->clear(); cbxAudioQuality->addItem ( tr ( "Low" ) ); // AQ_LOW cbxAudioQuality->addItem ( tr ( "Normal" ) ); // AQ_NORMAL cbxAudioQuality->addItem ( tr ( "High" ) ); // AQ_HIGH cbxAudioQuality->setCurrentIndex ( static_cast ( pClient->GetAudioQuality() ) ); + // GUI design (skin) combo box + cbxSkin->clear(); + cbxSkin->addItem ( tr ( "Normal" ) ); // GD_STANDARD + cbxSkin->addItem ( tr ( "Fancy" ) ); // GD_ORIGINAL + cbxSkin->addItem ( tr ( "Slim Channel" ) ); // GD_SLIMFADER + cbxSkin->setCurrentIndex ( static_cast ( pClient->GetGUIDesign() ) ); + // custom central server address edtCentralServerAddress->setText ( pClient->GetServerListCentralServerAddress() ); @@ -380,9 +377,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, this, &CClientSettingsDlg::OnNetBufServerValueChanged ); // check boxes - QObject::connect ( chbGUIDesignFancy, &QCheckBox::stateChanged, - this, &CClientSettingsDlg::OnGUIDesignFancyStateChanged ); - QObject::connect ( chbDisplayChannelLevels, &QCheckBox::stateChanged, this, &CClientSettingsDlg::OnDisplayChannelLevelsStateChanged ); @@ -421,6 +415,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent, QObject::connect ( cbxAudioQuality, static_cast ( &QComboBox::activated ), this, &CClientSettingsDlg::OnAudioQualityActivated ); + QObject::connect ( cbxSkin, static_cast ( &QComboBox::activated ), + this, &CClientSettingsDlg::OnGUIDesignActivated ); + // buttons QObject::connect ( butDriverSetup, &QPushButton::clicked, this, &CClientSettingsDlg::OnDriverSetupClicked ); @@ -639,6 +636,13 @@ void CClientSettingsDlg::OnAudioQualityActivated ( int iQualityIdx ) UpdateDisplay(); // upload rate will be changed } +void CClientSettingsDlg::OnGUIDesignActivated ( int iDesignIdx ) +{ + pClient->SetGUIDesign ( static_cast ( iDesignIdx ) ); + emit GUIDesignChanged(); + UpdateDisplay(); +} + void CClientSettingsDlg::OnAutoJitBufStateChanged ( int value ) { pClient->SetDoAutoSockBufSize ( value == Qt::Checked ); @@ -651,20 +655,6 @@ void CClientSettingsDlg::OnEnableOPUS64StateChanged ( int value ) UpdateDisplay(); } -void CClientSettingsDlg::OnGUIDesignFancyStateChanged ( int value ) -{ - if ( value == Qt::Unchecked ) - { - pClient->SetGUIDesign ( GD_STANDARD ); - } - else - { - pClient->SetGUIDesign ( GD_ORIGINAL ); - } - emit GUIDesignChanged(); - UpdateDisplay(); -} - void CClientSettingsDlg::OnDisplayChannelLevelsStateChanged ( int value ) { pClient->SetDisplayChannelLevels ( value != Qt::Unchecked ); diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 45638fb9..c6327bae 100755 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -87,7 +87,6 @@ protected: void OnNetBufValueChanged ( int value ); void OnNetBufServerValueChanged ( int value ); void OnAutoJitBufStateChanged ( int value ); - void OnGUIDesignFancyStateChanged ( int value ); void OnDisplayChannelLevelsStateChanged ( int value ); void OnEnableOPUS64StateChanged ( int value ); void OnCentralServerAddressEditingFinished(); @@ -100,6 +99,7 @@ protected: void OnROutChanActivated ( int iChanIdx ); void OnAudioChannelsActivated ( int iChanIdx ); void OnAudioQualityActivated ( int iQualityIdx ); + void OnGUIDesignActivated ( int iDesignIdx ); void OnDriverSetupClicked(); signals: diff --git a/src/clientsettingsdlgbase.ui b/src/clientsettingsdlgbase.ui index 7f625fde..40fb9f45 100755 --- a/src/clientsettingsdlgbase.ui +++ b/src/clientsettingsdlgbase.ui @@ -508,6 +508,13 @@ + + + + Skin + + + @@ -532,27 +539,19 @@ + + + - - - - - Fancy Skin - - - - - - - Display Channel Levels - - - - + + + Display Channel Levels + + @@ -726,7 +725,7 @@ cbxAudioChannels cbxAudioQuality edtNewClientLevel - chbGUIDesignFancy + cbxSkin chbDisplayChannelLevels edtCentralServerAddress diff --git a/src/multicolorledbar.cpp b/src/multicolorledbar.cpp index aa29f4f1..5160f66d 100755 --- a/src/multicolorledbar.cpp +++ b/src/multicolorledbar.cpp @@ -62,11 +62,6 @@ CMultiColorLEDBar::CMultiColorLEDBar ( QWidget* parent, Qt::WindowFlags f ) : pProgressBar->setOrientation ( Qt::Vertical ); pProgressBar->setRange ( 0, 100 * NUM_STEPS_LED_BAR ); pProgressBar->setFormat ( "" ); // suppress percent numbers - pProgressBar->setStyleSheet ( - "QProgressBar { margin: 1px;" - " padding: 1px; " - " width: 15px; }" - "QProgressBar::chunk { background: green; }" ); // setup stacked layout for meter type switching mechanism pStackedLayout = new QStackedLayout ( this ); @@ -76,7 +71,7 @@ CMultiColorLEDBar::CMultiColorLEDBar ( QWidget* parent, Qt::WindowFlags f ) : // according to QScrollArea description: "When using a scroll area to display the // contents of a custom widget, it is important to ensure that the size hint of // the child widget is set to a suitable value." - pProgressBar->setMinimumSize ( QSize ( 19, 1 ) ); // 15px + 2 * 1px + 2 * 1px = 19px + pProgressBar->setMinimumSize ( QSize ( 1, 1 ) ); pLEDMeter->setMinimumSize ( QSize ( 1, 1 ) ); // update the meter type (using the default value of the meter type) @@ -131,6 +126,27 @@ void CMultiColorLEDBar::SetLevelMeterType ( const ELevelMeterType eNType ) case MT_BAR: pStackedLayout->setCurrentIndex ( 1 ); + pProgressBar->setStyleSheet ( + "QProgressBar { margin: 1px;" + " padding: 1px; " + " width: 15px; }" + "QProgressBar::chunk { background: green; }" ); + break; + + case MT_SLIM_BAR: + // set all LEDs to disabled, otherwise we would not get our desired small width + for ( int iLEDIdx = 0; iLEDIdx < NUM_STEPS_LED_BAR; iLEDIdx++ ) + { + vecpLEDs[iLEDIdx]->setColor ( cLED::RL_DISABLED ); + } + + pStackedLayout->setCurrentIndex ( 1 ); + pProgressBar->setStyleSheet ( + "QProgressBar { border: 0px;" + " margin: 0px;" + " padding: 0px; " + " width: 4px; }" + "QProgressBar::chunk { background: green; }" ); break; } } @@ -177,6 +193,7 @@ void CMultiColorLEDBar::setValue ( const double dValue ) break; case MT_BAR: + case MT_SLIM_BAR: pProgressBar->setValue ( 100 * dValue ); break; } @@ -184,18 +201,14 @@ void CMultiColorLEDBar::setValue ( const double dValue ) } CMultiColorLEDBar::cLED::cLED ( QWidget* parent ) : - BitmCubeRoundDisabled ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDDisabledSmall.png" ) ), - BitmCubeRoundBlack ( QString::fromUtf8 ( ":/png/LEDs/res/HLEDBlackSmall.png" ) ), - BitmCubeRoundGreen ( QString::fromUtf8 ( ":/png/LEDs/res/HLEDGreenSmall.png" ) ), - BitmCubeRoundYellow ( QString::fromUtf8 ( ":/png/LEDs/res/HLEDYellowSmall.png" ) ), - BitmCubeRoundRed ( QString::fromUtf8 ( ":/png/LEDs/res/HLEDRedSmall.png" ) ) + BitmCubeRoundBlack ( QString::fromUtf8 ( ":/png/LEDs/res/HLEDBlackSmall.png" ) ), + BitmCubeRoundGreen ( QString::fromUtf8 ( ":/png/LEDs/res/HLEDGreenSmall.png" ) ), + BitmCubeRoundYellow ( QString::fromUtf8 ( ":/png/LEDs/res/HLEDYellowSmall.png" ) ), + BitmCubeRoundRed ( QString::fromUtf8 ( ":/png/LEDs/res/HLEDRedSmall.png" ) ) { // create LED label pLEDLabel = new QLabel ( "", parent ); - // bitmap defines minimum size of the label - pLEDLabel->setMinimumSize ( BitmCubeRoundBlack.width(), BitmCubeRoundBlack.height() ); - // set initial bitmap pLEDLabel->setPixmap ( BitmCubeRoundBlack ); eCurLightColor = RL_BLACK; @@ -209,7 +222,7 @@ void CMultiColorLEDBar::cLED::setColor ( const ELightColor eNewColor ) switch ( eNewColor ) { case RL_DISABLED: - pLEDLabel->setPixmap ( BitmCubeRoundDisabled ); + pLEDLabel->setPixmap ( QPixmap() ); break; case RL_BLACK: diff --git a/src/multicolorledbar.h b/src/multicolorledbar.h index 6fbc1019..e64dab12 100755 --- a/src/multicolorledbar.h +++ b/src/multicolorledbar.h @@ -50,7 +50,8 @@ public: enum ELevelMeterType { MT_LED, - MT_BAR + MT_BAR, + MT_SLIM_BAR }; CMultiColorLEDBar ( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); @@ -77,7 +78,6 @@ protected: QLabel* getLabelPointer() { return pLEDLabel; } protected: - QPixmap BitmCubeRoundDisabled; QPixmap BitmCubeRoundBlack; QPixmap BitmCubeRoundGreen; QPixmap BitmCubeRoundYellow; diff --git a/src/settings.cpp b/src/settings.cpp index 793867f9..5fba0ea9 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -269,7 +269,7 @@ void CSettings::Load() // GUI design if ( GetNumericIniSet ( IniXMLDocument, "client", "guidesign", - 0, 1 /* GD_ORIGINAL */, iValue ) ) + 0, 2 /* GD_SLIMFADER */, iValue ) ) { pClient->SetGUIDesign ( static_cast ( iValue ) ); } diff --git a/src/util.h b/src/util.h index aa5fdb0a..c119dcc6 100755 --- a/src/util.h +++ b/src/util.h @@ -549,7 +549,8 @@ enum EGUIDesign { // used for settings -> enum values should be fixed GD_STANDARD = 0, - GD_ORIGINAL = 1 + GD_ORIGINAL = 1, + GD_SLIMFADER = 2 };