support for cancel button

This commit is contained in:
Volker Fischer 2011-04-23 16:00:42 +00:00
parent 398a00ba73
commit 4e593c4baa
2 changed files with 19 additions and 2 deletions

View file

@ -63,6 +63,10 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
// Connections ------------------------------------------------------------- // Connections -------------------------------------------------------------
// buttons
QObject::connect ( CancelButton, SIGNAL ( clicked() ),
this, SLOT ( OnCancelButtonClicked() ) );
// line edits // line edits
QObject::connect ( LineEditServerAddr, SIGNAL ( editTextChanged ( const QString ) ), QObject::connect ( LineEditServerAddr, SIGNAL ( editTextChanged ( const QString ) ),
this, SLOT ( OnLineEditServerAddrTextChanged ( const QString ) ) ); this, SLOT ( OnLineEditServerAddrTextChanged ( const QString ) ) );
@ -70,6 +74,7 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
QObject::connect ( LineEditServerAddr, SIGNAL ( activated ( int ) ), QObject::connect ( LineEditServerAddr, SIGNAL ( activated ( int ) ),
this, SLOT ( OnLineEditServerAddrActivated ( int ) ) ); this, SLOT ( OnLineEditServerAddrActivated ( int ) ) );
// timers // timers
QObject::connect ( &TimerPing, SIGNAL ( timeout() ), QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
this, SLOT ( OnTimerPing() ) ); this, SLOT ( OnTimerPing() ) );
@ -92,9 +97,10 @@ void CConnectDlg::LoadStoredServers ( const CVector<QString>& vstrIPAddress )
void CConnectDlg::showEvent ( QShowEvent* ) void CConnectDlg::showEvent ( QShowEvent* )
{ {
// reset flag (on opening the connect dialg, we always want to request a new // reset flags (on opening the connect dialg, we always want to request a
// updated server list per definition) // new updated server list per definition)
bServerListReceived = false; bServerListReceived = false;
bCancelPressed = false;
// TEST // TEST
@ -233,6 +239,15 @@ void CConnectDlg::OnLineEditServerAddrTextChanged ( const QString )
} }
} }
void CConnectDlg::OnCancelButtonClicked()
{
// set cancel flag
bCancelPressed = true;
// close dialog
close();
}
void CConnectDlg::OnLineEditServerAddrActivated ( int index ) void CConnectDlg::OnLineEditServerAddrActivated ( int index )
{ {
// move activated list item to the top // move activated list item to the top

View file

@ -73,8 +73,10 @@ protected:
QTimer TimerReRequestServList; QTimer TimerReRequestServList;
CHostAddress CentralServerAddress; CHostAddress CentralServerAddress;
bool bServerListReceived; bool bServerListReceived;
bool bCancelPressed;
public slots: public slots:
void OnCancelButtonClicked();
void OnLineEditServerAddrTextChanged ( const QString ); void OnLineEditServerAddrTextChanged ( const QString );
void OnLineEditServerAddrActivated ( int index ); void OnLineEditServerAddrActivated ( int index );
void OnTimerPing(); void OnTimerPing();