1 | /*************************************************************************** |
---|---|
2 | * KBlocks, a falling blocks game for KDE * |
3 | * Copyright (C) 2010 Zhongjie Cai <squall.leonhart.cai@gmail.com> * |
4 | * * |
5 | * This program is free software; you can redistribute it and/or modify * |
6 | * it under the terms of the GNU General Public License as published by * |
7 | * the Free Software Foundation; either version 2 of the License, or * |
8 | * (at your option) any later version. * |
9 | ***************************************************************************/ |
10 | #ifndef KBLOCKSREPWIN_H |
11 | #define KBLOCKSREPWIN_H |
12 | |
13 | #include <KMainWindow> |
14 | #include <QTimer> |
15 | #include <QString> |
16 | #include <QPixmap> |
17 | |
18 | #include "KBlocksScene.h" |
19 | #include "KBlocksView.h" |
20 | #include "KBlocksGameLogic.h" |
21 | #include "KBlocksGameReplayer.h" |
22 | |
23 | using std::string; |
24 | |
25 | class KBlocksRepWin : public KMainWindow |
26 | { |
27 | Q_OBJECT |
28 | |
29 | public: |
30 | explicit KBlocksRepWin(const char * replayFile, bool binaryMode = true); |
31 | ~KBlocksRepWin(); |
32 | |
33 | public: |
34 | void setGamesPerLine(int count); |
35 | |
36 | void setUpdateInterval(int interval); |
37 | void setReplayStepLength(int stepLen); |
38 | |
39 | void setSnapshotFolder(const QString& folder); |
40 | void setSnapshotFilename(const QString& fileName); |
41 | |
42 | bool replayLoaded(); |
43 | |
44 | public: |
45 | void startReplay(); |
46 | void stopReplay(); |
47 | |
48 | private: |
49 | QString getTimeString(); |
50 | void snapshotView(); |
51 | |
52 | private slots: |
53 | void replayOneStep(); |
54 | |
55 | private: |
56 | int mGameCount; |
57 | int mGamesPerWidth; |
58 | |
59 | int mUpdateInterval; |
60 | QTimer mUpdateTimer; |
61 | |
62 | QString mSnapshotFolder; |
63 | QString mSnapshotFilename; |
64 | QPixmap mSnapshoter; |
65 | |
66 | KBlocksScene* mpGameScene; |
67 | KBlocksView* mpGameView; |
68 | |
69 | KBlocksGameLogic* mpGameLogic; |
70 | KBlocksGameReplayer* mpGameReplayer; |
71 | }; |
72 | |
73 | #endif |
74 |