[Kde-games-devel] [libkdegames] /: Move KGameDebugDialog to kfourinline

Albert Astals Cid aacid at kde.org
Mon Dec 24 16:07:30 UTC 2012


Git commit 43d7867ffab0ef6f635a7966165aff458f3d38a0 by Albert Astals Cid.
Committed on 24/12/2012 at 17:06.
Pushed by aacid into branch 'master'.

Move KGameDebugDialog to kfourinline

It is only used in kfourinline so i moved it there
We are deprecating the kgame
library (you need to define USE_UNSTABLE_LIBKDEGAMESPRIVATE_API to use it)

CCMAIL: kde-games-devel at kde.org

M  +0    -1    CMakeLists.txt
M  +0    -1    libkdegamesprivate/CMakeLists.txt
M  +1    -79   libkdegamesprivate/kgame/DESIGN
M  +0    -2    libkdegamesprivate/kgame/TODO
D  +0    -577  libkdegamesprivate/kgame/dialogs/kgamedebugdialog.cpp
D  +0    -152  libkdegamesprivate/kgame/dialogs/kgamedebugdialog.h
M  +1    -2    libkdegamesprivate/kgame/kgamemessage.h
M  +1    -2    libkdegamesprivate/kgame/kgameproperty.h
M  +2    -3    libkdegamesprivate/kgame/kgamepropertyhandler.h

