1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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
{
TQString name;
int seconds;
int x, y;
time_t date;
int gravity;
};
const unsigned HIGHSCORE_MAX = 10;
class App : public KMainWindow
{
Q_OBJECT
public:
App(TQWidget *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);
TQString 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:
TQString lastPlayerName;
Board *board;
TQValueVector<HighScore> highscore;
KHighscore* highscoreTable;
bool cheat;
enum statusBarItems { SBI_TIME, SBI_TILES, SBI_CHEAT };
};
#endif
|