mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Merge pull request #571 from cmitu/collections-label-for-system-options
Collections: make the display of system's name configurable.
This commit is contained in:
commit
13819ec0d9
|
@ -1032,7 +1032,6 @@ bool CollectionSystemManager::includeFileInAutoCollections(FileData* file)
|
||||||
return file->getName() != "kodi" && file->getSystem()->isGameSystem();
|
return file->getName() != "kodi" && file->getSystem()->isGameSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string getCustomCollectionConfigPath(std::string collectionName)
|
std::string getCustomCollectionConfigPath(std::string collectionName)
|
||||||
{
|
{
|
||||||
return getCollectionsFolder() + "/custom-" + collectionName + ".cfg";
|
return getCollectionsFolder() + "/custom-" + collectionName + ".cfg";
|
||||||
|
|
|
@ -345,14 +345,17 @@ void CollectionFileData::refreshMetadata()
|
||||||
mDirty = true;
|
mDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& CollectionFileData::getName()
|
const std::string& CollectionFileData::getName()
|
||||||
{
|
{
|
||||||
if (mDirty) {
|
if (mDirty) {
|
||||||
mCollectionFileName = Utils::String::removeParenthesis(mSourceFileData->metadata.get("name"));
|
mCollectionFileName = Utils::String::removeParenthesis(mSourceFileData->metadata.get("name"));
|
||||||
mCollectionFileName += " [" + Utils::String::toUpper(mSourceFileData->getSystem()->getName()) + "]";
|
mCollectionFileName += " [" + Utils::String::toUpper(mSourceFileData->getSystem()->getName()) + "]";
|
||||||
mDirty = false;
|
mDirty = false;
|
||||||
}
|
}
|
||||||
return mCollectionFileName;
|
|
||||||
|
if (Settings::getInstance()->getBool("CollectionShowSystemInfo"))
|
||||||
|
return mCollectionFileName;
|
||||||
|
return mSourceFileData->metadata.get("name");
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns Sort Type based on a string description
|
// returns Sort Type based on a string description
|
||||||
|
|
|
@ -75,6 +75,10 @@ void GuiCollectionSystemsOptions::initializeMenu()
|
||||||
sortAllSystemsSwitch->setState(Settings::getInstance()->getBool("SortAllSystems"));
|
sortAllSystemsSwitch->setState(Settings::getInstance()->getBool("SortAllSystems"));
|
||||||
mMenu.addWithLabel("SORT CUSTOM COLLECTIONS AND SYSTEMS", sortAllSystemsSwitch);
|
mMenu.addWithLabel("SORT CUSTOM COLLECTIONS AND SYSTEMS", sortAllSystemsSwitch);
|
||||||
|
|
||||||
|
toggleSystemNameInCollections = std::make_shared<SwitchComponent>(mWindow);
|
||||||
|
toggleSystemNameInCollections->setState(Settings::getInstance()->getBool("CollectionShowSystemInfo"));
|
||||||
|
mMenu.addWithLabel("SHOW SYSTEM NAME IN COLLECTIONS", toggleSystemNameInCollections);
|
||||||
|
|
||||||
if(CollectionSystemManager::get()->isEditing())
|
if(CollectionSystemManager::get()->isEditing())
|
||||||
{
|
{
|
||||||
row.elements.clear();
|
row.elements.clear();
|
||||||
|
@ -170,11 +174,14 @@ void GuiCollectionSystemsOptions::applySettings()
|
||||||
bool prevSort = Settings::getInstance()->getBool("SortAllSystems");
|
bool prevSort = Settings::getInstance()->getBool("SortAllSystems");
|
||||||
bool outBundle = bundleCustomCollections->getState();
|
bool outBundle = bundleCustomCollections->getState();
|
||||||
bool prevBundle = Settings::getInstance()->getBool("UseCustomCollectionsSystem");
|
bool prevBundle = Settings::getInstance()->getBool("UseCustomCollectionsSystem");
|
||||||
bool needUpdateSettings = prevAuto != outAuto || prevCustom != outCustom || outSort != prevSort || outBundle != prevBundle;
|
bool prevShow = Settings::getInstance()->getBool("CollectionShowSystemInfo");
|
||||||
|
bool outShow = toggleSystemNameInCollections->getState();
|
||||||
|
bool needUpdateSettings = prevAuto != outAuto || prevCustom != outCustom || outSort != prevSort || outBundle != prevBundle || prevShow != outShow ;
|
||||||
if (needUpdateSettings)
|
if (needUpdateSettings)
|
||||||
{
|
{
|
||||||
updateSettings(outAuto, outCustom);
|
updateSettings(outAuto, outCustom);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,6 +191,7 @@ void GuiCollectionSystemsOptions::updateSettings(std::string newAutoSettings, st
|
||||||
Settings::getInstance()->setString("CollectionSystemsCustom", newCustomSettings);
|
Settings::getInstance()->setString("CollectionSystemsCustom", newCustomSettings);
|
||||||
Settings::getInstance()->setBool("SortAllSystems", sortAllSystemsSwitch->getState());
|
Settings::getInstance()->setBool("SortAllSystems", sortAllSystemsSwitch->getState());
|
||||||
Settings::getInstance()->setBool("UseCustomCollectionsSystem", bundleCustomCollections->getState());
|
Settings::getInstance()->setBool("UseCustomCollectionsSystem", bundleCustomCollections->getState());
|
||||||
|
Settings::getInstance()->setBool("CollectionShowSystemInfo", toggleSystemNameInCollections->getState());
|
||||||
Settings::getInstance()->saveFile();
|
Settings::getInstance()->saveFile();
|
||||||
CollectionSystemManager::get()->loadEnabledListFromSettings();
|
CollectionSystemManager::get()->loadEnabledListFromSettings();
|
||||||
CollectionSystemManager::get()->updateSystemsList();
|
CollectionSystemManager::get()->updateSystemsList();
|
||||||
|
|
|
@ -30,6 +30,7 @@ private:
|
||||||
std::shared_ptr< OptionListComponent<std::string> > customOptionList;
|
std::shared_ptr< OptionListComponent<std::string> > customOptionList;
|
||||||
std::shared_ptr<SwitchComponent> sortAllSystemsSwitch;
|
std::shared_ptr<SwitchComponent> sortAllSystemsSwitch;
|
||||||
std::shared_ptr<SwitchComponent> bundleCustomCollections;
|
std::shared_ptr<SwitchComponent> bundleCustomCollections;
|
||||||
|
std::shared_ptr<SwitchComponent> toggleSystemNameInCollections;
|
||||||
MenuComponent mMenu;
|
MenuComponent mMenu;
|
||||||
SystemData* mSystem;
|
SystemData* mSystem;
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,6 +134,7 @@ void Settings::setDefaults()
|
||||||
mStringMap["OMXAudioDev"] = "both";
|
mStringMap["OMXAudioDev"] = "both";
|
||||||
mStringMap["CollectionSystemsAuto"] = "";
|
mStringMap["CollectionSystemsAuto"] = "";
|
||||||
mStringMap["CollectionSystemsCustom"] = "";
|
mStringMap["CollectionSystemsCustom"] = "";
|
||||||
|
mBoolMap["CollectionShowSystemInfo"] = true;
|
||||||
mBoolMap["SortAllSystems"] = false;
|
mBoolMap["SortAllSystems"] = false;
|
||||||
mBoolMap["UseCustomCollectionsSystem"] = true;
|
mBoolMap["UseCustomCollectionsSystem"] = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue