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 QGridLayout;
00034 class QVBoxLayout;
00035 class QListBoxItem;
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 public:
00078 
00079     enum ConfigOptions
00080     {
00081         NoConfig = 0,
00082         ChatConfig = 1,
00083         GameConfig = 2,
00084         NetworkConfig = 4,
00085         MsgServerConfig = 8,
00086         BanPlayerConfig = 16,
00087         AllConfig = 0xffff
00088     };
00089 
00100     KGameDialog(KGame* g, KPlayer* owner, const QString& title, 
00101             QWidget* parent, bool modal = false);
00102     
00132     KGameDialog(KGame* g, KPlayer* owner, const QString& title, 
00133             QWidget* parent, long initConfigs = AllConfig, 
00134             int chatMsgId = 15432, bool modal = false);
00135 
00136     virtual ~KGameDialog();
00137 
00138 
00151     void setOwner(KPlayer* owner);
00152 
00160     void setKGame(KGame* g);
00161 
00168     virtual void submitToKGame();
00169 
00178     void addChatWidget(KGameDialogChatConfig* chat, QVBox* parent = 0);
00179 
00192     void addConnectionList(KGameDialogConnectionConfig* c, QVBox* parent = 0);
00193 
00204     QVBox* addConfigPage(KGameDialogConfig* widget, const QString& title);
00205 
00210     QVBox *configPage(ConfigOptions which);
00211 
00216     KGameDialogNetworkConfig* networkConfig() const;
00217 
00222     KGameDialogGeneralConfig* gameConfig() const;
00223 
00230     void addConfigWidget(KGameDialogConfig* widget, QWidget* parent);
00231 
00236     void addNetworkConfig(KGameDialogNetworkConfig* netConf);
00237 
00242     void addGameConfig(KGameDialogGeneralConfig* conf);
00243 
00247     void addMsgServerConfig(KGameDialogMsgServerConfig* conf);
00248 
00249 protected:
00250 
00264     void initDefaultDialog(ConfigOptions initConfigs, int chatMsgId = 15432);
00265 
00273     void configureConfigWidgets();
00274 
00275 protected slots:
00280     virtual void slotOk();
00281 
00285     virtual void slotApply();
00286 
00292     virtual void slotDefault();
00293 
00298     void slotUnsetKGame();
00299 
00305     void setAdmin(bool isAdmin);
00306 
00311     void slotRemoveConfigWidget(QObject* configWidget);
00312 
00313 private:
00314     void init(KGame*, KPlayer*);
00315 
00316 private:
00317     KGameDialogPrivate* d;
00318 };
00319 
00320 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys