# HG changeset patch # User unc0rr # Date 1302892730 -14400 # Node ID a2ae7702bb759ef3ebaf54e77ac30d64b6e55926 # Parent 7b65e83e261d7c60732d7d5bcdc5a1450d782376 Add 'Cancel connection' button. Fixes issue #162 diff -r 7b65e83e261d -r a2ae7702bb75 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Fri Apr 15 21:36:59 2011 +0400 +++ b/QTfrontend/hwform.cpp Fri Apr 15 22:38:50 2011 +0400 @@ -244,6 +244,8 @@ connect(ui.pageDrawMap->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); + connect(ui.pageConnecting, SIGNAL(cancelConnection()), this, SLOT(GoBack())); + ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini"); ui.pageScheme->setModel(ammoSchemeModel); @@ -550,7 +552,7 @@ if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME) GoBack(); - if (curid == ID_PAGE_ROOMSLIST) NetDisconnect(); + if (curid == ID_PAGE_ROOMSLIST || curid == ID_PAGE_CONNECTING) NetDisconnect(); if (curid == ID_PAGE_NETGAME && hwnet) hwnet->partRoom(); // need to work on this, can cause invalid state for admin quit trying to prevent bad state message on kick //if (curid == ID_PAGE_NETGAME && (!game || game->gameState != gsStarted)) hwnet->partRoom(); diff -r 7b65e83e261d -r a2ae7702bb75 QTfrontend/netudpwidget.cpp --- a/QTfrontend/netudpwidget.cpp Fri Apr 15 21:36:59 2011 +0400 +++ b/QTfrontend/netudpwidget.cpp Fri Apr 15 22:38:50 2011 +0400 @@ -37,7 +37,6 @@ reset(); pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631); - pUdpSocket->writeDatagram("hedgewars client", QHostAddress("127.0.0.1"), 46631); } void HWNetUdpModel::onClientRead() diff -r 7b65e83e261d -r a2ae7702bb75 QTfrontend/pageconnecting.cpp --- a/QTfrontend/pageconnecting.cpp Fri Apr 15 21:36:59 2011 +0400 +++ b/QTfrontend/pageconnecting.cpp Fri Apr 15 22:38:50 2011 +0400 @@ -29,4 +29,9 @@ QLabel * lblConnecting = new QLabel(this); lblConnecting->setText(tr("Connecting...")); pageLayout->addWidget(lblConnecting); + + QPushButton * pbCancel = new QPushButton(this); + pbCancel->setText(tr("Cancel")); + pageLayout->addWidget(pbCancel); + connect(pbCancel, SIGNAL(clicked()), this, SIGNAL(cancelConnection())); } diff -r 7b65e83e261d -r a2ae7702bb75 QTfrontend/pages.h --- a/QTfrontend/pages.h Fri Apr 15 21:36:59 2011 +0400 +++ b/QTfrontend/pages.h Fri Apr 15 22:38:50 2011 +0400 @@ -476,6 +476,9 @@ public: PageConnecting(QWidget* parent = 0); + +signals: + void cancelConnection(); }; class PageScheme : public AbstractPage