Skip to content

Commit 977aaf5

Browse files
committed
Channel Selection Buttons
1 parent d86b804 commit 977aaf5

File tree

5 files changed

+180
-1
lines changed

5 files changed

+180
-1
lines changed

src/clientdlg.cpp

+78
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,23 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
263263
lblGlobalInfoLabel->setStyleSheet ( ".QLabel { background: red; }" );
264264
lblGlobalInfoLabel->hide();
265265

266+
// prepare Mute Myself push button (invisible by default)
267+
butGlobalInfoButton->hide();
268+
269+
// setup shortcut for Left, Center, Right and Mute button only NumPad numbers accepted
270+
chbLocalMute->setShortcut ( Qt::Key_0 + Qt::KeypadModifier );
271+
butPanSelL->setShortcut ( Qt::Key_1 + Qt::KeypadModifier );
272+
butPanSelC->setShortcut ( Qt::Key_2 + Qt::KeypadModifier );
273+
butPanSelR->setShortcut ( Qt::Key_3 + Qt::KeypadModifier );
274+
266275
// prepare update check info label (invisible by default)
267276
lblUpdateCheck->setOpenExternalLinks ( true ); // enables opening a web browser if one clicks on a html link
268277
lblUpdateCheck->setText ( "<font color=\"red\"><b>" + APP_UPGRADE_AVAILABLE_MSG_TEXT.arg ( APP_NAME ).arg ( VERSION ) + "</b></font>" );
269278
lblUpdateCheck->hide();
270279

280+
// init buttons, based on saved settings
281+
ButtonUpdate();
282+
271283
// setup timers
272284
TimerCheckAudioDeviceOk.setSingleShot ( true ); // only check once after connection
273285
TimerDetectFeedback.setSingleShot ( true );
@@ -443,6 +455,14 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
443455
// push buttons
444456
QObject::connect ( butConnect, &QPushButton::clicked, this, &CClientDlg::OnConnectDisconBut );
445457

458+
QObject::connect ( butGlobalInfoButton, &QPushButton::clicked, this, &CClientDlg::OnLocalMuteButtonClicked );
459+
460+
QObject::connect ( butPanSelL, &QPushButton::clicked, this, &CClientDlg::OnButtonPanSelLClicked );
461+
462+
QObject::connect ( butPanSelC, &QPushButton::clicked, this, &CClientDlg::OnButtonPanSelCClicked );
463+
464+
QObject::connect ( butPanSelR, &QPushButton::clicked, this, &CClientDlg::OnButtonPanSelRClicked );
465+
446466
// check boxes
447467
QObject::connect ( chbSettings, &QCheckBox::stateChanged, this, &CClientDlg::OnSettingsStateChanged );
448468

@@ -539,6 +559,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
539559

540560
QObject::connect ( &ConnectDlg, &CConnectDlg::ReqServerListQuery, this, &CClientDlg::OnReqServerListQuery );
541561

562+
QObject::connect ( &ClientSettingsDlg, &CClientSettingsDlg::PanFaderChanged, this, &CClientDlg::ButtonUpdate );
563+
542564
// note that this connection must be a queued connection, otherwise the server list ping
543565
// times are not accurate and the client list may not be retrieved for all servers listed
544566
// (it seems the sendto() function needs to be called from different threads to fire the
@@ -1036,10 +1058,12 @@ void CClientDlg::OnLocalMuteStateChanged ( int value )
10361058
if ( value == Qt::Checked )
10371059
{
10381060
lblGlobalInfoLabel->show();
1061+
// butGlobalInfoButton->show();
10391062
}
10401063
else
10411064
{
10421065
lblGlobalInfoLabel->hide();
1066+
// butGlobalInfoButton->hide();
10431067
}
10441068
}
10451069

@@ -1354,6 +1378,16 @@ void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign )
13541378
"QCheckBox { color: rgb(220, 220, 220);"
13551379
" font: bold; }" );
13561380

