Skip to content

Commit c710c60

Browse files
pgScorpioann0see
andcommitted
Refactor UpdateDisplay() to call UpdateUploadRate()
Extracted from: jamulussoftware#2550 Related to: https://github.com/jamulussoftware/jamulus/pull/3364/files/21815c1a0708979fe0414c30e0294feaa7632be3#r1759185427 Co-authored-by: ann0see <[email protected]>
1 parent 5227d1c commit c710c60

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/clientsettingsdlg.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,25 +1063,31 @@ void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton
10631063
UpdateDisplay();
10641064
}
10651065

1066+
/// @method
1067+
/// @brief Sets upstream rate label to current upload rate if the client is connected, else resets label
10661068
void CClientSettingsDlg::UpdateUploadRate()
10671069
{
1068-
// update upstream rate information label
1069-
lblUpstreamValue->setText ( QString().setNum ( pClient->GetUploadRateKbps() ) );
1070-
lblUpstreamUnit->setText ( "kbps" );
1070+
// update upstream rate information label if needed
1071+
if ( pClient->IsConnected() )
1072+
{
1073+
lblUpstreamValue->setText ( QString().setNum ( pClient->GetUploadRateKbps() ) );
1074+
lblUpstreamUnit->setText ( "kbps" );
1075+
}
1076+
else
1077+
{
1078+
// clear text labels with client parameters
1079+
lblUpstreamValue->setText ( "---" );
1080+
lblUpstreamUnit->setText ( "" );
1081+
}
10711082
}
10721083

1084+
/// @method
1085+
/// @brief Updates slider controls (settings might have been changed) and upstream rate information label
10731086
void CClientSettingsDlg::UpdateDisplay()
10741087
{
1075-
// update slider controls (settings might have been changed)
10761088
UpdateJitterBufferFrame();
10771089
UpdateSoundCardFrame();
1078-
1079-
if ( !pClient->IsRunning() )
1080-
{
1081-
// clear text labels with client parameters
1082-
lblUpstreamValue->setText ( "---" );
1083-
lblUpstreamUnit->setText ( "" );
1084-
}
1090+
UpdateUploadRate();
10851091
}
10861092

10871093
void CClientSettingsDlg::UpdateDirectoryComboBox()

0 commit comments

Comments
 (0)