diff options
author | bunnei <bunneidev@gmail.com> | 2018-08-07 03:34:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-07 03:34:20 +0200 |
commit | 75df8a39697050ce4661bbd3fa5a3f9d42ae371c (patch) | |
tree | 0aa774717cc315843d5ad7bb3f35088a854ef665 | |
parent | Merge pull request #944 from lioncash/menu (diff) | |
parent | qt/main: Avoid sign conversions in UpdateRecentFiles() (diff) | |
download | yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.tar yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.tar.gz yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.tar.bz2 yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.tar.lz yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.tar.xz yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.tar.zst yuzu-75df8a39697050ce4661bbd3fa5a3f9d42ae371c.zip |
-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) { void GMainWindow::ShowCallouts() {} +const int GMainWindow::max_recent_files_item; + GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { debug_context = Tegra::DebugContext::Construct(); @@ -579,11 +581,11 @@ void GMainWindow::StoreRecentFile(const QString& filename) { } void GMainWindow::UpdateRecentFiles() { - unsigned int num_recent_files = - std::min(UISettings::values.recent_files.size(), static_cast<int>(max_recent_files_item)); + const int num_recent_files = + std::min(UISettings::values.recent_files.size(), max_recent_files_item); - for (unsigned int i = 0; i < num_recent_files; i++) { - QString text = QString("&%1. %2").arg(i + 1).arg( + for (int i = 0; i < num_recent_files; i++) { + const QString text = QString("&%1. %2").arg(i + 1).arg( QFileInfo(UISettings::values.recent_files[i]).fileName()); actions_recent_files[i]->setText(text); actions_recent_files[i]->setData(UISettings::values.recent_files[i]); @@ -595,12 +597,8 @@ void GMainWindow::UpdateRecentFiles() { actions_recent_files[j]->setVisible(false); } - // Grey out the recent files menu if the list is empty - if (num_recent_files == 0) { - ui.menu_recent_files->setEnabled(false); - } else { - ui.menu_recent_files->setEnabled(true); - } + // Enable the recent files menu if the list isn't empty + ui.menu_recent_files->setEnabled(num_recent_files != 0); } void GMainWindow::OnGameListLoadFile(QString game_path) { |