@@ -481,6 +481,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
481481
482482 QObject::connect ( pClient, &CClient::Connecting, this , &CClientDlg::OnConnect );
483483
484+ QObject::connect ( pClient, &CClient::ConnectingFailed, this , &CClientDlg::OnConnectingFailed );
485+
484486 QObject::connect ( pClient, &CClient::Disconnected, this , &CClientDlg::OnDisconnect );
485487
486488 QObject::connect ( pClient, &CClient::ChatTextReceived, this , &CClientDlg::OnChatTextReceived );
@@ -738,10 +740,7 @@ void CClientDlg::OnConnectDlgAccepted()
738740 // initiate connection
739741 // TODO: Refactor this for failing call on Connect()
740742
741- if ( pClient->Connect ( strSelectedAddress, strMixerBoardLabel ) )
742- {
743- OnConnect ( strMixerBoardLabel );
744- }
743+ pClient->Connect ( strSelectedAddress, strMixerBoardLabel );
745744
746745 // reset flag
747746 bConnectDlgWasShown = false ;
@@ -751,9 +750,13 @@ void CClientDlg::OnConnectDlgAccepted()
751750void CClientDlg::OnConnectDisconBut ()
752751{
753752 // the connect/disconnect button implements a toggle functionality
754- if ( !pClient->Disconnect () )
753+ if ( pClient->IsRunning () )
754+ {
755+ pClient->Disconnect ();
756+ }
757+ else
755758 {
756- // If the client didn 't disconnect , we assume that we weren't connected. Thus show the connect dialog
759+ // If the client isn 't running , we assume that we weren't connected. Thus show the connect dialog
757760 // TODO: Refactor to have robust error handling
758761 ShowConnectionSetupDialog ();
759762 }
@@ -1221,8 +1224,15 @@ void CClientDlg::OnConnect ( const QString& strMixerBoardLabel )
12211224 }
12221225}
12231226
1227+ void CClientDlg::OnConnectingFailed ( const QString& strError )
1228+ {
1229+ QMessageBox::critical ( this , APP_NAME, strError, " Close" , nullptr );
1230+ }
1231+
12241232void CClientDlg::OnDisconnect ()
12251233{
1234+ // channel.cpp also issues Disconnected()
1235+
12261236 // change connect button text to "connect"
12271237 butConnect->setText ( tr ( " C&onnect" ) );
12281238
0 commit comments