diff options
| author | 2018-10-13 10:23:50 -0400 | |
|---|---|---|
| committer | 2018-10-13 10:35:18 -0400 | |
| commit | a4c57436fc157ccfcc6b3a93555b312fd1d14851 (patch) | |
| tree | c7f9817f53ed07016d9101c3e5adaa5c151cdf9e /src | |
| parent | Merge pull request #1409 from DarkLordZach/key-derivation (diff) | |
| download | yuzu-a4c57436fc157ccfcc6b3a93555b312fd1d14851.tar.gz yuzu-a4c57436fc157ccfcc6b3a93555b312fd1d14851.tar.xz yuzu-a4c57436fc157ccfcc6b3a93555b312fd1d14851.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index fc186dc2d..dd11402e8 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -908,22 +908,20 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id, | |||
| 908 | } | 908 | } |
| 909 | 909 | ||
| 910 | void GMainWindow::OnMenuLoadFile() { | 910 | void GMainWindow::OnMenuLoadFile() { |
| 911 | QString extensions; | 911 | const QString extensions = |
| 912 | for (const auto& piece : game_list->supported_file_extensions) | 912 | QString("*.").append(GameList::supported_file_extensions.join(" *.")).append(" main"); |
| 913 | extensions += "*." + piece + " "; | 913 | const QString file_filter = tr("Switch Executable (%1);;All Files (*.*)", |
| 914 | "%1 is an identifier for the Switch executable file extensions.") | ||
| 915 | .arg(extensions); | ||
| 916 | const QString filename = QFileDialog::getOpenFileName( | ||
| 917 | this, tr("Load File"), UISettings::values.roms_path, file_filter); | ||
| 914 | 918 | ||
| 915 | extensions += "main "; | 919 | if (filename.isEmpty()) { |
| 916 | 920 | return; | |
| 917 | QString file_filter = tr("Switch Executable") + " (" + extensions + ")"; | ||
| 918 | file_filter += ";;" + tr("All Files (*.*)"); | ||
| 919 | |||
| 920 | QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), | ||
| 921 | UISettings::values.roms_path, file_filter); | ||
| 922 | if (!filename.isEmpty()) { | ||
| 923 | UISettings::values.roms_path = QFileInfo(filename).path(); | ||
| 924 | |||
| 925 | BootGame(filename); | ||
| 926 | } | 921 | } |
| 922 | |||
| 923 | UISettings::values.roms_path = QFileInfo(filename).path(); | ||
| 924 | BootGame(filename); | ||
| 927 | } | 925 | } |
| 928 | 926 | ||
| 929 | void GMainWindow::OnMenuLoadFolder() { | 927 | void GMainWindow::OnMenuLoadFolder() { |