summaryrefslogtreecommitdiff
path: root/src/citra_qt/main.cpp
diff options
context:
space:
mode:
authorGravatar archshift2015-08-31 21:35:33 -0700
committerGravatar archshift2015-10-01 19:39:14 -0700
commit6e1bb58ee8ace739615e42cff02f07ee396edb6e (patch)
tree17b5eb9e4319d82e7e0a5683095ad7800941c79c /src/citra_qt/main.cpp
parentAdd helper function for creating a readable byte size string. (diff)
downloadyuzu-6e1bb58ee8ace739615e42cff02f07ee396edb6e.tar.gz
yuzu-6e1bb58ee8ace739615e42cff02f07ee396edb6e.tar.xz
yuzu-6e1bb58ee8ace739615e42cff02f07ee396edb6e.zip
Initial implementation of a game list
Diffstat (limited to 'src/citra_qt/main.cpp')
-rw-r--r--src/citra_qt/main.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 58de28c1d..ff2d60996 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -12,6 +12,7 @@
12 12
13#include "citra_qt/bootmanager.h" 13#include "citra_qt/bootmanager.h"
14#include "citra_qt/config.h" 14#include "citra_qt/config.h"
15#include "citra_qt/game_list.h"
15#include "citra_qt/hotkeys.h" 16#include "citra_qt/hotkeys.h"
16#include "citra_qt/main.h" 17#include "citra_qt/main.h"
17 18
@@ -59,6 +60,9 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
59 render_window = new GRenderWindow(this, emu_thread.get()); 60 render_window = new GRenderWindow(this, emu_thread.get());
60 render_window->hide(); 61 render_window->hide();
61 62
63 game_list = new GameList();
64 ui.horizontalLayout->addWidget(game_list);
65
62 profilerWidget = new ProfilerWidget(this); 66 profilerWidget = new ProfilerWidget(this);
63 addDockWidget(Qt::BottomDockWidgetArea, profilerWidget); 67 addDockWidget(Qt::BottomDockWidgetArea, profilerWidget);
64 profilerWidget->hide(); 68 profilerWidget->hide();
@@ -160,6 +164,7 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
160 UpdateRecentFiles(); 164 UpdateRecentFiles();
161 165
162 // Setup connections 166 // Setup connections
167 connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)));
163 connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile())); 168 connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()));
164 connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); 169 connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap()));
165 connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); 170 connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
@@ -193,6 +198,8 @@ GMainWindow::GMainWindow() : emu_thread(nullptr)
193 198
194 show(); 199 show();
195 200
201 game_list->PopulateAsync(settings.value("gameListRootDir").toString(), settings.value("gameListDeepScan").toBool());
202
196 QStringList args = QApplication::arguments(); 203 QStringList args = QApplication::arguments();
197 if (args.length() >= 2) { 204 if (args.length() >= 2) {
198 BootGame(args[1].toStdString()); 205 BootGame(args[1].toStdString());
@@ -264,6 +271,9 @@ void GMainWindow::BootGame(const std::string& filename) {
264 // Update the GUI 271 // Update the GUI
265 registersWidget->OnDebugModeEntered(); 272 registersWidget->OnDebugModeEntered();
266 callstackWidget->OnDebugModeEntered(); 273 callstackWidget->OnDebugModeEntered();
274 if (ui.action_Single_Window_Mode->isChecked()) {
275 game_list->hide();
276 }
267 render_window->show(); 277 render_window->show();
268 278
269 emulation_running = true; 279 emulation_running = true;
@@ -295,6 +305,7 @@ void GMainWindow::ShutdownGame() {
295 ui.action_Pause->setEnabled(false); 305 ui.action_Pause->setEnabled(false);
296 ui.action_Stop->setEnabled(false); 306 ui.action_Stop->setEnabled(false);
297 render_window->hide(); 307 render_window->hide();
308 game_list->show();
298 309
299 emulation_running = false; 310 emulation_running = false;
300} 311}
@@ -340,12 +351,16 @@ void GMainWindow::UpdateRecentFiles() {
340 } 351 }
341} 352}
342 353
354void GMainWindow::OnGameListLoadFile(QString game_path) {
355 BootGame(game_path.toLatin1().data());
356}
357
343void GMainWindow::OnMenuLoadFile() { 358void GMainWindow::OnMenuLoadFile() {
344 QSettings settings; 359 QSettings settings;
345 QString rom_path = settings.value("romsPath", QString()).toString(); 360 QString rom_path = settings.value("romsPath", QString()).toString();
346 361
347 QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); 362 QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)"));
348 if (filename.size()) { 363 if (!filename.isEmpty()) {
349 settings.setValue("romsPath", QFileInfo(filename).path()); 364 settings.setValue("romsPath", QFileInfo(filename).path());
350 StoreRecentFile(filename); 365 StoreRecentFile(filename);
351 366
@@ -358,7 +373,7 @@ void GMainWindow::OnMenuLoadSymbolMap() {
358 QString symbol_path = settings.value("symbolsPath", QString()).toString(); 373 QString symbol_path = settings.value("symbolsPath", QString()).toString();
359 374
360 QString filename = QFileDialog::getOpenFileName(this, tr("Load Symbol Map"), symbol_path, tr("Symbol map (*)")); 375 QString filename = QFileDialog::getOpenFileName(this, tr("Load Symbol Map"), symbol_path, tr("Symbol map (*)"));
361 if (filename.size()) { 376 if (!filename.isEmpty()) {
362 settings.setValue("symbolsPath", QFileInfo(filename).path()); 377 settings.setValue("symbolsPath", QFileInfo(filename).path());
363 378
364 LoadSymbolMap(filename.toLatin1().data()); 379 LoadSymbolMap(filename.toLatin1().data());
@@ -440,6 +455,7 @@ void GMainWindow::ToggleWindowMode() {
440 if (emulation_running) { 455 if (emulation_running) {
441 render_window->setVisible(true); 456 render_window->setVisible(true);
442 render_window->RestoreGeometry(); 457 render_window->RestoreGeometry();
458 game_list->show();
443 } 459 }
444 } 460 }
445} 461}