| 1 | // Version: $Id$cxx . . $ `<file>/src/toplevel.cc`/ |
| 2 | /*************************************************************************** |
| 3 | * Copyright (C) 2002-2003 Andi Peredri * |
| 4 | * [email protected] * |
| 5 | * Copyright (C) 2004-2005 Artur Wiebe * |
| 6 | * [email protected] * |
| 7 | * * |
| 8 | * This program is free software; you can redistribute it and/or modify * |
| 9 | * it under the terms of the GNU General Public License as published by * |
| 10 | * the Free Software Foundation; either version 2 of the License, or * |
| 11 | * (at your option) any later version. * |
| 12 | * * |
| 13 | * This program is distributed in the hope that it will be useful, * |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 16 | * GNU General Public License for more details. * |
| 17 | * * |
| 18 | * You should have received a copy of the GNU General Public License * |
| 19 | * along with this program; if not, write to the * |
| 20 | * Free Software Foundation, Inc., * |
| 21 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
| 22 | ***************************************************************************/ |
| 23 | |
| 24 | #include <QLayout> |
| 25 | #include <QApplication> |
| 26 | #include <QMenuBar> |
| 27 | #include <QToolBar> |
| 28 | #include <QDir> |
| 29 | #include <QMessageBox> |
| 30 | #include <QFileDialog> |
| 31 | #include <QCloseEvent> |
| 32 | #include <QFontDialog> |
| 33 | #include <QDebug> |
| 34 | |
| 35 | #include "pdn.h"cxx . . $ `<file>/src/pdn.h`/ |
| 36 | #include "toplevel.h"cxx . . $ `<file>/src/toplevel.h`/ |
| 37 | #include "newgamedlg.h"cxx . . $ `<file>/src/newgamedlg.h`/ |
| 38 | #include "history.h"cxx . . $ `<file>/src/history.h`/ |
| 39 | #include "view.h"cxx . . $ `<file>/src/view.h`/ |
| 40 | #include "common.h"cxx . . $ `<file>/src/common.h`/ |
| 41 | |
| 42 | #define CFG_THEME_PATHcxx . . $ `src/toplevel.cc:42:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"ThemePath" |
| 43 | #define CFG_FILENAMEcxx . . $ `src/toplevel.cc:43:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"Filename" |
| 44 | #define CFG_KEEPDIALOGcxx . . $ `src/toplevel.cc:44:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"ShowKeepDialog" |
| 45 | #define CFG_NOTATIONcxx . . $ `src/toplevel.cc:45:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"Notation" |
| 46 | #define CFG_NOT_ABOVEcxx . . $ `src/toplevel.cc:46:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"NotationAbove" |
| 47 | #define CFG_NOT_FONTcxx . . $ `src/toplevel.cc:47:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"NotationFont" |
| 48 | #define CFG_CLEAR_LOGcxx . . $ `src/toplevel.cc:48:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"ClearLogOnNewRound" |
| 49 | #define CFG_GEOMETRYcxx . . $ `src/toplevel.cc:49:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"WindowGeometry" |
| 50 | #define CFG_STATEcxx . . $ `src/toplevel.cc:50:9`! CFG_KEYcxx . . $ `src/common.h:44:9`!"WindowState" |
| 51 | |
| 52 | |
| 53 | myTopLevelcxx . . $ myTopLevel#::myTopLevelcxx . . $ myTopLevel#myTopLevel(49f6e7a06ebc5aa8).() |
| 54 | { |
| 55 | setWindowTitlecxx . . $ QWidget#setWindowTitle(3520e46b33348bf6).(APPNAMEcxx . . $ `src/common.h:25:9`!); |
| 56 | setWindowIconcxx . . $ QWidget#setWindowIcon(71dcdac178620ed6).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/logo.svg"cxx . . $ QString#QString(85c52e162fed56f9).)); |
| 57 | |
| 58 | m_newgamecxx . . $ myTopLevel#m_newgame. = new myNewGameDlgcxx . . $ myNewGameDlg#myNewGameDlg(108f35f7aa7f3cf9).(this); |
| 59 | make_central_widgetcxx . . $ myTopLevel#make_central_widget(49f6e7a06ebc5aa8).(); |
| 60 | make_dockscxx . . $ myTopLevel#make_docks(49f6e7a06ebc5aa8).(); |
| 61 | make_actionscxx . . $ myTopLevel#make_actions(49f6e7a06ebc5aa8).(); |
| 62 | restore_settingscxx . . $ myTopLevel#restore_settings(49f6e7a06ebc5aa8).(); |
| 63 | |
| 64 | /* |
| 65 | * new computer game. |
| 66 | */ |
| 67 | m_viewcxx . . $ myTopLevel#m_view.->newGamecxx . . $ myView#newGame(3cc809d575064bfd).(m_newgamecxx . . $ myTopLevel#m_newgame.->rulescxx . . $ myNewGameDlg#rules(455f465bc33b4cdf).(), m_newgamecxx . . $ myTopLevel#m_newgame.->freePlacementcxx . . $ myNewGameDlg#freePlacement(50ce9a9e25b4a850).(), |
| 68 | m_newgamecxx . . $ myTopLevel#m_newgame.->namecxx . . $ myNewGameDlg#name(34227b1e5d5004df).(), |
| 69 | m_newgamecxx . . $ myTopLevel#m_newgame.->isWhitecxx . . $ myNewGameDlg#isWhite(50ce9a9e25b4a850).(), m_newgamecxx . . $ myTopLevel#m_newgame.->opponentcxx . . $ myNewGameDlg#opponent(455f465bc33b4cdf).(), |
| 70 | m_newgamecxx . . $ myTopLevel#m_newgame.->opponentNamecxx . . $ myNewGameDlg#opponentName(34227b1e5d5004df).(), m_newgamecxx . . $ myTopLevel#m_newgame.->skillcxx . . $ myNewGameDlg#skill(455f465bc33b4cdf).()); |
| 71 | |
| 72 | if(layoutcxx . . $ QWidget#layout(5761b17781c20cfb).()) { |
| 73 | //layout()->setSizeConstraint(QLayout::SetFixedSize); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | void myTopLevelcxx . . $ myTopLevel#::make_dockscxx . . $ myTopLevel#make_docks(49f6e7a06ebc5aa8).() { |
| 78 | m_historycxx . . $ myTopLevel#m_history. = new myHistorycxx . . $ myHistory#(this); |
| 79 | |
| 80 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(m_historycxx . . $ myTopLevel#m_history., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(previewGame(int)), |
| 81 | m_viewcxx . . $ myTopLevel#m_view., SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_preview_game(int))); |
| 82 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(m_historycxx . . $ myTopLevel#m_history., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(applyMoves(const QString&)), |
| 83 | m_viewcxx . . $ myTopLevel#m_view., SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_apply_moves(const QString&))); |
| 84 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(m_historycxx . . $ myTopLevel#m_history., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(newMode(bool, bool)), |
| 85 | m_viewcxx . . $ myTopLevel#m_view., SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_new_mode(bool, bool))); |
| 86 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(m_viewcxx . . $ myTopLevel#m_view., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(working(bool)), |
| 87 | m_historycxx . . $ myTopLevel#m_history., SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slotWorking(bool))); |
| 88 | |
| 89 | m_history_dockcxx . . $ myTopLevel#m_history_dock. = make_dockcxx . . $ myTopLevel#make_dock(fef18df664ed20e8).("history"cxx . . $ QString#QString(85c52e162fed56f9)., trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("History"), Qtcxx . . $ Qt/::RightDockWidgetAreacxx . . $ Qt/RightDockWidgetArea., m_historycxx . . $ myTopLevel#m_history.); |
| 90 | |
| 91 | m_logcxx . . $ myTopLevel#m_log. = new QTextEditcxx . . $ QTextEdit#(this); |
| 92 | //m_log->setFixedHeight(100); //FIXME |
| 93 | m_logcxx . . $ myTopLevel#m_log.->setReadOnlycxx . . $ QTextEdit#setReadOnly(b45ddcbc8423892c).(true); |
| 94 | |
| 95 | m_log_dockcxx . . $ myTopLevel#m_log_dock. = make_dockcxx . . $ myTopLevel#make_dock(fef18df664ed20e8).("log"cxx . . $ QString#QString(85c52e162fed56f9)., trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Log"), Qtcxx . . $ Qt/::BottomDockWidgetAreacxx . . $ Qt/BottomDockWidgetArea., m_logcxx . . $ myTopLevel#m_log.); |
| 96 | |
| 97 | } |
| 98 | |
| 99 | QDockWidgetcxx . . $ QDockWidget#* myTopLevelcxx . . $ myTopLevel#::make_dockcxx . . $ myTopLevel#make_dock(fef18df664ed20e8).(const QStringcxx . . $ QString#& name, const QStringcxx . . $ QString#& title, Qtcxx . . $ Qt/::DockWidgetAreacxx . . $ Qt/DockWidgetArea# area, QWidgetcxx . . $ QWidget#* widget) { |
| 100 | QDockWidgetcxx . . $ QDockWidget#* dock = new QDockWidgetcxx . . $ QDockWidget#QDockWidget(184e10e88e175d5b).(title, this); |
| 101 | dock->setAllowedAreascxx . . $ QDockWidget#setAllowedAreas(49dde4d298fce72b).(Qtcxx . . $ QFlags#QFlags(93d577a3e9528307).::AllDockWidgetAreascxx . . $ Qt/AllDockWidgetAreas.); |
| 102 | dock->setWidgetcxx . . $ QDockWidget#setWidget(108f35f7aa7f3cf9).(widget); |
| 103 | dock->setObjectNamecxx . . $ QObject#setObjectName(3520e46b33348bf6).(name); |
| 104 | addDockWidgetcxx . . $ QMainWindow#addDockWidget(315e3aea24dde9f7).(area, dock); |
| 105 | return dock; |
| 106 | } |
| 107 | |
| 108 | |
| 109 | void myTopLevelcxx . . $ myTopLevel#::make_actionscxx . . $ myTopLevel#make_actions(49f6e7a06ebc5aa8).() |
| 110 | { |
| 111 | // game menu actions |
| 112 | gameNewcxx . . $ myTopLevel#gameNew. = new QActioncxx . . $ QAction#QAction(ef44fe276c987e61).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/logo.svg"cxx . . $ QString#QString(85c52e162fed56f9).), trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&New..."), this); |
| 113 | gameNewcxx . . $ myTopLevel#gameNew.->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("CTRL+N", "File|New")); |
| 114 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(gameNewcxx . . $ myTopLevel#gameNew., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_new_game())); |
| 115 | |
| 116 | gameNextRoundcxx . . $ myTopLevel#gameNextRound. = new QActioncxx . . $ QAction#QAction(ef44fe276c987e61).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/next.svg"cxx . . $ QString#QString(85c52e162fed56f9).), |
| 117 | trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Next Round"), this); |
| 118 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(gameNextRoundcxx . . $ myTopLevel#gameNextRound., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), |
| 119 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_next_round())); |
| 120 | |
| 121 | gameStopcxx . . $ myTopLevel#gameStop. = new QActioncxx . . $ QAction#QAction(ef44fe276c987e61).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/stop.svg"cxx . . $ QString#QString(85c52e162fed56f9).), trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Stop"), this); |
| 122 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(gameStopcxx . . $ myTopLevel#gameStop., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), m_viewcxx . . $ myTopLevel#m_view., SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slotStopGame())); |
| 123 | |
| 124 | gameOpencxx . . $ myTopLevel#gameOpen. = new QActioncxx . . $ QAction#QAction(ef44fe276c987e61).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/fileopen.svg"cxx . . $ QString#QString(85c52e162fed56f9).), trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Open..."), |
| 125 | this); |
| 126 | gameOpencxx . . $ myTopLevel#gameOpen.->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("CTRL+O", "File|Open")); |
| 127 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(gameOpencxx . . $ myTopLevel#gameOpen., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_open_game())); |
| 128 | |
| 129 | gameSavecxx . . $ myTopLevel#gameSave. = new QActioncxx . . $ QAction#QAction(ef44fe276c987e61).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/filesave.svg"cxx . . $ QString#QString(85c52e162fed56f9).), trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Save..."), |
| 130 | this); |
| 131 | gameSavecxx . . $ myTopLevel#gameSave.->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("CTRL+S", "File|Save")); |
| 132 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(gameSavecxx . . $ myTopLevel#gameSave., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_save_game())); |
| 133 | |
| 134 | QActioncxx . . $ QAction#* gameQuit = new QActioncxx . . $ QAction#QAction(ef44fe276c987e61).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/exit.svg"cxx . . $ QString#QString(85c52e162fed56f9).), trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Quit"), |
| 135 | this); |
| 136 | gameQuit->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("CTRL+Q", "File|Quit")); |
| 137 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(gameQuit, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), |
| 138 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(close())); |
| 139 | // QApplication::instance(), SLOT(quit())); |
| 140 | |
| 141 | // view menu actions |
| 142 | viewNotationcxx . . $ myTopLevel#viewNotation. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Show Notation"), this); |
| 143 | viewNotationcxx . . $ myTopLevel#viewNotation.->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true); |
| 144 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(viewNotationcxx . . $ myTopLevel#viewNotation., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(toggled(bool)), |
| 145 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_notation(bool))); |
| 146 | |
| 147 | viewNotationAbovecxx . . $ myTopLevel#viewNotationAbove. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Show notation &above men"), this); |
| 148 | viewNotationAbovecxx . . $ myTopLevel#viewNotationAbove.->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true); |
| 149 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(viewNotationAbovecxx . . $ myTopLevel#viewNotationAbove., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(toggled(bool)), |
| 150 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_notation(bool))); |
| 151 | |
| 152 | // settings menu |
| 153 | settingsKeepcxx . . $ myTopLevel#settingsKeep. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Confirm aborting current game"), this); |
| 154 | settingsKeepcxx . . $ myTopLevel#settingsKeep.->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true); |
| 155 | // |
| 156 | settingsClearLogcxx . . $ myTopLevel#settingsClearLog. = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Clear &log on new round"), this); |
| 157 | settingsClearLogcxx . . $ myTopLevel#settingsClearLog.->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true); |
| 158 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(settingsClearLogcxx . . $ myTopLevel#settingsClearLog., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(toggled(bool)), |
| 159 | m_viewcxx . . $ myTopLevel#m_view., SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slotClearLog(bool))); |
| 160 | // |
| 161 | QActioncxx . . $ QAction#* settingsNotationFont = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Notation font..."), |
| 162 | this); |
| 163 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(settingsNotationFont, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), |
| 164 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_notation_font())); |
| 165 | |
| 166 | // help menu actions |
| 167 | QActioncxx . . $ QAction#* helpRules = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Rules of Play"), this); |
| 168 | helpRules->setShortcutcxx . . $ QAction#setShortcut(462600f892e8a1ee).(trcxx . . $ QKeySequence#QKeySequence(6905a94d1418a018).("F1", "Help|Help")); |
| 169 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(helpRules, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_help())); |
| 170 | |
| 171 | QActioncxx . . $ QAction#* helpAbout = new QActioncxx . . $ QAction#QAction(ef44fe276c987e61).(QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/icons/logo.svg"cxx . . $ QString#QString(85c52e162fed56f9).), |
| 172 | trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&About")+cxx . . $ operator+(3d22f08efddf8107)." "APPNAMEcxx . . $ `src/common.h:25:9`!, this); |
| 173 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(helpAbout, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_about())); |
| 174 | |
| 175 | QActioncxx . . $ QAction#* helpAboutQt = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("About &Qt"), this); |
| 176 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(helpAboutQt, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered()), qAppcxx . . $ `<external>/6022697617041041825/qapplication.h:70:9`!, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(aboutQt())); |
| 177 | |
| 178 | |
| 179 | /* |
| 180 | * toolbar |
| 181 | */ |
| 182 | QToolBarcxx . . $ QToolBar#* tb = addToolBarcxx . . $ QMainWindow#addToolBar(30eedf26851806a).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Toolbar")); |
| 183 | tb->setMovablecxx . . $ QToolBar#setMovable(b45ddcbc8423892c).(false); |
| 184 | tb->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameNewcxx . . $ myTopLevel#gameNew.); |
| 185 | tb->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameOpencxx . . $ myTopLevel#gameOpen.); |
| 186 | tb->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameSavecxx . . $ myTopLevel#gameSave.); |
| 187 | tb->addSeparatorcxx . . $ QToolBar#addSeparator(a590eff9f1ec9a95).(); |
| 188 | tb->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameNextRoundcxx . . $ myTopLevel#gameNextRound.); |
| 189 | tb->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameStopcxx . . $ myTopLevel#gameStop.); |
| 190 | |
| 191 | |
| 192 | /* |
| 193 | * menus |
| 194 | */ |
| 195 | QMenucxx . . $ QMenu#* gameMenu = menuBarcxx . . $ QMainWindow#menuBar(752dea92cd67ab27).()->addMenucxx . . $ QMenuBar#addMenu(7bd5d996bbe37ddf).(myTopLevelcxx . . $ myTopLevel#::trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Game")); |
| 196 | gameMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameNewcxx . . $ myTopLevel#gameNew.); |
| 197 | gameMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameOpencxx . . $ myTopLevel#gameOpen.); |
| 198 | gameMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameSavecxx . . $ myTopLevel#gameSave.); |
| 199 | gameMenu->addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 200 | gameMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameNextRoundcxx . . $ myTopLevel#gameNextRound.); |
| 201 | gameMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameStopcxx . . $ myTopLevel#gameStop.); |
| 202 | gameMenu->addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 203 | gameMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(gameQuit); |
| 204 | |
| 205 | viewMenucxx . . $ myTopLevel#viewMenu. = menuBarcxx . . $ QMainWindow#menuBar(752dea92cd67ab27).()->addMenucxx . . $ QMenuBar#addMenu(7bd5d996bbe37ddf).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&View")); |
| 206 | viewMenucxx . . $ myTopLevel#viewMenu.->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(tb->toggleViewActioncxx . . $ QToolBar#toggleViewAction(50f6a0536a8019cb).()); |
| 207 | viewMenucxx . . $ myTopLevel#viewMenu.->addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 208 | viewMenucxx . . $ myTopLevel#viewMenu.->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(viewNotationcxx . . $ myTopLevel#viewNotation.); |
| 209 | viewMenucxx . . $ myTopLevel#viewMenu.->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(viewNotationAbovecxx . . $ myTopLevel#viewNotationAbove.); |
| 210 | viewMenucxx . . $ myTopLevel#viewMenu.->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(m_history_dockcxx . . $ myTopLevel#m_history_dock.->toggleViewActioncxx . . $ QDockWidget#toggleViewAction(50f6a0536a8019cb).()); |
| 211 | viewMenucxx . . $ myTopLevel#viewMenu.->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(m_log_dockcxx . . $ myTopLevel#m_log_dock.->toggleViewActioncxx . . $ QDockWidget#toggleViewAction(50f6a0536a8019cb).()); |
| 212 | |
| 213 | QMenucxx . . $ QMenu#* settingsMenu = menuBarcxx . . $ QMainWindow#menuBar(752dea92cd67ab27).()->addMenucxx . . $ QMenuBar#addMenu(7bd5d996bbe37ddf).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Settings")); |
| 214 | settingsMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(settingsKeepcxx . . $ myTopLevel#settingsKeep.); |
| 215 | settingsMenu->addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 216 | settingsMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(settingsNotationFont); |
| 217 | settingsMenu->addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 218 | settingsMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(settingsClearLogcxx . . $ myTopLevel#settingsClearLog.); |
| 219 | |
| 220 | QMenucxx . . $ QMenu#* helpMenu = menuBarcxx . . $ QMainWindow#menuBar(752dea92cd67ab27).()->addMenucxx . . $ QMenuBar#addMenu(7bd5d996bbe37ddf).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Help")); |
| 221 | helpMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(helpRules); |
| 222 | helpMenu->addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 223 | helpMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(helpAbout); |
| 224 | helpMenu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(helpAboutQt); |
| 225 | |
| 226 | |
| 227 | /* |
| 228 | * THEMES. create a default theme. |
| 229 | */ |
| 230 | QActionGroupcxx . . $ QActionGroup#* themes_grp = new QActionGroupcxx . . $ QActionGroup#QActionGroup(749de1b6ae65bddd).(this); |
| 231 | themes_grp->setExclusivecxx . . $ QActionGroup#setExclusive(b45ddcbc8423892c).(true); |
| 232 | |
| 233 | QActioncxx . . $ QAction#* default_theme = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).(DEFAULT_THEMEcxx . . $ `src/common.h:47:9`!), themes_grp); |
| 234 | default_theme->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true); |
| 235 | m_themescxx . . $ myTopLevel#m_themes.[cxx . . $ QMap#`operator[]`(bbd415b616967878).default_theme] =cxx . . $ QString#`operator=`(d02845eef0c33901). DEFAULT_THEMEcxx . . $ `src/common.h:47:9`!; |
| 236 | default_theme->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(true); |
| 237 | set_themecxx . . $ myTopLevel#set_theme(92b1e80c0a7f1406).(default_theme);//FIXME TODO |
| 238 | themes_grp->addActioncxx . . $ QActionGroup#addAction(440174cb3ba1362).(default_theme); |
| 239 | |
| 240 | viewMenucxx . . $ myTopLevel#viewMenu.->addSeparatorcxx . . $ QMenu#addSeparator(a590eff9f1ec9a95).(); |
| 241 | viewMenucxx . . $ myTopLevel#viewMenu.->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(default_theme); |
| 242 | read_themescxx . . $ myTopLevel#read_themes(726c7baffdc25e5e).(themes_grp, |
| 243 | viewMenucxx . . $ myTopLevel#viewMenu.,QDircxx . . $ QDir#::homePathcxx . . $ QDir#homePath(4365c3963150523e).()+cxx . . $ operator+(3d22f08efddf8107)."/"USER_PATHcxx . . $ `src/common.h:40:9`!"/"THEME_DIRcxx . . $ `src/common.h:41:9`!); |
| 244 | //TODO-hardcoded |
| 245 | read_themescxx . . $ myTopLevel#read_themes(726c7baffdc25e5e).(themes_grp, |
| 246 | viewMenucxx . . $ myTopLevel#viewMenu., PREFIXcxx . . $ `<built-in>:480:9`!"/share/qcheckers/"THEME_DIRcxx . . $ `src/common.h:41:9`!); |
| 247 | |
| 248 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(themes_grp, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(triggered(QAction*)), |
| 249 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(set_theme(QAction*))); |
| 250 | } |
| 251 | |
| 252 | |
| 253 | void myTopLevelcxx . . $ myTopLevel#::read_themescxx . . $ myTopLevel#read_themes(726c7baffdc25e5e).(QActionGroupcxx . . $ QActionGroup#* menu_grp, QMenucxx . . $ QMenu#* menu, |
| 254 | const QStringcxx . . $ QString#& path) |
| 255 | { |
| 256 | QDircxx . . $ QDir# sharedircxx . . $ QDir#QDir(3520e46b33348bf6).(path); |
| 257 | QStringListcxx . . $ QStringList# themes = sharedir.entryListcxx . . $ QDir#entryList(648720ae7e049ebe).(QDircxx . . $ QDir#::Dirscxx . . $ QDir#Dirs.|cxx . . $ `operator|`(153b300229e4e3d0).QDircxx . . $ QDir#::Readablecxx . . $ QDir#Readable.); |
| 258 | themes.removeAllcxx . . $ QList#removeAll(dd8e59d271e40448).("."cxx . . $ QString#QString(85c52e162fed56f9).); |
| 259 | themes.removeAllcxx . . $ QList#removeAll(dd8e59d271e40448).(".."cxx . . $ QString#QString(85c52e162fed56f9).); |
| 260 | |
| 261 | for(QStringListcxx . . $ QStringList#::iteratorcxx . . $ QList#iterator# it=themes.begincxx . . $ QList#begin(ca2520f641887418).(); it!=cxx . . $ QList#iterator#`operator!=`(afde28160b321935).themes.endcxx . . $ QList#end(ca2520f641887418).(); ++cxx . . $ QList#iterator#operator++(c343742bd746e713).it) { |
| 262 | sharedir.cdcxx . . $ QDir#cd(e1defb592416720d).(*cxx . . $ QList#iterator#`operator*`(c93303b41ac66b6d).it); |
| 263 | |
| 264 | QStringcxx . . $ QString# theme_dir = sharedir.absolutePathcxx . . $ QDir#absolutePath(6ef7b6c27b00b43d).(); |
| 265 | qInfocxx . . $ `<external>/10450329605257866924/qlogging.h:165:9`!("Check: %s", qUtf8Printablecxx . . $ `<external>/15045578679651060896/qglobal.h:835:11`!(theme_dir)); |
| 266 | Themecxx . . $ Theme#* theme = new Themecxx . . $ Theme#(this, theme_dir, 0); |
| 267 | if (! theme->isValidcxx . . $ Theme#isValid(c9857a73d68e59ba).()) { |
| 268 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Theme in " |
| 269 | <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). sharedir.absolutePathcxx . . $ QDir#absolutePath(6ef7b6c27b00b43d).() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " is invalid"; |
| 270 | } else { |
| 271 | QStringcxx . . $ QString# themename = theme->namecxx . . $ Theme#name(ea4b39313763ec41).(); |
| 272 | |
| 273 | QActioncxx . . $ QAction#* action = new QActioncxx . . $ QAction#QAction(6b24f83d17022bd9).(themename, this); |
| 274 | menu_grp->addActioncxx . . $ QActionGroup#addAction(440174cb3ba1362).(action); |
| 275 | menu->addActioncxx . . $ QWidget#addAction(92b1e80c0a7f1406).(action); |
| 276 | action->setCheckablecxx . . $ QAction#setCheckable(b45ddcbc8423892c).(true); |
| 277 | m_themescxx . . $ myTopLevel#m_themes.[cxx . . $ QMap#`operator[]`(bbd415b616967878).action] =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). theme_dir; |
| 278 | } |
| 279 | |
| 280 | sharedir.cdUpcxx . . $ QDir#cdUp(c9857a73d68e59ba).(); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | |
| 285 | void myTopLevelcxx . . $ myTopLevel#::restore_settingscxx . . $ myTopLevel#restore_settings(49f6e7a06ebc5aa8).() |
| 286 | { |
| 287 | QSettingscxx . . $ QSettings# cfgcxx . . $ QSettings#QSettings(b05324713c9ab95e).(APPNAMEcxx . . $ `src/common.h:25:9`!, APPNAMEcxx . . $ `src/common.h:25:9`!); |
| 288 | |
| 289 | QStringcxx . . $ QString# theme_path = cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_THEME_PATHcxx . . $ `src/toplevel.cc:42:9`!, DEFAULT_THEMEcxx . . $ `src/common.h:47:9`!) |
| 290 | .toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(); |
| 291 | for(myThemeMapcxx . . $ myTopLevel#myThemeMap#::iteratorcxx . . $ QMap#iterator# it = m_themescxx . . $ myTopLevel#m_themes..begincxx . . $ QMap#begin(2d49d7eeb2586d1c).(); it!=cxx . . $ QMap#iterator#`operator!=`(8a5a4c9a0d42c534).m_themescxx . . $ myTopLevel#m_themes..endcxx . . $ QMap#end(2d49d7eeb2586d1c).(); |
| 292 | it++cxx . . $ QMap#iterator#operator++(7cc628820cfd2204).) { |
| 293 | if(it.valuecxx . . $ QMap#iterator#value(51f62fb05f27f6a2).() ==cxx . . $ `operator==`(5bc2975d2d751687). theme_path) { |
| 294 | it.keycxx . . $ QMap#iterator#key(ea465e50d690edfe).()->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(true); |
| 295 | set_themecxx . . $ myTopLevel#set_theme(92b1e80c0a7f1406).(it.keycxx . . $ QMap#iterator#key(ea465e50d690edfe).()); |
| 296 | break; |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | filenamecxx . . $ myTopLevel#filename. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_FILENAMEcxx . . $ `src/toplevel.cc:43:9`!).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(); |
| 301 | |
| 302 | viewNotationcxx . . $ myTopLevel#viewNotation.->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_NOTATIONcxx . . $ `src/toplevel.cc:45:9`!, falsecxx . . $ QVariant#QVariant(b45ddcbc8423892c).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()); |
| 303 | viewNotationAbovecxx . . $ myTopLevel#viewNotationAbove.->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_NOT_ABOVEcxx . . $ `src/toplevel.cc:46:9`!, truecxx . . $ QVariant#QVariant(b45ddcbc8423892c).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()); |
| 304 | slot_notationcxx . . $ myTopLevel#slot_notation(b45ddcbc8423892c).(true); // here: arg is ignored by the function |
| 305 | |
| 306 | bool clear_log = cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_CLEAR_LOGcxx . . $ `src/toplevel.cc:48:9`!, truecxx . . $ QVariant#QVariant(b45ddcbc8423892c).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 307 | settingsClearLogcxx . . $ myTopLevel#settingsClearLog.->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(clear_log); |
| 308 | m_viewcxx . . $ myTopLevel#m_view.->slotClearLogcxx . . $ myView#slotClearLog(b45ddcbc8423892c).(clear_log); |
| 309 | |
| 310 | // |
| 311 | settingsKeepcxx . . $ myTopLevel#settingsKeep.->setCheckedcxx . . $ QAction#setChecked(b45ddcbc8423892c).(cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_KEEPDIALOGcxx . . $ `src/toplevel.cc:44:9`!, truecxx . . $ QVariant#QVariant(b45ddcbc8423892c).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).()); |
| 312 | |
| 313 | QFontcxx . . $ QFont# cfontcxx . . $ QFont#QFont(49f6e7a06ebc5aa8).; |
| 314 | if(cfont.fromStringcxx . . $ QFont#fromString(e1defb592416720d).(cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_NOT_FONTcxx . . $ `src/toplevel.cc:47:9`!, ""cxx . . $ QVariant#QVariant(85c52e162fed56f9).).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).())) |
| 315 | m_viewcxx . . $ myTopLevel#m_view.->setNotationFontcxx . . $ myView#setNotationFont(d0a4bd0c8524b912).(cfont); |
| 316 | |
| 317 | // new game |
| 318 | m_newgamecxx . . $ myTopLevel#m_newgame.->readSettingscxx . . $ myNewGameDlg#readSettings(a6b0dd7eca790fad).(&cfg); |
| 319 | |
| 320 | restoreGeometrycxx . . $ QWidget#restoreGeometry(544790aa27d183a0).(cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_GEOMETRYcxx . . $ `src/toplevel.cc:49:9`!).toByteArraycxx . . $ QVariant#toByteArray(a96750bfbcb1fbe9).()); |
| 321 | restoreStatecxx . . $ QMainWindow#restoreState(eb4ac98757633405).(cfg.valuecxx . . $ QSettings#value(12a1b1749da49362).(CFG_STATEcxx . . $ `src/toplevel.cc:50:9`!).toByteArraycxx . . $ QVariant#toByteArray(a96750bfbcb1fbe9).()); |
| 322 | } |
| 323 | |
| 324 | |
| 325 | void myTopLevelcxx . . $ myTopLevel#::make_central_widgetcxx . . $ myTopLevel#make_central_widget(49f6e7a06ebc5aa8).() |
| 326 | { |
| 327 | m_viewcxx . . $ myTopLevel#m_view. = new myViewcxx . . $ myView#myView(2403d8775207dcc0).(this); |
| 328 | |
| 329 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(m_viewcxx . . $ myTopLevel#m_view., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(working(bool)), |
| 330 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(slot_working(bool))); |
| 331 | |
| 332 | setCentralWidgetcxx . . $ QMainWindow#setCentralWidget(108f35f7aa7f3cf9).(m_viewcxx . . $ myTopLevel#m_view.); |
| 333 | } |
| 334 | |
| 335 | |
| 336 | void myTopLevelcxx . . $ myTopLevel#::warningcxx . . $ myTopLevel#warning(3520e46b33348bf6).(const QStringcxx . . $ QString#& text) |
| 337 | { |
| 338 | QMessageBoxcxx . . $ QMessageBox#::warningcxx . . $ QMessageBox#warning(a9e3742e6f7b4147).(this, trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Error")+cxx . . $ operator+(3d22f08efddf8107)." - "APPNAMEcxx . . $ `src/common.h:25:9`!, text); |
| 339 | } |
| 340 | |
| 341 | |
| 342 | void myTopLevelcxx . . $ myTopLevel#::informationcxx . . $ myTopLevel#information(c1427772cd1877b0).(const QStringcxx . . $ QString#& caption, const QStringcxx . . $ QString#& text) |
| 343 | { |
| 344 | QDialogcxx . . $ QDialog#* dlg = new QDialogcxx . . $ QDialog#QDialog(872e7b0c281abd8d).(this); |
| 345 | dlg->setModalcxx . . $ QDialog#setModal(b45ddcbc8423892c).(true); |
| 346 | dlg->setWindowTitlecxx . . $ QWidget#setWindowTitle(3520e46b33348bf6).(caption+cxx . . $ operator+(3d22f08efddf8107)." - "APPNAMEcxx . . $ `src/common.h:25:9`!); |
| 347 | |
| 348 | // logo left |
| 349 | QLabelcxx . . $ QLabel#* logo = new QLabelcxx . . $ QLabel#QLabel(872e7b0c281abd8d).(dlg); |
| 350 | logo->setPixmapcxx . . $ QLabel#setPixmap(8887f7d25b86c3f4).(QPixmapcxx . . $ QPixmap#QPixmap(dec4543235ec9b46).(":/icons/dialog.png"cxx . . $ QString#QString(85c52e162fed56f9).)); |
| 351 | |
| 352 | // text editor |
| 353 | QTextEditcxx . . $ QTextEdit#* te = new QTextEditcxx . . $ QTextEdit#(text, dlg); |
| 354 | te->setReadOnlycxx . . $ QTextEdit#setReadOnly(b45ddcbc8423892c).(true); |
| 355 | te->setMinimumWidthcxx . . $ QWidget#setMinimumWidth(d4f767463ce0a6b3).(m_viewcxx . . $ myTopLevel#m_view.->widthcxx . . $ QWidget#width(455f465bc33b4cdf).()-100); |
| 356 | te->setMinimumHeightcxx . . $ QWidget#setMinimumHeight(d4f767463ce0a6b3).(m_viewcxx . . $ myTopLevel#m_view.->heightcxx . . $ QWidget#height(455f465bc33b4cdf).()-200); |
| 357 | |
| 358 | // close button |
| 359 | QPushButtoncxx . . $ QPushButton#* button = new QPushButtoncxx . . $ QPushButton#QPushButton(90d5708627041e22).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("&Close"), dlg); |
| 360 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(button, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:265:10`!(clicked()), dlg, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:264:10`!(accept())); |
| 361 | |
| 362 | // Layout. |
| 363 | QHBoxLayoutcxx . . $ QHBoxLayout#* hb = new QHBoxLayoutcxx . . $ QHBoxLayout#(); |
| 364 | hb->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(logo, 0, Qtcxx . . $ QFlags#QFlags(93d577a3e9528307).::AlignTopcxx . . $ Qt/AlignTop.); |
| 365 | hb->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(te, 1); |
| 366 | |
| 367 | QHBoxLayoutcxx . . $ QHBoxLayout#* hb_button = new QHBoxLayoutcxx . . $ QHBoxLayout#(); |
| 368 | hb_button->addStretchcxx . . $ QBoxLayout#addStretch(d4f767463ce0a6b3).(); |
| 369 | hb_button->addWidgetcxx . . $ QBoxLayout#addWidget(d39963fa34d6acb).(button); |
| 370 | |
| 371 | QVBoxLayoutcxx . . $ QVBoxLayout#* vb = new QVBoxLayoutcxx . . $ QVBoxLayout#(dlg); |
| 372 | vb->addLayoutcxx . . $ QBoxLayout#addLayout(ecefce2409e37794).(hb, 1); |
| 373 | vb->addSpacingcxx . . $ QBoxLayout#addSpacing(d4f767463ce0a6b3).(5); |
| 374 | vb->addLayoutcxx . . $ QBoxLayout#addLayout(ecefce2409e37794).(hb_button); |
| 375 | |
| 376 | // go |
| 377 | dlg->execcxx . . $ QDialog#exec(b126dc7c1de90089).(); |
| 378 | delete dlg; |
| 379 | } |
| 380 | |
| 381 | myHistorycxx . . $ myHistory#* myTopLevelcxx . . $ myTopLevel#::get_historycxx . . $ myTopLevel#get_history(af936538a136922a).() const { |
| 382 | return m_historycxx . . $ myTopLevel#m_history.; |
| 383 | } |
| 384 | |
| 385 | void myTopLevelcxx . . $ myTopLevel#::clear_logcxx . . $ myTopLevel#clear_log(49f6e7a06ebc5aa8).() { |
| 386 | m_logcxx . . $ myTopLevel#m_log.->clearcxx . . $ QTextEdit#clear(49f6e7a06ebc5aa8).(); |
| 387 | } |
| 388 | |
| 389 | void myTopLevelcxx . . $ myTopLevel#::append_logcxx . . $ myTopLevel#append_log(3520e46b33348bf6).(const QStringcxx . . $ QString#& text) { |
| 390 | m_logcxx . . $ myTopLevel#m_log.->appendcxx . . $ QTextEdit#append(3520e46b33348bf6).(text); |
| 391 | m_logcxx . . $ myTopLevel#m_log.->ensureCursorVisiblecxx . . $ QTextEdit#ensureCursorVisible(49f6e7a06ebc5aa8).(); |
| 392 | } |
| 393 | |
| 394 | void myTopLevelcxx . . $ myTopLevel#::slot_save_gamecxx . . $ myTopLevel#slot_save_game(49f6e7a06ebc5aa8).() |
| 395 | { |
| 396 | QStringcxx . . $ QString# fn = QFileDialogcxx . . $ QFileDialog#::getSaveFileNamecxx . . $ QFileDialog#getSaveFileName(a6b29be4bec65236).(this, |
| 397 | trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Save Game")+cxx . . $ operator+(3d22f08efddf8107)." - "APPNAMEcxx . . $ `src/common.h:25:9`!, filenamecxx . . $ myTopLevel#filename., "PDN Files (*."cxx . . $ QString#QString(85c52e162fed56f9).EXTcxx . . $ `src/common.h:27:9`!")"); |
| 398 | if(!fn.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 399 | if(fn.rightcxx . . $ QString#right(3f3c3d0e9c0eb37f).(3)!=cxx . . $ QString#`operator!=`(7d4bdb1abc417636).EXTcxx . . $ `src/common.h:27:9`!) { |
| 400 | fn +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "."EXTcxx . . $ `src/common.h:27:9`!; |
| 401 | } |
| 402 | |
| 403 | if(m_viewcxx . . $ myTopLevel#m_view.->savePdncxx . . $ myView#savePdn(e1defb592416720d).(fn)) { |
| 404 | filenamecxx . . $ myTopLevel#filename. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). fn; |
| 405 | } else { |
| 406 | warningcxx . . $ myTopLevel#warning(3520e46b33348bf6).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Could not save: ")+cxx . . $ operator+(fab9b4f80031f353).filenamecxx . . $ myTopLevel#filename.); |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | |
| 412 | void myTopLevelcxx . . $ myTopLevel#::slot_open_gamecxx . . $ myTopLevel#slot_open_game(49f6e7a06ebc5aa8).() |
| 413 | { |
| 414 | QStringcxx . . $ QString# fn = QFileDialogcxx . . $ QFileDialog#::getOpenFileNamecxx . . $ QFileDialog#getOpenFileName(a6b29be4bec65236).(this, |
| 415 | trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Open Game")+cxx . . $ operator+(3d22f08efddf8107)." - "APPNAMEcxx . . $ `src/common.h:25:9`!, filenamecxx . . $ myTopLevel#filename., "PDN Files (*."cxx . . $ QString#QString(85c52e162fed56f9).EXTcxx . . $ `src/common.h:27:9`!")"); |
| 416 | if(!fn.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 417 | opencxx . . $ myTopLevel#open(3520e46b33348bf6).(fn); |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | |
| 422 | void myTopLevelcxx . . $ myTopLevel#::opencxx . . $ myTopLevel#open(3520e46b33348bf6).(const QStringcxx . . $ QString#& fn) |
| 423 | { |
| 424 | if(m_viewcxx . . $ myTopLevel#m_view.->openPdncxx . . $ myView#openPdn(e1defb592416720d).(fn)) { |
| 425 | filenamecxx . . $ myTopLevel#filename. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). fn; |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | |
| 430 | void myTopLevelcxx . . $ myTopLevel#::closeEventcxx . . $ myTopLevel#closeEvent(642e80679aeb34f8).(QCloseEventcxx . . $ QCloseEvent#* e) |
| 431 | { |
| 432 | if(!keep_gamecxx . . $ myTopLevel#keep_game(c9857a73d68e59ba).()) { |
| 433 | store_settingscxx . . $ myTopLevel#store_settings(49f6e7a06ebc5aa8).(); |
| 434 | e->acceptcxx . . $ QEvent#accept(49f6e7a06ebc5aa8).(); |
| 435 | } else { |
| 436 | e->ignorecxx . . $ QEvent#ignore(49f6e7a06ebc5aa8).(); |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | |
| 441 | void myTopLevelcxx . . $ myTopLevel#::store_settingscxx . . $ myTopLevel#store_settings(49f6e7a06ebc5aa8).() |
| 442 | { |
| 443 | QSettingscxx . . $ QSettings# configcxx . . $ QSettings#QSettings(b05324713c9ab95e).(APPNAMEcxx . . $ `src/common.h:25:9`!, APPNAMEcxx . . $ `src/common.h:25:9`!); |
| 444 | |
| 445 | for(myThemeMapcxx . . $ myTopLevel#myThemeMap#::iteratorcxx . . $ QMap#iterator# it=m_themescxx . . $ myTopLevel#m_themes..begincxx . . $ QMap#begin(2d49d7eeb2586d1c).(); it!=cxx . . $ QMap#iterator#`operator!=`(8a5a4c9a0d42c534).m_themescxx . . $ myTopLevel#m_themes..endcxx . . $ QMap#end(2d49d7eeb2586d1c).(); |
| 446 | it++cxx . . $ QMap#iterator#operator++(7cc628820cfd2204).) { |
| 447 | if(it.keycxx . . $ QMap#iterator#key(ea465e50d690edfe).()->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).()) { |
| 448 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_THEME_PATHcxx . . $ `src/toplevel.cc:42:9`!, itcxx . . $ QVariant#QVariant(3520e46b33348bf6)..valuecxx . . $ QMap#iterator#value(51f62fb05f27f6a2).()); |
| 449 | break; |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_FILENAMEcxx . . $ `src/toplevel.cc:43:9`!, filenamecxx . . $ QVariant#QVariant(3520e46b33348bf6).); |
| 454 | |
| 455 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_NOTATIONcxx . . $ `src/toplevel.cc:45:9`!, viewNotationcxx . . $ QVariant#QVariant(b45ddcbc8423892c).->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).()); |
| 456 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_NOT_ABOVEcxx . . $ `src/toplevel.cc:46:9`!, viewNotationAbovecxx . . $ QVariant#QVariant(b45ddcbc8423892c).->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).()); |
| 457 | |
| 458 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_KEEPDIALOGcxx . . $ `src/toplevel.cc:44:9`!, settingsKeepcxx . . $ QVariant#QVariant(b45ddcbc8423892c).->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).()); |
| 459 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_NOT_FONTcxx . . $ `src/toplevel.cc:47:9`!, m_viewcxx . . $ QVariant#QVariant(3520e46b33348bf6).->notationFontcxx . . $ myView#notationFont(9958934e48c66a6a).().toStringcxx . . $ QFont#toString(6ef7b6c27b00b43d).()); |
| 460 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_CLEAR_LOGcxx . . $ `src/toplevel.cc:48:9`!, settingsClearLogcxx . . $ QVariant#QVariant(b45ddcbc8423892c).->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).()); |
| 461 | |
| 462 | // new game |
| 463 | m_newgamecxx . . $ myTopLevel#m_newgame.->writeSettingscxx . . $ myNewGameDlg#writeSettings(a6b0dd7eca790fad).(&config); |
| 464 | |
| 465 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_GEOMETRYcxx . . $ `src/toplevel.cc:49:9`!, saveGeometrycxx . . $ QVariant#QVariant(45672f3c6961a244).()); |
| 466 | config.setValuecxx . . $ QSettings#setValue(1c60a90c724e6bfb).(CFG_STATEcxx . . $ `src/toplevel.cc:50:9`!, saveStatecxx . . $ QVariant#QVariant(45672f3c6961a244).()); |
| 467 | } |
| 468 | |
| 469 | |
| 470 | void myTopLevelcxx . . $ myTopLevel#::set_themecxx . . $ myTopLevel#set_theme(92b1e80c0a7f1406).(QActioncxx . . $ QAction#* action) |
| 471 | { |
| 472 | QStringcxx . . $ QString# path = m_themescxx . . $ QString#QString(132dd6869045752b).[cxx . . $ QMap#`operator[]`(bbd415b616967878).action]; |
| 473 | m_viewcxx . . $ myTopLevel#m_view.->setThemecxx . . $ myView#setTheme(3520e46b33348bf6).(path); |
| 474 | } |
| 475 | |
| 476 | |
| 477 | void myTopLevelcxx . . $ myTopLevel#::slot_helpcxx . . $ myTopLevel#slot_help(49f6e7a06ebc5aa8).() |
| 478 | { |
| 479 | QStringcxx . . $ QString# text = |
| 480 | trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("<p>In the beginning of game you have 12 checkers (men). " |
| 481 | "The men move forward only. The men can capture:" |
| 482 | "<ul>" |
| 483 | "<li>by jumping forward only (english rules);" |
| 484 | "<li>by jumping forward or backward (russian rules)." |
| 485 | "</ul>" |
| 486 | "<p>A man which reaches the far side of the board becomes a king. " |
| 487 | "The kings move forward or backward:" |
| 488 | "<ul>" |
| 489 | "<li>to one square only (english rules);" |
| 490 | "<li>to any number of squares (russian rules)." |
| 491 | "</ul>" |
| 492 | "<p>The kings capture by jumping forward or backward. " |
| 493 | "Whenever a player is able to make a capture he must do so."); |
| 494 | |
| 495 | informationcxx . . $ myTopLevel#information(c1427772cd1877b0).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Rules of Play"), text); |
| 496 | } |
| 497 | |
| 498 | |
| 499 | void myTopLevelcxx . . $ myTopLevel#::slot_aboutcxx . . $ myTopLevel#slot_about(49f6e7a06ebc5aa8).() |
| 500 | { |
| 501 | QStringcxx . . $ QString# text = |
| 502 | APPNAMEcxx . . $ `src/common.h:25:9`!", a board game.<br>Version "VERSIONcxx . . $ `src/common.h:26:9`!"<br><br>" |
| 503 | COPYRIGHTcxx . . $ `src/common.h:31:9`!"<br>" |
| 504 | "<a href=\""HOMEPAGEcxx . . $ `src/common.h:30:9`!"\">"HOMEPAGEcxx . . $ `src/common.h:30:9`!"</a><br><br>" |
| 505 | "Contributors:<br>"CONTRIBScxx . . $ `src/common.h:33:9`!"<br><br>" |
| 506 | "This program is distributed under the terms " |
| 507 | "of the GNU General Public License."; |
| 508 | |
| 509 | informationcxx . . $ myTopLevel#information(c1427772cd1877b0).(trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("About"), text); |
| 510 | } |
| 511 | |
| 512 | |
| 513 | void myTopLevelcxx . . $ myTopLevel#::slot_new_gamecxx . . $ myTopLevel#slot_new_game(49f6e7a06ebc5aa8).() |
| 514 | { |
| 515 | if(keep_gamecxx . . $ myTopLevel#keep_game(c9857a73d68e59ba).()) |
| 516 | return; |
| 517 | |
| 518 | if(m_newgamecxx . . $ myTopLevel#m_newgame.->execcxx . . $ QDialog#exec(b126dc7c1de90089).()==QDialogcxx . . $ QDialog#::Acceptedcxx . . $ QDialog#Accepted.) { |
| 519 | m_viewcxx . . $ myTopLevel#m_view.->newGamecxx . . $ myView#newGame(3cc809d575064bfd).(m_newgamecxx . . $ myTopLevel#m_newgame.->rulescxx . . $ myNewGameDlg#rules(455f465bc33b4cdf).(), m_newgamecxx . . $ myTopLevel#m_newgame.->freePlacementcxx . . $ myNewGameDlg#freePlacement(50ce9a9e25b4a850).(), |
| 520 | m_newgamecxx . . $ myTopLevel#m_newgame.->namecxx . . $ myNewGameDlg#name(34227b1e5d5004df).(), |
| 521 | m_newgamecxx . . $ myTopLevel#m_newgame.->isWhitecxx . . $ myNewGameDlg#isWhite(50ce9a9e25b4a850).(), m_newgamecxx . . $ myTopLevel#m_newgame.->opponentcxx . . $ myNewGameDlg#opponent(455f465bc33b4cdf).(), |
| 522 | m_newgamecxx . . $ myTopLevel#m_newgame.->opponentNamecxx . . $ myNewGameDlg#opponentName(34227b1e5d5004df).(), m_newgamecxx . . $ myTopLevel#m_newgame.->skillcxx . . $ myNewGameDlg#skill(455f465bc33b4cdf).()); |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | |
| 527 | void myTopLevelcxx . . $ myTopLevel#::slot_workingcxx . . $ myTopLevel#slot_working(b45ddcbc8423892c).(bool working) |
| 528 | { |
| 529 | bool disable = !working; |
| 530 | |
| 531 | gameNewcxx . . $ myTopLevel#gameNew.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(disable); |
| 532 | gameSavecxx . . $ myTopLevel#gameSave.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(disable); |
| 533 | |
| 534 | gameNextRoundcxx . . $ myTopLevel#gameNextRound.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(disable);// FIXME !m_view->isAborted()); |
| 535 | gameOpencxx . . $ myTopLevel#gameOpen.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(disable); |
| 536 | gameStopcxx . . $ myTopLevel#gameStop.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(!disable); |
| 537 | |
| 538 | m_viewcxx . . $ myTopLevel#m_view.->setEnabledcxx . . $ myView#setEnabled(b45ddcbc8423892c).(disable); |
| 539 | } |
| 540 | |
| 541 | |
| 542 | bool myTopLevelcxx . . $ myTopLevel#::keep_gamecxx . . $ myTopLevel#keep_game(c9857a73d68e59ba).() |
| 543 | { |
| 544 | if(!settingsKeepcxx . . $ myTopLevel#settingsKeep.->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).() || m_viewcxx . . $ myTopLevel#m_view.->isAbortedcxx . . $ myView#isAborted(50ce9a9e25b4a850).()) { |
| 545 | return false; |
| 546 | } |
| 547 | |
| 548 | int answer = QMessageBoxcxx . . $ QMessageBox#::questioncxx . . $ QMessageBox#question(21b6fd1dd558cc82).(this, trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Abort Game?")+cxx . . $ operator+(3d22f08efddf8107)." - "APPNAMEcxx . . $ `src/common.h:25:9`!, |
| 549 | trcxx . . $ myTopLevel#tr(75d9f1c324b4579d).("Current game will be lost if you continue.\n" |
| 550 | "Do you really want to discard it?"), |
| 551 | QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes., QMessageBoxcxx . . $ QMessageBox#::Nocxx . . $ QMessageBox#No.); |
| 552 | |
| 553 | if(answer == QMessageBoxcxx . . $ QMessageBox#::Yescxx . . $ QMessageBox#Yes.) { |
| 554 | return false; |
| 555 | } |
| 556 | |
| 557 | return true; |
| 558 | } |
| 559 | |
| 560 | |
| 561 | void myTopLevelcxx . . $ myTopLevel#::slot_next_roundcxx . . $ myTopLevel#slot_next_round(49f6e7a06ebc5aa8).() |
| 562 | { |
| 563 | if(!keep_gamecxx . . $ myTopLevel#keep_game(c9857a73d68e59ba).()) { |
| 564 | m_viewcxx . . $ myTopLevel#m_view.->slotNextRoundcxx . . $ myView#slotNextRound(49f6e7a06ebc5aa8).(); |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | |
| 569 | void myTopLevelcxx . . $ myTopLevel#::slot_notation_fontcxx . . $ myTopLevel#slot_notation_font(49f6e7a06ebc5aa8).() |
| 570 | { |
| 571 | bool ok; |
| 572 | QFontcxx . . $ QFont# font = QFontDialogcxx . . $ QFontDialog#::getFontcxx . . $ QFontDialog#getFont(44300c95903bfe7b).(&ok, m_viewcxx . . $ myTopLevel#m_view.->notationFontcxx . . $ myView#notationFont(9958934e48c66a6a).(), this); |
| 573 | if(ok) { |
| 574 | m_viewcxx . . $ myTopLevel#m_view.->setNotationFontcxx . . $ myView#setNotationFont(d0a4bd0c8524b912).(font); |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | |
| 579 | void myTopLevelcxx . . $ myTopLevel#::slot_notationcxx . . $ myTopLevel#slot_notation(b45ddcbc8423892c).(bool) |
| 580 | { |
| 581 | m_viewcxx . . $ myTopLevel#m_view.->setNotationcxx . . $ myView#setNotation(b0b38cda41d4ede4).(viewNotationcxx . . $ myTopLevel#viewNotation.->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).(), |
| 582 | viewNotationAbovecxx . . $ myTopLevel#viewNotationAbove.->isCheckedcxx . . $ QAction#isChecked(50ce9a9e25b4a850).()); |
| 583 | } |
| 584 |