summaryrefslogtreecommitdiffstats
path: root/src/citra_qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt')
-rw-r--r--src/citra_qt/bootmanager.cpp4
-rw-r--r--src/citra_qt/configure_general.ui2
-rw-r--r--src/citra_qt/debugger/graphics/graphics_tracing.h6
-rw-r--r--src/citra_qt/game_list.cpp50
-rw-r--r--src/citra_qt/game_list.h4
-rw-r--r--src/citra_qt/main.cpp180
-rw-r--r--src/citra_qt/main.h21
-rw-r--r--src/citra_qt/main.ui55
8 files changed, 198 insertions, 124 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp
index 948db384d..69d18cf0c 100644
--- a/src/citra_qt/bootmanager.cpp
+++ b/src/citra_qt/bootmanager.cpp
@@ -101,8 +101,8 @@ private:
GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread)
: QWidget(parent), child(nullptr), keyboard_id(0), emu_thread(emu_thread) {
- std::string window_title =
- Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc);
+ std::string window_title = Common::StringFromFormat("Citra %s| %s-%s", Common::g_build_name,
+ Common::g_scm_branch, Common::g_scm_desc);
setWindowTitle(QString::fromStdString(window_title));
keyboard_id = KeyMap::NewDeviceId();
diff --git a/src/citra_qt/configure_general.ui b/src/citra_qt/configure_general.ui
index 0f3352a1d..c739605a4 100644
--- a/src/citra_qt/configure_general.ui
+++ b/src/citra_qt/configure_general.ui
@@ -27,7 +27,7 @@
<item>
<widget class="QCheckBox" name="toggle_deepscan">
<property name="text">
- <string>Recursive scan for game folder</string>
+ <string>Search sub-directories for games</string>
</property>
</widget>
</item>
diff --git a/src/citra_qt/debugger/graphics/graphics_tracing.h b/src/citra_qt/debugger/graphics/graphics_tracing.h
index 3f73bcd2e..eb1292c29 100644
--- a/src/citra_qt/debugger/graphics/graphics_tracing.h
+++ b/src/citra_qt/debugger/graphics/graphics_tracing.h
@@ -15,6 +15,9 @@ public:
explicit GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> debug_context,
QWidget* parent = nullptr);
+ void OnEmulationStarting(EmuThread* emu_thread);
+ void OnEmulationStopping();
+
private slots:
void StartRecording();
void StopRecording();
@@ -23,9 +26,6 @@ private slots:
void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
void OnResumed() override;
- void OnEmulationStarting(EmuThread* emu_thread);
- void OnEmulationStopping();
-
signals:
void SetStartTracingButtonEnabled(bool enable);
void SetStopTracingButtonEnabled(bool enable);
diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp
index 28e01d81a..db6f920ff 100644
--- a/src/citra_qt/game_list.cpp
+++ b/src/citra_qt/game_list.cpp
@@ -39,6 +39,7 @@ GameList::GameList(QWidget* parent) : QWidget{parent} {
connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry);
connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu);
+ connect(&watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);
// We must register all custom types with the Qt Automoc system so that we are able to use it
// with signals/slots. In this case, QList falls under the umbrells of custom types.
@@ -103,6 +104,12 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
item_model->removeRows(0, item_model->rowCount());
emit ShouldCancelWorker();
+
+ auto watch_dirs = watcher.directories();
+ if (!watch_dirs.isEmpty()) {
+ watcher.removePaths(watch_dirs);
+ }
+ UpdateWatcherList(dir_path.toStdString(), deep_scan ? 256 : 0);
GameListWorker* worker = new GameListWorker(dir_path, deep_scan);
connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection);
@@ -137,7 +144,46 @@ const QStringList GameList::supported_file_extensions = {"3ds", "3dsx", "elf", "
static bool HasSupportedFileExtension(const std::string& file_name) {
QFileInfo file = QFileInfo(file_name.c_str());
- return GameList::supported_file_extensions.contains(file.completeSuffix(), Qt::CaseInsensitive);
+ return GameList::supported_file_extensions.contains(file.suffix(), Qt::CaseInsensitive);
+}
+
+void GameList::RefreshGameDirectory() {
+ if (!UISettings::values.gamedir.isEmpty() && current_worker != nullptr) {
+ LOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
+ PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
+ }
+}
+
+/**
+ * Adds the game list folder to the QFileSystemWatcher to check for updates.
+ *
+ * The file watcher will fire off an update to the game list when a change is detected in the game
+ * list folder.
+ *
+ * Notice: This method is run on the UI thread because QFileSystemWatcher is not thread safe and
+ * this function is fast enough to not stall the UI thread. If performance is an issue, it should
+ * be moved to another thread and properly locked to prevent concurrency issues.
+ *
+ * @param dir folder to check for changes in
+ * @param recursion 0 if recursion is disabled. Any positive number passed to this will add each
+ * directory recursively to the watcher and will update the file list if any of the folders
+ * change. The number determines how deep the recursion should traverse.
+ */
+void GameList::UpdateWatcherList(const std::string& dir, unsigned int recursion) {
+ const auto callback = [this, recursion](unsigned* num_entries_out, const std::string& directory,
+ const std::string& virtual_name) -> bool {
+ std::string physical_name = directory + DIR_SEP + virtual_name;
+
+ if (FileUtil::IsDirectory(physical_name)) {
+ UpdateWatcherList(physical_name, recursion - 1);
+ }
+ return true;
+ };
+
+ watcher.addPath(QString::fromStdString(dir));
+ if (recursion > 0) {
+ FileUtil::ForeachDirectoryEntry(nullptr, dir, callback);
+ }
}
void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsigned int recursion) {
@@ -182,6 +228,6 @@ void GameListWorker::run() {
}
void GameListWorker::Cancel() {
- disconnect(this, nullptr, nullptr, nullptr);
+ this->disconnect();
stop_processing = true;
}
diff --git a/src/citra_qt/game_list.h b/src/citra_qt/game_list.h
index e6b7eea0b..b141fa3a5 100644
--- a/src/citra_qt/game_list.h
+++ b/src/citra_qt/game_list.h
@@ -4,6 +4,7 @@
#pragma once
+#include <QFileSystemWatcher>
#include <QModelIndex>
#include <QSettings>
#include <QStandardItem>
@@ -46,8 +47,11 @@ private:
void DonePopulating();
void PopupContextMenu(const QPoint& menu_location);
+ void UpdateWatcherList(const std::string& path, unsigned int recursion);
+ void RefreshGameDirectory();
QTreeView* tree_view = nullptr;
QStandardItemModel* item_model = nullptr;
GameListWorker* current_worker = nullptr;
+ QFileSystemWatcher watcher;
};
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 3c2e19344..7a80af890 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -54,28 +54,30 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
Pica::g_debug_context = Pica::DebugContext::Construct();
-
+ setAcceptDrops(true);
ui.setupUi(this);
statusBar()->hide();
InitializeWidgets();
- InitializeDebugMenuActions();
+ InitializeDebugWidgets();
InitializeRecentFileMenuActions();
InitializeHotkeys();
SetDefaultUIGeometry();
RestoreUIState();
+ ConnectMenuEvents();
ConnectWidgetEvents();
- setWindowTitle(QString("Citra | %1-%2").arg(Common::g_scm_branch, Common::g_scm_desc));
+ setWindowTitle(QString("Citra %1| %2-%3")
+ .arg(Common::g_build_name, Common::g_scm_branch, Common::g_scm_desc));
show();
game_list->PopulateAsync(UISettings::values.gamedir, UISettings::values.gamedir_deepscan);
QStringList args = QApplication::arguments();
if (args.length() >= 2) {
- BootGame(args[1].toStdString());
+ BootGame(args[1]);
}
}
@@ -93,74 +95,85 @@ void GMainWindow::InitializeWidgets() {
game_list = new GameList();
ui.horizontalLayout->addWidget(game_list);
+}
+
+void GMainWindow::InitializeDebugWidgets() {
+ connect(ui.action_Create_Pica_Surface_Viewer, &QAction::triggered, this,
+ &GMainWindow::OnCreateGraphicsSurfaceViewer);
+
+ QMenu* debug_menu = ui.menu_View_Debugging;
profilerWidget = new ProfilerWidget(this);
addDockWidget(Qt::BottomDockWidgetArea, profilerWidget);
profilerWidget->hide();
+ debug_menu->addAction(profilerWidget->toggleViewAction());
#if MICROPROFILE_ENABLED
microProfileDialog = new MicroProfileDialog(this);
microProfileDialog->hide();
+ debug_menu->addAction(microProfileDialog->toggleViewAction());
#endif
disasmWidget = new DisassemblerWidget(this, emu_thread.get());
addDockWidget(Qt::BottomDockWidgetArea, disasmWidget);
disasmWidget->hide();
+ debug_menu->addAction(disasmWidget->toggleViewAction());
+ connect(this, &GMainWindow::EmulationStarting, disasmWidget,
+ &DisassemblerWidget::OnEmulationStarting);
+ connect(this, &GMainWindow::EmulationStopping, disasmWidget,
+ &DisassemblerWidget::OnEmulationStopping);
registersWidget = new RegistersWidget(this);
addDockWidget(Qt::RightDockWidgetArea, registersWidget);
registersWidget->hide();
+ debug_menu->addAction(registersWidget->toggleViewAction());
+ connect(this, &GMainWindow::EmulationStarting, registersWidget,
+ &RegistersWidget::OnEmulationStarting);
+ connect(this, &GMainWindow::EmulationStopping, registersWidget,
+ &RegistersWidget::OnEmulationStopping);
callstackWidget = new CallstackWidget(this);
addDockWidget(Qt::RightDockWidgetArea, callstackWidget);
callstackWidget->hide();
+ debug_menu->addAction(callstackWidget->toggleViewAction());
graphicsWidget = new GPUCommandStreamWidget(this);
addDockWidget(Qt::RightDockWidgetArea, graphicsWidget);
graphicsWidget->hide();
+ debug_menu->addAction(graphicsWidget->toggleViewAction());
graphicsCommandsWidget = new GPUCommandListWidget(this);
addDockWidget(Qt::RightDockWidgetArea, graphicsCommandsWidget);
graphicsCommandsWidget->hide();
+ debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Pica::g_debug_context, this);
addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget);
graphicsBreakpointsWidget->hide();
+ debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
graphicsVertexShaderWidget = new GraphicsVertexShaderWidget(Pica::g_debug_context, this);
addDockWidget(Qt::RightDockWidgetArea, graphicsVertexShaderWidget);
graphicsVertexShaderWidget->hide();
+ debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction());
graphicsTracingWidget = new GraphicsTracingWidget(Pica::g_debug_context, this);
addDockWidget(Qt::RightDockWidgetArea, graphicsTracingWidget);
graphicsTracingWidget->hide();
+ debug_menu->addAction(graphicsTracingWidget->toggleViewAction());
+ connect(this, &GMainWindow::EmulationStarting, graphicsTracingWidget,
+ &GraphicsTracingWidget::OnEmulationStarting);
+ connect(this, &GMainWindow::EmulationStopping, graphicsTracingWidget,
+ &GraphicsTracingWidget::OnEmulationStopping);
waitTreeWidget = new WaitTreeWidget(this);
addDockWidget(Qt::LeftDockWidgetArea, waitTreeWidget);
waitTreeWidget->hide();
-}
-
-void GMainWindow::InitializeDebugMenuActions() {
- auto graphicsSurfaceViewerAction = new QAction(tr("Create Pica Surface Viewer"), this);
- connect(graphicsSurfaceViewerAction, SIGNAL(triggered()), this,
- SLOT(OnCreateGraphicsSurfaceViewer()));
-
- QMenu* debug_menu = ui.menu_View->addMenu(tr("Debugging"));
- debug_menu->addAction(graphicsSurfaceViewerAction);
- debug_menu->addSeparator();
- debug_menu->addAction(profilerWidget->toggleViewAction());
-#if MICROPROFILE_ENABLED
- debug_menu->addAction(microProfileDialog->toggleViewAction());
-#endif
- debug_menu->addAction(disasmWidget->toggleViewAction());
- debug_menu->addAction(registersWidget->toggleViewAction());
- debug_menu->addAction(callstackWidget->toggleViewAction());
- debug_menu->addAction(graphicsWidget->toggleViewAction());
- debug_menu->addAction(graphicsCommandsWidget->toggleViewAction());
- debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
- debug_menu->addAction(graphicsVertexShaderWidget->toggleViewAction());
- debug_menu->addAction(graphicsTracingWidget->toggleViewAction());
debug_menu->addAction(waitTreeWidget->toggleViewAction());
+ connect(this, &GMainWindow::EmulationStarting, waitTreeWidget,
+ &WaitTreeWidget::OnEmulationStarting);
+ connect(this, &GMainWindow::EmulationStopping, waitTreeWidget,
+ &WaitTreeWidget::OnEmulationStopping);
}
void GMainWindow::InitializeRecentFileMenuActions() {
@@ -215,41 +228,40 @@ void GMainWindow::RestoreUIState() {
ui.action_Single_Window_Mode->setChecked(UISettings::values.single_window_mode);
ToggleWindowMode();
- ui.actionDisplay_widget_title_bars->setChecked(UISettings::values.display_titlebar);
- OnDisplayTitleBars(ui.actionDisplay_widget_title_bars->isChecked());
+ ui.action_Display_Dock_Widget_Headers->setChecked(UISettings::values.display_titlebar);
+ OnDisplayTitleBars(ui.action_Display_Dock_Widget_Headers->isChecked());
}
void GMainWindow::ConnectWidgetEvents() {
- connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)),
- Qt::DirectConnection);
+ connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)));
connect(game_list, SIGNAL(OpenSaveFolderRequested(u64)), this,
- SLOT(OnGameListOpenSaveFolder(u64)), Qt::DirectConnection);
- connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(OnConfigure()));
- connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()),
- Qt::DirectConnection);
- connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap()));
- connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this,
- SLOT(OnMenuSelectGameListRoot()));
- connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame()));
- connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame()));
- connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame()));
- connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode()));
-
- connect(this, SIGNAL(EmulationStarting(EmuThread*)), disasmWidget,
- SLOT(OnEmulationStarting(EmuThread*)));
- connect(this, SIGNAL(EmulationStopping()), disasmWidget, SLOT(OnEmulationStopping()));
- connect(this, SIGNAL(EmulationStarting(EmuThread*)), registersWidget,
- SLOT(OnEmulationStarting(EmuThread*)));
- connect(this, SIGNAL(EmulationStopping()), registersWidget, SLOT(OnEmulationStopping()));
+ SLOT(OnGameListOpenSaveFolder(u64)));
+
connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window,
SLOT(OnEmulationStarting(EmuThread*)));
connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping()));
- connect(this, SIGNAL(EmulationStarting(EmuThread*)), graphicsTracingWidget,
- SLOT(OnEmulationStarting(EmuThread*)));
- connect(this, SIGNAL(EmulationStopping()), graphicsTracingWidget, SLOT(OnEmulationStopping()));
- connect(this, SIGNAL(EmulationStarting(EmuThread*)), waitTreeWidget,
- SLOT(OnEmulationStarting(EmuThread*)));
- connect(this, SIGNAL(EmulationStopping()), waitTreeWidget, SLOT(OnEmulationStopping()));
+}
+
+void GMainWindow::ConnectMenuEvents() {
+ // File
+ connect(ui.action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile);
+ connect(ui.action_Load_Symbol_Map, &QAction::triggered, this,
+ &GMainWindow::OnMenuLoadSymbolMap);
+ connect(ui.action_Select_Game_List_Root, &QAction::triggered, this,
+ &GMainWindow::OnMenuSelectGameListRoot);
+ connect(ui.action_Exit, &QAction::triggered, this, &QMainWindow::close);
+
+ // Emulation
+ connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame);
+ connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame);
+ connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame);
+ connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure);
+
+ // View
+ connect(ui.action_Single_Window_Mode, &QAction::triggered, this,
+ &GMainWindow::ToggleWindowMode);
+ connect(ui.action_Display_Dock_Widget_Headers, &QAction::triggered, this,
+ &GMainWindow::OnDisplayTitleBars);
}
void GMainWindow::OnDisplayTitleBars(bool show) {
@@ -272,7 +284,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) {
}
}
-bool GMainWindow::LoadROM(const std::string& filename) {
+bool GMainWindow::LoadROM(const QString& filename) {
// Shutdown previous session if the emu thread is still active...
if (emu_thread != nullptr)
ShutdownGame();
@@ -290,12 +302,13 @@ bool GMainWindow::LoadROM(const std::string& filename) {
Core::System& system{Core::System::GetInstance()};
- const Core::System::ResultStatus result{system.Load(render_window, filename)};
+ const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())};
if (result != Core::System::ResultStatus::Success) {
switch (result) {
case Core::System::ResultStatus::ErrorGetLoader:
- LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filename.c_str());
+ LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!",
+ filename.toStdString().c_str());
QMessageBox::critical(this, tr("Error while loading ROM!"),
tr("The ROM format is not supported."));
break;
@@ -335,7 +348,7 @@ bool GMainWindow::LoadROM(const std::string& filename) {
return true;
}
-void GMainWindow::BootGame(const std::string& filename) {
+void GMainWindow::BootGame(const QString& filename) {
LOG_INFO(Frontend, "Citra starting...");
StoreRecentFile(filename); // Put the filename on top of the list
@@ -411,8 +424,8 @@ void GMainWindow::ShutdownGame() {
emulation_running = false;
}
-void GMainWindow::StoreRecentFile(const std::string& filename) {
- UISettings::values.recent_files.prepend(QString::fromStdString(filename));
+void GMainWindow::StoreRecentFile(const QString& filename) {
+ UISettings::values.recent_files.prepend(filename);
UISettings::values.recent_files.removeDuplicates();
while (UISettings::values.recent_files.size() > max_recent_files_item) {
UISettings::values.recent_files.removeLast();
@@ -447,7 +460,7 @@ void GMainWindow::UpdateRecentFiles() {
}
void GMainWindow::OnGameListLoadFile(QString game_path) {
- BootGame(game_path.toStdString());
+ BootGame(game_path);
}
void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) {
@@ -470,20 +483,21 @@ void GMainWindow::OnMenuLoadFile() {
for (const auto& piece : game_list->supported_file_extensions)
extensions += "*." + piece + " ";
- QString file_filter = tr("3DS executable") + " (" + extensions + ")";
+ QString file_filter = tr("3DS Executable") + " (" + extensions + ")";
+ file_filter += ";;" + tr("All Files (*.*)");
QString filename = QFileDialog::getOpenFileName(this, tr("Load File"),
UISettings::values.roms_path, file_filter);
if (!filename.isEmpty()) {
UISettings::values.roms_path = QFileInfo(filename).path();
- BootGame(filename.toStdString());
+ BootGame(filename);
}
}
void GMainWindow::OnMenuLoadSymbolMap() {
QString filename = QFileDialog::getOpenFileName(
- this, tr("Load Symbol Map"), UISettings::values.symbols_path, tr("Symbol map (*)"));
+ this, tr("Load Symbol Map"), UISettings::values.symbols_path, tr("Symbol Map (*.*)"));
if (!filename.isEmpty()) {
UISettings::values.symbols_path = QFileInfo(filename).path();
@@ -506,7 +520,7 @@ void GMainWindow::OnMenuRecentFile() {
QString filename = action->data().toString();
QFileInfo file_info(filename);
if (file_info.exists()) {
- BootGame(filename.toStdString());
+ BootGame(filename);
} else {
// Display an error message and remove the file from the list.
QMessageBox::information(this, tr("File not found"),
@@ -610,7 +624,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
UISettings::values.microprofile_visible = microProfileDialog->isVisible();
#endif
UISettings::values.single_window_mode = ui.action_Single_Window_Mode->isChecked();
- UISettings::values.display_titlebar = ui.actionDisplay_widget_title_bars->isChecked();
+ UISettings::values.display_titlebar = ui.action_Display_Dock_Widget_Headers->isChecked();
UISettings::values.first_start = false;
game_list->SaveInterfaceLayout();
@@ -625,6 +639,40 @@ void GMainWindow::closeEvent(QCloseEvent* event) {
QWidget::closeEvent(event);
}
+static bool IsSingleFileDropEvent(QDropEvent* event) {
+ const QMimeData* mimeData = event->mimeData();
+ return mimeData->hasUrls() && mimeData->urls().length() == 1;
+}
+
+void GMainWindow::dropEvent(QDropEvent* event) {
+ if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) {
+ const QMimeData* mimeData = event->mimeData();
+ QString filename = mimeData->urls().at(0).toLocalFile();
+ BootGame(filename);
+ }
+}
+
+void GMainWindow::dragEnterEvent(QDragEnterEvent* event) {
+ if (IsSingleFileDropEvent(event)) {
+ event->acceptProposedAction();
+ }
+}
+
+void GMainWindow::dragMoveEvent(QDragMoveEvent* event) {
+ event->acceptProposedAction();
+}
+
+bool GMainWindow::ConfirmChangeGame() {
+ if (emu_thread == nullptr)
+ return true;
+
+ auto answer = QMessageBox::question(
+ this, tr("Citra"),
+ tr("Are you sure you want to stop the emulation? Any unsaved progress will be lost."),
+ QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
+ return answer != QMessageBox::No;
+}
+
#ifdef main
#undef main
#endif
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h
index a2fd45c47..87637b92b 100644
--- a/src/citra_qt/main.h
+++ b/src/citra_qt/main.h
@@ -64,7 +64,7 @@ signals:
private:
void InitializeWidgets();
- void InitializeDebugMenuActions();
+ void InitializeDebugWidgets();
void InitializeRecentFileMenuActions();
void InitializeHotkeys();
@@ -72,15 +72,10 @@ private:
void RestoreUIState();
void ConnectWidgetEvents();
+ void ConnectMenuEvents();
- /**
- * Initializes the emulation system.
- * @param system_mode The system mode with which to intialize the kernel.
- * @returns Whether the system was properly initialized.
- */
- bool InitializeSystem(u32 system_mode);
- bool LoadROM(const std::string& filename);
- void BootGame(const std::string& filename);
+ bool LoadROM(const QString& filename);
+ void BootGame(const QString& filename);
void ShutdownGame();
/**
@@ -94,7 +89,7 @@ private:
*
* @param filename the filename to store
*/
- void StoreRecentFile(const std::string& filename);
+ void StoreRecentFile(const QString& filename);
/**
* Updates the recent files menu.
@@ -110,6 +105,7 @@ private:
* @return true if the user confirmed
*/
bool ConfirmClose();
+ bool ConfirmChangeGame();
void closeEvent(QCloseEvent* event) override;
private slots:
@@ -155,6 +151,11 @@ private:
WaitTreeWidget* waitTreeWidget;
QAction* actions_recent_files[max_recent_files_item];
+
+protected:
+ void dropEvent(QDropEvent* event) override;
+ void dragEnterEvent(QDragEnterEvent* event) override;
+ void dragMoveEvent(QDragMoveEvent* event) override;
};
#endif // _CITRA_QT_MAIN_HXX_
diff --git a/src/citra_qt/main.ui b/src/citra_qt/main.ui
index adfa3689e..4a95cda9a 100644
--- a/src/citra_qt/main.ui
+++ b/src/citra_qt/main.ui
@@ -79,8 +79,16 @@
<property name="title">
<string>&amp;View</string>
</property>
+ <widget class="QMenu" name="menu_View_Debugging">
+ <property name="title">
+ <string>Debugging</string>
+ </property>
+ <addaction name="action_Create_Pica_Surface_Viewer"/>
+ <addaction name="separator"/>
+ </widget>
<addaction name="action_Single_Window_Mode"/>
- <addaction name="actionDisplay_widget_title_bars"/>
+ <addaction name="action_Display_Dock_Widget_Headers"/>
+ <addaction name="menu_View_Debugging"/>
</widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
@@ -151,7 +159,7 @@
<string>Configure...</string>
</property>
</action>
- <action name="actionDisplay_widget_title_bars">
+ <action name="action_Display_Dock_Widget_Headers">
<property name="checkable">
<bool>true</bool>
</property>
@@ -167,44 +175,11 @@
<string>Selects a folder to display in the game list</string>
</property>
</action>
+ <action name="action_Create_Pica_Surface_Viewer">
+ <property name="text">
+ <string>Create Pica Surface Viewer</string>
+ </property>
+ </action>
</widget>
<resources/>
- <connections>
- <connection>
- <sender>action_Exit</sender>
- <signal>triggered()</signal>
- <receiver>MainWindow</receiver>
- <slot>close()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>367</x>
- <y>314</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>actionDisplay_widget_title_bars</sender>
- <signal>triggered(bool)</signal>
- <receiver>MainWindow</receiver>
- <slot>OnDisplayTitleBars(bool)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>-1</x>
- <y>-1</y>
- </hint>
- <hint type="destinationlabel">
- <x>540</x>
- <y>364</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>OnConfigure()</slot>
- <slot>OnDisplayTitleBars(bool)</slot>
- </slots>
</ui>