Debian Codegraph @

src/mainwindow.cpp

raw symbols SCIP
1 /***************************************************************************
2 * Copyright (C) 2009 by the qGo project *
3 * *
4 * This file is part of qGo. *
5 * *
6 * qGo is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, see <http://www.gnu.org/licenses/> *
18 * or write to the Free Software Foundation, Inc., *
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
20 ***************************************************************************/
21
22
23 #include "defines.h"cxx . . $ `<file>/src/defines.h`/
24 #include "mainwindow.h"cxx . . $ `<file>/src/mainwindow.h`/
25 #include "boardwindow.h"cxx . . $ `<file>/src/board/boardwindow.h`/
26 #include "connectionwidget.h"cxx . . $ `<file>/src/connectionwidget.h`/
27 #include "login.h"cxx . . $ `<file>/src/network/login.h`/
28 #include "sgfpreview.h"cxx . . $ `<file>/src/sgfpreview.h`/
29 #include "audio.h"cxx . . $ `<file>/src/audio/audio.h`/
30 #include "sgfparser.h"cxx . . $ `<file>/src/sgf/sgfparser.h`/
31 #include "newgamedialog.h"cxx . . $ `<file>/src/newgamedialog.h`/
32 #include "ui_mainwindow.h"cxx . . $ `<file>/build/ui/ui_mainwindow.h`/
33 #include "preferences.h"cxx . . $ `<file>/src/preferences.h`/
34
35 MainWindowcxx . . $ MainWindow#::MainWindowcxx . . $ MainWindow#MainWindow(872e7b0c281abd8d).(QWidgetcxx . . $ QWidget# * parent, Qtcxx . . $ Qt/::WindowFlagscxx . . $ Qt/WindowFlags# flags )
36 : QMainWindowcxx . . $ QMainWindow#QMainWindow(872e7b0c281abd8d).( parent, flags ), uicxx . . $ MainWindow#ui.(new Uicxx . . $ Ui/::MainWindowcxx . . $ Ui/MainWindow#)
37 {
38 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!( "Home Path : %s" ,QDircxx . . $ QDir#::homePathcxx . . $ QDir#homePath(4365c3963150523e).().toLatin1cxx . . $ QString#toLatin1(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).());
39 qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!( "Current Path : %s" ,QDircxx . . $ QDir#::currentPathcxx . . $ QDir#currentPath(4365c3963150523e). ().toLatin1cxx . . $ QString#toLatin1(7c2073558a834e49).().constDatacxx . . $ QByteArray#constData(a9f41ea0e82d88cf).());
40
41 uicxx . . $ MainWindow#ui.->setupUicxx . . $ Ui_MainWindow#setupUi(f2c32f691ede4a4e).(this);
42 this->setAttributecxx . . $ QWidget#setAttribute(52fc7bf162518f7f).( Qtcxx . . $ Qt/::WA_DeleteOnClosecxx . . $ Qt/WA_DeleteOnClose. );
43 //hide by default
44 setWindowTitlecxx . . $ QWidget#setWindowTitle(3520e46b33348bf6).(QStringcxx . . $ QString#QString(85c52e162fed56f9).(PACKAGEcxx . . $ `src/defines.h:32:9`!) +cxx . . $ operator+(3d22f08efddf8107). " " +cxx . . $ operator+(fab9b4f80031f353). QStringcxx . . $ QString#QString(85c52e162fed56f9).(VERSIONcxx . . $ `src/defines.h:33:9`!));
45 preferencescxx . . $ preferences..fillcxx . . $ _preferences#fill(49f6e7a06ebc5aa8).();
46
47 // connecting the new game button
48 connectcxx . . $ QObject#connect(835f87066c895669).(uicxx . . $ MainWindow#ui.->actionOpencxx . . $ Ui_MainWindow#actionOpen., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &MainWindowcxx . . $ MainWindow#::slot_fileOpencxx . . $ MainWindow#slot_fileOpen(49f6e7a06ebc5aa8).);
49 connectcxx . . $ QObject#connect(835f87066c895669).(uicxx . . $ MainWindow#ui.->actionNewcxx . . $ Ui_MainWindow#actionNew., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &MainWindowcxx . . $ MainWindow#::slot_fileNewcxx . . $ MainWindow#slot_fileNew(49f6e7a06ebc5aa8).);
50
51
52 //sound
53 connectSoundcxx . . $ MainWindow#connectSound. = new Soundcxx . . $ Sound#Sound(6caa6e6871ecf3b).("static.wav"cxx . . $ QString#QString(85c52e162fed56f9).);
54
55 logindialogcxx . . $ MainWindow#logindialog. = new LoginDialogcxx . . $ LoginDialog#LoginDialog(108f35f7aa7f3cf9).(this);
56
57 connectcxx . . $ QObject#connect(835f87066c895669).( uicxx . . $ MainWindow#ui.->actionConnectcxx . . $ Ui_MainWindow#actionConnect., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &MainWindowcxx . . $ MainWindow#::openConnectDialogcxx . . $ MainWindow#openConnectDialog(49f6e7a06ebc5aa8).);
58 connectcxx . . $ QObject#connect(835f87066c895669).(uicxx . . $ MainWindow#ui.->actionPreferencescxx . . $ Ui_MainWindow#actionPreferences., &QActioncxx . . $ QAction#::triggeredcxx . . $ QAction#triggered(b45ddcbc8423892c)., this, &MainWindowcxx . . $ MainWindow#::openPreferencescxx . . $ MainWindow#openPreferences(49f6e7a06ebc5aa8).);
59 }
60
61 MainWindowcxx . . $ MainWindow#::~cxx . . $ MainWindow#`~MainWindow`(ced63f7c635d850d).MainWindowcxx . . $ MainWindow#()
62 {
63 }
64
65 void MainWindowcxx . . $ MainWindow#::closeEventcxx . . $ MainWindow#closeEvent(642e80679aeb34f8).(QCloseEventcxx . . $ QCloseEvent# * e)
66 {
67 /* Close connection if open */
68 if(uicxx . . $ MainWindow#ui.->connectionWidgetcxx . . $ Ui_MainWindow#connectionWidget.->closeConnectioncxx . . $ ConnectionWidget#closeConnection(73da94e76e6bd037).() < 0)
69 {
70 e->ignorecxx . . $ QEvent#ignore(49f6e7a06ebc5aa8).();
71 return;
72 }
73 if(checkForOpenBoardscxx . . $ MainWindow#checkForOpenBoards(b126dc7c1de90089).() < 0)
74 {
75 e->ignorecxx . . $ QEvent#ignore(49f6e7a06ebc5aa8).();
76 return;
77 }
78 preferencescxx . . $ preferences..savecxx . . $ _preferences#save(49f6e7a06ebc5aa8).();
79 }
80
81
82 void MainWindowcxx . . $ MainWindow#::slot_fileOpencxx . . $ MainWindow#slot_fileOpen(49f6e7a06ebc5aa8).()
83 {
84 QFileDialogcxx . . $ QFileDialog# *dialog = new QFileDialogcxx . . $ QFileDialog#(this);
85 dialog->setOptioncxx . . $ QFileDialog#setOption(9efc47f2206199ad).(QFileDialogcxx . . $ QFileDialog#::DontUseNativeDialogcxx . . $ QFileDialog#DontUseNativeDialog., true);
86 SGFPreviewcxx . . $ SGFPreview# *previewWidget = new SGFPreviewcxx . . $ SGFPreview#(dialog);
87 QGridLayoutcxx . . $ QGridLayout# *layout = (QGridLayoutcxx . . $ QGridLayout#*)dialog->layoutcxx . . $ QWidget#layout(5761b17781c20cfb).();
88 layout->addWidgetcxx . . $ QGridLayout#addWidget(17d1465fab362e2d).(previewWidget, 1, 3);
89 connectcxx . . $ QObject#connect(835f87066c895669).(dialog, &QFileDialogcxx . . $ QFileDialog#::currentChangedcxx . . $ QFileDialog#currentChanged(3520e46b33348bf6).,previewWidget,&SGFPreviewcxx . . $ SGFPreview#::setPathcxx . . $ SGFPreview#setPath(7df51288a9ebd664).);
90 connectcxx . . $ QObject#connect(835f87066c895669).(dialog, &QFileDialogcxx . . $ QFileDialog#::fileSelectedcxx . . $ QFileDialog#fileSelected(3520e46b33348bf6).,this,&MainWindowcxx . . $ MainWindow#::openSGFcxx . . $ MainWindow#openSGF(7df51288a9ebd664).);
91 dialog->setNameFiltercxx . . $ QFileDialog#setNameFilter(3520e46b33348bf6).("Smart Game Format (*.sgf *.SGF)"cxx . . $ QString#QString(85c52e162fed56f9).);
92 dialog->setFileModecxx . . $ QFileDialog#setFileMode(508d43a8df9137e8).(QFileDialogcxx . . $ QFileDialog#::ExistingFilecxx . . $ QFileDialog#ExistingFile.);
93 dialog->execcxx . . $ QDialog#exec(b126dc7c1de90089).();
94 delete dialog;
95 }
96
97 void MainWindowcxx . . $ MainWindow#::openPreferencescxx . . $ MainWindow#openPreferences(49f6e7a06ebc5aa8).()
98 {
99 Preferencescxx . . $ Preferences# preferencesDialogcxx . . $ Preferences#Preferences(108f35f7aa7f3cf9).(this);
100 preferencesDialog.execcxx . . $ QDialog#exec(b126dc7c1de90089).();
101 }
102
103 void MainWindowcxx . . $ MainWindow#::openSGFcxx . . $ MainWindow#openSGF(7df51288a9ebd664).(QStringcxx . . $ QString# path)
104 {
105 SGFParsercxx . . $ SGFParser# * MW_SGFparser = new SGFParsercxx . . $ SGFParser#SGFParser(ed4f44641ad95fbd).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
106 QStringcxx . . $ QString# SGFloaded = MW_SGFparser->loadFilecxx . . $ SGFParser#loadFile(fd988a2ab94d906b).(path);
107 if (SGFloaded ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
108 return;
109
110 GameDatacxx . . $ GameData# * GameLoaded = MW_SGFparser->initGamecxx . . $ SGFParser#initGame(a4526618b9a7c13a).(SGFloaded, path);
111 if (GameLoaded == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!)
112 return;
113
114 GameLoaded->gameModecxx . . $ GameData#gameMode. = modeLocalcxx . . $ modeLocal.;
115 this->addBoardWindowcxx . . $ MainWindow#addBoardWindow(7be1a4e7105cba0c).(new BoardWindowcxx . . $ BoardWindow#BoardWindow(50cc386dd30baa3b).(GameLoaded, true, true));
116 }
117
118 /*
119 * The 'New Game' button in 'Go Engine' tab has been pressed.
120 */
121 void MainWindowcxx . . $ MainWindow#::slot_fileNewcxx . . $ MainWindow#slot_fileNew(49f6e7a06ebc5aa8).()
122 {
123 NewGameDialogcxx . . $ NewGameDialog# * newGameDialog = new NewGameDialogcxx . . $ NewGameDialog#(this);
124 newGameDialog->execcxx . . $ QDialog#exec(b126dc7c1de90089).();
125 delete newGameDialog;
126 }
127
128 void MainWindowcxx . . $ MainWindow#::addBoardWindowcxx . . $ MainWindow#addBoardWindow(7be1a4e7105cba0c).(BoardWindowcxx . . $ BoardWindow# * bw)
129 {
130 boardWindowListcxx . . $ MainWindow#boardWindowList..appendcxx . . $ QList#append(77d9f17553126ecb).(bw);
131 connectcxx . . $ QObject#connect(835f87066c895669).(bw, &BoardWindowcxx . . $ BoardWindow#::destroyedcxx . . $ QObject#destroyed(749de1b6ae65bddd)., this, &MainWindowcxx . . $ MainWindow#::removeBoardWindowcxx . . $ MainWindow#removeBoardWindow(749de1b6ae65bddd).);
132 }
133
134 void MainWindowcxx . . $ MainWindow#::removeBoardWindowcxx . . $ MainWindow#removeBoardWindow(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *bw)
135 {
136 for(int i = 0; i < boardWindowListcxx . . $ MainWindow#boardWindowList..lengthcxx . . $ QList#length(455f465bc33b4cdf).(); i++)
137 {
138 if(boardWindowListcxx . . $ MainWindow#boardWindowList.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i] == (BoardWindowcxx . . $ BoardWindow#*)bw)
139 {
140 boardWindowListcxx . . $ MainWindow#boardWindowList..removeAtcxx . . $ QList#removeAt(d4f767463ce0a6b3).(i);
141 return;
142 }
143 }
144 }
145
146 int MainWindowcxx . . $ MainWindow#::checkForOpenBoardscxx . . $ MainWindow#checkForOpenBoards(b126dc7c1de90089).(void)
147 {
148 for(int i = 0; i < boardWindowListcxx . . $ MainWindow#boardWindowList..lengthcxx . . $ QList#length(455f465bc33b4cdf).(); i++)
149 {
150 if(!(boardWindowListcxx . . $ MainWindow#boardWindowList.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i]->okayToQuitcxx . . $ BoardWindow#okayToQuit(c9857a73d68e59ba).()))
151 return -1;
152 }
153 //close all open, since boardwindow no longer has parent because of windows task bar issue:
154 qDeleteAllcxx . . $ qDeleteAll(77d9f17553126ecb).(boardWindowListcxx . . $ MainWindow#boardWindowList.);
155 boardWindowListcxx . . $ MainWindow#boardWindowList..clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).();
156 return 0;
157 }
158
159 void MainWindowcxx . . $ MainWindow#::openConnectDialogcxx . . $ MainWindow#openConnectDialog(49f6e7a06ebc5aa8).(void)
160 {
161 /* The login dialog is responsible for creating the connection
162 *and notifying the connectionWidget about it. */
163 if(connectionWidgetcxx . . $ connectionWidget.->isConnectedcxx . . $ ConnectionWidget#isConnected(c9857a73d68e59ba).())
164 return;
165 logindialogcxx . . $ MainWindow#logindialog.->execcxx . . $ QDialog#exec(b126dc7c1de90089).();
166 }