[atlantik-cvs] CVS: kdegames/atlantik/client selectserver_widget.cpp,1.33,1.34 selectserver_widget.h,1.17,1.18

[email protected] Sun, 27 Jul 2003 19:58:35 +0200 (CEST)
Newsgroups gmane.comp.kde.devel.atlantik
Message-ID <[email protected]>
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv25851/client

Modified Files:
	selectserver_widget.cpp selectserver_widget.h 
Log Message:
clean up local socket crud, no longer necessary with custom server gui

Index: selectserver_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectserver_widget.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- selectserver_widget.cpp	25 Jul 2003 01:15:59 -0000	1.33
+++ selectserver_widget.cpp	27 Jul 2003 17:58:33 -0000	1.34
@@ -67,7 +67,6 @@
 //	m_mainLayout->addWidget(m_serverList);
 
 	connect(m_serverList, SIGNAL(clicked(QListViewItem *)), this, SLOT(validateConnectButton()));
-//	connect(m_serverList, SIGNAL(clicked(QListViewItem *)), this, SLOT(slotListClicked(QListViewItem *)));
 	connect(m_serverList, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(slotConnect()));
 	connect(m_serverList, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), this, SLOT(validateConnectButton()));
 	connect(m_serverList, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(validateConnectButton()));
@@ -99,16 +98,12 @@
 	connect(m_monopigator, SIGNAL(finished()), SLOT(monopigatorFinished()));
 	connect(m_monopigator, SIGNAL(timeout()), SLOT(monopigatorTimeout()));
 
-	// Until we have a good way to use start a local monopd server, disable this button
-//	m_localGameButton->setEnabled(false);
-
 	slotRefresh(useMonopigatorOnStart);
 }
 
 SelectServer::~SelectServer()
 {
 	delete m_monopigator;
-	delete m_localSocket;
 }
 
 void SelectServer::setHideDevelopmentServers(bool hideDevelopmentServers)
@@ -124,16 +119,6 @@
 	m_monopigator->loadData("http://gator.monopd.net/");
 }
 
-void SelectServer::checkCustomServer(const QString &host, int port)
-{
-	m_localSocket = new KExtendedSocket(0, 0, KExtendedSocket::inputBufferedSocket);
-	connect(m_localSocket, SIGNAL(connectionSuccess()), this, SLOT(slotCustomConnected()));
-	connect(m_localSocket, SIGNAL(connectionFailed(int)), this, SLOT(slotCustomError()));
-	m_localSocket->setAddress(host, port);
-	m_localSocket->enableRead(true);
-	m_localSocket->startAsyncConnect();
-}
-
 void SelectServer::slotMonopigatorAdd(QString host, QString port, QString version, int users)
 {
 	if (m_hideDevelopmentServers && version.contains("CVS"))
@@ -144,22 +129,6 @@
 	validateConnectButton();
 }
 
-void SelectServer::slotCustomConnected()
-{
-	m_localServerAvailable = true;
-
-	MonopigatorEntry *item = new MonopigatorEntry(m_serverList, m_localSocket->host(), QString::number(9999), i18n("unknown"), i18n("unknown"), m_localSocket->port());
-	item->setPixmap(0, BarIcon("atlantik", KIcon::SizeSmall));
-	validateConnectButton();
-}
-
-void SelectServer::slotCustomError()
-{
-	m_localServerAvailable = false;
-
-	// TODO: fork server or offer option to do so
-}
-
 void SelectServer::monopigatorFinished()
 {
 	status_label->setText(i18n("Retrieved server list."));
@@ -172,47 +141,19 @@
 	m_refreshButton->setEnabled(true);
 }
 
-void SelectServer::validateRadioButtons()
-{
-	return;
-	if (m_serverList->childCount() > 0)
-	{
-		if (!m_onlineGameButton->isEnabled())
-			m_onlineGameButton->setEnabled(true);
-	}
-	else
-	{
-		if (m_onlineGameButton->isEnabled())
-			m_onlineGameButton->setEnabled(false);
-		m_serverList->clearSelection();
-	}
-}
-
 void SelectServer::validateConnectButton()
 {
-	validateRadioButtons();
-
 	if (m_serverList->selectedItem())
 		m_connectButton->setEnabled(true);
 	else
 		m_connectButton->setEnabled(false);
 }
 
-void SelectServer::slotListClicked(QListViewItem *item)
-{
-	// Simulate a user press
-	if(item && !m_onlineGameButton->isOn())
-		m_onlineGameButton->toggle();
-}
-
 void SelectServer::slotRefresh(bool useMonopigator)
 {
-	m_localServerAvailable = false;
-
 	m_serverList->clear();
 	validateConnectButton();
 
-	checkCustomServer("localhost", 1234);
 	if (useMonopigator)
 	{
 		m_refreshButton->setEnabled(false);

Index: selectserver_widget.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectserver_widget.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- selectserver_widget.h	20 Jul 2003 11:38:30 -0000	1.17
+++ selectserver_widget.h	27 Jul 2003 17:58:33 -0000	1.18
@@ -40,23 +40,19 @@
 
 	void initPage();
 	void setHideDevelopmentServers(bool hideDevelopmentServers);
-		bool validateNext();
-		QString hostToConnect() const;
-		int portToConnect();
+	bool validateNext();
+	QString hostToConnect() const;
+	int portToConnect();
 
-	public slots:
-		void validateRadioButtons();
-		void validateConnectButton();
+public slots:
+	void validateConnectButton();
 
-		void slotMonopigatorAdd(QString host, QString port, QString version, int users);
-		void slotListClicked(QListViewItem *);
+	void slotMonopigatorAdd(QString host, QString port, QString version, int users);
 
 private slots:
 	void slotConnect();
 	void customConnect();
 	void slotRefresh(bool useMonopigator = true);
-	void slotCustomConnected();
-	void slotCustomError();
 	void monopigatorFinished();
 	void monopigatorTimeout();
 
@@ -64,18 +60,15 @@
 	void serverConnect(const QString host, int port);
 
 private:
-	void checkCustomServer(const QString &host, int port);
 	void initMonopigator();
 
 	QVBoxLayout *m_mainLayout;
 	QLabel *status_label;
-	QRadioButton *m_localGameButton, *m_onlineGameButton;
 	KListView *m_serverList;
 	KLineEdit *m_hostEdit, *m_portEdit;
 	KPushButton *m_addServerButton, *m_refreshButton, *m_customConnect, *m_connectButton;
 	Monopigator *m_monopigator;
-	KExtendedSocket *m_localSocket;
-	bool m_localServerAvailable, m_hideDevelopmentServers;
+	bool m_hideDevelopmentServers;
 };
 
 #endif