summaryrefslogtreecommitdiffstats
path: root/kshisen/app.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /kshisen/app.h
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kshisen/app.h')
-rw-r--r--kshisen/app.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/kshisen/app.h b/kshisen/app.h
new file mode 100644
index 00000000..47808f9e
--- /dev/null
+++ b/kshisen/app.h
@@ -0,0 +1,122 @@
+/* Yo Emacs, this is -*- C++ -*-
+ *******************************************************************
+ *******************************************************************
+ *
+ *
+ * KSHISEN
+ *
+ *
+ *******************************************************************
+ *
+ * A japanese game similar to mahjongg
+ *
+ *******************************************************************
+ *
+ * created 1997 by Mario Weilguni <mweilguni@sime.com>
+ *
+ *******************************************************************
+ *
+ * This file is part of the KDE project "KSHISEN"
+ *
+ * KSHISEN is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * KSHISEN is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with KSHISEN; see the file COPYING. If not, write to
+ * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ *******************************************************************
+ */
+
+
+#ifndef __APP__H__
+#define __APP__H__
+
+// Should this get the whole HAVE_SYS_TIME_H TIME_WITH_SYS_TIME treatment?
+#include <time.h>
+
+#include <kmainwindow.h>
+#include "board.h"
+
+class KHighscore;
+
+struct HighScore
+{
+ QString name;
+ int seconds;
+ int x, y;
+ time_t date;
+ int gravity;
+};
+
+const unsigned HIGHSCORE_MAX = 10;
+
+class App : public KMainWindow
+{
+ Q_OBJECT
+
+public:
+ App(QWidget *parent = 0, const char *name=0);
+
+private slots:
+ void loadSettings();
+
+ void slotEndOfGame();
+ void enableItems();
+ void updateScore();
+ void showSettings();
+
+ void newGame();
+ void quitGame();
+ void restartGame();
+ void isSolvable();
+ void pause();
+ void undo();
+ void redo();
+ void hint();
+ void hallOfFame();
+ void keyBindings();
+ void boardResized();
+
+private:
+ void lockMenus(bool);
+ QString getPlayerName();
+
+ /**
+ * Read the old (pre- @ref KHighscore) highscore table.
+ *
+ * This reads the config file first, then saves it in the new format and
+ * re-reads it again as a KHighscore table.
+ **/
+ void readOldHighscore();
+ void readHighscore();
+ void writeHighscore();
+ int insertHighscore(const HighScore &);
+ int getScore(const HighScore &);
+ bool isBetter(const HighScore &, const HighScore &);
+ void showHighscore(int focusitem = -1);
+
+ void initKAction();
+ void setCheatMode();
+ void resetCheatMode();
+
+private:
+ QString lastPlayerName;
+ Board *board;
+ QValueVector<HighScore> highscore;
+ KHighscore* highscoreTable;
+ bool cheat;
+
+ enum statusBarItems { SBI_TIME, SBI_TILES, SBI_CHEAT };
+
+};
+
+#endif