File indexing completed on 2024-04-28 04:03:13
0001 /*************************************************************************** 0002 File : knights.h 0003 Project : Knights 0004 Description : Main window of the application 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2016-1018 Alexander Semke (alexander.semke@web.de) 0007 SPDX-FileCopyrightText: 2010-2012 Miha Čančula (miha@noughmad.eu) 0008 0009 ***************************************************************************/ 0010 0011 /*************************************************************************** 0012 * * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * * 0015 * This program is distributed in the hope that it will be useful, * 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0018 * GNU General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program; if not, write to the Free Software * 0022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0023 * Boston, MA 02110-1301 USA * 0024 * * 0025 ***************************************************************************/ 0026 0027 #ifndef KNIGHTS_H 0028 #define KNIGHTS_H 0029 0030 #include "ui_prefs_base.h" 0031 #include "ui_prefs_access.h" 0032 #include "proto/protocol.h" 0033 0034 #include <KGameDifficulty> 0035 #include <KXmlGuiWindow> 0036 0037 class KToggleAction; 0038 class KGameThemeProvider; 0039 0040 namespace Knights { 0041 class Protocol; 0042 class KnightsView; 0043 class ClockWidget; 0044 0045 class MainWindow : public KXmlGuiWindow { 0046 Q_OBJECT 0047 0048 public: 0049 MainWindow(); 0050 0051 public Q_SLOTS: 0052 void fileSave(); 0053 0054 private Q_SLOTS: 0055 void fileNew(); 0056 void fileLoad(); 0057 void fileSaveAs(); 0058 void resign(); 0059 void undo(); 0060 void redo(); 0061 void gameChanged(); 0062 void gameOver(Knights::Color); 0063 void optionsPreferences(); 0064 void activePlayerChanged(); 0065 0066 void protocolInitSuccesful(); 0067 void protocolError(Protocol::ErrorCode errorCode, const QString& errorString); 0068 0069 void setShowClockSetting(bool); 0070 void setShowHistorySetting(bool value); 0071 void setShowConsoleSetting(); 0072 void setShowChatSetting(bool); 0073 void updateCaption(); 0074 0075 void exitKnights(); 0076 0077 protected: 0078 void closeEvent(QCloseEvent*) override; 0079 0080 private: 0081 void setupDocks(); 0082 void setupActions(); 0083 bool maybeSave(); 0084 0085 Ui::prefs_base ui_prefs_base; 0086 Ui::prefs_access ui_prefs_access; 0087 KnightsView* m_view; 0088 QDockWidget* m_clockDock; 0089 ClockWidget* m_playerClock; 0090 QDockWidget* m_wconsoleDock; 0091 QDockWidget* m_bconsoleDock; 0092 QDockWidget* m_chatDock; 0093 QDockWidget* m_historyDock; 0094 0095 QAction* m_saveAction; 0096 QAction* m_saveAsAction; 0097 QAction* m_undoAction; 0098 QAction* m_redoAction; 0099 KToggleAction* m_pauseAction; 0100 QAction* m_resignAction; 0101 QAction* m_drawAction; 0102 QAction* m_adjournAction; 0103 KToggleAction* m_toolbarAction; 0104 KToggleAction* m_statusbarAction; 0105 QMap<QString, Protocol::Feature> m_protocolFeatures; 0106 KGameThemeProvider* m_themeProvider; 0107 0108 QString m_loadFileName; 0109 QString m_fileName; 0110 }; 0111 } 0112 0113 #endif // KNIGHTS_H