~ubuntu-branches/ubuntu/saucy/libkdegames/saucy-updates

« back to all changes in this revision

Viewing changes to libkdegamesprivate/kgame/DESIGN

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell, Rohan Garg, Philip Muškovac, Jonathan Riddell
  • Date: 2013-06-21 01:42:38 UTC
  • mfrom: (1.2.3)
  • Revision ID: package-import@ubuntu.com-20130621014238-mk0kx5llg3m15ua6
Tags: 4:4.10.80-0ubuntu1
[ Rohan Garg ]
* New upstream release

[ Philip Muškovac ]
* Add Qml imports to libkdegames6.install 
* Add new symbols to libkdegames6.symbols

[ Jonathan Riddell ]
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
4. KGameIO (Andreas Beckermann 10.08.2001)
41
41
 
42
 
5. Debugging (Andreas Beckermann 06.10.2001) TODO!
43
 
5.1 KGameDebugDialog
44
 
5.1.1 Debug KGame
45
 
5.1.3 Debug Messages
46
 
 
47
42
---------------------------------------------------------------------
48
43
1. DEFINITIONS
49
44
--------------
240
235
will be changed so that you cannot use IDs below IdUser in the future. Then you
241
236
have to specify the dataHandler(). You can also use a KGame or KPlayer pointer.
242
237
This will automatically use KGame::dataHandler() or KPlayer::dataHandler().
243
 
Finally you *can* provide a name for the property. This will be used for
244
 
debugging in KGameDebugDialog. If you want to save some memory you can leave
245
 
this out.
 
238
Finally you *can* provide a name for the property.
246
239
Note that if you use pointers to create the properties dynamically they are
247
240
*not* deleted automatically! You MUST delete them yourself!
248
241
Now you can use the KGameProperty like every variable else. See also Section 
334
327
 
335
328
 
336
329
 
337
 
5. Debugging
338
 
------------
339
 
The general debugging concept (if there is one at all) or general debugging
340
 
hints are not yet written. Feel free to do so
341
 
 
342
 
5.1 KGameDebugDialog
343
 
--------------------
344
 
A nice way of debugging a KGame based game is the KGameDebugDialog. Basically
345
 
all you have to do is to add something like "Debug" to your game's menu and add
346
 
a slot like
347
 
slotDebug()
348
 
{
349
 
 KGameDebugDialog* dialog = new KGameDebugDialog(mGame, this);
350
 
 connect(dialog, SIGNAL(finished()), dialog, SLOT(slotDelayedDestruct()));
351
 
 dialog->show();
352
 
}
353
 
that's it.
354
 
You can now click on that menu entry and you get a non-modal dialog where you
355
 
can start to debug :-)
356
 
The dialog consist of several pages. You can easily add your own using
357
 
KDialogBase::addVBoxPage() (for example). 
358
 
 
359
 
5.1.1 Debug KGame
360
 
-----------------
361
 
The first page, "Debug KGame" shows on the left most or even all status values of
362
 
KGame. That contains e.g.  minPlayers(), isAdmin(), gameStatus(), ...
363
 
The right side is probably the more important one. It lists *all* KGameProperties
364
 
which have been inserted to this KGame object (only to this KGame object - not
365
 
the ones that have been added to the players!). Most of the status variables of
366
 
the left side are here again as they are implemented as KGameProperty. You can
367
 
see the name of the property (together with its ID), its value and the policy
368
 
this property uses. Note that "unknwon" will be displayed as name of the
369
 
property if you haven't supplied one. See KGamePropertyBase::registerData() for
370
 
info. You probably always want to supply a name for the property to debug it
371
 
easily. In the future there will be something like
372
 
KGamePropertyHandler::setDebug() so that you can switch off debugging and save
373
 
the memory of the names in a release version. 
374
 
For as long as you use standard types for your properties (int, long, bool,
375
 
...) you should always be able to see the value of the property. If you just see
376
 
"unknown" then this type has not been implemented. You can connect to the signal
377
 
KGamePropertyHandler::signalRequestValue() and supply a QString with the value
378
 
yourself. If you do so for a standard type please also submit a bug report!
379
 
 
380
 
Currently the dialog does *not* update automatically! So you alway have to click
381
 
the "update" button when you want a current value. There are several reasons for
382
 
this (and one of them is that i'm too lazy to implement the update ;)). E.g.
383
 
often (very often) a property is just in the background - stores e.g. the
384
 
available money in a game. But you don't want it to update whenever the value
385
 
changes (a player receives/pays money) but only when the value on the screen
386
 
changes.
387
 
 
388
 
5.1.2 Debug Players
389
 
-------------------
390
 
This page consists of three widgets. On the very left there is a list of all
391
 
players in the game. Only the IDs are displayed to save space. If you click one
392
 
the other widgets are filled with content. These widgets are quite much the same
393
 
as the ones in "Debug KGame" - the left shows the value of the functions and the
394
 
right one displays all KProperties of a player. Not much to say here - except:
395
 
See "Debug KGame".
396
 
 
397
 
If you change to another player the value are also updated.
398
 
 
399
 
5.1.3 Debug Messages
400
 
--------------------
401
 
This page is probably not as important as the other ones. It displays *every*
402
 
message that is sent through the KGame object. As a KGameProperry also send
403
 
messages you probably get a lot of them...
404
 
You can exclude message IDs from being displayed (e.g. all game properties). 
405
 
You can also change the sorting of the list to see all messages of a certain ID.
406
 
The default is to sort by time (which is displayed on the left side).
407