support for connect on double click a list item

This commit is contained in:
Volker Fischer 2011-04-23 20:41:52 +00:00
parent 7392762f6c
commit 356ecff831
2 changed files with 24 additions and 4 deletions

View file

@ -64,6 +64,11 @@ CConnectDlg::CConnectDlg ( QWidget* parent, Qt::WindowFlags f )
// Connections ------------------------------------------------------------- // Connections -------------------------------------------------------------
// list view
QObject::connect ( ListViewServers,
SIGNAL ( itemDoubleClicked ( QTreeWidgetItem*, int ) ),
this, SLOT ( OnServerListItemDoubleClicked ( QTreeWidgetItem*, int ) ) );
// buttons // buttons
QObject::connect ( CancelButton, SIGNAL ( clicked() ), QObject::connect ( CancelButton, SIGNAL ( clicked() ),
this, SLOT ( OnCancelButtonClicked() ) ); this, SLOT ( OnCancelButtonClicked() ) );
@ -101,6 +106,9 @@ void CConnectDlg::showEvent ( QShowEvent* )
// clear current address // clear current address
strSelectedAddress = ""; strSelectedAddress = "";
// clear server list view
ListViewServers->clear();
// TEST // TEST
QString strNAddr = "llcon.dyndns.org:22122"; QString strNAddr = "llcon.dyndns.org:22122";
@ -157,8 +165,9 @@ void CConnectDlg::OnTimerReRequestServList()
void CConnectDlg::SetServerList ( const CHostAddress& InetAddr, void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
const CVector<CServerInfo>& vecServerInfo ) const CVector<CServerInfo>& vecServerInfo )
{ {
// set flag // set flag and disable timer for resend server list request
bServerListReceived = true; bServerListReceived = true;
TimerReRequestServList.stop();
// first clear list // first clear list
ListViewServers->clear(); ListViewServers->clear();
@ -232,6 +241,16 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS ); TimerPing.start ( PING_UPDATE_TIME_SERVER_LIST_MS );
} }
void CConnectDlg::OnServerListItemDoubleClicked ( QTreeWidgetItem* Item,
int )
{
// if a server list item was double clicked, close dialog and connect
if ( Item != 0 )
{
close();
}
}
void CConnectDlg::OnCancelButtonClicked() void CConnectDlg::OnCancelButtonClicked()
{ {
// set cancel flag // set cancel flag

View file

@ -81,6 +81,7 @@ protected:
bool bCancelPressed; bool bCancelPressed;
public slots: public slots:
void OnServerListItemDoubleClicked ( QTreeWidgetItem* Item, int );
void OnCancelButtonClicked(); void OnCancelButtonClicked();
void OnTimerPing(); void OnTimerPing();
void OnTimerReRequestServList(); void OnTimerReRequestServList();