http://commits.kde.org/libkdegames/43d7867ffab0ef6f635a7966165aff458f3d38a0

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88de30c..6a62f63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,7 +130,6 @@ set(kdegamesprivate_LIB_SRCS
     libkdegamesprivate/kchat.cpp
     libkdegamesprivate/kchatdialog.cpp
     libkdegamesprivate/kgame/dialogs/kgameconnectdialog.cpp
-    libkdegamesprivate/kgame/dialogs/kgamedebugdialog.cpp
     libkdegamesprivate/kgame/dialogs/kgamedialogconfig.cpp
     libkdegamesprivate/kgame/dialogs/kgamedialog.cpp
     libkdegamesprivate/kgame/dialogs/kgameerrordialog.cpp
diff --git a/libkdegamesprivate/CMakeLists.txt b/libkdegamesprivate/CMakeLists.txt
index 83d4aac..168d96d 100644
--- a/libkdegamesprivate/CMakeLists.txt
+++ b/libkdegamesprivate/CMakeLists.txt
@@ -43,7 +43,6 @@ DESTINATION ${INCLUDE_INSTALL_DIR}/libkdegamesprivate/kgame COMPONENT Devel)
 
 install(FILES
     kgame/dialogs/kgameconnectdialog.h
-    kgame/dialogs/kgamedebugdialog.h
     kgame/dialogs/kgamedialogconfig.h
     kgame/dialogs/kgamedialog.h
     kgame/dialogs/kgameerrordialog.h
diff --git a/libkdegamesprivate/kgame/DESIGN b/libkdegamesprivate/kgame/DESIGN
index 66c3d1a..a7c966a 100644
--- a/libkdegamesprivate/kgame/DESIGN
+++ b/libkdegamesprivate/kgame/DESIGN
@@ -39,11 +39,6 @@ AB: 3.x is obsolete!
 
 4. KGameIO (Andreas Beckermann 10.08.2001)
 
-5. Debugging (Andreas Beckermann 06.10.2001) TODO!
-5.1 KGameDebugDialog
-5.1.1 Debug KGame
-5.1.3 Debug Messages
-
 ---------------------------------------------------------------------
 1. DEFINITIONS
 --------------
@@ -240,9 +235,7 @@ KGamePropertyBase::IdUser. IDs below this are reserved for KGame. Probably this
 will be changed so that you cannot use IDs below IdUser in the future. Then you
 have to specify the dataHandler(). You can also use a KGame or KPlayer pointer.
 This will automatically use KGame::dataHandler() or KPlayer::dataHandler().
-Finally you *can* provide a name for the property. This will be used for
-debugging in KGameDebugDialog. If you want to save some memory you can leave
-this out.
+Finally you *can* provide a name for the property.
 Note that if you use pointers to create the properties dynamically they are
 *not* deleted automatically! You MUST delete them yourself!
 Now you can use the KGameProperty like every variable else. See also Section 
@@ -334,74 +327,3 @@ probably be calculated by the game IO itself.
 
 
 
-5. Debugging
-------------
-The general debugging concept (if there is one at all) or general debugging
-hints are not yet written. Feel free to do so
-
-5.1 KGameDebugDialog
---------------------
-A nice way of debugging a KGame based game is the KGameDebugDialog. Basically
-all you have to do is to add something like "Debug" to your game's menu and add
-a slot like
-slotDebug()
-{
- KGameDebugDialog* dialog = new KGameDebugDialog(mGame, this);
- connect(dialog, SIGNAL(finished()), dialog, SLOT(slotDelayedDestruct()));
- dialog->show();
-}
-that's it.
-You can now click on that menu entry and you get a non-modal dialog where you
-can start to debug :-)
-The dialog consist of several pages. You can easily add your own using
-KDialogBase::addVBoxPage() (for example). 
-
-5.1.1 Debug KGame
------------------
-The first page, "Debug KGame" shows on the left most or even all status values of
-KGame. That contains e.g.  minPlayers(), isAdmin(), gameStatus(), ...
-The right side is probably the more important one. It lists *all* KGameProperties
-which have been inserted to this KGame object (only to this KGame object - not
-the ones that have been added to the players!). Most of the status variables of
-the left side are here again as they are implemented as KGameProperty. You can
-see the name of the property (together with its ID), its value and the policy
-this property uses. Note that "unknwon" will be displayed as name of the
-property if you haven't supplied one. See KGamePropertyBase::registerData() for
-info. You probably always want to supply a name for the property to debug it
-easily. In the future there will be something like
-KGamePropertyHandler::setDebug() so that you can switch off debugging and save
-the memory of the names in a release version. 
-For as long as you use standard types for your properties (int, long, bool,
-...) you should always be able to see the value of the property. If you just see
-"unknown" then this type has not been implemented. You can connect to the signal
-KGamePropertyHandler::signalRequestValue() and supply a QString with the value
-yourself. If you do so for a standard type please also submit a bug report!
-
-Currently the dialog does *not* update automatically! So you alway have to click
-the "update" button when you want a current value. There are several reasons for
-this (and one of them is that i'm too lazy to implement the update ;)). E.g.
-often (very often) a property is just in the background - stores e.g. the
-available money in a game. But you don't want it to update whenever the value
-changes (a player receives/pays money) but only when the value on the screen
-changes.
-
-5.1.2 Debug Players
--------------------
-This page consists of three widgets. On the very left there is a list of all
-players in the game. Only the IDs are displayed to save space. If you click one
-the other widgets are filled with content. These widgets are quite much the same
-as the ones in "Debug KGame" - the left shows the value of the functions and the
-right one displays all KProperties of a player. Not much to say here - except:
-See "Debug KGame".
-
-If you change to another player the value are also updated.
-
-5.1.3 Debug Messages
---------------------
-This page is probably not as important as the other ones. It displays *every*
-message that is sent through the KGame object. As a KGameProperry also send
-messages you probably get a lot of them...
-You can exclude message IDs from being displayed (e.g. all game properties). 
-You can also change the sorting of the list to see all messages of a certain ID.
-The default is to sort by time (which is displayed on the left side).
-
diff --git a/libkdegamesprivate/kgame/TODO b/libkdegamesprivate/kgame/TODO
index 2f100b8..81ea005 100644
--- a/libkdegamesprivate/kgame/TODO
+++ b/libkdegamesprivate/kgame/TODO
@@ -35,7 +35,5 @@
 - 06.10.2001: If one kicks a player (in KGameDialog) the client should be kicked
               as well. Perhaps always disconnect a client when all players from
               it have disappeared?
-- 07.10.2001: display (List) or (Array) for KGameProperty[List|Array] in
-              KGameDebugDialog as value
 - 08.10.2001: KGamePropertyList|KGamePropertyArray must be ported to new QT3 API
               (e.g. erase instead of remove, ...)
diff --git a/libkdegamesprivate/kgame/dialogs/kgamedebugdialog.cpp b/libkdegamesprivate/kgame/dialogs/kgamedebugdialog.cpp
deleted file mode 100644
index bcb0152..0000000
--- a/libkdegamesprivate/kgame/dialogs/kgamedebugdialog.cpp
+++ /dev/null
@@ -1,577 +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 "kgamedebugdialog.h"
-
-#include "kgamemessage.h"
-#include "kgame.h"
-#include "kplayer.h"
-#include "kgamepropertyhandler.h"
-
-#include <klistwidget.h>
-#include <klocale.h>
-#include <kdebug.h>
-#include <kpushbutton.h>
-#include <KStandardGuiItem>
-
-#include <QTreeWidget>
-#include <QLayout>
-
-#include <QLabel>
-#include <QDateTime>
-#include <QVBoxLayout>
-#include <QFrame>
-#include <QHBoxLayout>
-#include <QGridLayout>
-
-#include <typeinfo>
-
-
-class KGameDebugDialogPrivate
-{
-public:
-	KGameDebugDialogPrivate()
-	{
-		mGame = 0;
-
-		mGamePage = 0;
-		mGameProperties = 0;
-		mGameAddress = 0;
-		mGameId = 0;
-		mGameCookie = 0;
-		mGameMaster = 0;
-		mGameAdmin = 0;
-		mGameOffering = 0;
-		mGameStatus = 0;
-		mGameRunning = 0;
-		mGameMaxPlayers = 0;
-		mGameMinPlayers = 0;
-		mGamePlayerCount = 0;
-
-		mPlayerPage = 0;
-		mPlayerList = 0;
-		mPlayerProperties = 0;
-		mPlayerAddress = 0;
-		mPlayerId = 0;
-		mPlayerName = 0;
-		mPlayerGroup = 0;
-		mPlayerUserId = 0;
-		mPlayerMyTurn = 0;
-		mPlayerAsyncInput= 0;
-		mPlayerKGameAddress = 0;
-		mPlayerVirtual = 0;
-		mPlayerActive = 0;
-		mPlayerRtti = 0;
-		mPlayerNetworkPriority = 0;
-
-		mMessagePage = 0;
-		mMessageList = 0;
-		mHideIdList = 0;
-	}
-
-	const KGame* mGame;
-
-	QFrame* mGamePage;
-	QTreeWidget* mGameProperties;
-	QTreeWidgetItem* mGameAddress;
-	QTreeWidgetItem* mGameId;
-	QTreeWidgetItem* mGameCookie;
-	QTreeWidgetItem* mGameMaster;
-	QTreeWidgetItem* mGameAdmin;
-	QTreeWidgetItem* mGameOffering;
-	QTreeWidgetItem* mGameStatus;
-	QTreeWidgetItem* mGameRunning;
-	QTreeWidgetItem* mGameMaxPlayers;
-	QTreeWidgetItem* mGameMinPlayers;
-	QTreeWidgetItem* mGamePlayerCount;
-
-	QFrame* mPlayerPage;
-	KListWidget* mPlayerList;
-	QTreeWidget* mPlayerProperties;
-	QTreeWidgetItem* mPlayerAddress;
-	QTreeWidgetItem* mPlayerId;
-	QTreeWidgetItem* mPlayerName;
-	QTreeWidgetItem* mPlayerGroup;
-	QTreeWidgetItem* mPlayerUserId;
-	QTreeWidgetItem* mPlayerMyTurn;
-	QTreeWidgetItem* mPlayerAsyncInput;
-	QTreeWidgetItem* mPlayerKGameAddress;
-	QTreeWidgetItem* mPlayerVirtual;
-	QTreeWidgetItem* mPlayerActive;
-	QTreeWidgetItem* mPlayerRtti;
-	QTreeWidgetItem* mPlayerNetworkPriority;
-
-	QFrame* mMessagePage;
-	QTreeWidget* mMessageList;
-	KListWidget* mHideIdList;
-};
-
-KGameDebugDialog::KGameDebugDialog(KGame* g, QWidget* parent, bool modal)
-    : KPageDialog(parent),
-      d( new KGameDebugDialogPrivate )
-{
- setCaption(i18n("KGame Debug Dialog"));
- setButtons(Close);
- setDefaultButton(Close);
- setModal(modal);
- showButtonSeparator(true);
- setFaceType(KPageDialog::Tabbed);
-
- initGamePage();
- initPlayerPage();
- initMessagePage();
-
- setKGame(g);
-}
-
-KGameDebugDialog::~KGameDebugDialog()
-{
- delete d;
-}
-
-void KGameDebugDialog::initGamePage()
-{
- d->mGamePage = new QFrame();
- addPage(d->mGamePage,i18n("Debug &KGame"));
- QVBoxLayout* topLayout = new QVBoxLayout(d->mGamePage);
- topLayout->setMargin( marginHint() );
- topLayout->setSpacing( spacingHint() );
- QHBoxLayout* layout = new QHBoxLayout;
- topLayout->addLayout(layout);
-
- QTreeWidget* v = new QTreeWidget(d->mGamePage);
- QTreeWidgetItem* vheader = new QTreeWidgetItem();
- vheader->setText(0, tr("Data"));
- vheader->setText(1, tr("Value"));
- v->setHeaderItem(vheader);
- layout->addWidget(v);
-
- d->mGameProperties = new QTreeWidget(d->mGamePage);
- QTreeWidgetItem* mGamePropertiesHeader = new QTreeWidgetItem();
- mGamePropertiesHeader->setText(0, tr("Property"));
- mGamePropertiesHeader->setText(1, tr("Value"));
- mGamePropertiesHeader->setText(2, tr("Policy"));
- d->mGameProperties->setHeaderItem(mGamePropertiesHeader);
- layout->addWidget(d->mGameProperties);
-
- QPushButton* b = new QPushButton(i18n("Update"), d->mGamePage);
- connect(b, SIGNAL(pressed()), this, SLOT(slotUpdateGameData()));
- topLayout->addWidget(b);
-
-// game data
- d->mGameAddress = new QTreeWidgetItem(v, QStringList(i18n("KGame Pointer")));
- d->mGameId = new QTreeWidgetItem(v, QStringList(i18n("Game ID")));
- d->mGameCookie = new QTreeWidgetItem(v, QStringList(i18n("Game Cookie")));
- d->mGameMaster = new QTreeWidgetItem(v, QStringList(i18n("Is Master")));
- d->mGameAdmin = new QTreeWidgetItem(v, QStringList(i18n("Is Admin")));
- d->mGameOffering = new QTreeWidgetItem(v, QStringList(i18n("Is Offering Connections")));
- d->mGameStatus = new QTreeWidgetItem(v, QStringList(i18n("Game Status")));
- d->mGameRunning = new QTreeWidgetItem(v, QStringList(i18n("Game is Running")));
- d->mGameMaxPlayers = new QTreeWidgetItem(v, QStringList(i18n("Maximal Players")));
- d->mGameMinPlayers = new QTreeWidgetItem(v, QStringList(i18n("Minimal Players")));
- d->mGamePlayerCount = new QTreeWidgetItem(v, QStringList(i18n("Players")));
-}
-
-void KGameDebugDialog::initPlayerPage()
-{
- d->mPlayerPage = new QFrame();
- addPage(d->mPlayerPage,i18n("Debug &Players"));
- QVBoxLayout* topLayout = new QVBoxLayout(d->mPlayerPage);
- topLayout->setMargin( marginHint() );
- topLayout->setSpacing( spacingHint() );
- QHBoxLayout* layout = new QHBoxLayout;
- topLayout->addLayout(layout);
-
- //TODO: connect to the KGame signals for joined/removed players!!!
- QVBoxLayout* listLayout = new QVBoxLayout;
- layout->addLayout(listLayout);
- QLabel* listLabel = new QLabel(i18n("Available Players"), d->mPlayerPage);
- listLayout->addWidget(listLabel);
- d->mPlayerList = new KListWidget(d->mPlayerPage);
- connect(d->mPlayerList, SIGNAL(executed(QListWidgetItem*)), this, SLOT(slotUpdatePlayerData(QListWidgetItem*)));
- listLayout->addWidget(d->mPlayerList);
- d->mPlayerList->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
-
- QTreeWidget* v = new QTreeWidget(d->mPlayerPage);
- layout->addWidget(v);
- QTreeWidgetItem* vheader = new QTreeWidgetItem();
- vheader->setText(0, tr("Data"));
- vheader->setText(1, tr("Value"));
- v->setHeaderItem(vheader);
-
- d->mPlayerProperties = new QTreeWidget(d->mPlayerPage);
- QTreeWidgetItem* mPlayerPropertiesHeader = new QTreeWidgetItem();
- mPlayerPropertiesHeader->setText(0, tr("Property"));
- mPlayerPropertiesHeader->setText(1, tr("Value"));
- mPlayerPropertiesHeader->setText(2, tr("Policy")); d->mPlayerProperties->setHeaderItem(mPlayerPropertiesHeader);
- layout->addWidget(d->mPlayerProperties);
-
- QPushButton* b = new QPushButton(i18n("Update"), d->mPlayerPage);
- connect(b, SIGNAL(pressed()), this, SLOT(slotUpdatePlayerList()));
- topLayout->addWidget(b);
-
- d->mPlayerAddress = new QTreeWidgetItem(v, QStringList(i18n("Player Pointer")));
- d->mPlayerId = new QTreeWidgetItem(v, QStringList(i18n("Player ID")));
- d->mPlayerName = new QTreeWidgetItem(v, QStringList(i18n("Player Name")));
- d->mPlayerGroup = new QTreeWidgetItem(v, QStringList(i18n("Player Group")));
- d->mPlayerUserId = new QTreeWidgetItem(v, QStringList(i18n("Player User ID")));
- d->mPlayerMyTurn = new QTreeWidgetItem(v, QStringList(i18n("My Turn")));
- d->mPlayerAsyncInput = new QTreeWidgetItem(v, QStringList(i18n("Async Input")));
- d->mPlayerKGameAddress = new QTreeWidgetItem(v, QStringList(i18n("KGame Address")));
- d->mPlayerVirtual = new QTreeWidgetItem(v, QStringList(i18n("Player is Virtual")));
- d->mPlayerActive = new QTreeWidgetItem(v, QStringList(i18n("Player is Active")));
- d->mPlayerRtti = new QTreeWidgetItem(v, QStringList(i18n("RTTI")));
- d->mPlayerNetworkPriority = new QTreeWidgetItem(v, QStringList(i18n("Network Priority")));
-}
-
-void KGameDebugDialog::initMessagePage()
-{
- d->mMessagePage = new QFrame();
- addPage(d->mMessagePage,i18n("Debug &Messages"));
- QGridLayout* layout = new QGridLayout(d->mMessagePage);
- layout->setMargin(marginHint());
- layout->setSpacing(spacingHint());
- d->mMessageList = new QTreeWidget(d->mMessagePage);
- layout->addWidget(d->mMessageList, 0, 0, 10, 4);
-
- QTreeWidgetItem* mMessageListHeader = new QTreeWidgetItem();
- mMessageListHeader->setText(0, tr("Time"));
- mMessageListHeader->setText(1, tr("ID"));
- mMessageListHeader->setText(2, tr("Receiver")); mMessageListHeader->setText(2, tr("Sender"));
- mMessageListHeader->setText(2, tr("ID - Text"));
- d->mMessageList->setHeaderItem(mMessageListHeader);
-
- QPushButton* hide = new QPushButton(i18n("&>>"), d->mMessagePage);
- connect(hide, SIGNAL(pressed()), this, SLOT(slotHideId()));
- layout->addWidget(hide, 4, 4);
-
- QPushButton* show = new QPushButton(i18n("&<<"), d->mMessagePage);
- connect(show, SIGNAL(pressed()), this, SLOT(slotShowId()));
- layout->addWidget(show, 6, 4);
-
- QLabel* l = new QLabel(i18n("Do not show IDs:"), d->mMessagePage);
- layout->addWidget(l, 0, 5, 1, 2);
- d->mHideIdList = new KListWidget(d->mMessagePage);
- layout->addWidget(d->mHideIdList, 1, 5, 8, 2);
-
- QPushButton* clear = new KPushButton(KStandardGuiItem::clear(), d->mMessagePage);
- connect(clear, SIGNAL(pressed()), this, SLOT(slotClearMessages()));
- layout->addWidget(clear, 10, 0, 1, 7);
- //TODO: "show all but..." and "show nothing but..."
-}
-
-void KGameDebugDialog::clearPlayerData()
-{
- d->mPlayerAddress->setText(1, QLatin1String( "" ));
- d->mPlayerId->setText(1, QLatin1String( "" ));
- d->mPlayerName->setText(1, QLatin1String( "" ));
- d->mPlayerGroup->setText(1, QLatin1String( "" ));
- d->mPlayerUserId->setText(1, QLatin1String( "" ));
- d->mPlayerMyTurn->setText(1, QLatin1String( "" ));
- d->mPlayerAsyncInput->setText(1, QLatin1String( "" ));
- d->mPlayerKGameAddress->setText(1, QLatin1String( "" ));
- d->mPlayerVirtual->setText(1, QLatin1String( "" ));
- d->mPlayerActive->setText(1, QLatin1String( "" ));
- d->mPlayerRtti->setText(1, QLatin1String( "" ));
- d->mPlayerNetworkPriority->setText(1, QLatin1String( "" ));
-
- d->mPlayerProperties->clear();
-}
-
-void KGameDebugDialog::clearGameData()
-{
- d->mGameAddress->setText(1, QLatin1String( "" ));
- d->mGameId->setText(1, QLatin1String( "" ));
- d->mGameCookie->setText(1, QLatin1String( "" ));
- d->mGameMaster->setText(1, QLatin1String( "" ));
- d->mGameAdmin->setText(1, QLatin1String( "" ));
- d->mGameOffering->setText(1, QLatin1String( "" ));
- d->mGameStatus->setText(1, QLatin1String( "" ));
- d->mGameRunning->setText(1, QLatin1String( "" ));
- d->mGameMaxPlayers->setText(1, QLatin1String( "" ));
- d->mGameMinPlayers->setText(1, QLatin1String( "" ));
-
- d->mGameProperties->clear();
-}
-
-void KGameDebugDialog::slotUpdatePlayerData()
-{
- if (!d->mGame || d->mPlayerList->currentRow() == -1) {
-	return;
- }
- slotUpdatePlayerData(d->mPlayerList->item(d->mPlayerList->currentRow()));
-}
-
-void KGameDebugDialog::slotUpdatePlayerList()
-{
- QListWidgetItem* i = d->mPlayerList->item(0);
- for (; d->mPlayerList->count() > 0; i = d->mPlayerList->item(0)) {
-	removePlayer(i);
- }
-
- for ( QList<KPlayer*>::const_iterator it = d->mGame->playerList()->begin(); it!=d->mGame->playerList()->end(); ++it )
- {
-  addPlayer(*it);
- }
-}
-
-void KGameDebugDialog::slotUpdateGameData()
-{
- if (!d->mGame) {
-	d->mGameAddress->setText(1, i18n("NULL pointer"));
-	return;
-}
-
- clearGameData();
-
- QString buf;
- buf.sprintf("%p", (void*)d->mGame);
- d->mGameAddress->setText(1, buf);
- d->mGameId->setText(1, QString::number(d->mGame->gameId()));
- d->mGameCookie->setText(1, QString::number(d->mGame->cookie()));
- d->mGameMaster->setText(1, d->mGame->isMaster() ? i18n("True") : i18n("False"));
- d->mGameAdmin->setText(1, d->mGame->isAdmin() ? i18n("True") : i18n("False"));
- d->mGameOffering->setText(1, d->mGame->isOfferingConnections() ? i18n("True") : i18n("False"));
- d->mGameStatus->setText(1, QString::number(d->mGame->gameStatus()));
- d->mGameRunning->setText(1, d->mGame->isRunning() ? i18n("True") : i18n("False"));
- d->mGameMaxPlayers->setText(1, QString::number(d->mGame->maxPlayers()));
- d->mGameMinPlayers->setText(1, QString::number(d->mGame->minPlayers()));
- d->mGamePlayerCount->setText(1, QString::number(d->mGame->playerCount()));
-
-//TODO ios
-
- KGamePropertyHandler* handler = d->mGame->dataHandler();
- QHashIterator<int, KGamePropertyBase*> it(handler->dict());
- while (it.hasNext()) {
-	it.next();
-	QString policy;
-	switch (it.value()->policy()) {
-		case KGamePropertyBase::PolicyClean:
-			policy = i18n("Clean");
-			break;
-		case KGamePropertyBase::PolicyDirty:
-			policy = i18n("Dirty");
-			break;
-		case KGamePropertyBase::PolicyLocal:
-			policy = i18n("Local");
-			break;
-		case KGamePropertyBase::PolicyUndefined:
-		default:
-			policy = i18n("Undefined");
-			break;
-	}
-  QStringList items;
-  items << handler->propertyName(it.value()->id()) << handler->propertyValue(it.value()) << policy;
-	new QTreeWidgetItem(d->mGameProperties,items);
-//	kDebug(11001) << ": checking for all game properties: found property name" << name;
- }
-}
-
-void KGameDebugDialog::slotUpdatePlayerData(QListWidgetItem* item)
-{
- if (!item || !d->mGame) {
-	return;
- }
-
- KPlayer* p = d->mGame->findPlayer(item->text().toInt());
-
- if (!p) {
-	kError(11001) << ": cannot find player";
-	return;
- }
-
- clearPlayerData();
-
- QString buf;
- buf.sprintf("%p", (void*)p);
- d->mPlayerAddress->setText(1, buf);
- d->mPlayerId->setText(1, QString::number(p->id()));
- d->mPlayerName->setText(1, p->name());
- d->mPlayerGroup->setText(1, p->group());
- d->mPlayerUserId->setText(1, QString::number(p->userId()));
- d->mPlayerMyTurn->setText(1, p->myTurn() ? i18n("True") : i18n("False"));
- d->mPlayerAsyncInput->setText(1, p->asyncInput() ? i18n("True") : i18n("False"));
- buf.sprintf("%p", (void*)p->game());
- d->mPlayerKGameAddress->setText(1, buf);
- d->mPlayerVirtual->setText(1, p->isVirtual() ? i18n("True") : i18n("False"));
- d->mPlayerActive->setText(1, p->isActive() ? i18n("True") : i18n("False"));
- d->mPlayerRtti->setText(1, QString::number(p->rtti()));
- d->mPlayerNetworkPriority->setText(1, QString::number(p->networkPriority()));
-
-//TODO ios
-
-// Properties
- KGamePropertyHandler * handler = p->dataHandler();
- QHashIterator<int, KGamePropertyBase*> it((handler->dict()));
- while (it.hasNext()) {
-	it.next();
-	QString policy;
-	switch (it.value()->policy()) {
-		case KGamePropertyBase::PolicyClean:
-			policy = i18n("Clean");
-			break;
-		case KGamePropertyBase::PolicyDirty:
-			policy = i18n("Dirty");
-			break;
-		case KGamePropertyBase::PolicyLocal:
-			policy = i18n("Local");
-			break;
-		case KGamePropertyBase::PolicyUndefined:
-		default:
-			policy = i18n("Undefined");
-			break;
-	}
-  QStringList items;
-  items << handler->propertyName(it.value()->id()) << handler->propertyValue(it.value()) << policy;
-	new QTreeWidgetItem(d->mPlayerProperties,items);
- }
-}
-
-void KGameDebugDialog::clearPages()
-{
- clearPlayerData();
- clearGameData();
- d->mPlayerList->clear();
- slotClearMessages();
-}
-
-void KGameDebugDialog::setKGame(const KGame* g)
-{
- slotUnsetKGame();
- d->mGame = g;
- if (g) {
- //TODO: connect to the KGame signals for joined/removed players!!!
-	connect(d->mGame, SIGNAL(destroyed()), this, SLOT(slotUnsetKGame()));
-//	connect();
-
-  for ( QList<KPlayer*>::const_iterator it = d->mGame->playerList()->begin(); it!=d->mGame->playerList()->end(); ++it )
-  {
-	  addPlayer(*it);
-  }
-
-	slotUpdateGameData();
-
-	connect(d->mGame, SIGNAL(signalMessageUpdate(int,quint32,quint32)), this, SLOT(slotMessageUpdate(int,quint32,quint32)));
- }
-}
-
-void KGameDebugDialog::slotUnsetKGame()
-{
- if (d->mGame) {
-	disconnect(d->mGame, 0, this, 0);
- }
- d->mGame = 0;
- clearPages();
-}
-
-void KGameDebugDialog::addPlayer(KPlayer* p)
-{
- if (!p) {
-	kError(11001) << "trying to add NULL player";
-	return;
- }
-
- (void) new QListWidgetItem(QString::number(p->id()), d->mPlayerList);
- //TODO connect to signals, like deleted/removed, ...
-}
-
-void KGameDebugDialog::removePlayer(QListWidgetItem* i)
-{
- if (!i || !d->mGame) {
-	return;
- }
- KPlayer* p = d->mGame->findPlayer(i->text().toInt());
- if (!p) {
-	return;
- }
- disconnect(p, 0, this, 0);
- if (i->isSelected()) {
-	clearPlayerData();
- }
- delete i;
-}
-
-void KGameDebugDialog::slotMessageUpdate(int msgid, quint32 receiver, quint32 sender)
-{
- if (!showId(msgid)) {
-	return;
- }
- QString msgidText = KGameMessage::messageId2Text(msgid);
- if (msgidText.isNull()) {
-	if (msgid > KGameMessage::IdUser) {
-		emit signalRequestIdName(msgid-KGameMessage::IdUser, true, msgidText);
-	} else {
-		emit signalRequestIdName(msgid, false, msgidText);
-	}
-	if (msgidText.isNull()) {
-		msgidText = i18n("Unknown");
-	}
- }
- QStringList items;
- items << QTime::currentTime().toString() <<
-    QString::number(msgid) << QString::number(receiver) <<
-    QString::number(sender) << msgidText;
- new QTreeWidgetItem( d->mMessageList, items);
-}
-
-void KGameDebugDialog::slotClearMessages()
-{
- d->mMessageList->clear();
-}
-
-void KGameDebugDialog::slotShowId()
-{
-/* QListBoxItem* i = d->mHideIdList->firstItem();
- for (; i; i = i->next()) {
-	if (i->selected()) {
-		d->mHideIdList->removeItem(i->);
-	}
- }*/
- if (!d->mHideIdList->currentItem()) {
-	return;
- }
- d->mHideIdList->takeItem(d->mHideIdList->currentRow());
-}
-
-void KGameDebugDialog::slotHideId()
-{
- if (!d->mMessageList->currentItem()) {
-	return;
- }
- int msgid = d->mMessageList->currentItem()->text(1).toInt();
- if (!showId(msgid)) {
-	return;
- }
- (void)new QListWidgetItem(QString::number(msgid), d->mHideIdList);
-}
-
-bool KGameDebugDialog::showId(int msgid)
-{
- for (int j = 0; j < d->mHideIdList->count(); ++j) {
- 	QListWidgetItem* i = d->mHideIdList->item(j);
-	if (i->text().toInt() == msgid) {
-		return false;
-	}
- }
- return true;
-}
-
-
-#include "kgamedebugdialog.moc"
diff --git a/libkdegamesprivate/kgame/dialogs/kgamedebugdialog.h b/libkdegamesprivate/kgame/dialogs/kgamedebugdialog.h
deleted file mode 100644
index 8a06895..0000000
--- a/libkdegamesprivate/kgame/dialogs/kgamedebugdialog.h
+++ /dev/null
@@ -1,152 +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.
-*/
-
-#ifndef __KGAMEDEBUGDIALOG_H__
-#define __KGAMEDEBUGDIALOG_H__
-
-#include <kpagedialog.h>
-#include "../../libkdegamesprivate_export.h"
-
-class QListWidgetItem;
-
-class KGame;
-class KPlayer;
-
-class KGameDebugDialogPrivate;
-
-/**
- * \class KGameDebugDialog kgamedebugdialog.h <KGameDebugDialog>
- */
-class KDEGAMESPRIVATE_EXPORT KGameDebugDialog : public KPageDialog
-{
-	Q_OBJECT
-public:
-	KGameDebugDialog(KGame* g, QWidget* parent, bool modal = false);
-	~KGameDebugDialog();
-
-	/**
-	 * Automatically connects the KGame object to all error dependant slots. 
-	 * Create a KGameErrorDialog object, call this function and forget
-	 * everything.
-	 * @param g The KGame which will emit the erorrs (or not ;-) )
-	 **/
-	void setKGame(const KGame* g);
-
-public Q_SLOTS:
-	/**
-	 * Unsets a @ref KGame which has been set using @ref setKGame before.
-	 * This is called automatically when the @ref KGame object is destroyed
-	 * and you normally don't have to call this yourself.
-	 *
-	 * Note that @ref setKGame also unsets an already existing @ref KGame
-	 * object if exising.
-	 **/
-	void slotUnsetKGame();
-
-	/**
-	 * Update the data of the @ref KGame object
-	 **/
-	void slotUpdateGameData();
-
-	/**
-	 * Update the properties of the currently selected player
-	 **/
-	void slotUpdatePlayerData();
-
-	/**
-	 * Updates the list of players and calls @ref clearPlayerData. Note that
-	 * after this call NO player is selected anymore.
-	 **/
-	void slotUpdatePlayerList();
-
-	void slotClearMessages();
-
-Q_SIGNALS:
-	/**
-	 * This signal is emitted when the "debug messages" page couldn't find
-	 * the name of a message id. This is usually the case for user-defined
-	 * messages. KGameDebugDialog asks you to give the msgid a name.
-	 * @param messageid The ID of the message. As given to @ref
-	 * KGame::sendMessage
-	 * @param userid User defined msgIds are internally increased by
-	 * KGameMessage::IdUser. You don't have to care about this but if
-	 * this signal is emitted with userid=false (shouldn't happen) then the
-	 * name of an internal message as defined in 
-	 * KGameMessage::GameMessageIds couldn't be found.
-	 * @param name The name of the msgid. You have to fill this!
-	 **/
-	void signalRequestIdName(int messageid, bool userid, QString& name);
-
-protected:
-	void clearPages();
-
-	/**
-	 * Clear the data of the player view. Note that the player list is NOT
-	 * cleared.
-	 **/
-	void clearPlayerData();
-
-	/**
-	 * Clear the data view of the @ref KGame object
-	 **/
-	void clearGameData();
-
-	/**
-	 * Add a new player to the player list
-	 **/
-	void addPlayer(KPlayer* p);
-
-	/**
-	 * Remove a player from the list
-	 **/
-	void removePlayer(QListWidgetItem* item);
-
-	/**
-	 * @return Whether messages with this msgid shall be displayed or not
-	 **/
-	bool showId(int msgid);
-
-protected Q_SLOTS:
-	/**
-	 * Update the data of the player specified in item
-	 * @param item The @ref QListWidgetItem of the player to be updated. Note
-	 * that the text of this item MUST be the ID of the player
-	 **/
-	void slotUpdatePlayerData(QListWidgetItem* item);
-
-	void slotShowId();
-	void slotHideId();
-
-	/**
-	 * A message has been received - see @ref KGame::signalMessageUpdate
-	 **/
-	void slotMessageUpdate(int msgid, quint32 receiver, quint32 sender);
-
-private:
-	void initGamePage();
-	void initPlayerPage();
-	void initMessagePage();
-
-private:
-	KGameDebugDialogPrivate* const d;
-};
-
-
-#endif
diff --git a/libkdegamesprivate/kgame/kgamemessage.h b/libkdegamesprivate/kgame/kgamemessage.h
index 4098b66..077d729 100644
--- a/libkdegamesprivate/kgame/kgamemessage.h
+++ b/libkdegamesprivate/kgame/kgamemessage.h
@@ -123,8 +123,7 @@ class KDEGAMESPRIVATE_EXPORT KGameMessage
     /**
      * This function takes a @ref GameMessageIds as argument and returns a
      * suitable string for it. This string can't be used to identify a message
-     * (as it is i18n'ed) but it can make debugging more easy. See also @ref
-     * KGameDebugDialog.
+     * (as it is i18n'ed) but it can make debugging more easy. 
      * @return Either a i18n'ed string (the name of the id) or QString() if
      * the msgid is unknown
      **/
diff --git a/libkdegamesprivate/kgame/kgameproperty.h b/libkdegamesprivate/kgame/kgameproperty.h
index aac5d0a..f8b68b3 100644
--- a/libkdegamesprivate/kgame/kgameproperty.h
+++ b/libkdegamesprivate/kgame/kgameproperty.h
@@ -241,8 +241,7 @@ public:
 	int id() const { return mId; }
 
 	/**
-	 * @return a type_info of the data this property contains. This is used
-	 * e.g. by KGameDebugDialog
+	 * @return a type_info of the data this property contains. 
 	 **/
 	virtual const type_info* typeinfo() { return &typeid(this); }
 
diff --git a/libkdegamesprivate/kgame/kgamepropertyhandler.h b/libkdegamesprivate/kgame/kgamepropertyhandler.h
index 6ce7490..ac215ee 100644
--- a/libkdegamesprivate/kgame/kgamepropertyhandler.h
+++ b/libkdegamesprivate/kgame/kgamepropertyhandler.h
@@ -130,7 +130,7 @@ public:
 	 * Adds a KGameProperty property to the handler
 	 * @param data the property
 	 * @param name A description of the property, which will be returned by
-	 * propertyName. This is used for debugging, e.g. in KGameDebugDialog
+	 * propertyName. This is used for debugging
 	 * @return true on success
 	 **/
 	bool addProperty(KGamePropertyBase *data, const QString& name=QString());
@@ -282,8 +282,7 @@ public:
 
 	/**
 	 * In several situations you just want to have a QString of a
-	 * KGameProperty object. This is the case in the 
-	 * KGameDebugDialog where the value of all properties is displayed. This
+	 * KGameProperty object. This
 	 * function will provide you with such a QString for all the types
 	 * used inside of all KGame classes. If you have a non-standard
 	 * property (probably a self defined class or something like this) you


More information about the kde-games-devel mailing list