libkdegames Library API Documentation

kgamedialogconfig.h

00001 /* 00002 This file is part of the KDE games library 00003 Copyright (C) 2001 Andreas Beckermann (b_mann@gmx.de) 00004 Copyright (C) 2001 Martin Heni (martin@heni-online.de) 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 // NAMING 00022 // please follow these naming rules if you add/change classes: 00023 // the main dialog is named KGameDialog and the base config widget 00024 // KGameDialogConfig. All config widgets are named KGameDialogXYZConfig (where 00025 // XYZ = the name of the config widget, like "general" or "network") and are 00026 // inherited from KGameDialogConfig. 00027 00028 #ifndef __KGAMEDIALOGCONFIG_H__ 00029 #define __KGAMEDIALOGCONFIG_H__ 00030 00031 #include <qwidget.h> 00032 00033 class QGridLayout; 00034 class QVBoxLayout; 00035 class QListBoxItem; 00036 00037 class KGame; 00038 class KPlayer; 00039 class KGamePropertyBase; 00040 00041 class KGameDialogConfigPrivate; 00050 class KGameDialogConfig : public QWidget 00051 { 00052 Q_OBJECT 00053 public: 00054 KGameDialogConfig(QWidget* parent = 0); 00055 virtual ~KGameDialogConfig(); 00056 00064 virtual void submitToKGame(KGame* g, KPlayer* p) = 0; 00065 00077 virtual void setOwner(KPlayer* p); 00078 00087 virtual void setKGame(KGame* g); 00088 00103 virtual void setAdmin(bool admin); 00104 00111 KGame* game() const; 00112 00120 KPlayer* owner() const; 00121 00126 bool admin() const; 00127 00128 protected: 00129 00130 private: 00131 KGameDialogConfigPrivate* d; 00132 }; 00133 00143 class KGameDialogGeneralConfigPrivate; 00144 class KGameDialogGeneralConfig : public KGameDialogConfig 00145 { 00146 Q_OBJECT 00147 public: 00161 KGameDialogGeneralConfig(QWidget* parent = 0, bool initializeGUI = true); 00162 virtual ~KGameDialogGeneralConfig(); 00163 00171 virtual void submitToKGame(KGame* g, KPlayer* p); 00172 00179 virtual void setOwner(KPlayer* p); 00180 00187 virtual void setKGame(KGame* g); 00188 00194 virtual void setAdmin(bool admin); 00195 00196 protected slots: 00197 void slotPropertyChanged(KGamePropertyBase*, KPlayer*); 00198 00199 protected: 00200 void setPlayerName(const QString& name); 00201 00202 QString playerName() const; 00203 00204 private: 00205 KGameDialogGeneralConfigPrivate* d; 00206 }; 00207 00208 class KGameDialogNetworkConfigPrivate; 00209 class KGameDialogNetworkConfig : public KGameDialogConfig 00210 { 00211 Q_OBJECT 00212 public: 00213 KGameDialogNetworkConfig(QWidget* parent = 0); 00214 virtual ~KGameDialogNetworkConfig(); 00215 00216 00217 void disableInitConnection(); 00218 00226 virtual void submitToKGame(KGame* g, KPlayer* p); 00227 00228 virtual void setKGame(KGame* g); 00229 00239 void setDefaultNetworkInfo(const QString& host, unsigned short int port,bool server=true); 00240 00241 signals: 00248 void signalServerTypeChanged(int); 00249 00250 00251 protected: 00252 void setConnected(bool connected, bool master = false); 00253 00254 protected slots: 00255 void slotInitConnection(); 00256 void slotExitConnection(); 00257 void slotConnectionBroken(); 00258 00259 00260 private: 00261 KGameDialogNetworkConfigPrivate* d; 00262 }; 00263 00264 class KGameDialogMsgServerConfigPrivate; 00265 class KGameDialogMsgServerConfig : public KGameDialogConfig 00266 { 00267 Q_OBJECT 00268 public: 00269 KGameDialogMsgServerConfig(QWidget* parent = 0); 00270 virtual ~KGameDialogMsgServerConfig(); 00271 00272 virtual void submitToKGame(KGame* g, KPlayer* p) {} 00273 00274 void setHasMsgServer(bool); 00275 00276 virtual void setKGame(KGame* g); 00277 virtual void setAdmin(bool); 00278 00279 protected slots: 00280 void slotChangeMaxClients(); 00281 void slotChangeAdmin(); 00282 void slotRemoveClient(); 00283 00284 protected: 00285 void removeClient(Q_UINT32 id); 00286 00287 private: 00288 KGameDialogMsgServerConfigPrivate* d; 00289 }; 00290 00291 class KGameDialogChatConfigPrivate; 00298 class KGameDialogChatConfig : public KGameDialogConfig 00299 { 00300 Q_OBJECT 00301 public: 00302 KGameDialogChatConfig(int chatMsgId, QWidget* parent = 0); 00303 virtual ~KGameDialogChatConfig(); 00304 00305 virtual void setKGame(KGame* g); 00306 virtual void setOwner(KPlayer* p); 00307 00308 virtual void submitToKGame(KGame* g, KPlayer* p) { } 00309 00310 private: 00311 KGameDialogChatConfigPrivate* d; 00312 }; 00313 00318 class KGameDialogConnectionConfigPrivate; 00319 class KGameDialogConnectionConfig : public KGameDialogConfig 00320 { 00321 Q_OBJECT 00322 public: 00323 KGameDialogConnectionConfig(QWidget* parent = 0); 00324 virtual ~KGameDialogConnectionConfig(); 00325 00326 virtual void setKGame(KGame*); 00327 virtual void setOwner(KPlayer*); 00328 virtual void setAdmin(bool admin); 00329 00330 virtual void submitToKGame(KGame*, KPlayer*) { } 00331 00332 protected: 00336 QListBoxItem* item(KPlayer* p) const; 00337 00338 protected slots: 00339 void slotKickPlayerOut(QListBoxItem* item); 00340 void slotPropertyChanged(KGamePropertyBase* prop, KPlayer* p); 00341 void slotPlayerLeftGame(KPlayer* p); 00342 void slotPlayerJoinedGame(KPlayer* p); 00343 void slotClearPlayers(); 00344 00345 private: 00346 KGameDialogConnectionConfigPrivate* d; 00347 00348 }; 00349 #endif
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 14:18:46 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003