File indexing completed on 2025-02-16 06:57:50
0001 /* 0002 Copyright (C) 2002-2005, Jason Katz-Brown <jasonkb@mit.edu> 0003 Copyright 2010 Stefan Majewsky <majewsky@gmx.net> 0004 0005 This program is free software; you can redistribute it and/or modify 0006 it under the terms of the GNU General Public License as published by 0007 the Free Software Foundation; either version 2 of the License, or 0008 (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more details. 0014 0015 You should have received a copy of the GNU General Public License 0016 along with this program; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 0018 */ 0019 0020 #ifndef KOLF_H 0021 #define KOLF_H 0022 0023 #include <KXmlGuiWindow> 0024 0025 #include "game.h" 0026 #include "itemfactory.h" 0027 #include <QUrl> 0028 class QGridLayout; 0029 class QAction; 0030 class KSelectAction; 0031 class KToggleAction; 0032 0033 class Editor; 0034 class ScoreBoard; 0035 0036 class KolfWindow : public KXmlGuiWindow 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 KolfWindow(); 0042 ~KolfWindow() override; 0043 0044 void openUrl(const QUrl &url); 0045 0046 public Q_SLOTS: 0047 void closeGame(); 0048 void updateModified(bool); 0049 0050 protected: 0051 bool queryClose() override; 0052 0053 protected Q_SLOTS: 0054 void startNewGame(); 0055 void loadGame(); 0056 void tutorial(); 0057 void newGame(); 0058 void save(); 0059 void saveAs(); 0060 void saveGame(); 0061 void saveGameAs(); 0062 void newPlayersTurn(Player *); 0063 void gameOver(); 0064 void editingStarted(); 0065 void editingEnded(); 0066 void checkEditing(); 0067 void setHoleFocus() { game->setFocus(); } 0068 void inPlayStart(); 0069 void inPlayEnd(); 0070 void maxStrokesReached(const QString &); 0071 void updateHoleMenu(int); 0072 void titleChanged(const QString &); 0073 void newStatusText(const QString &); 0074 void showInfoChanged(bool); 0075 void useMouseChanged(bool); 0076 void useAdvancedPuttingChanged(bool); 0077 void showGuideLineChanged(bool); 0078 void soundChanged(bool); 0079 void showHighScores(); 0080 void enableAllMessages(); 0081 void createSpacer(); 0082 0083 void emptySlot() {} 0084 0085 void setCurrentHole(int); 0086 0087 private: 0088 QWidget *dummy; 0089 KolfGame *game; 0090 Editor *editor; 0091 KolfGame *spacer; 0092 void setupActions(); 0093 QString filename; 0094 PlayerList players; 0095 PlayerList spacerPlayers; 0096 QGridLayout *layout; 0097 ScoreBoard *scoreboard; 0098 KToggleAction *editingAction; 0099 QAction *newHoleAction; 0100 QAction *resetHoleAction; 0101 QAction *undoShotAction; 0102 //QAction *replayShotAction; 0103 QAction *clearHoleAction; 0104 QAction *tutorialAction; 0105 QAction *newAction; 0106 QAction *endAction; 0107 QAction *saveAction; 0108 QAction *saveAsAction; 0109 QAction *saveGameAction; 0110 QAction *saveGameAsAction; 0111 QAction *loadGameAction; 0112 QAction *aboutAction; 0113 KSelectAction *holeAction; 0114 QAction *highScoreAction; 0115 QAction *nextAction; 0116 QAction *prevAction; 0117 QAction *firstAction; 0118 QAction *lastAction; 0119 QAction *randAction; 0120 KToggleAction *showInfoAction; 0121 KToggleAction *useMouseAction; 0122 KToggleAction *useAdvancedPuttingAction; 0123 KToggleAction *showGuideLineAction; 0124 KToggleAction *soundAction; 0125 void setHoleMovementEnabled(bool); 0126 void setHoleOtherEnabled(bool); 0127 inline void setEditingEnabled(bool); 0128 bool competition; 0129 0130 Kolf::ItemFactory m_itemFactory; 0131 0132 QString loadedGame; 0133 0134 bool isTutorial; 0135 bool courseModified; 0136 QString title; 0137 QString tempStatusBarText; 0138 }; 0139 0140 struct HighScore 0141 { 0142 HighScore() {} 0143 HighScore(const QString &name, int score) { this->name = name; this->score = score; } 0144 QString name; 0145 int score; 0146 }; 0147 typedef QList<HighScore> HighScoreList; 0148 0149 #endif