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 #include <kdemacros.h>
00033 
00034 class QGridLayout;
00035 class QVBoxLayout;
00036 class QListBoxItem;
00037 
00038 class KGame;
00039 class KPlayer;
00040 class KGamePropertyBase;
00041 
00042 class KGameDialogConfigPrivate;
00051 class KDE_EXPORT KGameDialogConfig : public QWidget
00052 {
00053     Q_OBJECT
00054 public:
00055     KGameDialogConfig(QWidget* parent = 0);
00056     virtual ~KGameDialogConfig();
00057 
00065     virtual void submitToKGame(KGame* g, KPlayer* p) = 0;
00066 
00078     virtual void setOwner(KPlayer* p);
00079 
00088     virtual void setKGame(KGame* g);
00089 
00104     virtual void setAdmin(bool admin);
00105 
00112     KGame* game() const;
00113 
00121     KPlayer* owner() const;
00122 
00127     bool admin() const;
00128 
00129 protected:
00130 
00131 private:
00132     KGameDialogConfigPrivate* d;
00133 };
00134 
00144 class KGameDialogGeneralConfigPrivate;
00145 class KGameDialogGeneralConfig : public KGameDialogConfig
00146 {
00147     Q_OBJECT
00148 public:
00162     KGameDialogGeneralConfig(QWidget* parent = 0, bool initializeGUI = true);
00163     virtual ~KGameDialogGeneralConfig();
00164 
00172     virtual void submitToKGame(KGame* g, KPlayer* p);
00173 
00180     virtual void setOwner(KPlayer* p);
00181 
00188     virtual void setKGame(KGame* g);
00189 
00195     virtual void setAdmin(bool admin);
00196 
00197 protected slots:
00198     void slotPropertyChanged(KGamePropertyBase*, KPlayer*);
00199 
00200 protected:
00201     void setPlayerName(const QString& name);
00202 
00203     QString playerName() const;
00204 
00205 private:
00206     KGameDialogGeneralConfigPrivate* d;
00207 };
00208 
00209 class KGameDialogNetworkConfigPrivate;
00210 class KDE_EXPORT KGameDialogNetworkConfig : public KGameDialogConfig
00211 {
00212     Q_OBJECT
00213 public:
00214     KGameDialogNetworkConfig(QWidget* parent = 0);
00215     virtual ~KGameDialogNetworkConfig();
00216 
00217 
00218     void disableInitConnection();
00219 
00227     virtual void submitToKGame(KGame* g, KPlayer* p);
00228 
00229     virtual void setKGame(KGame* g);
00230 
00240     void setDefaultNetworkInfo(const QString& host, unsigned short int port,bool server=true);
00241 
00242 signals:
00249   void signalServerTypeChanged(int);
00250 
00251 
00252 protected:
00253     void setConnected(bool connected, bool master = false);
00254 
00255 protected slots:
00256     void slotInitConnection();
00257     void slotExitConnection();
00258     void slotConnectionBroken();
00259 
00260 
00261 private:
00262     KGameDialogNetworkConfigPrivate* d;
00263 };
00264 
00265 class KGameDialogMsgServerConfigPrivate;
00266 class KGameDialogMsgServerConfig : public KGameDialogConfig
00267 {
00268     Q_OBJECT
00269 public:
00270     KGameDialogMsgServerConfig(QWidget* parent = 0);
00271     virtual ~KGameDialogMsgServerConfig();
00272 
00273     virtual void submitToKGame(KGame*, KPlayer*) {}
00274 
00275     void setHasMsgServer(bool);
00276 
00277     virtual void setKGame(KGame* g);
00278     virtual void setAdmin(bool);
00279 
00280 protected slots:
00281     void slotChangeMaxClients();
00282     void slotChangeAdmin();
00283     void slotRemoveClient();
00284 
00285 protected:
00286     void removeClient(Q_UINT32 id);
00287 
00288 private:
00289     KGameDialogMsgServerConfigPrivate* d;
00290 };
00291 
00292 class KGameDialogChatConfigPrivate;
00299 class KGameDialogChatConfig : public KGameDialogConfig
00300 {
00301     Q_OBJECT
00302 public:
00303     KGameDialogChatConfig(int chatMsgId, QWidget* parent = 0);
00304     virtual ~KGameDialogChatConfig();
00305 
00306     virtual void setKGame(KGame* g);
00307     virtual void setOwner(KPlayer* p);
00308 
00309     virtual void submitToKGame(KGame*, KPlayer*) { }
00310 
00311 private:
00312     KGameDialogChatConfigPrivate* d;
00313 };
00314 
00319 class KGameDialogConnectionConfigPrivate;
00320 class KGameDialogConnectionConfig : public KGameDialogConfig
00321 {
00322     Q_OBJECT
00323 public:
00324     KGameDialogConnectionConfig(QWidget* parent = 0);
00325     virtual ~KGameDialogConnectionConfig();
00326 
00327     virtual void setKGame(KGame*);
00328     virtual void setOwner(KPlayer*);
00329     virtual void setAdmin(bool admin);
00330 
00331     virtual void submitToKGame(KGame*, KPlayer*) { }
00332 
00333 protected:
00337     QListBoxItem* item(KPlayer* p) const;
00338 
00339 protected slots:
00340     void slotKickPlayerOut(QListBoxItem* item);
00341     void slotPropertyChanged(KGamePropertyBase* prop, KPlayer* p);
00342     void slotPlayerLeftGame(KPlayer* p);
00343     void slotPlayerJoinedGame(KPlayer* p);
00344     void slotClearPlayers();
00345 
00346 private:
00347     KGameDialogConnectionConfigPrivate* d;
00348         
00349 };
00350 #endif
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.3.91.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 21 17:36:38 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003