[atlantik-cvs] CVS: kdegames/atlantik/client atlantik.cpp,1.131,1.132 atlantik.h,1.51,1.52 configdlg.cpp,1.18,1.19 configdlg.h,1.11,1.12 selectserver_widget.cpp,1.20,1.21 selectserver_widget.h,1.11,1.12

[email protected]
Newsgroups gmane.comp.kde.devel.atlantik
Message-ID <[email protected]>
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv26878/client

Modified Files:
	atlantik.cpp atlantik.h configdlg.cpp configdlg.h 
	selectserver_widget.cpp selectserver_widget.h 
Log Message:
fix http://bugs.kde.org/show_bug.cgi?id=52774

Index: atlantik.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.cpp,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- atlantik.cpp	6 Jan 2003 11:37:06 -0000	1.131
+++ atlantik.cpp	9 Jan 2003 01:35:43 -0000	1.132
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
@@ -157,6 +157,10 @@
 	m_config.animateTokens = config->readBoolEntry("AnimateToken", false);
 	m_config.quartzEffects = config->readBoolEntry("QuartzEffects", true);
 
+	// Meta server configuation
+	config->setGroup("Monopigator");
+	m_config.connectOnStart = config->readBoolEntry("ConnectOnStart", false);
+
 	// Portfolio colors
 	config->setGroup("WM");
 	QColor activeDefault(204, 204, 204), inactiveDefault(153, 153, 153);
@@ -216,7 +220,7 @@
 
 void Atlantik::showSelectServer()
 {
-	m_selectServer = new SelectServer(m_mainWidget, "selectServer");
+	m_selectServer = new SelectServer(m_config.connectOnStart, m_mainWidget, "selectServer");
 	m_mainLayout->addMultiCellWidget(m_selectServer, 0, 2, 1, 1);
 	m_selectServer->show();
 	if (m_selectGame)
@@ -438,6 +442,13 @@
 		configChanged = true;
 	}
 
+	optBool = m_configDialog->connectOnStart();
+	if (m_config.connectOnStart != optBool)
+	{
+		m_config.connectOnStart = optBool;
+		configChanged = true;
+	}
+
 	config->setGroup("Personalization");
 	config->writeEntry("PlayerName", m_config.playerName);
 
@@ -447,6 +458,9 @@
 	config->writeEntry("DarkenMortgaged", m_config.darkenMortgaged);
 	config->writeEntry("AnimateToken", m_config.animateTokens);
 	config->writeEntry("QuartzEffects", m_config.quartzEffects);
+
+	config->setGroup("Monopigator");
+	config->writeEntry("ConnectOnStart", m_config.connectOnStart);
 
 	config->sync();
 

Index: atlantik.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- atlantik.h	11 Sep 2002 03:39:10 -0000	1.51
+++ atlantik.h	9 Jan 2003 01:35:43 -0000	1.52
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
@@ -44,6 +44,9 @@
 	bool darkenMortgaged;
 	bool quartzEffects;
 	bool animateTokens;
+
+	// Meta server options
+	bool connectOnStart;
 
 	// Portfolio colors
 	QColor activeColor, inactiveColor;

Index: configdlg.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/configdlg.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- configdlg.cpp	14 Oct 2002 22:22:10 -0000	1.18
+++ configdlg.cpp	9 Jan 2003 01:35:43 -0000	1.19
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
@@ -30,9 +30,11 @@
 	m_parent = parent;
 	p_p13n = addPage(i18n("Personalization"), i18n("Personalization"), BarIcon("personal", KIcon::SizeMedium));
 	p_board = addPage(i18n("Board"), i18n("Board"), BarIcon("monop_board", KIcon::SizeMedium));
+	p_monopigator = addPage(i18n("Meta Server"), i18n("Meta Server"), BarIcon("network", KIcon::SizeMedium));
 
 	configPlayer = new ConfigPlayer(this, p_p13n, "configPlayer");
 	configBoard = new ConfigBoard(this, p_board, "configBoard");
+	configMonopigator = new ConfigMonopigator(this, p_monopigator, "configMonopigator");
 
 	setMinimumSize(sizeHint());
 }
@@ -67,6 +69,11 @@
 	return configPlayer->playerName();
 }
 
+bool ConfigDialog::connectOnStart()
+{
+	return configMonopigator->connectOnStart();
+}
+
 AtlantikConfig ConfigDialog::config()
 {
 	return m_parent->config();
@@ -96,6 +103,34 @@
 void ConfigPlayer::reset()
 {
 	m_playerName->setText(m_configDialog->config().playerName);
+}
+
+ConfigMonopigator::ConfigMonopigator(ConfigDialog *configDialog, QWidget *parent, const char *name) : QWidget(parent, name)
+{
+	m_configDialog = configDialog;
+	QVBoxLayout *layout = new QVBoxLayout(parent, KDialog::marginHint(), KDialog::spacingHint());
+
+	m_connectOnStart = new QCheckBox(i18n("Request list of Internet servers on start-up"), parent);
+	layout->addWidget(m_connectOnStart);
+
+	QString message=i18n(
+		"If checked, Atlantik connects to a meta server on start-up to\n"
+		"request a list of Internet servers.\n");
+	QWhatsThis::add(m_connectOnStart, message);
+
+	layout->addStretch(1);
+
+	reset();
+}
+
+bool ConfigMonopigator::connectOnStart()
+{
+	return m_connectOnStart->isChecked();
+}
+
+void ConfigMonopigator::reset()
+{
+	m_connectOnStart->setChecked(m_configDialog->config().connectOnStart);
 }
 
 ConfigBoard::ConfigBoard(ConfigDialog *configDialog, QWidget *parent, const char *name) : QWidget(parent, name)

Index: configdlg.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/configdlg.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- configdlg.h	23 Apr 2002 16:56:30 -0000	1.11
+++ configdlg.h	9 Jan 2003 01:35:43 -0000	1.12
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
@@ -64,6 +64,22 @@
 	QCheckBox *m_indicateUnowned, *m_highliteUnowned, *m_darkenMortgaged, *m_animateToken, *m_quartzEffects;
 };
 
