Skip to content

Commit

Permalink
Hide auto select button if there is only one device
Browse files Browse the repository at this point in the history
  • Loading branch information
npostavs committed Nov 4, 2021
1 parent 3861325 commit b4afc90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1198,10 +1198,11 @@ void CClientDlg::Connect ( const QString& strSelectedAddress, const QString& str
catch ( const CGenErr& generr )
{
// show error message and return the function
QMessageBox msgBox ( QMessageBox::Critical, APP_NAME, generr.GetErrorText(),
QMessageBox::NoButton, this );
QMessageBox msgBox ( QMessageBox::Critical, APP_NAME, generr.GetErrorText(), QMessageBox::NoButton, this );
QPushButton* openSettingsButton = msgBox.addButton ( tr ( "Open Settings" ), QMessageBox::ActionRole );
QPushButton* autoSelectButton = msgBox.addButton ( tr ( "Auto Select Device" ), QMessageBox::ActionRole );
// See also CClientSettingsDlg::UpdateSoundDeviceChannelSelectionFrame()
QPushButton* autoSelectButton =
( pClient->GetSndCrdDevNames().count() > 1 ) ? msgBox.addButton ( tr ( "Auto Select Device" ), QMessageBox::ActionRole ) : nullptr;
QPushButton* closeButton = msgBox.addButton ( tr ( "Close" ), QMessageBox::AcceptRole );

msgBox.setTextFormat ( Qt::RichText ); // Some error messages are HTML formatted
Expand Down
3 changes: 3 additions & 0 deletions src/clientsettingsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,9 @@ void CClientSettingsDlg::UpdateSoundDeviceChannelSelectionFrame()
{
cbxSoundcard->addItem ( strDevName );
}
// Selecting devices automatically only makes sense if there is more than
// one to choose from.
butTryLoadAnyDriver->setVisible ( slSndCrdDevNames.count() > 1 );

const QString& sSndCrdName = pClient->GetSndCrdDev();
cbxSoundcard->setCurrentText ( sSndCrdName );
Expand Down

0 comments on commit b4afc90

Please sign in to comment.