Skip to content

Commit 66edab5

Browse files
committed
Revert strError handling
1 parent d7b4b8b commit 66edab5

File tree

6 files changed

+22
-23
lines changed

6 files changed

+22
-23
lines changed

src/channel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ void CChannel::Disconnect()
513513
// (assuming that no audio packet is received in the meantime)
514514
iConTimeOut = 1; // a small number > 0
515515
}
516-
516+
517517
if ( !bIsServer )
518518
{
519519
if ( IsConnected() )

src/channel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class CChannel : public QObject
7676

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

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

src/client.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -618,16 +618,12 @@ QString CClient::SetSndCrdDev ( const QString strNewDev )
618618
Sound.Start();
619619
}
620620

621+
// in case of an error inform the GUI about it
621622
if ( !strError.isEmpty() )
622623
{
623-
// due to error, disconnect
624-
Disconnect();
624+
emit SoundDeviceChanged ( strError );
625625
}
626626

627-
// in case of an error, this will inform the GUI about it
628-
629-
emit SoundDeviceChanged();
630-
631627
return strError;
632628
}
633629

@@ -754,18 +750,8 @@ void CClient::OnSndCrdReinitRequest ( int iSndCrdResetType )
754750
}
755751
MutexDriverReinit.unlock();
756752

757-
if ( !strError.isEmpty() )
758-
{
759-
#ifndef HEADLESS
760-
QMessageBox::critical ( 0, APP_NAME, strError, tr ( "Ok" ) );
761-
#else
762-
qCritical() << qUtf8Printable ( strError );
763-
exit ( 1 );
764-
#endif
765-
}
766-
767753
// inform GUI about the sound card device change
768-
emit SoundDeviceChanged();
754+
emit SoundDeviceChanged ( strError );
769755
}
770756

771757
void CClient::OnHandledSignal ( int sigNum )
@@ -924,7 +910,8 @@ bool CClient::Connect ( QString strServerAddress, QString strServerName )
924910
if ( !Channel.IsEnabled() )
925911
{
926912
// Set server address and connect if valid address was supplied
927-
if ( SetServerAddr ( strServerAddress ) ) {
913+
if ( SetServerAddr ( strServerAddress ) )
914+
{
928915

929916
Start();
930917

src/client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ protected slots:
431431

432432
void Connecting ( QString strServerName );
433433
void Disconnected();
434-
void SoundDeviceChanged();
434+
void SoundDeviceChanged ( QString strError );
435435
void ControllerInFaderLevel ( int iChannelIdx, int iValue );
436436
void ControllerInPanValue ( int iChannelIdx, int iValue );
437437
void ControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo );

src/clientdlg.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,8 +1143,20 @@ void CClientDlg::OnTimerCheckAudioDeviceOk()
11431143

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

1146-
void CClientDlg::OnSoundDeviceChanged()
1146+
void CClientDlg::OnSoundDeviceChanged ( QString strError )
11471147
{
1148+
if ( !strError.isEmpty() )
1149+
{
1150+
// the sound device setup has a problem, disconnect any active connection
1151+
if ( pClient->IsRunning() )
1152+
{
1153+
pClient->Disconnect();
1154+
}
1155+
1156+
// show the error message of the device setup
1157+
QMessageBox::critical ( this, APP_NAME, strError, tr ( "Ok" ), nullptr );
1158+
}
1159+
11481160
// if the check audio device timer is running, it must be restarted on a device change
11491161
if ( TimerCheckAudioDeviceOk.isActive() )
11501162
{

src/clientdlg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public slots:
190190
void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
191191
void OnChatTextReceived ( QString strChatText );
192192
void OnLicenceRequired ( ELicenceType eLicenceType );
193-
void OnSoundDeviceChanged();
193+
void OnSoundDeviceChanged ( QString strError );
194194

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

0 commit comments

Comments
 (0)