+class ConfigMonopigator : public QWidget
+{
+Q_OBJECT
+
+public:
+	ConfigMonopigator(ConfigDialog *dialog, QWidget *parent, const char *name = 0);
+
+	bool connectOnStart();
+
+private:
+	void reset();
+
+	ConfigDialog *m_configDialog;
+	QCheckBox *m_connectOnStart;
+};
+
 class ConfigDialog : public KDialogBase
 {
 Q_OBJECT
@@ -78,12 +94,14 @@
 	bool quartzEffects();
 	AtlantikConfig config();
 	QString playerName();
+	bool connectOnStart();
 
 private:
 	Atlantik *m_parent;
-	QFrame *p_p13n, *p_board;
+	QFrame *p_p13n, *p_board, *p_monopigator;
 	ConfigPlayer *configPlayer;
 	ConfigBoard *configBoard;
+	ConfigMonopigator *configMonopigator;
 };
 
 #endif

Index: selectserver_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectserver_widget.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- selectserver_widget.cpp	7 Jan 2003 22:52:04 -0000	1.20
+++ selectserver_widget.cpp	9 Jan 2003 01:35:43 -0000	1.21
@@ -24,7 +24,7 @@
 
 #include "selectserver_widget.moc"
 
-SelectServer::SelectServer(QWidget *parent, const char *name) : QWidget(parent, name)
+SelectServer::SelectServer(bool useMonopigatorOnStart, QWidget *parent, const char *name) : QWidget(parent, name)
 {
 	m_mainLayout = new QVBoxLayout(this, KDialog::marginHint());
 	Q_CHECK_PTR(m_mainLayout);
@@ -63,7 +63,7 @@
 
 	buttonBox->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
 
-	m_refreshButton = new KPushButton(BarIcon("reload", KIcon::SizeSmall), i18n("Refresh"), this);
+	m_refreshButton = new KPushButton( (useMonopigatorOnStart ? BarIcon("reload", KIcon::SizeSmall) : BarIcon("network", KIcon::SizeSmall)), (useMonopigatorOnStart ? i18n("Refresh") : i18n("Server List")), this);
 	buttonBox->addWidget(m_refreshButton);
 
 	connect(m_refreshButton, SIGNAL(clicked()), this, SLOT(slotRefresh()));
@@ -87,7 +87,7 @@
 	// Until we have a good way to use start a local monopd server, disable this button
 //	m_localGameButton->setEnabled(false);
 
-	slotRefresh();
+	slotRefresh(useMonopigatorOnStart);
 }
 
 SelectServer::~SelectServer()
@@ -100,6 +100,9 @@
 {
 	// Hardcoded, but there aren't any other Monopigator root servers at the moment
 	status_label->setText(i18n("Retrieving server list..."));
+	m_refreshButton->setText(i18n("Refresh"));
+	// FIXME: change pixmap
+	// m_refreshButton->setPixmap(BarIcon("reload", KIcon::SizeSmall));
 	m_monopigator->loadData("http://gator.monopd.net/");
 }
 
@@ -176,7 +179,7 @@
 		m_onlineGameButton->toggle();
 }
 
-void SelectServer::slotRefresh()
+void SelectServer::slotRefresh(bool useMonopigator)
 {
 	m_localServerAvailable = false;
 
@@ -184,7 +187,8 @@
 	validateConnectButton();
 
 	checkLocalServer();
-	initMonopigator();
+	if (useMonopigator)
+		initMonopigator();
 }
 
 void SelectServer::slotConnect()

Index: selectserver_widget.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectserver_widget.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- selectserver_widget.h	7 Jan 2003 22:52:04 -0000	1.11
+++ selectserver_widget.h	9 Jan 2003 01:35:43 -0000	1.12
@@ -34,7 +34,7 @@
 Q_OBJECT
 
 public:
-	SelectServer(QWidget *parent, const char *name=0);
+	SelectServer(bool useMonopigatorOnStart, QWidget *parent, const char *name=0);
 	virtual ~SelectServer();
 
 	void initPage();
@@ -51,7 +51,7 @@
 
 	private slots:
 		void slotConnect();
-		void slotRefresh();
+		void slotRefresh(bool useMonopigator = true);
 		void slotLocalConnected();
 		void slotLocalError();
 		void monopigatorFinished();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.