Skip to content

Commit

Permalink
Revert strError handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ann0see committed Sep 13, 2024
1 parent d7b4b8b commit 66edab5
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void CChannel::Disconnect()
// (assuming that no audio packet is received in the meantime)
iConTimeOut = 1; // a small number > 0
}

if ( !bIsServer )
{
if ( IsConnected() )
Expand Down
2 changes: 1 addition & 1 deletion src/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CChannel : public QObject

void PrepAndSendPacket ( CHighPrioSocket* pSocket, const CVector<uint8_t>& vecbyNPacket, const int iNPacketLen );

void ResetTimeOutCounter() { iConTimeOut = (bDisconnectAndDisable && !bIsServer) ? 1 : iConTimeOutStartVal; }
void ResetTimeOutCounter() { iConTimeOut = ( bDisconnectAndDisable && !bIsServer ) ? 1 : iConTimeOutStartVal; }
bool IsConnected() const { return iConTimeOut > 0; }
void Disconnect();

Expand Down
23 changes: 5 additions & 18 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,16 +618,12 @@ QString CClient::SetSndCrdDev ( const QString strNewDev )
Sound.Start();
}

// in case of an error inform the GUI about it
if ( !strError.isEmpty() )
{
// due to error, disconnect
Disconnect();
emit SoundDeviceChanged ( strError );
}

// in case of an error, this will inform the GUI about it

emit SoundDeviceChanged();

return strError;
}

Expand Down Expand Up @@ -754,18 +750,8 @@ void CClient::OnSndCrdReinitRequest ( int iSndCrdResetType )
}
MutexDriverReinit.unlock();

if ( !strError.isEmpty() )
{
#ifndef HEADLESS
QMessageBox::critical ( 0, APP_NAME, strError, tr ( "Ok" ) );
#else
qCritical() << qUtf8Printable ( strError );
exit ( 1 );
#endif
}

// inform GUI about the sound card device change
emit SoundDeviceChanged();
emit SoundDeviceChanged ( strError );
}

void CClient::OnHandledSignal ( int sigNum )
Expand Down Expand Up @@ -924,7 +910,8 @@ bool CClient::Connect ( QString strServerAddress, QString strServerName )
if ( !Channel.IsEnabled() )
{
// Set server address and connect if valid address was supplied
if ( SetServerAddr ( strServerAddress ) ) {
if ( SetServerAddr ( strServerAddress ) )
{

Start();

Expand Down
2 changes: 1 addition & 1 deletion src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ protected slots:

void Connecting ( QString strServerName );
void Disconnected();
void SoundDeviceChanged();
void SoundDeviceChanged ( QString strError );
void ControllerInFaderLevel ( int iChannelIdx, int iValue );
void ControllerInPanValue ( int iChannelIdx, int iValue );
void ControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo );
Expand Down
14 changes: 13 additions & 1 deletion src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,8 +1143,20 @@ void CClientDlg::OnTimerCheckAudioDeviceOk()

void CClientDlg::OnTimerDetectFeedback() { bDetectFeedback = false; }

void CClientDlg::OnSoundDeviceChanged()
void CClientDlg::OnSoundDeviceChanged ( QString strError )
{
if ( !strError.isEmpty() )
{
// the sound device setup has a problem, disconnect any active connection
if ( pClient->IsRunning() )
{
pClient->Disconnect();
}

// show the error message of the device setup
QMessageBox::critical ( this, APP_NAME, strError, tr ( "Ok" ), nullptr );
}

// if the check audio device timer is running, it must be restarted on a device change
if ( TimerCheckAudioDeviceOk.isActive() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public slots:
void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void OnChatTextReceived ( QString strChatText );
void OnLicenceRequired ( ELicenceType eLicenceType );
void OnSoundDeviceChanged();
void OnSoundDeviceChanged ( QString strError );

void OnChangeChanGain ( int iId, float fGain, bool bIsMyOwnFader ) { pClient->SetRemoteChanGain ( iId, fGain, bIsMyOwnFader ); }

Expand Down

0 comments on commit 66edab5

Please sign in to comment.