• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • libtdegames
 

libtdegames

Public Types | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
KGameDialog Class Reference

#include <kgamedialog.h>

Inherits KDialogBase.

Public Types

enum  ConfigOptions {
  NoConfig = 0 , ChatConfig = 1 , GameConfig = 2 , NetworkConfig = 4 ,
  MsgServerConfig = 8 , BanPlayerConfig = 16 , AllConfig = 0xffff
}
 

Public Member Functions

 KGameDialog (KGame *g, KPlayer *owner, const TQString &title, TQWidget *parent, bool modal=false)
 
 KGameDialog (KGame *g, KPlayer *owner, const TQString &title, TQWidget *parent, long initConfigs=AllConfig, int chatMsgId=15432, bool modal=false)
 
void setOwner (KPlayer *owner)
 
void setKGame (KGame *g)
 
virtual void submitToKGame ()
 
void addChatWidget (KGameDialogChatConfig *chat, TQVBox *parent=0)
 
void addConnectionList (KGameDialogConnectionConfig *c, TQVBox *parent=0)
 
TQVBox * addConfigPage (KGameDialogConfig *widget, const TQString &title)
 
TQVBox * configPage (ConfigOptions which)
 
KGameDialogNetworkConfig * networkConfig () const
 
KGameDialogGeneralConfig * gameConfig () const
 
void addConfigWidget (KGameDialogConfig *widget, TQWidget *parent)
 
void addNetworkConfig (KGameDialogNetworkConfig *netConf)
 
void addGameConfig (KGameDialogGeneralConfig *conf)
 
void addMsgServerConfig (KGameDialogMsgServerConfig *conf)
 

Protected Slots

virtual void slotOk ()
 
virtual void slotApply ()
 
virtual void slotDefault ()
 
void slotUnsetKGame ()
 
void setAdmin (bool isAdmin)
 
void slotRemoveConfigWidget (TQObject *configWidget)
 

Protected Member Functions

void initDefaultDialog (ConfigOptions initConfigs, int chatMsgId=15432)
 
void configureConfigWidgets ()
 

Detailed Description

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):

KGameDialog dlg(kgame, i18n("New Game"), localPlayer, this, true,
ID_CHAT);
dlg.setDefaultNetworkInfo(port, host); // AB: obsolete!
dlg.exec();
KGameDialog
TODO: rewrite entire documentation.
Definition: kgamedialog.h:75

This will create a default modal dialog with the title "New Game". You don't have to do more than this.

Main configuration dialog for KGame

Author
Andreas Beckermann b_man.nosp@m.n@gm.nosp@m.x.de

Definition at line 74 of file kgamedialog.h.

Member Enumeration Documentation

◆ ConfigOptions

enum KGameDialog::ConfigOptions

Definition at line 80 of file kgamedialog.h.

Constructor & Destructor Documentation

◆ KGameDialog() [1/2]

KGameDialog::KGameDialog ( KGame *  g,
KPlayer *  owner,
const TQString &  title,
TQWidget *  parent,
bool  modal = false 
)

Create an empty KGameDialog.

You can add widgets using addConfigPage.

Parameters
gThe KGame object of this game
ownerThe KPlayer object who is responsible for this dialog, aka "the local player"
titleThe title of the dialog - see KDialog::setCaption
parentThe parent of the dialog
modalWhether the dialog is modal or not

Definition at line 66 of file kgamedialog.cpp.

◆ KGameDialog() [2/2]

KGameDialog::KGameDialog ( KGame *  g,
KPlayer *  owner,
const TQString &  title,
TQWidget *  parent,
long  initConfigs = AllConfig,
int  chatMsgId = 15432,
bool  modal = false 
)

Create a KGameDialog with the standard configuration widgets.

This creates the following widgets:

  • KGameDialogGeneralConfig
  • KGameDialogNetworkConfig
  • KGameDialogMsgServerConfig
  • KGameDialogChatConfig
  • KGameDialogConnectionConfig

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

Parameters
gThe KGame object of this game
ownerThe KPlayer object who is responsible for this dialog, aka "the local player"
titleThe title of the dialog - see KDialog::setCaption
parentThe parent of the dialog
modalWhether the dialog is modal or not
initConfigswhether the default KGameDialogConfig widgets shall be created using initDefaultDialog. Use false if you want to use custom widgets.
chatMsgIdThe ID of Chat messages. See KGameChat. Unused if initConfigs = false

Definition at line 74 of file kgamedialog.cpp.

◆ ~KGameDialog()

KGameDialog::~KGameDialog ( )
virtual

Definition at line 134 of file kgamedialog.cpp.

Member Function Documentation

◆ addChatWidget()

void KGameDialog::addChatWidget ( KGameDialogChatConfig *  chat,
TQVBox *  parent = 0 
)

Adds a KGameChat to the dialog.

If no parent is specified the game page will be used.

Parameters
chatThe chat widget
parentThe 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.

Definition at line 168 of file kgamedialog.cpp.

◆ addConfigPage()

TQVBox * KGameDialog::addConfigPage ( KGameDialogConfig *  widget,
const TQString &  title 
)

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.

Parameters
widgetThe new config widget
titleThe title of the newly added page.
Returns
The newly added page which contains your config widget.

