mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-09-12 12:07:49 +02:00
yuzu/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.
This commit is contained in:
parent
1584fb6b38
commit
a4c57436fc
@ -908,22 +908,20 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMenuLoadFile() {
|
void GMainWindow::OnMenuLoadFile() {
|
||||||
QString extensions;
|
const QString extensions =
|
||||||
for (const auto& piece : game_list->supported_file_extensions)
|
QString("*.").append(GameList::supported_file_extensions.join(" *.")).append(" main");
|
||||||
extensions += "*." + piece + " ";
|
const QString file_filter = tr("Switch Executable (%1);;All Files (*.*)",
|
||||||
|
"%1 is an identifier for the Switch executable file extensions.")
|
||||||
|
.arg(extensions);
|
||||||
|
const QString filename = QFileDialog::getOpenFileName(
|
||||||
|
this, tr("Load File"), UISettings::values.roms_path, file_filter);
|
||||||
|
|
||||||
extensions += "main ";
|
if (filename.isEmpty()) {
|
||||||
|
return;
|
||||||
QString file_filter = tr("Switch 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UISettings::values.roms_path = QFileInfo(filename).path();
|
||||||
|
BootGame(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnMenuLoadFolder() {
|
void GMainWindow::OnMenuLoadFolder() {
|
||||||
|
Loading…
Reference in New Issue
Block a user