[prev in list] [next in list] [prev in thread] [next in thread]
List: atlantik-devel
Subject: [atlantik-cvs]
From: kde () office ! kde ! org
Date: 2003-12-07 23:31:54
[Download RAW message or body]
Update of /home/kde/kdegames/atlantik/client
In directory office:/tmp/cvs-serv30825/client
Modified Files:
Tag: atlantik_3_3_branch
atlantik.cpp selectconfiguration_widget.cpp
selectconfiguration_widget.h
Log Message:
completely support new configupdate behavior for bool options
Index: atlantik.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/atlantik.cpp,v
retrieving revision 1.157.2.4
retrieving revision 1.157.2.5
diff -u -d -r1.157.2.4 -r1.157.2.5
--- atlantik.cpp 17 Nov 2003 02:50:41 -0000 1.157.2.4
+++ atlantik.cpp 7 Dec 2003 23:31:50 -0000 1.157.2.5
@@ -321,10 +321,12 @@
m_mainLayout->addMultiCellWidget(m_selectConfiguration, 0, 2, 1, 1);
m_selectConfiguration->show();
+ connect(m_atlanticCore, SIGNAL(createGUI(ConfigOption *)), m_selectConfiguration, \
SLOT(addConfigOption(ConfigOption *))); connect(m_atlantikNetwork, \
SIGNAL(gameOption(QString, QString, QString, QString, QString)), \
m_selectConfiguration, SLOT(gameOption(QString, QString, QString, QString, \
QString))); connect(m_atlantikNetwork, SIGNAL(gameInit()), m_selectConfiguration, \
SLOT(initGame())); connect(m_selectConfiguration, SIGNAL(startGame()), \
m_atlantikNetwork, SLOT(startGame())); connect(m_selectConfiguration, \
SIGNAL(leaveGame()), m_atlantikNetwork, SLOT(leaveGame())); \
+ connect(m_selectConfiguration, SIGNAL(changeOption(int, const QString &)), \
m_atlantikNetwork, SLOT(changeOption(int, const QString &))); \
connect(m_selectConfiguration, SIGNAL(buttonCommand(QString)), m_atlantikNetwork, \
SLOT(writeData(QString))); connect(m_selectConfiguration, SIGNAL(iconSelected(const \
QString &)), m_atlantikNetwork, SLOT(setImage(const QString &))); \
connect(m_selectConfiguration, SIGNAL(statusMessage(const QString &)), this, \
SLOT(slotMsgStatus(const QString &)));
Index: selectconfiguration_widget.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectconfiguration_widget.cpp,v
retrieving revision 1.39.2.2
retrieving revision 1.39.2.3
diff -u -d -r1.39.2.2 -r1.39.2.3
--- selectconfiguration_widget.cpp 17 Nov 2003 02:50:42 -0000 1.39.2.2
+++ selectconfiguration_widget.cpp 7 Dec 2003 23:31:50 -0000 1.39.2.3
@@ -27,6 +27,7 @@
#include <kstandarddirs.h>
#include <atlantic_core.h>
+#include <configoption.h>
#include <game.h>
#include <player.h>
@@ -111,6 +112,21 @@
m_tokenWidget = 0;
}
+void SelectConfiguration::addConfigOption(ConfigOption *configOption)
+{
+ // FIXME: only bool types supported!
+ QCheckBox *checkBox = new QCheckBox(configOption->description(), m_configBox, \
"checkbox"); + m_configMap[(QObject *)checkBox] = configOption;
+ m_configBoxMap[configOption] = checkBox;
+
+ checkBox->setChecked( configOption->value().toInt() );
+ checkBox->setEnabled( configOption->edit() && m_atlanticCore->selfIsMaster() );
+ checkBox->show();
+
+ connect(checkBox, SIGNAL(clicked()), this, SLOT(changeOption()));
+ connect(configOption, SIGNAL(changed(ConfigOption *)), this, \
SLOT(optionChanged(ConfigOption *))); +}
+
void SelectConfiguration::gameOption(QString title, QString type, QString value, \
QString edit, QString command) {
// Find if option exists in GUI yet
@@ -136,6 +152,27 @@
// TODO: create options other than type=bool
// TODO: Enable edit for master only
+}
+
+void SelectConfiguration::changeOption()
+{
+ ConfigOption *configOption = m_configMap[(QObject *)QObject::sender()];
+ if (configOption)
+ {
+ kdDebug() << "checked " << ((QCheckBox *)QObject::sender())->isChecked() << endl;
+ emit changeOption( configOption->id(), QString::number( ((QCheckBox \
*)QObject::sender())->isChecked() ) ); + }
+}
+
+void SelectConfiguration::optionChanged(ConfigOption *configOption)
+{
+ QCheckBox *checkBox = m_configBoxMap[configOption];
+ if (checkBox)
+ {
+ checkBox->setText( configOption->description() );
+ checkBox->setChecked( configOption->value().toInt() );
+ checkBox->setEnabled( configOption->edit() && m_atlanticCore->selfIsMaster() );
+ }
}
void SelectConfiguration::optionChanged()
Index: selectconfiguration_widget.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/client/selectconfiguration_widget.h,v
retrieving revision 1.19.2.2
retrieving revision 1.19.2.3
diff -u -d -r1.19.2.2 -r1.19.2.3
--- selectconfiguration_widget.h 17 Nov 2003 02:50:42 -0000 1.19.2.2
+++ selectconfiguration_widget.h 7 Dec 2003 23:31:50 -0000 1.19.2.3
@@ -28,6 +28,7 @@
class QListViewItem;
class AtlanticCore;
+class ConfigOption;
class Game;
class Player;
class TokenWidget;
@@ -46,7 +47,10 @@
private slots:
void slotTokenButtonClicked();
void slotTokenSelected(const QString &name);
+ void addConfigOption(ConfigOption *configOption);
+ void changeOption();
void gameOption(QString title, QString type, QString value, QString edit, QString \
command); + void optionChanged(ConfigOption *configOption);
void optionChanged();
void slotEndUpdate();
void initGame();
@@ -58,6 +62,7 @@
void leaveGame();
void joinConfiguration(int configurationId);
void newConfiguration();
+ void changeOption(int configId, const QString &value);
void buttonCommand(QString);
void iconSelected(const QString &);
void statusMessage(const QString &message);
@@ -67,6 +72,8 @@
QVGroupBox *m_configBox, *m_messageBox;
KPushButton *m_backButton, *m_startButton, *m_tokenButton;
QMap <QObject *, QString> m_optionCommandMap;
+ QMap <QObject *, ConfigOption *> m_configMap;
+ QMap <ConfigOption *, QCheckBox *> m_configBoxMap;
QMap <QString, QCheckBox *> m_checkBoxMap;
QMap <Player *, QListViewItem *> m_items;
Game *m_game;
_______________________________________________
atlantik-cvs mailing list
atlantik-cvs@kde.org
https://mail.kde.org/mailman/listinfo/atlantik-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic