MCPcopy Create free account
hub / github.com/clementgallet/libTAS / MainWindow

Method MainWindow

src/program/ui/MainWindow.cpp:134–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}\
133
134MainWindow::MainWindow(Context* c) : QMainWindow(), context(c)
135{
136 qRegisterMetaType<std::string>("std::string");
137
138#ifdef LIBTAS_INTERIM_COMMIT
139#ifdef LIBTAS_INTERIM_DATE
140 QString title = QString("libTAS v%1.%2.%3 - interim %4 (%5)").arg(MAJORVERSION).arg(MINORVERSION).arg(PATCHVERSION).arg(LIBTAS_INTERIM_COMMIT).arg(LIBTAS_INTERIM_DATE);
141#else
142 QString title = QString("libTAS v%1.%2.%3 - interim %4").arg(MAJORVERSION).arg(MINORVERSION).arg(PATCHVERSION).arg(LIBTAS_INTERIM_COMMIT);
143#endif
144#else
145 QString title = QString("libTAS v%1.%2.%3").arg(MAJORVERSION).arg(MINORVERSION).arg(PATCHVERSION);
146#endif
147
148 setWindowTitle(title);
149
150 /* Create the object that will launch and communicate with the game,
151 * and connect all the signals.
152 */
153 gameLoop = new GameLoop(context);
154 windowManager = new WindowManager(this, context, gameLoop);
155 connect(gameLoop, &GameLoop::uiChanged, this, &MainWindow::updateUIFrequent, Qt::QueuedConnection);
156 connect(gameLoop, &GameLoop::newFrame, this, &MainWindow::updateUIFrame, Qt::QueuedConnection);
157 connect(gameLoop, &GameLoop::statusChanged, this, &MainWindow::updateStatus, Qt::QueuedConnection);
158 connect(gameLoop, &GameLoop::configChanged, this, &MainWindow::updateUIFromConfig, Qt::QueuedConnection);
159 connect(gameLoop, &GameLoop::alertToShow, this, &MainWindow::alertDialog, Qt::QueuedConnection);
160 connect(gameLoop->gameEvents, &GameEvents::alertToShow, this, &MainWindow::alertDialog, Qt::QueuedConnection);
161 connect(gameLoop, &GameLoop::sharedConfigChanged, this, &MainWindow::updateSharedConfigChanged, Qt::QueuedConnection);
162 connect(gameLoop->gameEvents, &GameEvents::sharedConfigChanged, this, &MainWindow::updateSharedConfigChanged, Qt::QueuedConnection);
163 connect(gameLoop, &GameLoop::askToShow, this, &MainWindow::alertOffer, Qt::QueuedConnection);
164 connect(gameLoop->gameEvents, &GameEvents::askToShow, this, &MainWindow::alertOffer, Qt::QueuedConnection);
165 connect(gameLoop, &GameLoop::updateFramerate, this, &MainWindow::updateFramerate, Qt::QueuedConnection);
166 connect(gameLoop, &GameLoop::isInputEditorVisible, this, &MainWindow::slotSyncInputEditorVisible, Qt::DirectConnection);
167 connect(gameLoop->gameEvents, &GameEvents::isInputEditorVisible, this, &MainWindow::slotSyncInputEditorVisible, Qt::DirectConnection);
168 connect(gameLoop, &GameLoop::getRamWatch, this, &MainWindow::slotFetchRamWatch, Qt::DirectConnection);
169 connect(gameLoop, &GameLoop::getMarkerText, this, &MainWindow::slotFetchMarkerText, Qt::DirectConnection);
170 connect(gameLoop->gameEvents, &GameEvents::savestatePerformed, this, &MainWindow::slotRegisterSavestate, Qt::QueuedConnection);
171 connect(gameLoop, &GameLoop::getTimeTrace, this, &MainWindow::slotAddTimeTrace, Qt::QueuedConnection);
172 connect(gameLoop, &GameLoop::statusChanged, this, &MainWindow::slotUpdateSettingsWindow, Qt::QueuedConnection);
173
174 /* Menu */
175 createActions();
176 createMenus();
177 menuBar()->setNativeMenuBar(false);
178
179 /* Game Executable */
180 gamePath = new QComboBox();
181 gamePath->setMinimumWidth(400);
182 gamePath->setEditable(true);
183 connect(gamePath, &QComboBox::editTextChanged, this, &MainWindow::slotGamePathChanged);
184 gamePath->setInsertPolicy(QComboBox::NoInsert);
185 disabledWidgetsOnStart.append(gamePath);
186 updateRecentGamepaths();
187
188 browseGamePath = new QPushButton("Browse...");
189 connect(browseGamePath, &QAbstractButton::clicked, this, &MainWindow::slotBrowseGamePath);
190 disabledWidgetsOnStart.append(browseGamePath);
191

Callers

nothing calls this directly

Calls 3

valueMethod · 0.80
appendMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected