bug fix: the command line argument "-c" did not work anymore

This commit is contained in:
Volker Fischer 2013-02-09 21:23:10 +00:00
parent e8e2e8f540
commit 43d3225936
2 changed files with 65 additions and 38 deletions

View File

@ -266,9 +266,8 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
if ( bNewConnectOnStartup ) if ( bNewConnectOnStartup )
{ {
// since the software starts up right now, the previous state was // since the software starts up right now, the previous state was
// "not connected" so that a call to "OnConnectDisconBut()" will // "not connected" so we start the connection
// start the connection ConnectDisconnect ( true, true );
OnConnectDisconBut();
} }
@ -743,10 +742,29 @@ void CLlconClientDlg::OnCLPingTimeWithNumClientsReceived ( CHostAddress InetAddr
iNumClients ); iNumClients );
} }
void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart ) void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart,
const bool bConnectOnStartup )
{ {
// start/stop client, set button text // start/stop client, set button text
if ( bDoStart ) if ( bDoStart )
{
QString strSelectedAddress;
bool bConnectStateOK = false; // init flag
// only show connection dialog if this is not a connection on startup
if ( bConnectOnStartup )
{
// per definition use the last connection (first entry in the
// stored address list)
strSelectedAddress = pClient->vstrIPAddress[0];
// only if address is not empty, start the client
if ( !strSelectedAddress.isEmpty() )
{
bConnectStateOK = true;
}
}
else
{ {
// get the central server address string // get the central server address string
const QString strCurCentServAddr = const QString strCurCentServAddr =
@ -760,7 +778,7 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
// check if state is OK (e.g., no Cancel was pressed) // check if state is OK (e.g., no Cancel was pressed)
if ( ConnectDlg.GetStateOK() ) if ( ConnectDlg.GetStateOK() )
{ {
const QString strSelectedAddress = ConnectDlg.GetSelectedAddress(); strSelectedAddress = ConnectDlg.GetSelectedAddress();
// only store new host address in our data base if the address is // only store new host address in our data base if the address is
// not empty and it was not a server list item (only the addresses // not empty and it was not a server list item (only the addresses
@ -794,6 +812,14 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart )
pClient->vstrIPAddress = vstrTempList; pClient->vstrIPAddress = vstrTempList;
} }
// everything was ok with the connection dialog, set flag
bConnectStateOK = true;
}
}
// only start connection action if the connection state is ok
if ( bConnectStateOK )
{
// set address and check if address is valid // set address and check if address is valid
if ( pClient->SetServerAddr ( strSelectedAddress ) ) if ( pClient->SetServerAddr ( strSelectedAddress ) )
{ {

View File

@ -82,7 +82,8 @@ protected:
void ShowChatWindow(); void ShowChatWindow();
void UpdateAudioFaderSlider(); void UpdateAudioFaderSlider();
void UpdateRevSelection(); void UpdateRevSelection();
void ConnectDisconnect ( const bool bDoStart ); void ConnectDisconnect ( const bool bDoStart,
const bool bConnectOnStartup = false );
CClient* pClient; CClient* pClient;
CSettings* pSettings; CSettings* pSettings;