kgamedialog.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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, 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 __KGAMEDIALOG_H__ 00029 #define __KGAMEDIALOG_H__ 00030 00031 #include <kdialogbase.h> 00032 #include <kdemacros.h> 00033 class TQGridLayout; 00034 class TQVBoxLayout; 00035 class TQListBoxItem; 00036 00037 class KGame; 00038 class KPlayer; 00039 class KGamePropertyBase; 00040 00041 class KGameDialogConfig; 00042 class KGameDialogGeneralConfig; 00043 class KGameDialogNetworkConfig; 00044 class KGameDialogMsgServerConfig; 00045 class KGameDialogChatConfig; 00046 class KGameDialogConnectionConfig; 00047 00048 class KGameDialogPrivate; 00074 class KDE_EXPORT KGameDialog : public KDialogBase 00075 { 00076 Q_OBJECT 00077 TQ_OBJECT 00078 public: 00079 00080 enum ConfigOptions 00081 { 00082 NoConfig = 0, 00083 ChatConfig = 1, 00084 GameConfig = 2, 00085 NetworkConfig = 4, 00086 MsgServerConfig = 8, 00087 BanPlayerConfig = 16, 00088 AllConfig = 0xffff 00089 }; 00090 00101 KGameDialog(KGame* g, KPlayer* owner, const TQString& title, 00102 TQWidget* parent, bool modal = false); 00103 00133 KGameDialog(KGame* g, KPlayer* owner, const TQString& title, 00134 TQWidget* parent, long initConfigs = AllConfig, 00135 int chatMsgId = 15432, bool modal = false); 00136 00137 virtual ~KGameDialog(); 00138 00139 00152 void setOwner(KPlayer* owner); 00153 00161 void setKGame(KGame* g); 00162 00169 virtual void submitToKGame(); 00170 00179 void addChatWidget(KGameDialogChatConfig* chat, TQVBox* parent = 0); 00180 00193 void addConnectionList(KGameDialogConnectionConfig* c, TQVBox* parent = 0); 00194 00205 TQVBox* addConfigPage(KGameDialogConfig* widget, const TQString& title); 00206 00211 TQVBox *configPage(ConfigOptions which); 00212 00217 KGameDialogNetworkConfig* networkConfig() const; 00218 00223 KGameDialogGeneralConfig* gameConfig() const; 00224 00231 void addConfigWidget(KGameDialogConfig* widget, TQWidget* parent); 00232 00237 void addNetworkConfig(KGameDialogNetworkConfig* netConf); 00238 00243 void addGameConfig(KGameDialogGeneralConfig* conf); 00244 00248 void addMsgServerConfig(KGameDialogMsgServerConfig* conf); 00249 00250 protected: 00251 00265 void initDefaultDialog(ConfigOptions initConfigs, int chatMsgId = 15432); 00266 00274 void configureConfigWidgets(); 00275 00276 protected slots: 00281 virtual void slotOk(); 00282 00286 virtual void slotApply(); 00287 00293 virtual void slotDefault(); 00294 00299 void slotUnsetKGame(); 00300 00306 void setAdmin(bool isAdmin); 00307 00312 void slotRemoveConfigWidget(TQObject* configWidget); 00313 00314 private: 00315 void init(KGame*, KPlayer*); 00316 00317 private: 00318 KGameDialogPrivate* d; 00319 }; 00320 00321 #endif