/usr/include/kgame/kgamedialogconfig.h is in libkdegames-dev 4:4.8.2-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | /*
This file is part of the KDE games library
Copyright (C) 2001 Andreas Beckermann (b_mann@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 <libkdegames_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@gmx.de>
**/
class KDEGAMES_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@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 KDEGAMES_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@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
|