From 5f00fe905c8b5f9802a66e1cfd0f21873b769147 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Thu, 16 Feb 2017 22:32:22 -0800 Subject: Qt: Remove unnecessary std::string usage --- src/citra_qt/main.cpp | 23 ++++++++++++----------- src/citra_qt/main.h | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 3c1ae8848..78538c5a7 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -75,7 +75,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { QStringList args = QApplication::arguments(); if (args.length() >= 2) { - BootGame(args[1].toStdString()); + BootGame(args[1]); } } @@ -272,7 +272,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 +290,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 +336,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 +412,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 +448,7 @@ void GMainWindow::UpdateRecentFiles() { } void GMainWindow::OnGameListLoadFile(QString game_path) { - BootGame(game_path.toStdString()); + BootGame(game_path); } void GMainWindow::OnGameListOpenSaveFolder(u64 program_id) { @@ -477,7 +478,7 @@ void GMainWindow::OnMenuLoadFile() { if (!filename.isEmpty()) { UISettings::values.roms_path = QFileInfo(filename).path(); - BootGame(filename.toStdString()); + BootGame(filename); } } @@ -506,7 +507,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"), @@ -634,7 +635,7 @@ void GMainWindow::dropEvent(QDropEvent* event) { if (IsSingleFileDropEvent(event) && ConfirmChangeGame()) { const QMimeData* mimeData = event->mimeData(); QString filename = mimeData->urls().at(0).toLocalFile(); - BootGame(filename.toStdString()); + BootGame(filename); } } diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 102fd151d..7ae972937 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -79,8 +79,8 @@ private: * @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 +94,7 @@ private: * * @param filename the filename to store */ - void StoreRecentFile(const std::string& filename); + void StoreRecentFile(const QString& filename); /** * Updates the recent files menu. -- cgit v1.2.3 From c7c0219f8adf48dea66fd4785f4f9cdc1d229cec Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Thu, 16 Feb 2017 22:33:15 -0800 Subject: Qt: Remove orpahned function declaration --- src/citra_qt/main.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 7ae972937..debc35c92 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -73,12 +73,6 @@ private: void ConnectWidgetEvents(); - /** - * 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 QString& filename); void BootGame(const QString& filename); void ShutdownGame(); -- cgit v1.2.3 From c81a2aabbf5df13711dc9ad739a12133093834a1 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Thu, 16 Feb 2017 22:38:05 -0800 Subject: Qt: Allow any file extension in Open dialog --- src/citra_qt/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 78538c5a7..b5d927cf2 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -471,7 +471,8 @@ 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); @@ -484,7 +485,7 @@ void GMainWindow::OnMenuLoadFile() { 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(); -- cgit v1.2.3 From cef18c94e223aea4747a058dcbc719f5e14a6cab Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Thu, 16 Feb 2017 22:41:04 -0800 Subject: Qt: Make IsSingleFileDropEvent static --- src/citra_qt/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/citra_qt') diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index b5d927cf2..717552468 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -627,7 +627,7 @@ void GMainWindow::closeEvent(QCloseEvent* event) { QWidget::closeEvent(event); } -bool IsSingleFileDropEvent(QDropEvent* event) { +static bool IsSingleFileDropEvent(QDropEvent* event) { const QMimeData* mimeData = event->mimeData(); return mimeData->hasUrls() && mimeData->urls().length() == 1; } -- cgit v1.2.3