bug fix: the welcome message may appear twice if a list item of the server list was double clicked
This commit is contained in:
parent
765cb7d266
commit
5d63aa590f
2 changed files with 64 additions and 52 deletions
|
@ -33,14 +33,15 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
|
||||||
const bool bShowAnalyzerConsole,
|
const bool bShowAnalyzerConsole,
|
||||||
QWidget* parent,
|
QWidget* parent,
|
||||||
Qt::WindowFlags f ) :
|
Qt::WindowFlags f ) :
|
||||||
QDialog ( parent, f ),
|
QDialog ( parent, f ),
|
||||||
pClient ( pNCliP ),
|
pClient ( pNCliP ),
|
||||||
pSettings ( pNSetP ),
|
pSettings ( pNSetP ),
|
||||||
ClientSettingsDlg ( pNCliP, parent, Qt::Window ),
|
bConnectDlgWasShown ( false ),
|
||||||
ChatDlg ( parent, Qt::Window ),
|
ClientSettingsDlg ( pNCliP, parent, Qt::Window ),
|
||||||
ConnectDlg ( bNewShowComplRegConnList, parent, Qt::Dialog ),
|
ChatDlg ( parent, Qt::Window ),
|
||||||
AnalyzerConsole ( pNCliP, parent, Qt::Window ),
|
ConnectDlg ( bNewShowComplRegConnList, parent, Qt::Dialog ),
|
||||||
MusicianProfileDlg ( pNCliP, parent )
|
AnalyzerConsole ( pNCliP, parent, Qt::Window ),
|
||||||
|
MusicianProfileDlg ( pNCliP, parent )
|
||||||
{
|
{
|
||||||
setupUi ( this );
|
setupUi ( this );
|
||||||
|
|
||||||
|
@ -654,56 +655,65 @@ void CClientDlg::OnAudioPanValueChanged ( int value )
|
||||||
|
|
||||||
void CClientDlg::OnConnectDlgAccepted()
|
void CClientDlg::OnConnectDlgAccepted()
|
||||||
{
|
{
|
||||||
// get the address from the connect dialog
|
// We had an issue that the accepted signal was emit twice if a list item was double
|
||||||
QString strSelectedAddress = ConnectDlg.GetSelectedAddress();
|
// 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.
|
||||||
// only store new host address in our data base if the address is
|
if ( bConnectDlgWasShown )
|
||||||
// not empty and it was not a server list item (only the addresses
|
|
||||||
// typed in manually are stored by definition)
|
|
||||||
if ( !strSelectedAddress.isEmpty() &&
|
|
||||||
!ConnectDlg.GetServerListItemWasChosen() )
|
|
||||||
{
|
{
|
||||||
// store new address at the top of the list, if the list was already
|
// get the address from the connect dialog
|
||||||
// full, the last element is thrown out
|
QString strSelectedAddress = ConnectDlg.GetSelectedAddress();
|
||||||
pClient->vstrIPAddress.StringFiFoWithCompare ( strSelectedAddress );
|
|
||||||
}
|
|
||||||
|
|
||||||
// get name to be set in audio mixer group box title
|
// only store new host address in our data base if the address is
|
||||||
QString strMixerBoardLabel;
|
// not empty and it was not a server list item (only the addresses
|
||||||
|
// typed in manually are stored by definition)
|
||||||
if ( ConnectDlg.GetServerListItemWasChosen() )
|
if ( !strSelectedAddress.isEmpty() &&
|
||||||
{
|
!ConnectDlg.GetServerListItemWasChosen() )
|
||||||
// in case a server in the server list was chosen,
|
|
||||||
// display the server name of the server list
|
|
||||||
strMixerBoardLabel = ConnectDlg.GetSelectedServerName();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// an item of the server address combo box was chosen,
|
|
||||||
// just show the address string as it was entered by the
|
|
||||||
// user
|
|
||||||
strMixerBoardLabel = strSelectedAddress;
|
|
||||||
|
|
||||||
// special case: if the address is empty, we substitude the default
|
|
||||||
// central server address so that a user which just pressed the connect
|
|
||||||
// button without selecting an item in the table or manually entered an
|
|
||||||
// address gets a successful connection
|
|
||||||
if ( strSelectedAddress.isEmpty() )
|
|
||||||
{
|
{
|
||||||
strSelectedAddress = DEFAULT_SERVER_ADDRESS;
|
// store new address at the top of the list, if the list was already
|
||||||
strMixerBoardLabel = DEFAULT_SERVER_NAME;
|
// full, the last element is thrown out
|
||||||
|
pClient->vstrIPAddress.StringFiFoWithCompare ( strSelectedAddress );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// first check if we are already connected, if this is the case we have to
|
// get name to be set in audio mixer group box title
|
||||||
// disconnect the old server first
|
QString strMixerBoardLabel;
|
||||||
if ( pClient->IsRunning() )
|
|
||||||
{
|
|
||||||
Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
// initiate connection
|
if ( ConnectDlg.GetServerListItemWasChosen() )
|
||||||
Connect ( strSelectedAddress, strMixerBoardLabel );
|
{
|
||||||
|
// in case a server in the server list was chosen,
|
||||||
|
// display the server name of the server list
|
||||||
|
strMixerBoardLabel = ConnectDlg.GetSelectedServerName();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// an item of the server address combo box was chosen,
|
||||||
|
// just show the address string as it was entered by the
|
||||||
|
// user
|
||||||
|
strMixerBoardLabel = strSelectedAddress;
|
||||||
|
|
||||||
|
// special case: if the address is empty, we substitude the default
|
||||||
|
// central server address so that a user which just pressed the connect
|
||||||
|
// button without selecting an item in the table or manually entered an
|
||||||
|
// address gets a successful connection
|
||||||
|
if ( strSelectedAddress.isEmpty() )
|
||||||
|
{
|
||||||
|
strSelectedAddress = DEFAULT_SERVER_ADDRESS;
|
||||||
|
strMixerBoardLabel = DEFAULT_SERVER_NAME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// first check if we are already connected, if this is the case we have to
|
||||||
|
// disconnect the old server first
|
||||||
|
if ( pClient->IsRunning() )
|
||||||
|
{
|
||||||
|
Disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
// initiate connection
|
||||||
|
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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue