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     
00250     void setDiscoveryInfo(const QString& type, const QString& name=QString::null);
00251     
00252 signals:
00259   void signalServerTypeChanged(int);
00260 
00261 
00262 protected:
00263     void setConnected(bool connected, bool master = false);
00264 
00265 protected slots:
00266     void slotInitConnection();
00267     void slotExitConnection();
00268     void slotConnectionBroken();
00269 
00270 
00271 private:
00272     KGameDialogNetworkConfigPrivate* d;
00273 };
00274 
00275 class KGameDialogMsgServerConfigPrivate;
00276 class KGameDialogMsgServerConfig : public KGameDialogConfig
00277 {
00278     Q_OBJECT
00279 public:
00280     KGameDialogMsgServerConfig(QWidget* parent = 0);
00281     virtual ~KGameDialogMsgServerConfig();
00282 
00283     virtual void submitToKGame(KGame*, KPlayer*) {}
00284 
00285     void setHasMsgServer(bool);
00286 
00287     virtual void setKGame(KGame* g);
00288     virtual void setAdmin(bool);
00289 
00290 protected slots:
00291     void slotChangeMaxClients();
00292     void slotChangeAdmin();
00293     void slotRemoveClient();
00294 
00295 protected:
00296     void removeClient(Q_UINT32 id);
00297 
00298 private:
00299     KGameDialogMsgServerConfigPrivate* d;
00300 };
00301 
00302 class KGameDialogChatConfigPrivate;
00309 class KGameDialogChatConfig : public KGameDialogConfig
00310 {
00311     Q_OBJECT
00312 public:
00313     KGameDialogChatConfig(int chatMsgId, QWidget* parent = 0);
00314     virtual ~KGameDialogChatConfig();
00315 
00316     virtual void setKGame(KGame* g);
00317     virtual void setOwner(KPlayer* p);
00318 
00319     virtual void submitToKGame(KGame*, KPlayer*) { }
00320 
00321 private:
00322     KGameDialogChatConfigPrivate* d;
00323 };
00324 
00329 class KGameDialogConnectionConfigPrivate;
00330 class KGameDialogConnectionConfig : public KGameDialogConfig
00331 {
00332     Q_OBJECT
00333 public:
00334     KGameDialogConnectionConfig(QWidget* parent = 0);
00335     virtual ~KGameDialogConnectionConfig();
00336 
00337     virtual void setKGame(KGame*);
00338     virtual void setOwner(KPlayer*);
00339     virtual void setAdmin(bool admin);
00340 
00341     virtual void submitToKGame(KGame*, KPlayer*) { }
00342 
00343 protected:
00347     QListBoxItem* item(KPlayer* p) const;
00348 
00349 protected slots:
00350     void slotKickPlayerOut(QListBoxItem* item);
00351     void slotPropertyChanged(KGamePropertyBase* prop, KPlayer* p);
00352     void slotPlayerLeftGame(KPlayer* p);
00353     void slotPlayerJoinedGame(KPlayer* p);
00354     void slotClearPlayers();
00355 
00356 private:
00357     KGameDialogConnectionConfigPrivate* d;
00358         
00359 };
00360 #endif
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 16 14:17:07 2005 by doxygen 1.4.0 written by Dimitri van Heesch, © 1997-2003