From 7ddfce4a8721094fcd35a0c13c5cf13d0d1d861a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 13 Oct 2018 10:23:50 -0400 Subject: [PATCH] citra_qt/main: Simplify OnMenuLoadFile() We can utilize QStringList's join() function to perform all of the appending in a single function call. While we're at it, make the extension list a single translatable string and add a disambiguation comment to explain to translators what %1 actually is. --- src/citra_qt/main.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 40c42fc310..01f2ac65a7 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -989,20 +989,20 @@ void GMainWindow::OnGameListShowList(bool show) { }; void GMainWindow::OnMenuLoadFile() { - QString extensions; - for (const auto& piece : game_list->supported_file_extensions) - extensions += "*." + piece + " "; + const QString extensions = + QString("*.").append(GameList::supported_file_extensions.join(" *.")); + const QString file_filter = tr("3DS Executable (%1);;All Files (*.*)", + "%1 is an identifier for the 3DS executable file extensions.") + .arg(extensions); + const QString filename = QFileDialog::getOpenFileName( + this, tr("Load File"), UISettings::values.roms_path, file_filter); - 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); + if (filename.isEmpty()) { + return; } + + UISettings::values.roms_path = QFileInfo(filename).path(); + BootGame(filename); } void GMainWindow::OnMenuInstallCIA() {