1381+
butPanSelC->setStyleSheet ( ":disabled {background-color: rgb(77, 171, 204); color: rgb(220, 220, 220); font: bold;}" );
1382+
butPanSelL->setStyleSheet ( ":disabled {background-color: rgb(77, 171, 204); color: rgb(220, 220, 220); font: bold;}" );
1383+
butPanSelR->setStyleSheet ( ":disabled {background-color: rgb(77, 171, 204); color: rgb(220, 220, 220); font: bold;}" );
1384+
1385+
butGlobalInfoButton->setStyleSheet ( "background: red;"
1386+
"border: none;"
1387+
"padding-left: 6px;"
1388+
"padding-right: 6px;"
1389+
"color: rgb(220, 220, 220);"
1390+
"font: bold;" );
13571391
#ifdef _WIN32
13581392
// Workaround QT-Windows problem: This should not be necessary since in the
13591393
// background frame the style sheet for QRadioButton was already set. But it
@@ -1372,6 +1406,14 @@ void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign )
13721406
default:
13731407
// reset style sheet and set original parameters
13741408
backgroundFrame->setStyleSheet ( "" );
1409+
butGlobalInfoButton->setStyleSheet ( "background: red;"
1410+
"border: none;"
1411+
"padding-left: 6px;"
1412+
"padding-right: 6px;" );
1413+
1414+
butPanSelC->setStyleSheet ( ":disabled {background-color: rgb(196, 196, 196); color: rgb(0, 0, 0)}" );
1415+
butPanSelL->setStyleSheet ( ":disabled {background-color: rgb(196, 196, 196); color: rgb(0, 0, 0)}" );
1416+
butPanSelR->setStyleSheet ( ":disabled {background-color: rgb(196, 196, 196); color: rgb(0, 0, 0)}" );
13751417

13761418
#ifdef _WIN32
13771419
// Workaround QT-Windows problem: See above description
@@ -1493,3 +1535,39 @@ void CClientDlg::SetPingTime ( const int iPingTime, const int iOverallDelayMs, c
14931535
// set current LED status
14941536
ledDelay->SetLight ( eOverallDelayLEDColor );
14951537
}
1538+
1539+
void CClientDlg::ButtonUpdate()
1540+
{
1541+
int value = pClient->GetAudioInFader();
1542+
1543+
switch ( value )
1544+
{
1545+
case AUD_FADER_IN_MIDDLE:
1546+
// level is C so disable Center button, enable L and R
1547+
butPanSelL->setEnabled ( true );
1548+
butPanSelC->setEnabled ( false );
1549+
butPanSelR->setEnabled ( true );
1550+
break;
1551+
1552+
case AUD_FADER_IN_MIN:
1553+
// right channel only
1554+
butPanSelL->setEnabled ( false );
1555+
butPanSelC->setEnabled ( true );
1556+
butPanSelR->setEnabled ( true );
1557+
break;
1558+
1559+
case AUD_FADER_IN_MAX:
1560+
// left channel oonly
1561+
butPanSelL->setEnabled ( true );
1562+
butPanSelC->setEnabled ( true );
1563+
butPanSelR->setEnabled ( false );
1564+
break;
1565+
1566+
default:
1567+
// not L, C or R so enable all buttons
1568+
butPanSelL->setEnabled ( true );
1569+
butPanSelC->setEnabled ( true );
1570+
butPanSelR->setEnabled ( true );
1571+
break;
1572+
}
1573+
}

src/clientdlg.h

+7
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ class CClientDlg : public CBaseDlg, private Ui_CClientDlgBase
127127
CAnalyzerConsole AnalyzerConsole;
128128

129129
public slots:
130+
void ButtonUpdate();
131+
130132
void OnConnectDisconBut();
131133
void OnTimerSigMet();
132134
void OnTimerBuffersLED();
@@ -180,6 +182,11 @@ public slots:
180182
void OnChatStateChanged ( int value );
181183
void OnLocalMuteStateChanged ( int value );
182184

185+
void OnLocalMuteButtonClicked() { chbLocalMute->setChecked ( false ); }
186+
void OnButtonPanSelLClicked() { ClientSettingsDlg.SetSliderAudioPan ( AUD_FADER_IN_MIN ); }
187+
void OnButtonPanSelCClicked() { ClientSettingsDlg.SetSliderAudioPan ( AUD_FADER_IN_MIDDLE ); }
188+
void OnButtonPanSelRClicked() { ClientSettingsDlg.SetSliderAudioPan ( AUD_FADER_IN_MAX ); }
189+
183190
void OnAudioReverbValueChanged ( int value ) { pClient->SetReverbLevel ( value ); }
184191

185192
void OnReverbSelLClicked() { pClient->SetReverbOnLeftChan ( true ); }

src/clientdlgbase.ui

