mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Fixed multiple issues with the UI modes.
This commit is contained in:
parent
4cc66a12a1
commit
d2d6813a54
|
@ -14,6 +14,7 @@
|
|||
#include "utils/FileSystemUtil.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "utils/TimeUtil.h"
|
||||
#include "views/UIModeController.h"
|
||||
#include "AudioManager.h"
|
||||
#include "CollectionSystemsManager.h"
|
||||
#include "FileFilterIndex.h"
|
||||
|
@ -110,6 +111,14 @@ const bool FileData::getFavorite()
|
|||
return false;
|
||||
}
|
||||
|
||||
const bool FileData::getKidgame()
|
||||
{
|
||||
if (metadata.get("kidgame") == "true")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool FileData::getHidden()
|
||||
{
|
||||
if (metadata.get("hidden") == "true")
|
||||
|
@ -301,7 +310,7 @@ const std::string FileData::getVideoPath() const
|
|||
const std::vector<FileData*>& FileData::getChildrenListToDisplay()
|
||||
{
|
||||
FileFilterIndex* idx = mSystem->getIndex();
|
||||
if (idx->isFiltered()) {
|
||||
if (idx->isFiltered() || UIModeController::getInstance()->isUIModeKid()) {
|
||||
mFilteredChildren.clear();
|
||||
for (auto it = mChildren.cbegin(); it != mChildren.cend(); it++) {
|
||||
if (idx->showFile((*it))) {
|
||||
|
@ -441,6 +450,7 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending,
|
|||
mHasFolders = false;
|
||||
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
||||
bool showHiddenGames = Settings::getInstance()->getBool("ShowHiddenGames");
|
||||
bool isKidMode = UIModeController::getInstance()->isUIModeKid();
|
||||
std::vector<FileData*> mChildrenFolders;
|
||||
std::vector<FileData*> mChildrenOthers;
|
||||
|
||||
|
@ -526,9 +536,11 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending,
|
|||
for (auto it = mChildren.cbegin(); it != mChildren.cend(); it++) {
|
||||
// Game count, which will be displayed in the system view.
|
||||
if ((*it)->getType() == GAME && (*it)->getCountAsGame()) {
|
||||
gameCount.first++;
|
||||
if ((*it)->getFavorite())
|
||||
gameCount.second++;
|
||||
if (!isKidMode || (isKidMode && (*it)->getKidgame())) {
|
||||
gameCount.first++;
|
||||
if ((*it)->getFavorite())
|
||||
gameCount.second++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((*it)->getType() != FOLDER)
|
||||
|
@ -552,6 +564,7 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
|
|||
mHasFolders = false;
|
||||
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
||||
bool showHiddenGames = Settings::getInstance()->getBool("ShowHiddenGames");
|
||||
bool isKidMode = UIModeController::getInstance()->isUIModeKid();
|
||||
std::vector<FileData*> mChildrenFolders;
|
||||
std::vector<FileData*> mChildrenFavoritesFolders;
|
||||
std::vector<FileData*> mChildrenFavorites;
|
||||
|
@ -589,9 +602,11 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
|
|||
|
||||
// Game count, which will be displayed in the system view.
|
||||
if (mChildren[i]->getType() == GAME && mChildren[i]->getCountAsGame()) {
|
||||
gameCount.first++;
|
||||
if (mChildren[i]->getFavorite())
|
||||
gameCount.second++;
|
||||
if (!isKidMode || (isKidMode && mChildren[i]->getKidgame())) {
|
||||
gameCount.first++;
|
||||
if (mChildren[i]->getFavorite())
|
||||
gameCount.second++;
|
||||
}
|
||||
}
|
||||
|
||||
if (foldersOnTop && mChildren[i]->getType() == FOLDER) {
|
||||
|
@ -707,11 +722,19 @@ void FileData::sort(const SortType& type, bool mFavoritesOnTop)
|
|||
|
||||
void FileData::countGames(std::pair<unsigned int, unsigned int>& gameCount)
|
||||
{
|
||||
bool isKidMode = (Settings::getInstance()->getString("UIMode") == "kid" ||
|
||||
Settings::getInstance()->getBool("ForceKid"));
|
||||
|
||||
(Settings::getInstance()->getString("UIMode") == "kid" ||
|
||||
Settings::getInstance()->getBool("ForceKid"));
|
||||
|
||||
for (unsigned int i = 0; i < mChildren.size(); i++) {
|
||||
if (mChildren[i]->getType() == GAME && mChildren[i]->getCountAsGame()) {
|
||||
gameCount.first++;
|
||||
if (mChildren[i]->getFavorite())
|
||||
gameCount.second++;
|
||||
if (!isKidMode || (isKidMode && mChildren[i]->getKidgame())) {
|
||||
gameCount.first++;
|
||||
if (mChildren[i]->getFavorite())
|
||||
gameCount.second++;
|
||||
}
|
||||
}
|
||||
// Iterate through any folders.
|
||||
else if (mChildren[i]->getType() == FOLDER)
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
virtual const std::string& getName();
|
||||
const std::string& getSortName();
|
||||
const bool getFavorite();
|
||||
const bool getKidgame();
|
||||
const bool getHidden();
|
||||
const bool getCountAsGame();
|
||||
const std::pair<unsigned int, unsigned int> getGameCount() { return mGameCount; };
|
||||
|
|
|
@ -85,11 +85,11 @@ void FileFilterIndex::importIndex(FileFilterIndex* indexToImport)
|
|||
sizeof(indexStructDecls) / sizeof(indexStructDecls[0]));
|
||||
|
||||
for (std::vector<IndexImportStructure>::const_iterator indexesIt =
|
||||
indexImportDecl.cbegin(); indexesIt != indexImportDecl.cend(); ++indexesIt )
|
||||
indexImportDecl.cbegin(); indexesIt != indexImportDecl.cend(); indexesIt++)
|
||||
{
|
||||
for (std::map<std::string, int>::const_iterator sourceIt =
|
||||
(*indexesIt).sourceIndex->cbegin(); sourceIt !=
|
||||
(*indexesIt).sourceIndex->cend(); ++sourceIt ) {
|
||||
(*indexesIt).sourceIndex->cend(); sourceIt++) {
|
||||
if ((*indexesIt).destinationIndex->find((*sourceIt).first) ==
|
||||
(*indexesIt).destinationIndex->cend())
|
||||
// Entry doesn't exist.
|
||||
|
@ -254,13 +254,13 @@ void FileFilterIndex::setFilter(FilterIndexType type, std::vector<std::string>*
|
|||
}
|
||||
else {
|
||||
for (std::vector<FilterDataDecl>::const_iterator it = filterDataDecl.cbegin();
|
||||
it != filterDataDecl.cend(); ++it ) {
|
||||
it != filterDataDecl.cend(); it++) {
|
||||
if ((*it).type == type) {
|
||||
FilterDataDecl filterData = (*it);
|
||||
*(filterData.filteredByRef) = values->size() > 0;
|
||||
filterData.currentFilteredKeys->clear();
|
||||
for (std::vector<std::string>::const_iterator vit =
|
||||
values->cbegin(); vit != values->cend(); ++vit ) {
|
||||
values->cbegin(); vit != values->cend(); vit++) {
|
||||
// Check if it exists.
|
||||
if (filterData.allIndexKeys->find(*vit) != filterData.allIndexKeys->cend()) {
|
||||
filterData.currentFilteredKeys->push_back(std::string(*vit));
|
||||
|
@ -285,33 +285,27 @@ void FileFilterIndex::setFilter(FilterIndexType type, std::vector<std::string>*
|
|||
void FileFilterIndex::clearAllFilters()
|
||||
{
|
||||
for (std::vector<FilterDataDecl>::const_iterator it = filterDataDecl.cbegin();
|
||||
it != filterDataDecl.cend(); ++it ) {
|
||||
it != filterDataDecl.cend(); it++) {
|
||||
FilterDataDecl filterData = (*it);
|
||||
*(filterData.filteredByRef) = false;
|
||||
filterData.currentFilteredKeys->clear();
|
||||
}
|
||||
setTextFilter("");
|
||||
return;
|
||||
}
|
||||
|
||||
void FileFilterIndex::resetFilters()
|
||||
{
|
||||
clearAllFilters();
|
||||
setUIModeFilters();
|
||||
setKidModeFilters();
|
||||
}
|
||||
|
||||
void FileFilterIndex::setUIModeFilters()
|
||||
void FileFilterIndex::setKidModeFilters()
|
||||
{
|
||||
if (Settings::getInstance()->getBool("GamelistFilters")){
|
||||
if (UIModeController::getInstance()->isUIModeKiosk()) {
|
||||
mFilterByHidden = true;
|
||||
std::vector<std::string> val = { "FALSE" };
|
||||
setFilter(HIDDEN_FILTER, &val);
|
||||
}
|
||||
if (UIModeController::getInstance()->isUIModeKid()) {
|
||||
mFilterByKidGame = true;
|
||||
std::vector<std::string> val = { "TRUE" };
|
||||
setFilter(KIDGAME_FILTER, &val);
|
||||
}
|
||||
if (UIModeController::getInstance()->isUIModeKid()) {
|
||||
mFilterByKidGame = true;
|
||||
std::vector<std::string> val = { "TRUE" };
|
||||
setFilter(KIDGAME_FILTER, &val);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -349,17 +343,13 @@ void FileFilterIndex::debugPrintIndexes()
|
|||
|
||||
bool FileFilterIndex::showFile(FileData* game)
|
||||
{
|
||||
// This shouldn't happen, but just in case let's get it out of the way.
|
||||
if (!isFiltered())
|
||||
return true;
|
||||
|
||||
// If folder, needs further inspection - i.e. see if folder contains at least one element
|
||||
// that should be shown.
|
||||
if (game->getType() == FOLDER) {
|
||||
std::vector<FileData*> children = game->getChildren();
|
||||
// Iterate through all of the children, until there's a match.
|
||||
for (std::vector<FileData*>::const_iterator it = children.cbegin();
|
||||
it != children.cend(); ++it ) {
|
||||
it != children.cend(); it++) {
|
||||
if (showFile(*it))
|
||||
return true;
|
||||
}
|
||||
|
@ -380,9 +370,12 @@ bool FileFilterIndex::showFile(FileData* game)
|
|||
}
|
||||
|
||||
for (std::vector<FilterDataDecl>::const_iterator it = filterDataDecl.cbegin();
|
||||
it != filterDataDecl.cend(); ++it ) {
|
||||
it != filterDataDecl.cend(); it++) {
|
||||
FilterDataDecl filterData = (*it);
|
||||
if (*(filterData.filteredByRef)) {
|
||||
if (filterData.primaryKey == "kidgame" && UIModeController::getInstance()->isUIModeKid()) {
|
||||
return (getIndexableKey(game, filterData.type, false) != "FALSE");
|
||||
}
|
||||
else if (*(filterData.filteredByRef)) {
|
||||
// Try to find a match.
|
||||
std::string key = getIndexableKey(game, filterData.type, false);
|
||||
keepGoing = isKeyBeingFilteredBy(key, filterData.type);
|
||||
|
@ -410,6 +403,20 @@ bool FileFilterIndex::showFile(FileData* game)
|
|||
return keepGoing;
|
||||
}
|
||||
|
||||
bool FileFilterIndex::isFiltered()
|
||||
{
|
||||
if (UIModeController::getInstance()->isUIModeKid()) {
|
||||
return (mFilterByText || mFilterByFavorites || mFilterByGenre || mFilterByPlayers ||
|
||||
mFilterByPubDev || mFilterByRatings || mFilterByCompleted || mFilterByBroken ||
|
||||
mFilterByHidden);
|
||||
}
|
||||
else {
|
||||
return (mFilterByText || mFilterByFavorites || mFilterByGenre || mFilterByPlayers ||
|
||||
mFilterByPubDev || mFilterByRatings || mFilterByKidGame || mFilterByCompleted ||
|
||||
mFilterByBroken || mFilterByHidden);
|
||||
}
|
||||
}
|
||||
|
||||
bool FileFilterIndex::isKeyBeingFilteredBy(std::string key, FilterIndexType type)
|
||||
{
|
||||
const FilterIndexType filterTypes[9] = { FAVORITES_FILTER, GENRE_FILTER,
|
||||
|
@ -423,7 +430,7 @@ bool FileFilterIndex::isKeyBeingFilteredBy(std::string key, FilterIndexType type
|
|||
for (int i = 0; i < 9; i++) {
|
||||
if (filterTypes[i] == type) {
|
||||
for (std::vector<std::string>::const_iterator it = filterKeysList[i].cbegin();
|
||||
it != filterKeysList[i].cend(); ++it ) {
|
||||
it != filterKeysList[i].cend(); it++) {
|
||||
if (key == (*it))
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -56,16 +56,14 @@ public:
|
|||
void clearAllFilters();
|
||||
void debugPrintIndexes();
|
||||
bool showFile(FileData* game);
|
||||
bool isFiltered() { return (mFilterByText || mFilterByFavorites || mFilterByGenre ||
|
||||
mFilterByPlayers || mFilterByPubDev || mFilterByRatings || mFilterByKidGame ||
|
||||
mFilterByCompleted || mFilterByBroken || mFilterByHidden ); };
|
||||
bool isFiltered();
|
||||
bool isKeyBeingFilteredBy(std::string key, FilterIndexType type);
|
||||
std::vector<FilterDataDecl>& getFilterDataDecls();
|
||||
|
||||
void importIndex(FileFilterIndex* indexToImport);
|
||||
void resetIndex();
|
||||
void resetFilters();
|
||||
void setUIModeFilters();
|
||||
void setKidModeFilters();
|
||||
|
||||
private:
|
||||
std::vector<FilterDataDecl> filterDataDecl;
|
||||
|
|
|
@ -110,14 +110,8 @@ void GuiGamelistFilter::addFiltersToMenu()
|
|||
|
||||
std::vector<FilterDataDecl> decls = mFilterIndex->getFilterDataDecls();
|
||||
|
||||
int skip = 0;
|
||||
if (!UIModeController::getInstance()->isUIModeFull())
|
||||
skip = 1;
|
||||
if (UIModeController::getInstance()->isUIModeKid())
|
||||
skip = 2;
|
||||
|
||||
for (std::vector<FilterDataDecl>::const_iterator it = decls.cbegin();
|
||||
it != decls.cend()-skip; ++it ) {
|
||||
for (std::vector<FilterDataDecl>::const_iterator it =
|
||||
decls.cbegin(); it != decls.cend(); it++) {
|
||||
|
||||
FilterIndexType type = (*it).type; // Type of filter.
|
||||
// All possible filters for this type.
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "views/ViewController.h"
|
||||
#include "CollectionSystemsManager.h"
|
||||
#include "EmulationStation.h"
|
||||
#include "FileFilterIndex.h"
|
||||
#include "FileSorts.h"
|
||||
#include "Platform.h"
|
||||
#include "Scripting.h"
|
||||
|
@ -191,12 +192,15 @@ void GuiMenu::openUISettings()
|
|||
ui_mode->add(*it, *it, setMode == *it);
|
||||
s->addWithLabel("UI MODE", ui_mode);
|
||||
s->addSaveFunc([ui_mode, this, s] {
|
||||
// Always save settings if mode was forced to 'full'.
|
||||
if (Settings::getInstance()->getBool("ForceFull"))
|
||||
s->setNeedsSaving();
|
||||
std::string selectedMode = ui_mode->getSelected();
|
||||
if (selectedMode != Settings::getInstance()->getString("UIMode") &&
|
||||
selectedMode != "full") {
|
||||
// If any of the force flags are set, then always apply and save the setting.
|
||||
if (selectedMode == Settings::getInstance()->getString("UIMode") &&
|
||||
!Settings::getInstance()->getBool("ForceFull") &&
|
||||
!Settings::getInstance()->getBool("ForceKiosk") &&
|
||||
!Settings::getInstance()->getBool("ForceKid")) {
|
||||
return;
|
||||
}
|
||||
else if (selectedMode != "full") {
|
||||
std::string msg = "YOU ARE CHANGING THE UI TO A RESTRICTED MODE:\n'" +
|
||||
Utils::String::toUpper(selectedMode) + "'\n";
|
||||
msg += "THIS WILL HIDE MOST MENU OPTIONS TO PREVENT CHANGES TO THE SYSTEM.\n";
|
||||
|
@ -204,7 +208,7 @@ void GuiMenu::openUISettings()
|
|||
msg += "\"" + UIModeController::getInstance()->getFormattedPassKeyStr() + "\"\n\n";
|
||||
msg += "DO YOU WANT TO PROCEED?";
|
||||
mWindow->pushGui(new GuiMsgBox(mWindow, this->getHelpStyle(), msg,
|
||||
"YES", [selectedMode, s] {
|
||||
"YES", [this, selectedMode] {
|
||||
LOG(LogDebug) << "GuiMenu::openUISettings(): Setting UI mode to '"
|
||||
<< selectedMode << "'.";
|
||||
Settings::getInstance()->setString("UIMode", selectedMode);
|
||||
|
@ -212,17 +216,36 @@ void GuiMenu::openUISettings()
|
|||
Settings::getInstance()->setBool("ForceKiosk", false);
|
||||
Settings::getInstance()->setBool("ForceKid", false);
|
||||
Settings::getInstance()->saveFile();
|
||||
UIModeController::getInstance()->setCurrentUIMode(selectedMode);
|
||||
for (auto it = SystemData::sSystemVector.cbegin();
|
||||
it != SystemData::sSystemVector.cend(); it++) {
|
||||
if ((*it)->getThemeFolder() == "custom-collections") {
|
||||
for (FileData* customSystem :
|
||||
(*it)->getRootFolder()->getChildrenListToDisplay())
|
||||
customSystem->getSystem()->getIndex()->resetFilters();
|
||||
}
|
||||
(*it)->sortSystem();
|
||||
(*it)->getIndex()->resetFilters();
|
||||
}
|
||||
ViewController::get()->reloadAll();
|
||||
ViewController::get()->goToSystem(SystemData::sSystemVector.front(), false);
|
||||
mWindow->invalidateCachedBackground();
|
||||
}, "NO", nullptr));
|
||||
}
|
||||
else if (ui_mode->getSelected() != Settings::getInstance()->getString("UIMode") &&
|
||||
selectedMode == "full") {
|
||||
else {
|
||||
LOG(LogDebug) << "GuiMenu::openUISettings(): Setting UI mode to '" <<
|
||||
selectedMode << "'.";
|
||||
Settings::getInstance()->setString("UIMode", ui_mode->getSelected());
|
||||
Settings::getInstance()->setBool("ForceFull", false);
|
||||
Settings::getInstance()->setBool("ForceKiosk", false);
|
||||
Settings::getInstance()->setBool("ForceKid", false);
|
||||
UIModeController::getInstance()->setCurrentUIMode("full");
|
||||
s->setNeedsSaving();
|
||||
s->setNeedsSorting();
|
||||
s->setNeedsSortingCollections();
|
||||
s->setNeedsResetFilters();
|
||||
s->setNeedsReloading();
|
||||
s->setNeedsGoToSystem(SystemData::sSystemVector.front());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
// GuiSettings.cpp
|
||||
//
|
||||
// User interface template for a settings GUI.
|
||||
// The saving of es_settings.cfg and the reload of the gamelists are triggered from here
|
||||
// based on the flags set by the actual menu entries' lambda functions.
|
||||
// The saving of es_settings.cfg, the reload of gamelists and some other actions are
|
||||
// also triggered to be executed here via flags set by the menu entries' lambda functions.
|
||||
//
|
||||
|
||||
#include "guis/GuiSettings.h"
|
||||
|
@ -14,6 +14,7 @@
|
|||
#include "views/gamelist/IGameListView.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "CollectionSystemsManager.h"
|
||||
#include "FileFilterIndex.h"
|
||||
#include "Settings.h"
|
||||
#include "SystemData.h"
|
||||
#include "Window.h"
|
||||
|
@ -25,13 +26,14 @@ GuiSettings::GuiSettings(
|
|||
mMenu(window, title),
|
||||
mNeedsSaving(false),
|
||||
mNeedsCollectionsUpdate(false),
|
||||
mNeedsReloading(false),
|
||||
mNeedsSorting(false),
|
||||
mNeedsSortingCollections(false),
|
||||
mGoToSystem(nullptr),
|
||||
mNeedsResetFilters(false),
|
||||
mNeedsReloading(false),
|
||||
mNeedsGoToStart(false),
|
||||
mNeedsGoToSystem(false),
|
||||
mNeedsGoToGroupedCollections(false)
|
||||
mNeedsGoToGroupedCollections(false),
|
||||
mGoToSystem(nullptr)
|
||||
{
|
||||
addChild(&mMenu);
|
||||
mMenu.addButton("BACK", "back", [this] { delete this; });
|
||||
|
@ -62,9 +64,6 @@ void GuiSettings::save()
|
|||
CollectionSystemsManager::get()->updateSystemsList();
|
||||
}
|
||||
|
||||
if (mNeedsReloading)
|
||||
ViewController::get()->reloadAll();
|
||||
|
||||
if (mNeedsSorting) {
|
||||
for (auto it = SystemData::sSystemVector.cbegin(); it !=
|
||||
SystemData::sSystemVector.cend(); it++) {
|
||||
|
@ -77,6 +76,21 @@ void GuiSettings::save()
|
|||
}
|
||||
}
|
||||
|
||||
if (mNeedsResetFilters) {
|
||||
for (auto it = SystemData::sSystemVector.cbegin();
|
||||
it != SystemData::sSystemVector.cend(); it++) {
|
||||
if ((*it)->getThemeFolder() == "custom-collections") {
|
||||
for (FileData* customSystem :
|
||||
(*it)->getRootFolder()->getChildrenListToDisplay())
|
||||
customSystem->getSystem()->getIndex()->resetFilters();
|
||||
}
|
||||
(*it)->getIndex()->resetFilters();
|
||||
}
|
||||
}
|
||||
|
||||
if (mNeedsReloading)
|
||||
ViewController::get()->reloadAll();
|
||||
|
||||
if (mNeedsGoToStart)
|
||||
ViewController::get()->goToStart();
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
// GuiSettings.h
|
||||
//
|
||||
// User interface template for a settings GUI.
|
||||
// The saving of es_settings.cfg and the reload of the gamelists are triggered from here
|
||||
// based on the flags set by the actual menu entries' lambda functions.
|
||||
// The saving of es_settings.cfg, the reload of gamelists and some other actions are
|
||||
// also triggered to be executed here via flags set by the menu entries' lambda functions.
|
||||
//
|
||||
|
||||
#ifndef ES_APP_GUIS_GUI_SETTINGS_H
|
||||
|
@ -35,9 +35,10 @@ public:
|
|||
|
||||
void setNeedsSaving() { mNeedsSaving = true; };
|
||||
void setNeedsCollectionsUpdate() { mNeedsCollectionsUpdate = true; };
|
||||
void setNeedsReloading() { mNeedsReloading = true; };
|
||||
void setNeedsSorting() { mNeedsSorting = true; };
|
||||
void setNeedsSortingCollections() { mNeedsSortingCollections = true; };
|
||||
void setNeedsResetFilters() { mNeedsResetFilters = true; }
|
||||
void setNeedsReloading() { mNeedsReloading = true; };
|
||||
void setNeedsGoToStart() { mNeedsGoToStart = true; };
|
||||
void setNeedsGoToSystem(SystemData* goToSystem)
|
||||
{ mNeedsGoToSystem = true; mGoToSystem = goToSystem; };
|
||||
|
@ -52,9 +53,10 @@ private:
|
|||
std::vector<std::function<void()>> mSaveFuncs;
|
||||
bool mNeedsSaving;
|
||||
bool mNeedsCollectionsUpdate;
|
||||
bool mNeedsReloading;
|
||||
bool mNeedsSorting;
|
||||
bool mNeedsSortingCollections;
|
||||
bool mNeedsResetFilters;
|
||||
bool mNeedsReloading;
|
||||
bool mNeedsGoToStart;
|
||||
bool mNeedsGoToSystem;
|
||||
bool mNeedsGoToGroupedCollections;
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
|
||||
#include "utils/StringUtil.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "FileFilterIndex.h"
|
||||
#include "Log.h"
|
||||
#include "SystemData.h"
|
||||
#include "Window.h"
|
||||
|
||||
UIModeController* UIModeController::sInstance = nullptr;
|
||||
|
@ -34,8 +36,19 @@ void UIModeController::monitorUIMode()
|
|||
{
|
||||
std::string uimode = Settings::getInstance()->getString("UIMode");
|
||||
// UI mode was changed.
|
||||
if (uimode != mCurrentUIMode) {
|
||||
if (uimode != mCurrentUIMode && !ViewController::get()->isCameraMoving()) {
|
||||
mCurrentUIMode = uimode;
|
||||
// Reset filters and sort gamelists (which will update the game counter).
|
||||
for (auto it = SystemData::sSystemVector.cbegin(); it !=
|
||||
SystemData::sSystemVector.cend(); it++) {
|
||||
(*it)->sortSystem(true);
|
||||
(*it)->getIndex()->resetFilters();
|
||||
if ((*it)->getThemeFolder() == "custom-collections") {
|
||||
for (FileData* customSystem :
|
||||
(*it)->getRootFolder()->getChildrenListToDisplay())
|
||||
customSystem->getSystem()->getIndex()->resetFilters();
|
||||
}
|
||||
}
|
||||
ViewController::get()->ReloadAndGoToStart();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ public:
|
|||
bool isUIModeKid();
|
||||
bool isUIModeKiosk();
|
||||
|
||||
void setCurrentUIMode(const std::string& mode) { mCurrentUIMode = mode; };
|
||||
|
||||
private:
|
||||
UIModeController();
|
||||
bool inputIsMatch(InputConfig * config, Input input);
|
||||
|
|
|
@ -133,8 +133,14 @@ void ViewController::goToStart()
|
|||
void ViewController::ReloadAndGoToStart()
|
||||
{
|
||||
mWindow->renderLoadingScreen("Loading...");
|
||||
ViewController::get()->reloadAll();
|
||||
ViewController::get()->goToStart();
|
||||
reloadAll();
|
||||
if (mState.viewing == GAME_LIST) {
|
||||
goToSystemView(SystemData::sSystemVector.front(), false);
|
||||
goToSystem(SystemData::sSystemVector.front(), false);
|
||||
}
|
||||
else {
|
||||
goToSystem(SystemData::sSystemVector.front(), false);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewController::isCameraMoving()
|
||||
|
@ -554,7 +560,7 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
|
|||
if (exists != mGameListViews.cend())
|
||||
return exists->second;
|
||||
|
||||
system->getIndex()->setUIModeFilters();
|
||||
system->getIndex()->setKidModeFilters();
|
||||
// If there's no entry, then create it and return it.
|
||||
std::shared_ptr<IGameListView> view;
|
||||
|
||||
|
@ -781,7 +787,7 @@ void ViewController::reloadGameListView(IGameListView* view, bool reloadTheme)
|
|||
|
||||
if (reloadTheme)
|
||||
system->loadTheme();
|
||||
system->getIndex()->setUIModeFilters();
|
||||
system->getIndex()->setKidModeFilters();
|
||||
std::shared_ptr<IGameListView> newView = getGameListView(system);
|
||||
|
||||
// To counter having come from a placeholder.
|
||||
|
|
|
@ -30,7 +30,7 @@ ScrollableContainer::ScrollableContainer(
|
|||
mAutoScrollResetAccumulator(0)
|
||||
{
|
||||
// Set the modifier to get equivalent scrolling speed regardless of screen resolution.
|
||||
// 1920p is the reference.
|
||||
// 1080p is the reference.
|
||||
mResolutionModifier = static_cast<float>(Renderer::getScreenWidth()) / 1920.0f;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue