00001 /*************************************************************************** 00002 This file is part of the KDE games lskat program 00003 Copyright (c) 2006 Martin Heni <kde@heni-online.de> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 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 Lskat 00021 ----- 00022 begin : March 2000 00023 copyright : (C) 1995-2006 by Martin Heni 00024 email : kde@heni-online.de 00025 ***************************************************************************/ 00026 00027 #ifndef LSKAT_H 00028 #define LSKAT_H 00029 00030 // Qt includes 00031 #include <QHash> 00032 00033 // KDE includes 00034 #include <kxmlguiwindow.h> 00035 #include <kconfig.h> 00036 #include <kdialog.h> 00037 #include <kdemacros.h> 00038 00039 // Local includes 00040 #include "abstractinput.h" 00041 #include "thememanager.h" 00042 00043 // Forward declararion 00044 class GameView; 00045 class Deck; 00046 class AbstractEngine; 00047 class AbstractDisplay; 00048 class Player; 00049 class ConfigTwo; 00050 class QGraphicsScene; 00051 00052 using namespace InputDevice; 00053 00056 class Mainwindow : public KXmlGuiWindow 00057 { 00058 Q_OBJECT 00059 00060 public: 00062 enum GameMode {Intro=0,LSkat=1,Skat=2}; 00063 00067 Mainwindow(QWidget* parent=0); 00068 00071 ~Mainwindow(); 00072 00073 public slots: 00076 void menuNewLSkatGame(); 00077 00080 void menuEndGame(); 00081 00084 void menuStartplayer(); 00085 00086 /* The input device for player 1 is changed in 00087 * the menu. 00088 */ 00089 void menuPlayer1By(); 00090 00091 /* The input device for player 2 is changed in 00092 * the menu. 00093 */ 00094 void menuPlayer2By(); 00095 00098 void menuCardDeck(); 00099 00102 void menuPlayerNames(); 00103 00106 void menuClearStatistics(); 00107 00110 void gameOver(int winner); 00111 00114 void nextPlayer(Player* player); 00115 00116 protected: 00123 AbstractInput* createInput( 00124 InputDevice::InputDeviceType inputType, 00125 AbstractDisplay* display, 00126 AbstractEngine* engine); 00127 00130 void initGUI(); 00131 00134 void startGame(); 00135 00139 void setStartPlayer(int no); 00140 00144 virtual void saveProperties(); 00145 00150 virtual void readProperties(); 00151 00157 virtual bool queryExit(); 00158 00159 protected slots: 00164 void setInputType(int no, InputDeviceType type); 00165 00166 00167 private: 00168 // Attributes not to be saved 00169 // The game engine 00170 AbstractEngine* mEngine; 00171 // The game display 00172 AbstractDisplay* mDisplay; 00173 // The main view 00174 GameView* mView; 00175 // The card deck 00176 Deck* mDeck; 00177 // LSkat config 00178 ConfigTwo* mLSkatConfig; 00179 // The graphics scene 00180 QGraphicsScene* mCanvas; 00181 // The theme manager used 00182 ThemeManager* mTheme; 00183 // The directory for the theme files 00184 QString mThemeDirName; 00185 00186 00187 // Properties to be saved 00188 // The cards directory 00189 QString mCardDir; 00190 // The card deck backside 00191 QString mDeckGrafix; 00192 // Current game mode (Intro, LSkat, ...) 00193 GameMode mGameMode; 00194 // Who starts the next game round/ 00195 int mStartPlayer; 00196 }; 00197 00198 #endif 00199
1.4.6