+89
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,95 @@
549549
</item>
550550
</layout>
551551
</item>
552+
<item>
553+
<layout class="QVBoxLayout" name="verticalLayout_31">
554+
<property name="spacing">
555+
<number>6</number>
556+
</property>
557+
<item>
558+
<widget class="QPushButton" name="butPanSelL">
559+
<property name="enabled">
560+
<bool>true</bool>
561+
</property>
562+
<property name="minimumSize">
563+
<size>
564+
<width>0</width>
565+
<height>140</height>
566+
</size>
567+
</property>
568+
<property name="autoFillBackground">
569+
<bool>false</bool>
570+
</property>
571+
<property name="text">
572+
<string>Left</string>
573+
</property>
574+
<property name="checkable">
575+
<bool>false</bool>
576+
</property>
577+
<property name="checked">
578+
<bool>false</bool>
579+
</property>
580+
<property name="autoDefault">
581+
<bool>false</bool>
582+
</property>
583+
</widget>
584+
</item>
585+
<item>
586+
<widget class="QPushButton" name="butPanSelC">
587+
<property name="minimumSize">
588+
<size>
589+
<width>0</width>
590+
<height>140</height>
591+
</size>
592+
</property>
593+
<property name="text">
594+
<string>Center</string>
595+
</property>
596+
<property name="checkable">
597+
<bool>false</bool>
598+
</property>
599+
<property name="autoDefault">
600+
<bool>false</bool>
601+
</property>
602+
</widget>
603+
</item>
604+
<item>
605+
<widget class="QPushButton" name="butPanSelR">
606+
<property name="minimumSize">
607+
<size>
608+
<width>0</width>
609+
<height>140</height>
610+
</size>
611+
</property>
612+
<property name="text">
613+
<string>Right</string>
614+
</property>
615+
<property name="checkable">
616+
<bool>false</bool>
617+
</property>
618+
<property name="autoDefault">
619+
<bool>false</bool>
620+
</property>
621+
</widget>
622+
</item>
623+
</layout>
624+
</item>
625+
<item>
626+
<widget class="QPushButton" name="butGlobalInfoButton">
627+
<property name="sizePolicy">
628+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
629+
<horstretch>0</horstretch>
630+
<verstretch>0</verstretch>
631+
</sizepolicy>
632+
</property>
633+
<property name="text">
634+
<string>MUTED (Other people won't hear you)</string>
635+
</property>
636+
<property name="flat">
637+
<bool>true</bool>
638+
</property>
639+
</widget>
640+
</item>
552641
<item>
553642
<layout class="QVBoxLayout" name="verticalLayout">
554643
<item>

src/clientsettingsdlg.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1176,10 +1176,13 @@ void CClientSettingsDlg::UpdateAudioFaderSlider()
11761176
lblAudioPanValue->setText ( tr ( "R" ) + " -" + QString().setNum ( AUD_FADER_IN_MIDDLE - iCurAudInFader ) );
11771177
}
11781178
}
1179+
emit PanFaderChanged();
11791180
}
11801181

11811182
void CClientSettingsDlg::OnAudioPanValueChanged ( int value )
11821183
{
11831184
pClient->SetAudioInFader ( value );
11841185
UpdateAudioFaderSlider();
11851186
}
1187+
1188+
void CClientSettingsDlg::SetSliderAudioPan ( int value ) { sldAudioPan->setValue ( value ); }

src/clientsettingsdlg.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class CClientSettingsDlg : public CBaseDlg, private Ui_CClientSettingsDlgBase
6666
void UpdateJitterBufferFrame();
6767
void UpdateSoundCardFrame();
6868
void UpdateDirectoryServerComboBox();
69-
void UpdateAudioFaderSlider();
7069
QString GenSndCrdBufferDelayString ( const int iFrameSize, const QString strAddText = "" );
7170

7271
virtual void showEvent ( QShowEvent* );
@@ -77,6 +76,7 @@ class CClientSettingsDlg : public CBaseDlg, private Ui_CClientSettingsDlgBase
7776
QButtonGroup SndCrdBufferDelayButtonGroup;
7877

7978
public slots:
79+
void UpdateAudioFaderSlider();
8080
void OnTimerStatus() { UpdateDisplay(); }
8181
void OnNetBufValueChanged ( int value );
8282
void OnNetBufServerValueChanged ( int value );
@@ -105,6 +105,7 @@ public slots:
105105
void OnTabChanged();
106106
void OnMakeTabChange ( int iTabIdx );
107107
void OnAudioPanValueChanged ( int value );
108+
void SetSliderAudioPan ( int value );
108109

109110
#if defined( _WIN32 ) && !defined( WITH_JACK )
110111
// Only include this slot for Windows when JACK is NOT used
@@ -117,4 +118,5 @@ public slots:
117118
void AudioChannelsChanged();
118119
void CustomDirectoriesChanged();
119120
void NumMixerPanelRowsChanged ( int value );
121+
void PanFaderChanged();
120122
};

0 commit comments

Comments
 (0)