[Kde-games-devel] [libkdegames] /: Move libkdegamesprivate/kgame/dialogs to kfourinline
Albert Astals Cid
aacid at kde.org
Mon Dec 24 16:41:56 UTC 2012
Git commit 3d5f02457211429c2cbfe02001ad761f6ce121e5 by Albert Astals Cid.
Committed on 24/12/2012 at 17:41.
Pushed by aacid into branch 'master'.
Move libkdegamesprivate/kgame/dialogs to kfourinline
Only used there, we are killing libkdegamesprivate/kgame
CCMAIL: kde-games-devel at kde.org
M +0 -4 CMakeLists.txt
M +0 -6 libkdegamesprivate/CMakeLists.txt
D +0 -230 libkdegamesprivate/kgame/dialogs/kgameconnectdialog.cpp
D +0 -108 libkdegamesprivate/kgame/dialogs/kgameconnectdialog.h
D +0 -368 libkdegamesprivate/kgame/dialogs/kgamedialog.cpp
D +0 -323 libkdegamesprivate/kgame/dialogs/kgamedialog.h
D +0 -788 libkdegamesprivate/kgame/dialogs/kgamedialogconfig.cpp
D +0 -374 libkdegamesprivate/kgame/dialogs/kgamedialogconfig.h
http://commits.kde.org/libkdegames/3d5f02457211429c2cbfe02001ad761f6ce121e5
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2407b9e..232cf3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,6 @@ include_directories(
# the following only for libkdegamesprivate, but there aren't
# target-specific include directories
${CMAKE_CURRENT_SOURCE_DIR}/libkdegamesprivate/kgame
- ${CMAKE_CURRENT_SOURCE_DIR}/libkdegamesprivate/kgame/dialogs
${CMAKE_CURRENT_SOURCE_DIR}/libkdegamesprivate/..
)
@@ -129,9 +128,6 @@ set(kdegamesprivate_LIB_SRCS
libkdegamesprivate/kchatbasemodel.cpp
libkdegamesprivate/kchat.cpp
libkdegamesprivate/kchatdialog.cpp
- libkdegamesprivate/kgame/dialogs/kgameconnectdialog.cpp
- libkdegamesprivate/kgame/dialogs/kgamedialogconfig.cpp
- libkdegamesprivate/kgame/dialogs/kgamedialog.cpp
libkdegamesprivate/kgame/kgamechat.cpp
libkdegamesprivate/kgame/kgame.cpp
libkdegamesprivate/kgame/kgameerror.cpp
diff --git a/libkdegamesprivate/CMakeLists.txt b/libkdegamesprivate/CMakeLists.txt
index 1860349..eb0bdef 100644
--- a/libkdegamesprivate/CMakeLists.txt
+++ b/libkdegamesprivate/CMakeLists.txt
@@ -40,9 +40,3 @@ install(FILES
kgame/kmessageserver.h
kgame/kplayer.h
DESTINATION ${INCLUDE_INSTALL_DIR}/libkdegamesprivate/kgame COMPONENT Devel)
-
-install(FILES
- kgame/dialogs/kgameconnectdialog.h
- kgame/dialogs/kgamedialogconfig.h
- kgame/dialogs/kgamedialog.h
-DESTINATION ${INCLUDE_INSTALL_DIR}/libkdegamesprivate/kgame/dialogs COMPONENT Devel)
diff --git a/libkdegamesprivate/kgame/dialogs/kgameconnectdialog.cpp b/libkdegamesprivate/kgame/dialogs/kgameconnectdialog.cpp
deleted file mode 100644
index c0df5ad..0000000
--- a/libkdegamesprivate/kgame/dialogs/kgameconnectdialog.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- This file is part of the KDE games library
- Copyright (C) 2001 Andreas Beckermann (b_mann at gmx.de)
- Copyright (C) 2001 Martin Heni (kde at heni-online.de)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "kgameconnectdialog.h"
-
-#include <knuminput.h>
-#include <klocale.h>
-#include <kdebug.h>
-#include <klineedit.h>
-
-#include <QComboBox>
-#include <QLayout>
-#include <qradiobutton.h>
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QList>
-#include <QButtonGroup>
-#include <dnssd/servicebrowser.h>
-#include <QPushButton>
-#include <QGroupBox>
-
-class KGameConnectWidgetPrivate
-{
- public:
- KGameConnectWidgetPrivate()
- {
- mPort = 0;
- mHost = 0;
- mButtonGroup = 0;
- mBrowser = 0;
- }
-
- KIntNumInput* mPort;
- KLineEdit* mHost;
- QButtonGroup* mButtonGroup;
- QComboBox *mClientName;
- QLabel *mClientNameLabel;
- DNSSD::ServiceBrowser *mBrowser;
- QLabel *mServerNameLabel;
- KLineEdit *mServerName;
- QString mType;
-};
-
-KGameConnectWidget::KGameConnectWidget(QWidget* parent) : QWidget(parent)
-{
- d = new KGameConnectWidgetPrivate;
-
- QVBoxLayout* vb = new QVBoxLayout(this);
- vb->setMargin(0);
- QGroupBox* box = new QGroupBox(this);
- QVBoxLayout* boxlay = new QVBoxLayout(box);
- d->mButtonGroup = new QButtonGroup(this);
- d->mButtonGroup->setExclusive(true);
- vb->addWidget(box);
- connect(d->mButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slotTypeChanged(int)));
- QRadioButton* buttonCreate = new QRadioButton(i18n("Create a network game"), box);
- boxlay->addWidget(buttonCreate);
- d->mButtonGroup->addButton(buttonCreate,0);
- QRadioButton* buttonJoin = new QRadioButton(i18n("Join a network game"), box);
- boxlay->addWidget(buttonJoin);
- d->mButtonGroup->addButton(buttonJoin,1);
-
- QWidget *g = new QWidget(this);
- vb->addWidget(g);
- d->mServerNameLabel = new QLabel(i18n("Game name:"), g);
- d->mServerName = new KLineEdit(g);
- d->mClientNameLabel = new QLabel(i18n("Network games:"), g);
- d->mClientName = new QComboBox(g);
-
- QGridLayout* layout = new QGridLayout(g);
- layout->setMargin(0);
- layout->addWidget(d->mServerNameLabel, 0, 0);
- layout->addWidget(d->mServerName, 0, 1);
- layout->addWidget(d->mClientNameLabel, 1, 0);
- layout->addWidget(d->mClientName, 1, 1);
- connect(d->mClientName,SIGNAL(activated(int)),SLOT(slotGameSelected(int)));
- QLabel* label = new QLabel(i18n("Port to connect to:"), g);
- d->mPort = new KIntNumInput(g);
- layout->addWidget(label, 2, 0);
- layout->addWidget(d->mPort, 2, 1);
- label = new QLabel(i18n("Host to connect to:"), g);
- d->mHost = new KLineEdit(g);
- layout->addWidget(label, 3, 0);
- layout->addWidget(d->mHost, 3, 1);
-
- QPushButton *button=new QPushButton(i18n("&Start Network"), this);
- connect(button, SIGNAL(clicked()), this, SIGNAL(signalNetworkSetup()));
- vb->addWidget(button);
- // Hide until type is set
- d->mClientName->hide();
- d->mClientNameLabel->hide();
- d->mServerName->hide();
- d->mServerNameLabel->hide();
-}
-
-void KGameConnectWidget::showDnssdControls()
-{
- if (!d->mBrowser) return;
- if (d->mHost->isEnabled()) { // client
- d->mClientName->show();
- d->mClientNameLabel->show();
- d->mServerName->hide();
- d->mServerNameLabel->hide();
- slotGameSelected(d->mClientName->currentIndex());
- } else {
- d->mClientName->hide();
- d->mClientNameLabel->hide();
- d->mServerName->show();
- d->mServerNameLabel->show();
- }
-}
-
-void KGameConnectWidget::setType(const QString& type)
-{
- d->mType = type;
- delete d->mBrowser;
- d->mBrowser = new DNSSD::ServiceBrowser(type);
- connect(d->mBrowser,SIGNAL(finished()),SLOT(slotGamesFound()));
- d->mBrowser->startBrowse();
- showDnssdControls();
-}
-
-void KGameConnectWidget::slotGamesFound()
-{
- bool autoselect=false;
- if (!d->mClientName->count()) autoselect=true;
- d->mClientName->clear();
- QStringList names;
-
- QListIterator<DNSSD::RemoteService::Ptr> it(d->mBrowser->services());
- while (it.hasNext())
- names << it.next()->serviceName();
- d->mClientName->addItems(names);
- if (autoselect && d->mClientName->count()) slotGameSelected(0);
-}
-
-void KGameConnectWidget::setName(const QString& name)
-{
- d->mServerName->setText(name);
-}
-
-QString KGameConnectWidget::gameName() const
-{
- return d->mServerName->text();
-}
-
-QString KGameConnectWidget::type() const
-{
- return d->mType;
-}
-
-void KGameConnectWidget::slotGameSelected(int nr)
-{
- if (nr>=(d->mBrowser->services().count()) || nr<0) return;
- if (!d->mHost->isEnabled()) return; // this is server mode, do not overwrite host and port controls
- DNSSD::RemoteService::Ptr srv = d->mBrowser->services()[nr];
- if (!srv->isResolved() && !srv->resolve()) return;
- d->mHost->setText(srv->hostName());
- d->mPort->setValue(srv->port());
-}
-KGameConnectWidget::~KGameConnectWidget()
-{
- delete d->mBrowser;
- delete d;
-}
-
-QString KGameConnectWidget::host() const
-{
- if (d->mHost->isEnabled()) {
- return d->mHost->text();
- } else {
- return QString();
- }
-}
-
-unsigned short int KGameConnectWidget::port() const
-{
- return d->mPort->value();
-}
-
-void KGameConnectWidget::setHost(const QString& host)
-{
- d->mHost->setText(host);
-}
-
-void KGameConnectWidget::setPort(unsigned short int port)
-{
- d->mPort->setValue(port);
-}
-
-void KGameConnectWidget::setDefault(int state)
-{
- if (d->mButtonGroup->button(state) == 0) {
- kError(11001) << "KGameConnectWidget::setDefault" << state;
- return;
- }
- d->mButtonGroup->button(state)->setChecked(true);
- slotTypeChanged(state);
-}
-
-void KGameConnectWidget::slotTypeChanged(int t)
-{
- if (t == 0) {
- d->mHost->setEnabled(false);
- } else if (t == 1) {
- d->mHost->setEnabled(true);
- }
- showDnssdControls();
- emit signalServerTypeChanged(t);
-}
-
-#include "kgameconnectdialog.moc"
-
diff --git a/libkdegamesprivate/kgame/dialogs/kgameconnectdialog.h b/libkdegamesprivate/kgame/dialogs/kgameconnectdialog.h
deleted file mode 100644
index bc9720b..0000000
--- a/libkdegamesprivate/kgame/dialogs/kgameconnectdialog.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- This file is part of the KDE games library
- Copyright (C) 2001 Martin Heni (kde at heni-online.de)
- Copyright (C) 2001 Andreas Beckermann (b_mann at gmx.de)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef __KGAMECONNECTDIALOG_H__
-#define __KGAMECONNECTDIALOG_H__
-
-#include <kdialog.h>
-
-class KGameConnectWidgetPrivate;
-
-/**
- * \class KGameConnectWidget kgameconnectdialog.h <KGameConnectWidget>
- */
-class KGameConnectWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit KGameConnectWidget(QWidget* parent);
- virtual ~KGameConnectWidget();
-
- /**
- * @param host The host to connect to by default
- **/
- void setHost(const QString& host);
-
- /**
- * @return The host to connect to or QString() if the user wants to
- * be the MASTER
- **/
- QString host() const;
-
- /**
- * @param port The port that will be shown by default
- **/
- void setPort(unsigned short int port);
-
- /**
- * @return The port to connect to / to listen
- **/
- unsigned short int port() const;
-
- /**
- * Specifies which state is the default (0 = server game; 1 = join game)
- * @param state The default state. 0 For a server game, 1 to join a game
- **/
- void setDefault(int state);
-
- /**
- * Sets DNS-SD service type, both for publishing and browsing
- * @param type Service type (something like _kwin4._tcp).
- * It should be unique for application.
- **/
- void setType(const QString& type);
-
- /**
- * @return service type
- */
- QString type() const;
-
- /**
- * Set game name for publishing.
- * @param name Game name. Important only for server mode. If not
- * set hostname will be used. In case of name conflict -2, -3 and so on will be added to name.
- */
- void setName(const QString& name);
-
- /**
- * @return game name.
- */
- QString gameName() const;
-
-protected Q_SLOTS:
- /**
- * The type has changed, ie the user switched between creating or
- * joining.
- **/
- void slotTypeChanged(int);
- void slotGamesFound();
- void slotGameSelected(int);
-
-Q_SIGNALS:
- void signalNetworkSetup();
- void signalServerTypeChanged(int);
-
-private:
- void showDnssdControls();
- KGameConnectWidgetPrivate* d;
-
-};
-
-#endif
diff --git a/libkdegamesprivate/kgame/dialogs/kgamedialog.cpp b/libkdegamesprivate/kgame/dialogs/kgamedialog.cpp
deleted file mode 100644
index 78a0228..0000000
--- a/libkdegamesprivate/kgame/dialogs/kgamedialog.cpp
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
- This file is part of the KDE games library
- Copyright (C) 2001 Andreas Beckermann (b_mann at gmx.de)
- Copyright (C) 2001 Martin Heni (kde at heni-online.de)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "kgamedialog.h"
-
-#include <QLayout>
-//Added by qt3to4:
-#include <QVBoxLayout>
-#include <QList>
-
-#include <klocale.h>
-#include <kvbox.h>
-#include <kdebug.h>
-
-#include "kgame.h"
-#include "kplayer.h"
-#include "kgamedialogconfig.h"
-
-#include "kgamedialog.moc"
-
-class KGameDialogPrivate
-{
-public:
- KGameDialogPrivate()
- {
- mGamePage = 0;
- mNetworkPage = 0;
- mMsgServerPage = 0;
- mTopLayout = 0;
-
- mNetworkConfig = 0;
- mGameConfig = 0;
-
- mOwner = 0;
- mGame = 0;
- }
-
- KVBox* mGamePage;
- KVBox* mNetworkPage;
- KVBox* mMsgServerPage;// unused here?
- QVBoxLayout* mTopLayout;
- KGameDialogNetworkConfig* mNetworkConfig;
- KGameDialogGeneralConfig* mGameConfig;
-
-// a list of all config widgets added to this dialog
- QList<KGameDialogConfig*> mConfigWidgets;
-
-// just pointers:
- KPlayer* mOwner;
- KGame* mGame;
-};
-
-KGameDialog::KGameDialog(KGame* g, KPlayer* owner, const QString& title,
- QWidget* parent, bool modal)
- : KPageDialog(parent),
- d( new KGameDialogPrivate )
-{
- setCaption(title);
- setButtons(Ok|Default|Apply|Cancel);
- setDefaultButton(Ok);
- setFaceType(KPageDialog::Tabbed);
- setModal(modal);
-
- init(g, owner);
- connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
- connect(this,SIGNAL(defaultClicked()),this,SLOT(slotDefault()));
- connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
-}
-
-KGameDialog::KGameDialog(KGame* g, KPlayer* owner, const QString& title,
- QWidget* parent, long initConfigs, int chatMsgId, bool modal)
- : KPageDialog(parent),
- d( new KGameDialogPrivate )
-{
- setCaption(title);
- setButtons(Ok|Default|Apply|Cancel);
- setDefaultButton(Ok);
- setFaceType(KPageDialog::Tabbed);
- setModal(modal);
- init(g, owner);
- if ((ConfigOptions)initConfigs!=NoConfig) {
- initDefaultDialog((ConfigOptions)initConfigs, chatMsgId);
- }
- connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
- connect(this,SIGNAL(defaultClicked()),this,SLOT(slotDefault()));
- connect(this,SIGNAL(applyClicked()),this,SLOT(slotApply()));
-}
-
-void KGameDialog::init(KGame* g, KPlayer* owner)
-{
-//AB: do we need a "Cancel" Button? currently removed
-
-// kDebug(11001) << ": this=" << this;
-
- setOwner(owner);
- setKGame(g);
- if (g) {
- setAdmin(g->isAdmin());
- } else {
- setAdmin(false);
- }
-}
-
-void KGameDialog::initDefaultDialog(ConfigOptions initConfigs, int chatMsgId)
-{
- if (initConfigs & GameConfig) {
- kDebug() << "add gameconf";
- addGameConfig(new KGameDialogGeneralConfig(0));
- }
- if (initConfigs & NetworkConfig) {
- addNetworkConfig(new KGameDialogNetworkConfig(0));
- }
- if (initConfigs & (MsgServerConfig) ) {
- addMsgServerConfig(new KGameDialogMsgServerConfig(0));
- }
- if (initConfigs & ChatConfig) {
- KGameDialogChatConfig * c = new KGameDialogChatConfig(chatMsgId, 0);
- if (d->mGamePage) {
- addChatWidget(c, d->mGamePage);
- } else {
- addConfigPage(c, i18n("&Chat"));
- }
- }
- if (initConfigs & BanPlayerConfig) {
- // add the connection management system - ie the widget where the ADMIN can
- // kick players out
- if (d->mNetworkPage) {
- // put it on the network page
- addConnectionList(new KGameDialogConnectionConfig(0), d->mNetworkPage);
- } else {
- // if no network page available put it on an own page
- addConfigPage(new KGameDialogConnectionConfig(0), i18n("C&onnections"));
- }
- }
-}
-
-KGameDialog::~KGameDialog()
-{
-// kDebug(11001) << "DESTRUCT KGameDialog" << this;
- qDeleteAll(d->mConfigWidgets);
- delete d;
-}
-
-void KGameDialog::addGameConfig(KGameDialogGeneralConfig* conf)
-{
- if (!conf) {
- return;
- }
- d->mGameConfig = conf;
- d->mGamePage = addConfigPage(d->mGameConfig, i18n("&Game"));
-}
-
-void KGameDialog::addNetworkConfig(KGameDialogNetworkConfig* netConf)
-{
- if (!netConf) {
- return;
- }
- d->mNetworkConfig = netConf;
- d->mNetworkPage = addConfigPage(netConf, i18n("&Network"));
-}
-
-void KGameDialog::addMsgServerConfig(KGameDialogMsgServerConfig* msgConf)
-{
- if (!msgConf) {
- return;
- }
- d->mMsgServerPage = addConfigPage(msgConf, i18n("&Message Server"));
-}
-
-void KGameDialog::addChatWidget(KGameDialogChatConfig* chat, KVBox* parent)
-{
- if (!chat) {
- return;
- }
- if (!parent) {
- parent = d->mGamePage;
- }
- if (!parent) {
- kError(11001) << "cannot add chat widget without page";
- return;
- }
- addConfigWidget(chat, parent);
-}
-
-void KGameDialog::addConnectionList(KGameDialogConnectionConfig* c, KVBox* parent)
-{
- if (!c) {
- return;
- }
- if (!parent) {
- parent = d->mNetworkPage;
- }
- if (!parent) {
- kError(11001) << "Cannot add connection list without page";
- return;
- }
- addConfigWidget(c, parent);
-}
-
-KVBox *KGameDialog::configPage(ConfigOptions which)
-{
- KVBox *box = 0;
- switch(which)
- {
- case NetworkConfig:
- box = d->mNetworkPage;
- break;
- case GameConfig:
- box = d->mGamePage;
- break;
- case MsgServerConfig:
- box = d->mMsgServerPage;
- break;
- default:
- kError(11001) << ": Parameter" << which << "not supported";
- }
- return box;
-}
-
-KVBox* KGameDialog::addConfigPage(KGameDialogConfig* widget, const QString& title)
-{
- if (!widget) {
- kError(11001) << "Cannot add NULL config widget";
- return 0;
- }
- KVBox* page = new KVBox();
- addPage(page,title);
- addConfigWidget(widget, page);
- return page;
-}
-
-void KGameDialog::addConfigWidget(KGameDialogConfig* widget, QWidget* parent)
-{
- if (!widget) {
- kError(11001) << "Cannot add NULL config widget";
- return;
- }
- if (!parent) {
- kError(11001) << "Cannot reparent to NULL widget";
- return;
- }
-// kDebug(11001) << "reparenting widget";
- widget->setParent(parent);
- widget->move(QPoint(0,0));
- d->mConfigWidgets.append(widget);
- connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(slotRemoveConfigWidget(QObject*)));
- if (!d->mGame) {
- kWarning(11001) << "No game has been set!";
- } else {
- widget->setKGame(d->mGame);
- widget->setAdmin(d->mGame->isAdmin());
- }
- if (!d->mOwner) {
- kWarning(11001) << "No player has been set!";
- } else {
- widget->setOwner(d->mOwner);
- }
- widget->show();
-}
-
-KGameDialogGeneralConfig* KGameDialog::gameConfig() const
-{ return d->mGameConfig; }
-KGameDialogNetworkConfig* KGameDialog::networkConfig() const
-{ return d->mNetworkConfig; }
-
-void KGameDialog::slotApply()
-{
- submitToKGame();
-}
-
-void KGameDialog::slotDefault()
-{
- if (!d->mGame) {
- return;
- }
-
-//TODO *only* call setKGame/setOwner for the *current* page!!
- setKGame(d->mGame);
- setOwner(d->mOwner);
-}
-
-void KGameDialog::slotOk()
-{
- slotApply();
- QDialog::accept();
-}
-
-void KGameDialog::setOwner(KPlayer* owner)
-{
-//AB: note: NULL player is ok!
- d->mOwner = owner;
- for (int i = 0; i < d->mConfigWidgets.count(); i++) {
- if (d->mConfigWidgets.at(i)) {
- d->mConfigWidgets.at(i)->setOwner(d->mOwner);
- //TODO: hide playerName in KGameDialogGeneralConfig
- } else {
- kError(11001) << "NULL widget??";
- }
- }
-}
-
-void KGameDialog::setKGame(KGame* g)
-{
- if (d->mGame) {
- disconnect(d->mGame, 0, this, 0);
- }
- d->mGame = g;
- for (int i = 0; i < d->mConfigWidgets.count(); i++) {
- d->mConfigWidgets.at(i)->setKGame(d->mGame);
- }
- if (d->mGame) {
- setAdmin(d->mGame->isAdmin());
- connect(d->mGame, SIGNAL(destroyed()), this, SLOT(slotUnsetKGame()));
- connect(d->mGame, SIGNAL(signalAdminStatusChanged(bool)),
- this, SLOT(setAdmin(bool)));
- }
-}
-
-void KGameDialog::setAdmin(bool admin)
-{
- for (int i = 0; i < d->mConfigWidgets.count(); i++) {
- d->mConfigWidgets.at(i)->setAdmin(admin);
- }
-}
-
-void KGameDialog::slotUnsetKGame() // called when KGame is destroyed
-{ setKGame(0); }
-
-void KGameDialog::submitToKGame()
-{
- if (!d->mGame) {
- kError(11001) << ": no game has been set";
- return;
- }
- if (!d->mOwner) {
- kError(11001) << ": no player has been set";
- return;
- }
-
- for (int i = 0; i < d->mConfigWidgets.count(); i++) {
-// kDebug(11001) << "submit to kgame" << i;
- d->mConfigWidgets.at(i)->submitToKGame(d->mGame, d->mOwner);
-// kDebug(11001) << "done: submit to kgame" << i;
- }
-}
-
-void KGameDialog::slotRemoveConfigWidget(QObject* configWidget)
-{
- d->mConfigWidgets.removeAll((KGameDialogConfig*)configWidget);
-}
-
diff --git a/libkdegamesprivate/kgame/dialogs/kgamedialog.h b/libkdegamesprivate/kgame/dialogs/kgamedialog.h
deleted file mode 100644
index b27184c..0000000
--- a/libkdegamesprivate/kgame/dialogs/kgamedialog.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- This file is part of the KDE games library
- Copyright (C) 2001 Andreas Beckermann (b_mann at gmx.de)
- Copyright (C) 2001 Martin Heni (kde at heni-online.de)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-// NAMING
-// please follow these naming rules if you add/change classes:
-// the main dialog is named KGameDialog and the base config widget
-// KGameDialogConfig. All config widgets are named KGameDialogXYZConfig (where
-// XYZ = the name of the config widget, like "general" or "network") and are
-// inherited from KGameDialogConfig.
-
-#ifndef __KGAMEDIALOG_H__
-#define __KGAMEDIALOG_H__
-
-#include <kpagedialog.h>
-#include "../../libkdegamesprivate_export.h"
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QGridLayout>
-class QGridLayout;
-class QVBoxLayout;
-class KVBox;
-
-class KGame;
-class KPlayer;
-
-class KGameDialogConfig;
-class KGameDialogGeneralConfig;
-class KGameDialogNetworkConfig;
-class KGameDialogMsgServerConfig;
-class KGameDialogChatConfig;
-class KGameDialogConnectionConfig;
-
-class KGameDialogPrivate;
-/**
- * \class KGameDialog kgamedialog.h <KGameDialog>
- *
- * TODO: rewrite entire documentation. Nearly nothing is valid anymore.
- * The main configuration dialog for KGame. Here all players meat each other,
- * every player can see how many players connected (and their names) and the
- * ADMIN can even "kick" players out. You can talk to each other (using
- * KGameChat and the ADMIN can define the maxPlayers/minPlayers as well as the
- * number of computer players.
- *
- *
- * AB: setDefaultXYZ is obsolete!!
- * You will usually create an instance of KGameDialog or any derived class and
- * call setDefaultXYZ methods. Example (maybe
- * obsoleted parameters - docu is currently changing very fast):
- * \code
- * KGameDialog dlg(kgame, i18n("New Game"), localPlayer, this, true,
- * ID_CHAT);
- * dlg.setDefaultNetworkInfo(port, host); // AB: obsolete!
- * dlg.exec();
- * \endcode
- * This will create a default modal dialog with the title "New Game". You don't
- * have to do more than this.
- *
- * @short Main configuration dialog for KGame
- * @author Andreas Beckermann <b_mann at gmx.de>
- **/
-class KDEGAMESPRIVATE_EXPORT KGameDialog : public KPageDialog
-{
- Q_OBJECT
-public:
-
- enum ConfigOptions
- {
- NoConfig = 0,
- ChatConfig = 1,
- GameConfig = 2,
- NetworkConfig = 4,
- MsgServerConfig = 8,
- BanPlayerConfig = 16,
- AllConfig = 0xffff
- };
-
- /**
- * Create an empty KGameDialog. You can add widgets using
- * addConfigPage.
- * @param g The KGame object of this game
- * @param owner The KPlayer object who is responsible for this
- * dialog, aka "the local player"
- * @param title The title of the dialog - see KDialog::setCaption
- * @param parent The parent of the dialog
- * @param modal Whether the dialog is modal or not
- **/
- KGameDialog(KGame* g, KPlayer* owner, const QString& title,
- QWidget* parent, bool modal = false);
-
- /**
- * Create a KGameDialog with the standard configuration widgets. This
- * creates the following widgets:
- * <ul>
- * <li> KGameDialogGeneralConfig
- * <li> KGameDialogNetworkConfig
- * <li> KGameDialogMsgServerConfig
- * <li> KGameDialogChatConfig
- * <li> KGameDialogConnectionConfig
- * </ul>
- * If you want to use your own implementations (or none) of the widgets
- * above you should subclass KGameDialog. Use addGameConfig,
- * addNetworkConfig, addMsgConfig, addChatWidget and
- * addConnectionList in this case.
- *
- * If you want to add further configuration widget you can simply use
- * addConfigPage
- * @param g The KGame object of this game
- * @param owner The KPlayer object who is responsible for this
- * dialog, aka "the local player"
- * @param title The title of the dialog - see KDialog::setCaption
- * @param parent The parent of the dialog
- * @param modal Whether the dialog is modal or not
- * @param initConfigs whether the default KGameDialogConfig widgets
- * shall be created using initDefaultDialog. Use false if you want
- * to use custom widgets.
- * @param chatMsgId The ID of Chat messages. See KGameChat. Unused
- * if initConfigs = false
- **/
- KGameDialog(KGame* g, KPlayer* owner, const QString& title,
- QWidget* parent, long initConfigs = AllConfig,
- int chatMsgId = 15432, bool modal = false);
-
- virtual ~KGameDialog();
-
-
- /**
- * Change the owner of the dialog. This will be used as the fromPlayer in
- * KGameChat and will receive the entered player name.
- * @param owner The owner of the dialog. It must already be added to the
- * KGame object!
- *
- * Calls the KGameDialogConfig::setOwner implementation of all
- * widgets that have been added by addConfigWidget
- * @param owner The new owner player of this dialog must already be
- * added to the KGame object. Can even be NULL (then no player
- * configuration is made)
- **/
- void setOwner(KPlayer* owner);
-
- /**
- * Change the KGame object this dialog is used for.
- *
- * Calls the KGameDialogConfig::setKGame implementation of all
- * widgets that have been added by addConfigWidget
- * @param g The new KGame object
- **/
- void setKGame(KGame* g);
-
- /**
- * This will submit all configuration data to the KGame object.
- * Automatically called by slotApply and slotOk
- * There is no need to replace this unless you
- * want to add widgets which are not derived from those classes
- **/
- virtual void submitToKGame();
-
- /**
- * Adds a KGameChat to the dialog. If no parent is specified the
- * game page will be used.
- * @param chat The chat widget
- * @param parent The parent of the chat widget. This MUST be an
- * already added config widget. Note that the game page will be used
- * if parent is 0.
- **/
- void addChatWidget(KGameDialogChatConfig* chat, KVBox* parent = 0);
-
- /**
- * Add a connection list to the dialog. The list consists of a
- * KLisBox containing all players in the current game (see
- * KGame::playerList). The admin can "ban" players, ie kick them out of
- * the game.
- *
- * This is another not-really-config-config-widget. It just displays the
- * connections and lets you ban players.
- * @param c The KGameDialogConnectionConfig object
- * @param parent The parent of the widget. If 0 the networkConfig
- * page is used.
- **/
- void addConnectionList(KGameDialogConnectionConfig* c, KVBox* parent = 0);
-
- /**
- * Add a new page to the dialog. The page will contain you new config
- * widget and will have your provided title.
- *
- * The widget will be reparented to this dialog. This also calls
- * KGameDialogConfig::setKGame and KGameDialogConfig::setOwner.
- * @param widget The new config widget
- * @param title The title of the newly added page.
- * @return The newly added page which contains your config widget.
- **/
- KVBox* addConfigPage(KGameDialogConfig* widget, const QString& title);
-
- /**
- * @return The QVBox of the given key, The key is from ConfigOptions
- * Note that not all are supported yet
- **/
- KVBox *configPage(ConfigOptions which);
-
- /**
- * @return The default netowrk config. Note that this always returns 0 if
- * you did not specify NetworkConfig in the constructor!
- **/
- KGameDialogNetworkConfig* networkConfig() const;
-
- /**
- * @return The default game config. Note that this always returns 0 if
- * you did not specify GameConfig in the constructor!
- **/
- KGameDialogGeneralConfig* gameConfig() const;
-
- /**
- * Add a config widget to the specified parent. Usually you call
- * addConfigPage for one widget and addConfigWidget for another to add
- * it to the same page. Just use the returned page of
- * addConfigPage.
- **/
- void addConfigWidget(KGameDialogConfig* widget, QWidget* parent);
-
- /**
- * Used to add the main network config widget in a new page. Use this to
- * make networkConfig return something useful.
- **/
- void addNetworkConfig(KGameDialogNetworkConfig* netConf);
-
- /**
- * Add the main game config widget in a new page. Use this to make
- * gameConfig return something useful.
- **/
- void addGameConfig(KGameDialogGeneralConfig* conf);
-
- /**
- * Used to add the message server config widget in a new page.
- **/
- void addMsgServerConfig(KGameDialogMsgServerConfig* conf);
-
-protected:
-
- /**
- * This is used to create a dialog containing all the default widgets.
- *
- * You may want to use this if you just want to use your own
- * configuration widgets which inherit the standard ones.
- *
- * Note that if one of the widgets is NULL the default implementation
- * will be used! (except the chat widget - you need to create it
- * yourself as you have to provide a message id)
- * @param initConfigs The widgets to be created
- * @param chatMsgId The msgid for the chat config (only if specified in
- * initConfigs) - see KGameDialogChatConfig
- **/
- void initDefaultDialog(ConfigOptions initConfigs, int chatMsgId = 15432);
-
- /**
- * Go through all config widgets and call their
- * KGameDialogConfig::setKGame and KGameDialogConfig::setOwner implementation
- *
- * This function could be private and probably will be very soon.
- * Don't use it yourself
- **/
- void configureConfigWidgets();
-
-protected Q_SLOTS:
- /**
- * Called when the user clicks on Ok. Calls slotApply and
- * QDialog::accept()
- **/
- virtual void slotOk();
-
- /**
- * Just calls submitToKGame()
- **/
- virtual void slotApply();
-
- /**
- * Sets the default values for the configuration widgets. Set these
- * values by (e.g.) setDefaultMaxPlayers()
- * @deprecated
- **/
- virtual void slotDefault();
-
- /**
- * Called when the KGame object is destroyed. Calls setKGame(0) so
- * that all widgets can disconnect their slots and so on.
- **/
- void slotUnsetKGame();
-
- /**
- * Called when the ADMIN status of this KGame client changes. See
- * KGameNetwork::signalAdminStatusChanged
- * @param isAdmin TRUE if this client is now the ADMIN otherwise FALSE
- **/
- void setAdmin(bool isAdmin);
-
- /**
- * Remove a config widget from the widget list.
- * @see QObject::destroyed
- **/
- void slotRemoveConfigWidget(QObject* configWidget);
-
-private:
- void init(KGame*, KPlayer*);
-
-private:
- KGameDialogPrivate* const d;
-};
-
-#endif
diff --git a/libkdegamesprivate/kgame/dialogs/kgamedialogconfig.cpp b/libkdegamesprivate/kgame/dialogs/kgamedialogconfig.cpp
deleted file mode 100644
index 3c9d727..0000000
--- a/libkdegamesprivate/kgame/dialogs/kgamedialogconfig.cpp
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- This file is part of the KDE games library
- Copyright (C) 2001 Andreas Beckermann (b_mann at gmx.de)
- Copyright (C) 2001 Martin Heni (kde at heni-online.de)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "kgamedialogconfig.h"
-
-#include "kgame.h"
-#include "kplayer.h"
-#include "kgamechat.h"
-#include "kgameconnectdialog.h"
-#include "kgameproperty.h"
-
-#include <klistwidget.h>
-#include <klocale.h>
-#include <knuminput.h>
-#include <kdialog.h>
-#include <kmessagebox.h>
-#include <klineedit.h>
-
-#include <QLayout>
-#include <QLabel>
-#include <QPushButton>
-#include <QGroupBox>
-
-#include "kgamedialogconfig.moc"
-
-class KGameDialogConfigPrivate
-{
-public:
- KGameDialogConfigPrivate()
- {
- mOwner = 0;
- mGame = 0;
-
- mAdmin = false;
- }
-
- bool mAdmin;
- KGame* mGame;
- KPlayer* mOwner;
-};
-
-KGameDialogConfig::KGameDialogConfig(QWidget* parent)
- : QWidget( parent ),
- d( new KGameDialogConfigPrivate )
-{
-}
-
-KGameDialogConfig::~KGameDialogConfig()
-{
- kDebug(11001) ;
- delete d;
-}
-
-void KGameDialogConfig::setKGame(KGame* g)
-{
- d->mGame = g;
-}
-
-void KGameDialogConfig::setOwner(KPlayer* p)
-{
- d->mOwner = p;
-}
-
-void KGameDialogConfig::setAdmin(bool a)
-{
- d->mAdmin = a;
-}
-
-KGame* KGameDialogConfig::game() const
-{ return d->mGame; }
-bool KGameDialogConfig::admin() const
-{ return d->mAdmin; }
-KPlayer* KGameDialogConfig::owner() const
-{ return d->mOwner; }
-
-/////////////////////////// KGameDialogNetworkConfig /////////////////////////
-class KGameDialogNetworkConfigPrivate
-{
-public:
- KGameDialogNetworkConfigPrivate()
- {
- mInitConnection = 0;
- mNetworkLabel = 0;
- mDisconnectButton = 0;
- mConnect = 0;
- mDefaultServer=true;
-
- }
-
- // QPushButton* mInitConnection;
- QGroupBox* mInitConnection;
- QLabel* mNetworkLabel;
- QPushButton *mDisconnectButton;
-
- bool mDefaultServer;
- QString mDefaultHost;
- unsigned short int mDefaultPort;
- KGameConnectWidget *mConnect;
-};
-
-
-KGameDialogNetworkConfig::KGameDialogNetworkConfig(QWidget* parent)
- : KGameDialogConfig(parent)
-{
-// kDebug(11001) << ": this=" << this;
- d = new KGameDialogNetworkConfigPrivate();
-
- QVBoxLayout* topLayout = new QVBoxLayout(this);
- topLayout->setMargin( KDialog::marginHint() );
- topLayout->setSpacing( KDialog::spacingHint() );
-
- QHBoxLayout *hb = new QHBoxLayout;
- hb->setSpacing( KDialog::spacingHint() );
- topLayout->addLayout(hb);
-
- d->mNetworkLabel = new QLabel(this);
- hb->addWidget(d->mNetworkLabel);
-
- d->mDisconnectButton=new QPushButton(i18n("Disconnect"),this);
- connect(d->mDisconnectButton, SIGNAL(clicked()), this, SLOT(slotExitConnection()));
- hb->addWidget(d->mDisconnectButton);
-
- d->mInitConnection = new QGroupBox(i18n("Network Configuration"), this);
- QHBoxLayout* gboxLay = new QHBoxLayout(d->mInitConnection);
- topLayout->addWidget(d->mInitConnection);
-
- d->mConnect = new KGameConnectWidget(d->mInitConnection);
- gboxLay->addWidget(d->mConnect);
- connect(d->mConnect, SIGNAL(signalNetworkSetup()), this, SLOT(slotInitConnection()));
- connect(d->mConnect, SIGNAL(signalServerTypeChanged(int)),
- this, SIGNAL(signalServerTypeChanged(int)));
-
- // Needs to be AFTER the creation of the dialogs
- setConnected(false);
- setDefaultNetworkInfo(QLatin1String( "localhost" ), 7654,true);
-}
-
-KGameDialogNetworkConfig::~KGameDialogNetworkConfig()
-{
- kDebug(11001) ;
- delete d;
-}
-
-void KGameDialogNetworkConfig::slotExitConnection()
-{
- kDebug(11001) << " !!!!!!!!!!!!!!!!!!!!!!!";
- if (game()) game()->disconnect();
- setConnected(false,false);
-}
-
-void KGameDialogNetworkConfig::slotInitConnection()
-{
- kDebug(11001) ;
- bool connected = false;
- bool master = true;
- unsigned short int port = d->mConnect->port();
- QString host = d->mConnect->host();
-
- if (host.isNull()) {
- master = true;
- if (game()) {
- game()->setDiscoveryInfo(d->mConnect->type(),d->mConnect->gameName());
- connected = game()->offerConnections(port);
- }
- } else {
- master = false;
- if (game()) {
- connected = game()->connectToServer(host, port);
- }
- // We need to learn about failed connections
- if (game()) {
- connect(game(), SIGNAL(signalConnectionBroken()),
- this, SLOT(slotConnectionBroken()));
- }
- }
- setConnected(connected, master);
-}
-
-void KGameDialogNetworkConfig::slotConnectionBroken()
-{
- kDebug(11001) ;
- setConnected(false,false);
- KMessageBox::error(this, i18n("Cannot connect to the network"));
-}
-
-void KGameDialogNetworkConfig::setConnected(bool connected, bool master)
-{
- if (!connected) {
- d->mNetworkLabel->setText(i18n("Network status: No Network"));
- d->mInitConnection->setEnabled(true);
- d->mDisconnectButton->setEnabled(false);
- return;
- }
- if (master) {
- d->mNetworkLabel->setText(i18n("Network status: You are MASTER"));
- } else {
- d->mNetworkLabel->setText(i18n("Network status: You are connected"));
- }
- d->mInitConnection->setEnabled(false);
- d->mDisconnectButton->setEnabled(true);
-}
-
-void KGameDialogNetworkConfig::submitToKGame(KGame* , KPlayer* )
-{
-}
-
-void KGameDialogNetworkConfig::setKGame(KGame* g)
-{
- KGameDialogConfig::setKGame(g);
- if (!game()) {
- setConnected(false);
- return;
- }
- setConnected(game()->isNetwork(), game()->isMaster());
-}
-
-void KGameDialogNetworkConfig::setDefaultNetworkInfo(const QString& host, unsigned short int port,bool server)
-{
- d->mDefaultPort = port;
- d->mDefaultHost = host;
- d->mDefaultServer = server;
-
- d->mConnect->setHost(host);
- d->mConnect->setPort(port);
- if (server) {
- d->mConnect->setDefault(0);
- } else {
- d->mConnect->setDefault(1);
- }
-}
-
-void KGameDialogNetworkConfig::setDiscoveryInfo(const QString& type, const QString& name)
-{
- d->mConnect->setType(type);
- d->mConnect->setName(name);
-}
-
-/////////////////////////// KGameDialogGeneralConfig /////////////////////////
-class KGameDialogGeneralConfigPrivate
-{
-public:
- KGameDialogGeneralConfigPrivate()
- {
- mTopLayout = 0;
- mName = 0;
- }
-
- KLineEdit* mName;
-
- QVBoxLayout* mTopLayout;
-};
-
-KGameDialogGeneralConfig::KGameDialogGeneralConfig(QWidget* parent, bool initializeGUI)
- : KGameDialogConfig(parent)
-{
-// kDebug(11001) << ": this=" << this;
- d = new KGameDialogGeneralConfigPrivate;
-
- if (initializeGUI) {
- d->mTopLayout = new QVBoxLayout(this);
- d->mTopLayout->setMargin( KDialog::marginHint() );
- d->mTopLayout->setSpacing( KDialog::spacingHint() );
-
- QWidget* nameWidget = new QWidget(this);
- d->mTopLayout->addWidget(nameWidget);
- QHBoxLayout* l = new QHBoxLayout(nameWidget);
- QLabel* nameLabel = new QLabel(i18n("Your name:"), nameWidget);
- l->addWidget(nameLabel);
- d->mName = new KLineEdit(nameWidget);
- l->addWidget(d->mName);
- }
-}
-
-KGameDialogGeneralConfig::~KGameDialogGeneralConfig()
-{
- kDebug(11001) ;
- delete d;
-}
-
-void KGameDialogGeneralConfig::setPlayerName(const QString& name)
-{
- if (d->mName) {
- d->mName->setText(name);
- }
-}
-
-QString KGameDialogGeneralConfig::playerName() const
-{
- return d->mName ? d->mName->text() : QString();
-}
-
-void KGameDialogGeneralConfig::setOwner(KPlayer* p)
-{
- if (owner()) {
- owner()->disconnect(this);
- }
- KGameDialogConfig::setOwner(p);
- if (!owner()) {
- // can this config be used at all?
- // maybe call hide()
- return;
- }
- connect(owner(), SIGNAL(signalPropertyChanged(KGamePropertyBase*,KPlayer*)),
- this, SLOT(slotPropertyChanged(KGamePropertyBase*,KPlayer*)));
- setPlayerName(p->name());
- //TODO: connect signalPropertyChanged and check for playername changes!
-}
-
-void KGameDialogGeneralConfig::setKGame(KGame* g)
-{
- KGameDialogConfig::setKGame(g);
- if (!g) {
- // TODO
- // can this config be used at all?
- // maybe call hide()
- return;
- }
-}
-
-void KGameDialogGeneralConfig::setAdmin(bool admin)
-{
- KGameDialogConfig::setAdmin(admin);
-// enable/disable widgets
-
-}
-
-void KGameDialogGeneralConfig::submitToKGame(KGame* g, KPlayer* p)
-{
-//FIXME
- if (p) {
- p->setName(playerName());
- }
- if (g) {
- }
-}
-
-void KGameDialogGeneralConfig::slotPropertyChanged(KGamePropertyBase* prop, KPlayer* p)
-{
- if (!prop || !p || p != owner()) {
- return;
- }
- switch (prop->id()) {
- case KGamePropertyBase::IdName:
- setPlayerName(p->name());
- break;
- default:
- break;
- }
-}
-
-class KGameDialogMsgServerConfigPrivate
-{
-public:
- KGameDialogMsgServerConfigPrivate()
- {
- senderLayout = 0;
- localLayout = 0;
-
- changeMaxClients = 0;
- changeAdmin= 0;
- removeClient= 0;
- noAdmin = 0;
-
- noMaster = 0;
- }
-
- QVBoxLayout* senderLayout;
- QHBoxLayout* localLayout;
-
- QPushButton* changeMaxClients;
- QPushButton* changeAdmin;
- QPushButton* removeClient;
- QLabel* noAdmin;
-
- QLabel* noMaster;
-};
-
-
-// TODO: change ADMIN ID, remove CLIENTS, change MAXCLIENTS
-// we do everything here with QPushButtons as we want to wait a moment before
-// continuing - the message must be sent over network first
-KGameDialogMsgServerConfig::KGameDialogMsgServerConfig(QWidget* parent)
- : KGameDialogConfig(parent)
-{
- d = new KGameDialogMsgServerConfigPrivate;
-
- QVBoxLayout* topLayout = new QVBoxLayout(this);
- topLayout->setMargin( KDialog::marginHint() );
- topLayout->setSpacing( KDialog::spacingHint() );
- d->senderLayout = new QVBoxLayout;
- d->localLayout = new QHBoxLayout;
- topLayout->addLayout( d->senderLayout );
- topLayout->addLayout( d->localLayout );
-}
-
-KGameDialogMsgServerConfig::~KGameDialogMsgServerConfig()
-{
- kDebug(11001) ;
- delete d;
-}
-
-void KGameDialogMsgServerConfig::setKGame(KGame* g)
-{
- KGameDialogConfig::setKGame(g);
- //TODO display the ID of the admin if we aren't
- // connect(g, SIGNAL(signalAdminChanged(int)), this, SLOT(slotChangeIsAdmin(int)));//TODO
- if (!game()) {
- // we cannot do anything without a KGame object!
- setAdmin(false);
- return;
- }
- setAdmin(game()->isAdmin());
- setHasMsgServer(game()->messageServer());
-}
-
-
-void KGameDialogMsgServerConfig::slotChangeMaxClients()
-{
- if (!game()) {
- kError(11001) << ": no valid game object available!";
- return;
- }
- if (!game()->isAdmin()) {
- kError(11001) << ": only ADMIN is allowed to call this!";
- return;
- }
- int max;
-// edit->setText(QString::number()); // current max clients! //TODO
-
- QDialog* dialog = new QDialog();
- dialog->setWindowTitle(i18n("Maximal Number of Clients"));
- QHBoxLayout* l = new QHBoxLayout(dialog);
- l->setMargin( KDialog::marginHint() );
- l->setSpacing( KDialog::spacingHint() );
-
- l->addWidget(new QLabel(i18n("Maximal number of clients (-1 = infinite):"), dialog));
- KLineEdit* edit = new KLineEdit(dialog);//TODO: use KIntNumInput
- l->addWidget(edit);
-// edit->setText(QString::number(max)); // current max clients! //TODO
- if (dialog->exec() == QDialog::Accepted) {
- bool ok;
- max = edit->text().toInt(&ok);
- if (ok) {
- game()->setMaxClients(max);
- }
- }
-
-}
-
-void KGameDialogMsgServerConfig::slotRemoveClient()
-{
-}
-
-void KGameDialogMsgServerConfig::slotChangeAdmin()
-{
- if (!game()) {
- kError(11001) << ": no valid game object available!";
- return;
- }
- if (!admin()) {
- kError(11001) << ": only ADMIN is allowed to call this!";
- return;
- }
- //TODO
- quint32 newAdmin = 0;
-// newAdmin = ;
- game()->electAdmin(newAdmin);
-}
-
-void KGameDialogMsgServerConfig::removeClient(quint32 /*id*/)
-{
-//TODO
-}
-
-void KGameDialogMsgServerConfig::setAdmin(bool a)
-{
- if (admin() == a) {
- // no need to do anything
- return;
- }
- KGameDialogConfig::setAdmin(a);
- if (admin()) {
- delete d->noAdmin;
- d->noAdmin = 0;
- d->changeMaxClients = new QPushButton(i18n("Change Maximal Number of Clients"), this);
- connect(d->changeMaxClients, SIGNAL(pressed()), this, SLOT(slotChangeMaxClients()));
- d->changeAdmin = new QPushButton(i18n("Change Admin"), this);
- connect(d->changeAdmin, SIGNAL(pressed()), this, SLOT(slotChangeAdmin()));
- d->removeClient = new QPushButton(i18n("Remove Client with All Players"), this);
- connect(d->removeClient, SIGNAL(pressed()), this, SLOT(slotRemoveClient()));
- d->senderLayout->addWidget(d->changeMaxClients);
- d->senderLayout->addWidget(d->changeAdmin);
- d->senderLayout->addWidget(d->removeClient);
- } else {
- delete d->changeMaxClients;
- d->changeMaxClients = 0;
- delete d->changeAdmin;
- d->changeAdmin = 0;
- delete d->removeClient;
- d->removeClient = 0;
- d->noAdmin = new QLabel(i18n("Only the admin can configure the message server!"), this);
- d->senderLayout->addWidget(d->noAdmin);
- }
-}
-
-
-void KGameDialogMsgServerConfig::setHasMsgServer(bool has)
-{
- if (!has) {
- // delete all inputs
- if (!d->noMaster) {
- d->noMaster = new QLabel(i18n("You do not own the message server"), this);
- d->localLayout->addWidget(d->noMaster);
- }
- return;
- }
- if (d->noMaster) {
- delete d->noMaster;
- d->noMaster = 0;
- }
- //TODO
- // list all connections, data (max clients) and so on
- // cannot be done above (together with QPushButtons) as it is possible that
- // this client is ADMIN but not MASTER (i.e. doesn't own the messageserver)
-}
-
-
-class KGameDialogChatConfigPrivate
-{
-public:
- KGameDialogChatConfigPrivate()
- {
- mChat = 0;
- }
-
- KGameChat* mChat;
-};
-
-KGameDialogChatConfig::KGameDialogChatConfig(int chatMsgId, QWidget* parent)
- : KGameDialogConfig(parent)
-{
- d = new KGameDialogChatConfigPrivate;
- QVBoxLayout* topLayout = new QVBoxLayout(this);
- topLayout->setMargin( KDialog::marginHint() );
- topLayout->setSpacing( KDialog::spacingHint() );
- QGroupBox* b = new QGroupBox(i18n("Chat"), this);
- topLayout->addWidget(b);
- QHBoxLayout* gboxLay = new QHBoxLayout(b);
- d->mChat = new KGameChat(0, chatMsgId, b);
- gboxLay->addWidget(d->mChat);
-}
-
-KGameDialogChatConfig::~KGameDialogChatConfig()
-{
- kDebug(11001) ;
- delete d;
-}
-
-void KGameDialogChatConfig::setKGame(KGame* g)
-{
- KGameDialogConfig::setKGame(g);
- d->mChat->setKGame(game());
- if (!game()) {
- hide();
- } else {
- show();
- }
-}
-
-void KGameDialogChatConfig::setOwner(KPlayer* p)
-{
- KGameDialogConfig::setOwner(p);
- if (!owner()) {
- hide();
- return;
- }
- d->mChat->setFromPlayer(owner());
- show();
-}
-
-
-
-class KGameDialogConnectionConfigPrivate
-{
-public:
- KGameDialogConnectionConfigPrivate()
- {
- mPlayerBox = 0;
- }
-
- QHash<QListWidgetItem*, KPlayer*> mItem2Player;
- KListWidget* mPlayerBox;
-};
-
-KGameDialogConnectionConfig::KGameDialogConnectionConfig(QWidget* parent)
- : KGameDialogConfig(parent)
-{
- //TODO: prevent player to ban himself
- d = new KGameDialogConnectionConfigPrivate;
- QVBoxLayout* topLayout = new QVBoxLayout(this);
- topLayout->setMargin( KDialog::marginHint() );
- topLayout->setSpacing( KDialog::spacingHint() );
- QGroupBox* b = new QGroupBox(i18n("Connected Players"), this);
- topLayout->addWidget(b);
- QHBoxLayout* gboxLay = new QHBoxLayout(b);
- d->mPlayerBox = new KListWidget(b);
- gboxLay->addWidget(d->mPlayerBox);
- setMinimumHeight(100);
-}
-
-KGameDialogConnectionConfig::~KGameDialogConnectionConfig()
-{
- kDebug(11001) ;
- // d->mIem2Player.clear();
- delete d;
-}
-
-void KGameDialogConnectionConfig::setKGame(KGame* g)
-{
- if (game()) {
- disconnect(game(), 0, this, 0);
- }
- KGameDialogConfig::setKGame(g);
- slotClearPlayers();
- if (game()) {
-// react to changes in KGame::playerList()
- connect(game(), SIGNAL(signalPlayerJoinedGame(KPlayer*)),
- this, SLOT(slotPlayerJoinedGame(KPlayer*)));
- connect(game(), SIGNAL(signalPlayerLeftGame(KPlayer*)),
- this, SLOT(slotPlayerLeftGame(KPlayer*)));
-
- const QList<KPlayer*> *playerList = game()->playerList();
- for ( QList<KPlayer*>::const_iterator it = playerList->begin(); it!=playerList->end();++it )
- {
- slotPlayerJoinedGame(*it);
- }
- }
-}
-
-void KGameDialogConnectionConfig::setOwner(KPlayer* p)
-{
- KGameDialogConfig::setOwner(p);
-}
-
-void KGameDialogConnectionConfig::setAdmin(bool a)
-{
- if (!game()) {// not possible... in theory
- return;
- }
- if (admin()) {
- disconnect(game(), SIGNAL(executed(QListWidgetItem*)), this, 0);
- }
- KGameDialogConfig::setAdmin(a);
- if (admin()) {
- connect(d->mPlayerBox, SIGNAL(executed(QListWidgetItem*)), this,
- SLOT(slotKickPlayerOut(QListWidgetItem*)));
- }
-}
-
-QListWidgetItem* KGameDialogConnectionConfig::item(KPlayer* p) const
-{
- QHash<QListWidgetItem*, KPlayer*>::const_iterator it, itEnd;
- it = d->mItem2Player.constBegin();
- itEnd = d->mItem2Player.constEnd();
- for ( ; it != itEnd; ++it ) {
- if (it.value() == p) return it.key();
- }
- return 0;
-}
-
-void KGameDialogConnectionConfig::slotClearPlayers()
-{
- QHash<QListWidgetItem*, KPlayer*>::const_iterator it, itEnd;
- it = d->mItem2Player.constBegin();
- itEnd = d->mItem2Player.constEnd();
- for ( ; it != itEnd; ++it ) {
- slotPlayerLeftGame(it.value());
- }
-
- if (d->mItem2Player.count() > 0) {
- kWarning(11001) << ": itemList wasn't cleared properly";
- d->mItem2Player.clear();
- }
- if (d->mPlayerBox->count() > 0) {
- kWarning(11001) << ": listBox wasn't cleared properly";
- d->mPlayerBox->clear();
- }
-
-}
-
-void KGameDialogConnectionConfig::slotPlayerJoinedGame(KPlayer* p)
-{
- if (!p) {
- kError(11001) << ": Cannot add NULL player";
- return;
- }
- bool playerFound = false;
- QHash<QListWidgetItem*, KPlayer*>::const_iterator it, itEnd;
- it = d->mItem2Player.constBegin();
- itEnd = d->mItem2Player.constEnd();
- for ( ; !playerFound && it != itEnd; ++it ) playerFound = it.value() == p;
- if (playerFound) {
- kError(11001) << ": attempt to double add player";
- return;
- }
- kDebug(11001) << ": add player" << p->id();
- QListWidgetItem* t = new QListWidgetItem(p->name(), d->mPlayerBox);
- d->mItem2Player.insert(t, p);
-
- connect(p, SIGNAL(signalPropertyChanged(KGamePropertyBase*,KPlayer*)),
- this, SLOT(slotPropertyChanged(KGamePropertyBase*,KPlayer*)));
-
-}
-
-void KGameDialogConnectionConfig::slotPlayerLeftGame(KPlayer* p)
-{
- // disconnect first
- this->disconnect(p);
- if (!item(p)) {
- kError(11001) << ": cannot find" << p->id()
- << "in list";
- return;
- }
- d->mPlayerBox->takeItem(d->mPlayerBox->row(item(p)));
-
-}
-
-void KGameDialogConnectionConfig::slotKickPlayerOut(QListWidgetItem* item)
-{
- kDebug(11001) << "kick player out";
- KPlayer* p = d->mItem2Player[item];
- if (!p) {
- kError(11001) << "invalid item selected - no player found";
- return;
- }
- if (!game()) {
- kWarning(11001) << "no game set";
- return;
- }
- if (!admin()) {
- kDebug(11001) << "Only the ADMIN can kick players";
- return;
- }
- if (p == owner()) { // you wanna ban the ADMIN ??
- kDebug(11001) << "you cannot kick the ADMIN";
- return;
- }
-
- if (KMessageBox::questionYesNo(this, i18n("Do you want to ban player \"%1\" from the game?",
- p->name()), QString(), KGuiItem (i18n("Ban Player")), KGuiItem (i18n("Do Not Ban"))) == KMessageBox::Yes) {
- kDebug(11001) << "will remove player" << p;
- game()->removePlayer(p);
-// d->mPlayerBox->removeItem(d->mPlayerBox->index(item)); // should be done by signalPlayerLeftGame
- } else {
- kDebug(11001) << "will NOT remove player" << p;
- }
-}
-
-void KGameDialogConnectionConfig::slotPropertyChanged(KGamePropertyBase* prop, KPlayer* player)
-{
- if(prop->id() == KGamePropertyBase::IdName) {
- QListWidgetItem* old = item(player);
- QListWidgetItem* t = new QListWidgetItem(player->name());
- int row = d->mPlayerBox->row(old);
- d->mPlayerBox->takeItem( row );
- d->mPlayerBox->insertItem(row, t);
- d->mItem2Player.remove(old);
- d->mItem2Player.insert(t, player);
- }
-}
-
diff --git a/libkdegamesprivate/kgame/dialogs/kgamedialogconfig.h b/libkdegamesprivate/kgame/dialogs/kgamedialogconfig.h
deleted file mode 100644
index 9c948b6..0000000
--- a/libkdegamesprivate/kgame/dialogs/kgamedialogconfig.h
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- This file is part of the KDE games library
- Copyright (C) 2001 Andreas Beckermann (b_mann at gmx.de)
- Copyright (C) 2001 Martin Heni (kde at heni-online.de)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License version 2 as published by the Free Software Foundation.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-// NAMING
-// please follow these naming rules if you add/change classes:
-// the main dialog is named KGameDialog and the base config widget
-// KGameDialogConfig. All config widgets are named KGameDialogXYZConfig (where
-// XYZ = the name of the config widget, like "general" or "network") and are
-// inherited from KGameDialogConfig.
-
-#ifndef __KGAMEDIALOGCONFIG_H__
-#define __KGAMEDIALOGCONFIG_H__
-
-#include <QtGui/QWidget>
-#include "../../libkdegamesprivate_export.h"
-
-class QListWidgetItem;
-
-class KGame;
-class KPlayer;
-class KGamePropertyBase;
-
-class KGameDialogConfigPrivate;
-/**
- * \class KGameDialogConfig kgamedialogconfig.h <KGameDialogConfig>
- *
- * Base class for configuration widgets.
- *
- * You can inherit from this and implement @ref submitToKGame, @ref
- * setOwner and @ref setKGame to create your personal @ref KGame configuration widget :-)
- * @short Base class for configuration widgets
- * @author Andreas Beckermann <b_mann at gmx.de>
- **/
-class KDEGAMESPRIVATE_EXPORT KGameDialogConfig : public QWidget
-{
- Q_OBJECT
-public:
- KGameDialogConfig(QWidget* parent = 0);
- virtual ~KGameDialogConfig();
-
- /**
- * Called by @ref KGameDialog to submit all settings to the KGame
- * Object.
- * You have to replace this if you add your own widgets!
- * @param g A pointer to your KGame.
- * @param p A pointer to the player owning this dialog
- **/
- virtual void submitToKGame(KGame* g, KPlayer* p) = 0;
-
- /**
- * The owner player of the dialog has been changed. The default
- * changes the pointer for owner so don't forget to call the
- * default implementation if you overwrite this!
- *
- * You can use this e.g. to change a line edit widget containing the
- * player name.
- *
- * Note: even NULL players are allowed!
- * @param p The new owner player of the dialog
- **/
- virtual void setOwner(KPlayer* p);
-
- /**
- * The KGame object of the dialog has been changed. The default
- * implementation changes the pointer for game so don't forget to
- * call the default implementation if you overwrite this!
- *
- * You can use this e.g. to re-read the min/max player settings.
- * @param g The KGame object
- **/
- virtual void setKGame(KGame* g);
-
- /**
- * The admin status has been changed.
- * If the KGame object of this config widget is the
- * admin the user is allowed to configure it. Otherwise most
- * widgets will have to be disabled. Note that you don't necessarily
- * need to deactivate all widget - e.g. the player name must be
- * configured by the player. Mainly the KGame configuration can be done
- * by the admin only.
- *
- * By default this does nothing. Changes the value for admin so
- * don't forget to call the default implementation in derived classes!
- * @param admin Whether the KGame object of this dialog can be
- * configured
- **/
- virtual void setAdmin(bool admin);
-
- /**
- * A pointer to the KGame object that has been set by @ref setKGame.
- *
- * Note that NULL is allowed!
- * @return The KGame object assigned to this dialog
- **/
- KGame* game() const;
-
- /**
- * A pointer to the KPlayer object that has been set by @ref
- * setOwner.
- *
- * Note that NULL is allowed!
- * @return The owner of the dialog
- **/
- KPlayer* owner() const;
-
- /**
- * @return True if the owner is ADMIN otherwise FALSE. See also
- * @ref setAdmin
- **/
- bool admin() const;
-
-protected:
-
-private:
- KGameDialogConfigPrivate* const d;
-};
-
-class KGameDialogGeneralConfigPrivate;
-/**
- * \class KGameDialogGeneralConfig kgamedialogconfig.h <KGameDialogConfig>
- *
- * The main game configuration widget.
- *
- * It currently contains a line edit for the name of the player only. You can
- * add widgets by using the KGameDialogGeneralConfig as parent parameter as it
- * uses QLayout::autoAdd == true.
- * @author Andreas Beckermann <b_mann at gmx.de>
- **/
-class KGameDialogGeneralConfig : public KGameDialogConfig
-{
- Q_OBJECT
-public:
- /**
- * Construct a KGameDialogGeneralConfig. Currently it contains a line
- * edit widget to change the player name only.
- *
- * If you just want to add more widgets you can just create your widgets
- * with the KGameDialogGeneralConfig as parent as it uses
- * QLayout::setAutoAdd(true).
- *
- * @param parent Parent widget for this dialog.
- * @param initializeGUI If you really don't want to use the
- * predefined widget and/or layout use FALSE here. Note that then none
- * of the predefined widgets (currently only the name of the player)
- * will exist anymore.
- *
- **/
- explicit KGameDialogGeneralConfig(QWidget* parent = 0, bool initializeGUI = true);
- virtual ~KGameDialogGeneralConfig();
-
- /**
- * Called by @ref KGameDialog to submit all settings to the KGame
- * Object.
- * You have to replace this if you add your own widgets!
- * @param g A pointer to your KGame.
- * @param p A pointer to the player owning this dialog
- **/
- virtual void submitToKGame(KGame* g, KPlayer* p);
-
- /**
- * Change the owner of the config widget.
- *
- * Changes the playername in the line edit
- * @param p The new owner player
- **/
- virtual void setOwner(KPlayer* p);
-
- /**
- * See @ref KGameDialogConfig::setKGame
- *
- * Sets the default values of all KGame related predefined widgets
- * (currently none)
- **/
- virtual void setKGame(KGame* g);
-
- /**
- * See @ref KGameDialogConfig::setAdmin
- *
- * This deactivates the min/max player widgets
- **/
- virtual void setAdmin(bool admin);
-
-protected Q_SLOTS:
- void slotPropertyChanged(KGamePropertyBase*, KPlayer*);
-
-protected:
- void setPlayerName(const QString& name);
-
- QString playerName() const;
-
-private:
- KGameDialogGeneralConfigPrivate* d;
-};
-
-class KGameDialogNetworkConfigPrivate;
-/**
- * \class KGameDialogNetworkConfig kgamedialogconfig.h <KGameDialogConfig>
- */
-class KDEGAMESPRIVATE_EXPORT KGameDialogNetworkConfig : public KGameDialogConfig
-{
- Q_OBJECT
-public:
- KGameDialogNetworkConfig(QWidget* parent = 0);
- virtual ~KGameDialogNetworkConfig();
-
-
- void disableInitConnection();
-
- /**
- * Called by @ref KGameDialog to submit all settings to the KGame
- * Object.
- * You have to replace this if you add your own widgets!
- * @param g A pointer to your KGame.
- * @param p A pointer to the player owning this dialog
- **/
- virtual void submitToKGame(KGame* g, KPlayer* p);
-
- virtual void setKGame(KGame* g);
-
- /**
- * This sets the default port and host used in @ref KGameConnectDialog.
- * The user will be able to change these defaults!
- *
- * If you don't call this then host "localhost" and port "0" is used.
- * You are strongly encouraged to change at least the port!
- * @param port The default port to connect to / listen on
- * @param host The default host to connect to
- * @param server The default state. 0 For a server game, 1 to join a game
- **/
- void setDefaultNetworkInfo(const QString& host, unsigned short int port,bool server=true);
-
- /**
- * Set service type that will be published or browsed for and game name that will be displayed in
- * server browser. Without this publishing and discovery of LAN servers will not be enabled.
- * @param name Game name. Important only for server mode. If not
- * set hostname will be used. In case of name conflict -2, -3 and so on will be added to name.
- * @param type Service type (something like _kwin4._tcp). It should be unique for application.
- **/
- void setDiscoveryInfo(const QString& type, const QString& name=QString());
-
-Q_SIGNALS:
- /**
- * This signal is emmited if the user changes the server type (client/server)
- * in the network configuration dialog.
- *
- * @param t type (0/1) of the connection
- **/
- void signalServerTypeChanged(int t);
-
-
-protected:
- void setConnected(bool connected, bool master = false);
-
-protected Q_SLOTS:
- void slotInitConnection();
- void slotExitConnection();
- void slotConnectionBroken();
-
-
-private:
- KGameDialogNetworkConfigPrivate* d;
-};
-
-class KGameDialogMsgServerConfigPrivate;
-/**
- * \class KGameDialogMsgServerConfig kgamedialogconfig.h <KGameDialogConfig>
- */
-class KGameDialogMsgServerConfig : public KGameDialogConfig
-{
- Q_OBJECT
-public:
- KGameDialogMsgServerConfig(QWidget* parent = 0);
- virtual ~KGameDialogMsgServerConfig();
-
- virtual void submitToKGame(KGame* g, KPlayer* p) { Q_UNUSED(g); Q_UNUSED(p); }
-
- void setHasMsgServer(bool);
-
- virtual void setKGame(KGame* g);
- virtual void setAdmin(bool admin);
-
-protected Q_SLOTS:
- void slotChangeMaxClients();
- void slotChangeAdmin();
- void slotRemoveClient();
-
-protected:
- void removeClient(quint32 id);
-
-private:
- KGameDialogMsgServerConfigPrivate* d;
-};
-
-class KGameDialogChatConfigPrivate;
-/**
- * \class KGameDialogChatConfig kgamedialogconfig.h <KGameDialogConfig>
- *
- * This is not really a configuration widget but rather a simple chat widget.
- * This widget does nothing but just providing a @ref KGameChat object.
- * @short A chat widget inside a @ref KGameDialog
- * @author Andreas Beckermann <b_mann at gmx.de>
- **/
-class KGameDialogChatConfig : public KGameDialogConfig
-{
- Q_OBJECT
-public:
- explicit KGameDialogChatConfig(int chatMsgId, QWidget* parent = 0);
- virtual ~KGameDialogChatConfig();
-
- virtual void setKGame(KGame* g);
- virtual void setOwner(KPlayer* p);
-
- virtual void submitToKGame(KGame* g, KPlayer* p) { Q_UNUSED(g); Q_UNUSED(p); }
-
-private:
- KGameDialogChatConfigPrivate* d;
-};
-
-class KGameDialogConnectionConfigPrivate;
-/**
- * \class KGameDialogConnectionConfig kgamedialogconfig.h <KGameDialogConfig>
- *
- * @short Lists all connected players and gives the ability to kick them off the
- * game
- **/
-class KGameDialogConnectionConfig : public KGameDialogConfig
-{
- Q_OBJECT
-public:
- KGameDialogConnectionConfig(QWidget* parent = 0);
- virtual ~KGameDialogConnectionConfig();
-
- virtual void setKGame(KGame* g);
- virtual void setOwner(KPlayer* p);
- virtual void setAdmin(bool admin);
-
- virtual void submitToKGame(KGame* g, KPlayer* p) { Q_UNUSED(g); Q_UNUSED(p); }
-
-protected:
- /**
- * @param p A player
- * @return The @ref QListWidgetItem that belongs to the player @p p
- **/
- QListWidgetItem* item(KPlayer* p) const;
-
-protected Q_SLOTS:
- void slotKickPlayerOut(QListWidgetItem* item);
- void slotPropertyChanged(KGamePropertyBase* prop, KPlayer* p);
- void slotPlayerLeftGame(KPlayer* p);
- void slotPlayerJoinedGame(KPlayer* p);
- void slotClearPlayers();
-
-private:
- KGameDialogConnectionConfigPrivate* d;
-
-};
-#endif
More information about the kde-games-devel
mailing list