diff options
| author | 2018-08-06 21:34:20 -0400 | |
|---|---|---|
| committer | 2018-08-06 21:34:20 -0400 | |
| commit | 75df8a39697050ce4661bbd3fa5a3f9d42ae371c (patch) | |
| tree | 0aa774717cc315843d5ad7bb3f35088a854ef665 /src | |
| parent | Merge pull request #944 from lioncash/menu (diff) | |
| parent | qt/main: Avoid sign conversions in UpdateRecentFiles() (diff) | |
| download | yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.tar.gz yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.tar.xz yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.zip | |
Merge pull request #946 from lioncash/compress
qt/main: Collapse if statement in UpdateRecentFiles()
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 886288c0d..dd71bd763 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -81,6 +81,8 @@ static void ShowCalloutMessage(const QString& message, CalloutFlag flag) { | |||
| 81 | 81 | ||
| 82 | void GMainWindow::ShowCallouts() {} | 82 | void GMainWindow::ShowCallouts() {} |
| 83 | 83 | ||
| 84 | const int GMainWindow::max_recent_files_item; | ||
| 85 | |||
| 84 | GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { | 86 | GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { |
| 85 | 87 | ||
| 86 | debug_context = Tegra::DebugContext::Construct(); | 88 | debug_context = Tegra::DebugContext::Construct(); |
| @@ -579,11 +581,11 @@ void GMainWindow::StoreRecentFile(const QString& filename) { | |||
| 579 | } | 581 | } |
| 580 | 582 | ||
| 581 | void GMainWindow::UpdateRecentFiles() { | 583 | void GMainWindow::UpdateRecentFiles() { |
| 582 | unsigned int num_recent_files = | 584 | const int num_recent_files = |
| 583 | std::min(UISettings::values.recent_files.size(), static_cast<int>(max_recent_files_item)); | 585 | std::min(UISettings::values.recent_files.size(), max_recent_files_item); |
| 584 | 586 | ||
| 585 | for (unsigned int i = 0; i < num_recent_files; i++) { | 587 | for (int i = 0; i < num_recent_files; i++) { |
| 586 | QString text = QString("&%1. %2").arg(i + 1).arg( | 588 | const QString text = QString("&%1. %2").arg(i + 1).arg( |
| 587 | QFileInfo(UISettings::values.recent_files[i]).fileName()); | 589 | QFileInfo(UISettings::values.recent_files[i]).fileName()); |
| 588 | actions_recent_files[i]->setText(text); | 590 | actions_recent_files[i]->setText(text); |
| 589 | actions_recent_files[i]->setData(UISettings::values.recent_files[i]); | 591 | actions_recent_files[i]->setData(UISettings::values.recent_files[i]); |
| @@ -595,12 +597,8 @@ void GMainWindow::UpdateRecentFiles() { | |||
| 595 | actions_recent_files[j]->setVisible(false); | 597 | actions_recent_files[j]->setVisible(false); |
| 596 | } | 598 | } |
| 597 | 599 | ||
| 598 | // Grey out the recent files menu if the list is empty | 600 | // Enable the recent files menu if the list isn't empty |
| 599 | if (num_recent_files == 0) { | 601 | ui.menu_recent_files->setEnabled(num_recent_files != 0); |
| 600 | ui.menu_recent_files->setEnabled(false); | ||
| 601 | } else { | ||
| 602 | ui.menu_recent_files->setEnabled(true); | ||
| 603 | } | ||
| 604 | } | 602 | } |
| 605 | 603 | ||
| 606 | void GMainWindow::OnGameListLoadFile(QString game_path) { | 604 | void GMainWindow::OnGameListLoadFile(QString game_path) { |