28 #include "kgamedialogconfig.h"
30 #include "kgamedialog.h"
32 #include "kgamedialog.moc"
34 class KGameDialogPrivate
53 TQVBox* mMsgServerPage;
54 TQVBoxLayout* mTopLayout;
55 KGameDialogNetworkConfig* mNetworkConfig;
56 KGameDialogGeneralConfig* mGameConfig;
59 TQPtrList<KGameDialogConfig> mConfigWidgets;
67 TQWidget* parent,
bool modal)
68 : KDialogBase(Tabbed, title, Ok|Default|Apply,
69 Ok, parent, 0, modal, true)
75 TQWidget* parent,
long initConfigs,
int chatMsgId,
bool modal)
76 : KDialogBase(Tabbed, title, Ok|Default|Apply,
77 Ok, parent, 0, modal, true)
80 if ((ConfigOptions)initConfigs!=NoConfig) {
90 d =
new KGameDialogPrivate;
103 if (initConfigs & GameConfig) {
104 kdDebug() <<
"add gameconf" << endl;
107 if (initConfigs & NetworkConfig) {
110 if (initConfigs & (MsgServerConfig) ) {
113 if (initConfigs & ChatConfig) {
121 if (initConfigs & BanPlayerConfig) {
124 if (d->mNetworkPage) {
129 addConfigPage(
new KGameDialogConnectionConfig(0), i18n(
"C&onnections"));
134 KGameDialog::~KGameDialog()
137 d->mConfigWidgets.setAutoDelete(
true);
138 d->mConfigWidgets.clear();
147 d->mGameConfig = conf;
156 d->mNetworkConfig = netConf;
165 d->mMsgServerPage =
addConfigPage(msgConf, i18n(
"&Message Server"));
174 parent = d->mGamePage;
177 kdError(11001) <<
"cannot add chat widget without page" << endl;
189 parent = d->mNetworkPage;
192 kdError(11001) <<
"Cannot add connection list without page" << endl;
204 box = d->mNetworkPage;
209 case MsgServerConfig:
210 box = d->mMsgServerPage;
213 kdError(11001) << k_funcinfo <<
": Parameter " << which <<
" not supported" << endl;
221 kdError(11001) <<
"Cannot add NULL config widget" << endl;
224 TQVBox* page = addVBoxPage(title);
232 kdError(11001) <<
"Cannot add NULL config widget" << endl;
236 kdError(11001) <<
"Cannot reparent to NULL widget" << endl;
240 widget->reparent(parent, TQPoint(0,0));
241 d->mConfigWidgets.append(widget);
244 kdWarning(11001) <<
"No game has been set!" << endl;
247 widget->
setAdmin(d->mGame->isAdmin());
250 kdWarning(11001) <<
"No player has been set!" << endl;
258 {
return d->mGameConfig; }
260 {
return d->mNetworkConfig; }
288 for (
int unsigned i = 0; i < d->mConfigWidgets.count(); i++) {
289 if (d->mConfigWidgets.at(i)) {
290 d->mConfigWidgets.at(i)->setOwner(d->mOwner);
293 kdError(11001) <<
"NULL widget??" << endl;
301 disconnect(d->mGame, 0,
this, 0);
304 for (
int unsigned i = 0; i < d->mConfigWidgets.count(); i++) {
305 d->mConfigWidgets.at(i)->setKGame(d->mGame);
309 connect(d->mGame, TQT_SIGNAL(destroyed()),
this, TQT_SLOT(
slotUnsetKGame()));
310 connect(d->mGame, TQT_SIGNAL(signalAdminStatusChanged(
bool)),
317 for (
int unsigned i = 0; i < d->mConfigWidgets.count(); i++) {
318 d->mConfigWidgets.at(i)->setAdmin(admin);
328 kdError(11001) << k_funcinfo <<
": no game has been set" << endl;
332 kdError(11001) << k_funcinfo <<
": no player has been set" << endl;
336 for (
int unsigned i = 0; i < d->mConfigWidgets.count(); i++) {
338 d->mConfigWidgets.at(i)->submitToKGame(d->mGame, d->mOwner);