From 31c7d4e36fc66494182acd4ad703cad1477d03f7 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 11 Aug 2020 18:46:06 -0700 Subject: [PATCH] Don't hide the games immediately --- app/gui/appmodel.cpp | 16 +++++++++++++++- app/gui/appmodel.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/gui/appmodel.cpp b/app/gui/appmodel.cpp index 2325ba84..23e48115 100644 --- a/app/gui/appmodel.cpp +++ b/app/gui/appmodel.cpp @@ -101,12 +101,26 @@ void AppModel::quitRunningApp() m_ComputerManager->quitRunningApp(m_Computer); } +bool AppModel::isAppCurrentlyVisible(const NvApp& app) +{ + for (const NvApp& visibleApp : m_VisibleApps) { + if (app.id == visibleApp.id) { + return true; + } + } + + return false; +} + QVector AppModel::getVisibleApps(const QVector& appList) { QVector visibleApps; for (const NvApp& app : appList) { - if (m_ShowHiddenGames || !app.hidden) { + // Don't immediately hide games that were previously visible. This + // allows users to easily uncheck the "Hide App" checkbox if they + // check it by mistake. + if (m_ShowHiddenGames || !app.hidden || isAppCurrentlyVisible(app)) { visibleApps.append(app); } } diff --git a/app/gui/appmodel.h b/app/gui/appmodel.h index a69abd7a..bf072361 100644 --- a/app/gui/appmodel.h +++ b/app/gui/appmodel.h @@ -54,6 +54,8 @@ private: QVector getVisibleApps(const QVector& appList); + bool isAppCurrentlyVisible(const NvApp& app); + NvComputer* m_Computer; BoxArtManager m_BoxArtManager; ComputerManager* m_ComputerManager;