Diffstat (limited to 'noncore/games/mindbreaker/mindbreaker.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/mindbreaker/mindbreaker.h | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/noncore/games/mindbreaker/mindbreaker.h b/noncore/games/mindbreaker/mindbreaker.h index fca649a..3132e80 100644 --- a/noncore/games/mindbreaker/mindbreaker.h +++ b/noncore/games/mindbreaker/mindbreaker.h | |||
@@ -1,10 +1,10 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
@@ -48,35 +48,47 @@ static const int answerpeg_diff = 9; | |||
48 | 48 | ||
49 | static const int board_height = (title_height + (panel_height * 9)); | 49 | static const int board_height = (title_height + (panel_height * 9)); |
50 | static const int board_width = (panel_width + (bin_margin * 2) + peg_size); | 50 | static const int board_width = (panel_width + (bin_margin * 2) + peg_size); |
51 | 51 | ||
52 | class Peg; | 52 | class Peg; |
53 | class QToolButton; | 53 | class QToolButton; |
54 | class QTimer; | ||
54 | 55 | ||
55 | class MindBreakerBoard : public QCanvasView // QWidget | 56 | class MindBreakerBoard : public QCanvasView // QWidget |
56 | { | 57 | { |
57 | Q_OBJECT | 58 | Q_OBJECT |
58 | public: | 59 | public: |
59 | MindBreakerBoard(QCanvas &c, QWidget *parent=0, const char *name=0, int wFlags=0 ); | 60 | MindBreakerBoard(QWidget *parent=0, const char *name=0, int wFlags=0 ); |
60 | ~MindBreakerBoard(); | 61 | ~MindBreakerBoard(); |
61 | 62 | ||
62 | void getScore(int *, int *); | 63 | void getScore(int *, int *); |
64 | |||
65 | void resizeEvent(QResizeEvent*); | ||
66 | void fixSize(); | ||
67 | |||
63 | signals: | 68 | signals: |
64 | void scoreChanged(int, int); | 69 | void scoreChanged(int, int); |
65 | 70 | ||
66 | public slots: | 71 | public slots: |
67 | void clear(); | 72 | void clear(); |
68 | void resetScore(); | 73 | void resetScore(); |
69 | 74 | ||
75 | private slots: | ||
76 | void doFixSize(); | ||
77 | |||
70 | protected: | 78 | protected: |
71 | void contentsMousePressEvent(QMouseEvent *); | 79 | void contentsMousePressEvent(QMouseEvent *); |
72 | void contentsMouseMoveEvent(QMouseEvent *); | 80 | void contentsMouseMoveEvent(QMouseEvent *); |
73 | void contentsMouseReleaseEvent(QMouseEvent *); | 81 | void contentsMouseReleaseEvent(QMouseEvent *); |
74 | void resizeEvent(QResizeEvent *); | ||
75 | 82 | ||
76 | private: | 83 | private: |
84 | QCanvas cnv; | ||
85 | |||
86 | void readConfig(); | ||
87 | void writeConfig(); | ||
88 | |||
77 | void drawBackground(); | 89 | void drawBackground(); |
78 | void checkGuess(); | 90 | void checkGuess(); |
79 | void checkScores(); | 91 | void checkScores(); |
80 | void placeGuessPeg(int pos, int pegId); | 92 | void placeGuessPeg(int pos, int pegId); |
81 | 93 | ||
82 | QImage panelImage; | 94 | QImage panelImage; |
@@ -97,23 +109,28 @@ private: | |||
97 | bool copy_press; | 109 | bool copy_press; |
98 | Peg *copy_peg; | 110 | Peg *copy_peg; |
99 | bool game_over; | 111 | bool game_over; |
100 | 112 | ||
101 | int total_turns; | 113 | int total_turns; |
102 | int total_games; | 114 | int total_games; |
115 | |||
116 | QTimer *widthTimer; | ||
103 | }; | 117 | }; |
104 | 118 | ||
105 | class MindBreaker : public QMainWindow // QWidget | 119 | class MindBreaker : public QMainWindow // QWidget |
106 | { | 120 | { |
107 | Q_OBJECT | 121 | Q_OBJECT |
108 | public: | 122 | public: |
109 | MindBreaker(QWidget *parent=0, const char *name=0, int wFlags=0 ); | 123 | MindBreaker(QWidget *parent=0, const char *name=0, int wFlags=0 ); |
110 | 124 | static QString appName() { return QString::fromLatin1("mindbreaker"); } | |
111 | public slots: | 125 | public slots: |
112 | void setScore(int, int); | 126 | void setScore(int, int); |
113 | 127 | ||
128 | protected: | ||
129 | void resizeEvent( QResizeEvent * ); | ||
130 | |||
114 | private: | 131 | private: |
115 | QCanvas canvas; | 132 | QCanvas canvas; |
116 | MindBreakerBoard *board; | 133 | MindBreakerBoard *board; |
117 | QToolButton *score; | 134 | QToolButton *score; |
118 | 135 | ||
119 | }; | 136 | }; |