bug fix: the welcome message may appear twice if a list item of the server list was double clicked

This commit is contained in:
Volker Fischer 2020-04-13 07:46:28 +02:00
parent 765cb7d266
commit 5d63aa590f
2 changed files with 64 additions and 52 deletions

View file

@ -36,6 +36,7 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
QDialog ( parent, f ), QDialog ( parent, f ),
pClient ( pNCliP ), pClient ( pNCliP ),
pSettings ( pNSetP ), pSettings ( pNSetP ),
bConnectDlgWasShown ( false ),
ClientSettingsDlg ( pNCliP, parent, Qt::Window ), ClientSettingsDlg ( pNCliP, parent, Qt::Window ),
ChatDlg ( parent, Qt::Window ), ChatDlg ( parent, Qt::Window ),
ConnectDlg ( bNewShowComplRegConnList, parent, Qt::Dialog ), ConnectDlg ( bNewShowComplRegConnList, parent, Qt::Dialog ),
@ -653,6 +654,11 @@ void CClientDlg::OnAudioPanValueChanged ( int value )
} }
void CClientDlg::OnConnectDlgAccepted() void CClientDlg::OnConnectDlgAccepted()
{
// We had an issue that the accepted signal was emit twice if a list item was double
// clicked in the connect dialog. To avoid this we introduced a flag which makes sure
// we process the accepted signal only once after the dialog was initially shown.
if ( bConnectDlgWasShown )
{ {
// get the address from the connect dialog // get the address from the connect dialog
QString strSelectedAddress = ConnectDlg.GetSelectedAddress(); QString strSelectedAddress = ConnectDlg.GetSelectedAddress();
@ -704,6 +710,10 @@ void CClientDlg::OnConnectDlgAccepted()
// initiate connection // initiate connection
Connect ( strSelectedAddress, strMixerBoardLabel ); Connect ( strSelectedAddress, strMixerBoardLabel );
// reset flag
bConnectDlgWasShown = false;
}
} }
void CClientDlg::OnConnectDisconBut() void CClientDlg::OnConnectDisconBut()
@ -836,6 +846,7 @@ void CClientDlg::ShowConnectionSetupDialog()
pClient->GetServerListCentralServerAddress() ) ); pClient->GetServerListCentralServerAddress() ) );
// show connect dialog // show connect dialog
bConnectDlgWasShown = true;
ConnectDlg.show(); ConnectDlg.show();
// make sure dialog is upfront and has focus // make sure dialog is upfront and has focus

View file

@ -96,6 +96,7 @@ protected:
CSettings* pSettings; CSettings* pSettings;
bool bConnected; bool bConnected;
bool bConnectDlgWasShown;
QTimer TimerSigMet; QTimer TimerSigMet;
QTimer TimerBuffersLED; QTimer TimerBuffersLED;
QTimer TimerStatus; QTimer TimerStatus;