File indexing completed on 2024-05-05 04:02:56
0001 /* 0002 SPDX-FileCopyrightText: 2010 Ni Hui <shuizhuyuanluo@126.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef MAINWINDOW_H 0008 #define MAINWINDOW_H 0009 0010 #include <KXmlGuiWindow> 0011 0012 #include <QLabel> 0013 #include <cstdlib> 0014 0015 class KToggleAction; 0016 class KGameClock; 0017 class GameScene; 0018 class MainWindow : public KXmlGuiWindow 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit MainWindow( bool kSameMode = false, QWidget* parent = nullptr ); 0023 ~MainWindow() override; 0024 private Q_SLOTS: 0025 void configureSettings(); 0026 void loadSettings(); 0027 void newGame(); 0028 void newNumGame(); 0029 void pauseGame( bool isPaused ); 0030 void restartGame(); 0031 void loadGame(); 0032 void saveGame(); 0033 void changeMarkedCount( int markedCount ); 0034 void changeScore( int remainCount ); 0035 void changeRemainCount( int remainCount ); 0036 void changeTime( const QString& newTime ); 0037 void showHighscores(); 0038 void onGameOver( int remainCount ); 0039 void setSoundsEnabled( bool enabled ); 0040 private: 0041 void newGameWithId(int gameId); 0042 bool confirmAbort(); 0043 void setupActions(); 0044 bool m_kSameMode; 0045 GameScene* m_scene; 0046 /** Klickety mode only */ 0047 KGameClock* m_gameClock; 0048 /** KSame mode only */ 0049 int m_gameScore, m_lastRemainCount; 0050 KToggleAction* m_pauseAction; 0051 QLabel* m_statusBarLabelLeft; 0052 QLabel* m_statusBarLabelRight; 0053 }; 0054 0055 #endif // MAINWINDOW_H