Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor UpdateDisplay() to call UpdateUploadRate() #3369

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions src/clientsettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,25 +1063,31 @@ void CClientSettingsDlg::OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton
UpdateDisplay();
}

/// @method
Copy link
Member Author

@ann0see ann0see Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably no need to add @ method here.

/// @brief Sets upstream rate label to current upload rate if the client is connected, else resets label
void CClientSettingsDlg::UpdateUploadRate()
{
// update upstream rate information label
lblUpstreamValue->setText ( QString().setNum ( pClient->GetUploadRateKbps() ) );
lblUpstreamUnit->setText ( "kbps" );
// update upstream rate information label if needed
if ( pClient->IsConnected() )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is

bool IsConnected() { return Channel.IsConnected(); }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's from https://github.com/jamulussoftware/jamulus/pull/2550/files#diff-d5cde46c72d0c085d1d2c0ca59957407b17931c2f194a33268b3535169006629R1042

A potential semantic change. Probably worth reverting to IsRunning() unless proven to be incorrect.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to hear a second OK/not OK from someone nevertheless.

{
lblUpstreamValue->setText ( QString().setNum ( pClient->GetUploadRateKbps() ) );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is

int GetUploadRateKbps() { return Channel.GetUploadRateKbps(); }

So it makes far more sense to check the Channel.IsConnected().

But really, it's down to the audio settings, nothing to do with whether a sound card is connected or a server is connected:
image
It can be computed from those values, I think. (But it's probably the Channel that gets passed the values to do the computation - it gets passed uncompressed audio and does the number crunching.)

lblUpstreamUnit->setText ( "kbps" );
}
else
{
// clear text labels with client parameters
lblUpstreamValue->setText ( "---" );
lblUpstreamUnit->setText ( "" );
}
}

/// @method
/// @brief Updates slider controls (settings might have been changed) and upstream rate information label
void CClientSettingsDlg::UpdateDisplay()
{
// update slider controls (settings might have been changed)
UpdateJitterBufferFrame();
UpdateSoundCardFrame();

if ( !pClient->IsRunning() )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is

bool IsRunning() { return Sound.IsRunning(); }

{
// clear text labels with client parameters
lblUpstreamValue->setText ( "---" );
lblUpstreamUnit->setText ( "" );
}
UpdateUploadRate();
}

void CClientSettingsDlg::UpdateDirectoryComboBox()
Expand Down
Loading