Definition at line 218 of file kgamedialog.cpp.

◆ addConfigWidget()

void KGameDialog::addConfigWidget ( KGameDialogConfig *  widget,
TQWidget *  parent 
)

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.

Definition at line 229 of file kgamedialog.cpp.

◆ addConnectionList()

void KGameDialog::addConnectionList ( KGameDialogConnectionConfig *  c,
TQVBox *  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.

Parameters
cThe KGameDialogConnectionConfig object
parentThe parent of the widget. If 0 the networkConfig page is used.

Definition at line 183 of file kgamedialog.cpp.

◆ addGameConfig()

void KGameDialog::addGameConfig ( KGameDialogGeneralConfig *  conf)

Add the main game config widget in a new page.

Use this to make gameConfig return something useful.

Definition at line 142 of file kgamedialog.cpp.

◆ addMsgServerConfig()

void KGameDialog::addMsgServerConfig ( KGameDialogMsgServerConfig *  conf)

Used to add the message server config widget in a new page.

Definition at line 160 of file kgamedialog.cpp.

◆ addNetworkConfig()

void KGameDialog::addNetworkConfig ( KGameDialogNetworkConfig *  netConf)

Used to add the main network config widget in a new page.

Use this to make networkConfig return something useful.

Definition at line 151 of file kgamedialog.cpp.

◆ configPage()

TQVBox * KGameDialog::configPage ( ConfigOptions  which)
Returns
The TQVBox of the given key, The key is from ConfigOptions Note that not all are supported yet

Definition at line 198 of file kgamedialog.cpp.

◆ configureConfigWidgets()

void KGameDialog::configureConfigWidgets ( )
protected

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

◆ gameConfig()

KGameDialogGeneralConfig * KGameDialog::gameConfig ( ) const
Returns
The default game config. Note that this always returns 0 if you did not specify GameConfig in the constructor!

Definition at line 257 of file kgamedialog.cpp.

◆ initDefaultDialog()

void KGameDialog::initDefaultDialog ( ConfigOptions  initConfigs,
int  chatMsgId = 15432 
)
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)

Parameters
initConfigsThe widgets to be created
chatMsgIdThe msgid for the chat config (only if specified in initConfigs) - see KGameDialogChatConfig

Definition at line 101 of file kgamedialog.cpp.

◆ networkConfig()

KGameDialogNetworkConfig * KGameDialog::networkConfig ( ) const
Returns
The default netowrk config. Note that this always returns 0 if you did not specify NetworkConfig in the constructor!

Definition at line 259 of file kgamedialog.cpp.

◆ setAdmin

void KGameDialog::setAdmin ( bool  isAdmin)
protectedslot

Called when the ADMIN status of this KGame client changes.

See KGameNetwork::signalAdminStatusChanged

Parameters
isAdmintrue if this client is now the ADMIN otherwise false

Definition at line 315 of file kgamedialog.cpp.

◆ setKGame()

void KGameDialog::setKGame ( KGame *  g)

Change the KGame object this dialog is used for.

Calls the KGameDialogConfig::setKGame implementation of all widgets that have been added by addConfigWidget

Parameters
gThe new KGame object

Definition at line 298 of file kgamedialog.cpp.

◆ setOwner()

void KGameDialog::setOwner ( KPlayer *  owner)

Change the owner of the dialog.

This will be used as the fromPlayer in KGameChat and will receive the entered player name.

Parameters
ownerThe 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

Parameters
ownerThe new owner player of this dialog must already be added to the KGame object. Can even be NULL (then no player configuration is made)

Definition at line 284 of file kgamedialog.cpp.

◆ slotApply

void KGameDialog::slotApply ( )
protectedvirtualslot

Just calls submitToKGame()

Definition at line 262 of file kgamedialog.cpp.

◆ slotDefault

void KGameDialog::slotDefault ( )
protectedvirtualslot

Sets the default values for the configuration widgets.

Set these values by (e.g.) setDefaultMaxPlayers()

Deprecated:

Definition at line 267 of file kgamedialog.cpp.

◆ slotOk

void KGameDialog::slotOk ( )
protectedvirtualslot

Called when the user clicks on Ok.

Calls slotApply and TQDialog::accept()

Definition at line 278 of file kgamedialog.cpp.

◆ slotRemoveConfigWidget

void KGameDialog::slotRemoveConfigWidget ( TQObject *  configWidget)
protectedslot

Remove a config widget from the widget list.

See also
TQObject::destroyed

Definition at line 343 of file kgamedialog.cpp.

◆ slotUnsetKGame

void KGameDialog::slotUnsetKGame ( )
protectedslot

Called when the KGame object is destroyed.

Calls setKGame(0) so that all widgets can disconnect their slots and so on.

Definition at line 322 of file kgamedialog.cpp.

◆ submitToKGame()

void KGameDialog::submitToKGame ( )
virtual

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

Definition at line 325 of file kgamedialog.cpp.


The documentation for this class was generated from the following files:
  • kgamedialog.h
  • kgamedialog.cpp

libtdegames

Skip menu "libtdegames"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

libtdegames

Skip menu "libtdegames"
  • libtdegames
Generated for libtdegames by doxygen 1.9.4
This website is maintained by Timothy Pearson.