Fix some bugs
authorunc0rr
Sun, 09 Dec 2007 17:16:15 +0000
changeset 638 e1cc516488f2
parent 637 8fa7ed5e13bd
child 639 69d7ff3ab6f0
Fix some bugs
QTfrontend/netudpwidget.cpp
QTfrontend/netwwwwidget.cpp
QTfrontend/pages.cpp
--- a/QTfrontend/netudpwidget.cpp	Sun Dec 09 14:12:01 2007 +0000
+++ b/QTfrontend/netudpwidget.cpp	Sun Dec 09 17:16:15 2007 +0000
@@ -28,7 +28,6 @@
 
   pUdpSocket->bind();
   connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead()));
-  updateList();
 }
 
 void HWNetUdpWidget::updateList()
--- a/QTfrontend/netwwwwidget.cpp	Sun Dec 09 14:12:01 2007 +0000
+++ b/QTfrontend/netwwwwidget.cpp	Sun Dec 09 17:16:15 2007 +0000
@@ -18,7 +18,7 @@
 
 #include <QHttp>
 #include <QListWidget>
-#include <QMessageBox>
+#include <QDebug>
 
 #include "netwwwwidget.h"
 #include "hwconsts.h"
@@ -33,8 +33,6 @@
 
 void HWNetWwwWidget::updateList()
 {
-	http->abort();
-
 	QString request = QString("protocol_version=%1")
 			.arg(*cProtoVer);
 	http->post("/games/list_games", request.toUtf8());
@@ -46,8 +44,9 @@
 {
 	if (error)
 	{
-		QMessageBox::critical(this, tr("Error"), http->errorString());
+		qDebug() << "Error" << http->errorString();
 		return;
 	}
+	serversList->clear();
 	serversList->addItem(http->readAll());
 }
--- a/QTfrontend/pages.cpp	Sun Dec 09 14:12:01 2007 +0000
+++ b/QTfrontend/pages.cpp	Sun Dec 09 17:16:15 2007 +0000
@@ -493,13 +493,18 @@
 	if (netServersWidget) delete netServersWidget;
 
 	if (rbLocalGame->isChecked())
+	{
 		netServersWidget = new HWNetUdpWidget(ConnGroupBox);
+		static_cast<HWNetUdpWidget *>(netServersWidget)->updateList();
+	}
 	else
+	{
 		netServersWidget = new HWNetWwwWidget(ConnGroupBox);
+		static_cast<HWNetWwwWidget *>(netServersWidget)->updateList();
+	}
 	GBClayout->addWidget(netServersWidget, 1, 0, 2, 2);
 
 	connect(BtnUpdateSList, SIGNAL(clicked()), netServersWidget, SLOT(updateList()));
-	netServersWidget->updateList();
 }
 
 PageNetGame::PageNetGame(QWidget* parent) : QWidget(parent)