mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-23 06:35:38 +00:00
iterator -> const_iterator
This commit is contained in:
parent
b63a2835ba
commit
9fbe95daa3
|
@ -37,7 +37,7 @@ CollectionSystemManager::CollectionSystemManager(Window* window) : mWindow(windo
|
||||||
// create a map
|
// create a map
|
||||||
std::vector<CollectionSystemDecl> tempSystemDecl = std::vector<CollectionSystemDecl>(systemDecls, systemDecls + sizeof(systemDecls) / sizeof(systemDecls[0]));
|
std::vector<CollectionSystemDecl> tempSystemDecl = std::vector<CollectionSystemDecl>(systemDecls, systemDecls + sizeof(systemDecls) / sizeof(systemDecls[0]));
|
||||||
|
|
||||||
for (std::vector<CollectionSystemDecl>::iterator it = tempSystemDecl.begin(); it != tempSystemDecl.end(); ++it )
|
for (std::vector<CollectionSystemDecl>::const_iterator it = tempSystemDecl.cbegin(); it != tempSystemDecl.cend(); ++it )
|
||||||
{
|
{
|
||||||
mCollectionSystemDeclsIndex[(*it).name] = (*it);
|
mCollectionSystemDeclsIndex[(*it).name] = (*it);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ CollectionSystemManager::~CollectionSystemManager()
|
||||||
removeCollectionsFromDisplayedSystems();
|
removeCollectionsFromDisplayedSystems();
|
||||||
|
|
||||||
// iterate the map
|
// iterate the map
|
||||||
for(std::map<std::string, CollectionSystemData>::iterator it = mCustomCollectionSystemsData.begin() ; it != mCustomCollectionSystemsData.end() ; it++ )
|
for(std::map<std::string, CollectionSystemData>::const_iterator it = mCustomCollectionSystemsData.cbegin() ; it != mCustomCollectionSystemsData.cend() ; it++ )
|
||||||
{
|
{
|
||||||
if (it->second.isPopulated)
|
if (it->second.isPopulated)
|
||||||
{
|
{
|
||||||
|
@ -103,14 +103,14 @@ void CollectionSystemManager::saveCustomCollection(SystemData* sys)
|
||||||
{
|
{
|
||||||
std::string name = sys->getName();
|
std::string name = sys->getName();
|
||||||
std::unordered_map<std::string, FileData*> games = sys->getRootFolder()->getChildrenByFilename();
|
std::unordered_map<std::string, FileData*> games = sys->getRootFolder()->getChildrenByFilename();
|
||||||
bool found = mCustomCollectionSystemsData.find(name) != mCustomCollectionSystemsData.end();
|
bool found = mCustomCollectionSystemsData.find(name) != mCustomCollectionSystemsData.cend();
|
||||||
if (found) {
|
if (found) {
|
||||||
CollectionSystemData sysData = mCustomCollectionSystemsData.at(name);
|
CollectionSystemData sysData = mCustomCollectionSystemsData.at(name);
|
||||||
if (sysData.needsSave)
|
if (sysData.needsSave)
|
||||||
{
|
{
|
||||||
std::ofstream configFile;
|
std::ofstream configFile;
|
||||||
configFile.open(getCustomCollectionConfigPath(name));
|
configFile.open(getCustomCollectionConfigPath(name));
|
||||||
for(std::unordered_map<std::string, FileData*>::iterator iter = games.begin(); iter != games.end(); ++iter)
|
for(std::unordered_map<std::string, FileData*>::const_iterator iter = games.cbegin(); iter != games.cend(); ++iter)
|
||||||
{
|
{
|
||||||
std::string path = iter->first;
|
std::string path = iter->first;
|
||||||
configFile << path << std::endl;
|
configFile << path << std::endl;
|
||||||
|
@ -151,7 +151,7 @@ void CollectionSystemManager::loadEnabledListFromSettings()
|
||||||
// iterate the map
|
// iterate the map
|
||||||
for(std::map<std::string, CollectionSystemData>::iterator it = mAutoCollectionSystemsData.begin() ; it != mAutoCollectionSystemsData.end() ; it++ )
|
for(std::map<std::string, CollectionSystemData>::iterator it = mAutoCollectionSystemsData.begin() ; it != mAutoCollectionSystemsData.end() ; it++ )
|
||||||
{
|
{
|
||||||
it->second.isEnabled = (std::find(autoSelected.begin(), autoSelected.end(), it->first) != autoSelected.end());
|
it->second.isEnabled = (std::find(autoSelected.cbegin(), autoSelected.cend(), it->first) != autoSelected.cend());
|
||||||
}
|
}
|
||||||
|
|
||||||
// we parse the custom collection settings list
|
// we parse the custom collection settings list
|
||||||
|
@ -160,7 +160,7 @@ void CollectionSystemManager::loadEnabledListFromSettings()
|
||||||
// iterate the map
|
// iterate the map
|
||||||
for(std::map<std::string, CollectionSystemData>::iterator it = mCustomCollectionSystemsData.begin() ; it != mCustomCollectionSystemsData.end() ; it++ )
|
for(std::map<std::string, CollectionSystemData>::iterator it = mCustomCollectionSystemsData.begin() ; it != mCustomCollectionSystemsData.end() ; it++ )
|
||||||
{
|
{
|
||||||
it->second.isEnabled = (std::find(customSelected.begin(), customSelected.end(), it->first) != customSelected.end());
|
it->second.isEnabled = (std::find(customSelected.cbegin(), customSelected.cend(), it->first) != customSelected.cend());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ void CollectionSystemManager::updateSystemsList()
|
||||||
std::sort(SystemData::sSystemVector.begin(), SystemData::sSystemVector.end(), systemSort);
|
std::sort(SystemData::sSystemVector.begin(), SystemData::sSystemVector.end(), systemSort);
|
||||||
|
|
||||||
// move RetroPie system to end, before auto collections
|
// move RetroPie system to end, before auto collections
|
||||||
for(auto sysIt = SystemData::sSystemVector.begin(); sysIt != SystemData::sSystemVector.end(); )
|
for(auto sysIt = SystemData::sSystemVector.cbegin(); sysIt != SystemData::sSystemVector.cend(); )
|
||||||
{
|
{
|
||||||
if ((*sysIt)->getName() == "retropie")
|
if ((*sysIt)->getName() == "retropie")
|
||||||
{
|
{
|
||||||
|
@ -204,7 +204,7 @@ void CollectionSystemManager::updateSystemsList()
|
||||||
addEnabledCollectionsToDisplayedSystems(&mAutoCollectionSystemsData);
|
addEnabledCollectionsToDisplayedSystems(&mAutoCollectionSystemsData);
|
||||||
|
|
||||||
// create views for collections, before reload
|
// create views for collections, before reload
|
||||||
for(auto sysIt = SystemData::sSystemVector.begin(); sysIt != SystemData::sSystemVector.end(); sysIt++)
|
for(auto sysIt = SystemData::sSystemVector.cbegin(); sysIt != SystemData::sSystemVector.cend(); sysIt++)
|
||||||
{
|
{
|
||||||
if ((*sysIt)->isCollection())
|
if ((*sysIt)->isCollection())
|
||||||
{
|
{
|
||||||
|
@ -227,10 +227,10 @@ void CollectionSystemManager::refreshCollectionSystems(FileData* file)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::map<std::string, CollectionSystemData> allCollections;
|
std::map<std::string, CollectionSystemData> allCollections;
|
||||||
allCollections.insert(mAutoCollectionSystemsData.begin(), mAutoCollectionSystemsData.end());
|
allCollections.insert(mAutoCollectionSystemsData.cbegin(), mAutoCollectionSystemsData.cend());
|
||||||
allCollections.insert(mCustomCollectionSystemsData.begin(), mCustomCollectionSystemsData.end());
|
allCollections.insert(mCustomCollectionSystemsData.cbegin(), mCustomCollectionSystemsData.cend());
|
||||||
|
|
||||||
for(auto sysDataIt = allCollections.begin(); sysDataIt != allCollections.end(); sysDataIt++)
|
for(auto sysDataIt = allCollections.cbegin(); sysDataIt != allCollections.cend(); sysDataIt++)
|
||||||
{
|
{
|
||||||
updateCollectionSystem(file, sysDataIt->second);
|
updateCollectionSystem(file, sysDataIt->second);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
|
||||||
|
|
||||||
SystemData* curSys = sysData.system;
|
SystemData* curSys = sysData.system;
|
||||||
const std::unordered_map<std::string, FileData*>& children = curSys->getRootFolder()->getChildrenByFilename();
|
const std::unordered_map<std::string, FileData*>& children = curSys->getRootFolder()->getChildrenByFilename();
|
||||||
bool found = children.find(key) != children.end();
|
bool found = children.find(key) != children.cend();
|
||||||
FileData* rootFolder = curSys->getRootFolder();
|
FileData* rootFolder = curSys->getRootFolder();
|
||||||
FileFilterIndex* fileIndex = curSys->getIndex();
|
FileFilterIndex* fileIndex = curSys->getIndex();
|
||||||
std::string name = curSys->getName();
|
std::string name = curSys->getName();
|
||||||
|
@ -292,8 +292,8 @@ void CollectionSystemManager::deleteCollectionFiles(FileData* file)
|
||||||
std::string key = file->getFullPath();
|
std::string key = file->getFullPath();
|
||||||
// find games in collection systems
|
// find games in collection systems
|
||||||
std::map<std::string, CollectionSystemData> allCollections;
|
std::map<std::string, CollectionSystemData> allCollections;
|
||||||
allCollections.insert(mAutoCollectionSystemsData.begin(), mAutoCollectionSystemsData.end());
|
allCollections.insert(mAutoCollectionSystemsData.cbegin(), mAutoCollectionSystemsData.cend());
|
||||||
allCollections.insert(mCustomCollectionSystemsData.begin(), mCustomCollectionSystemsData.end());
|
allCollections.insert(mCustomCollectionSystemsData.cbegin(), mCustomCollectionSystemsData.cend());
|
||||||
|
|
||||||
for(auto sysDataIt = allCollections.begin(); sysDataIt != allCollections.end(); sysDataIt++)
|
for(auto sysDataIt = allCollections.begin(); sysDataIt != allCollections.end(); sysDataIt++)
|
||||||
{
|
{
|
||||||
|
@ -301,7 +301,7 @@ void CollectionSystemManager::deleteCollectionFiles(FileData* file)
|
||||||
{
|
{
|
||||||
const std::unordered_map<std::string, FileData*>& children = (sysDataIt->second.system)->getRootFolder()->getChildrenByFilename();
|
const std::unordered_map<std::string, FileData*>& children = (sysDataIt->second.system)->getRootFolder()->getChildrenByFilename();
|
||||||
|
|
||||||
bool found = children.find(key) != children.end();
|
bool found = children.find(key) != children.cend();
|
||||||
if (found) {
|
if (found) {
|
||||||
sysDataIt->second.needsSave = true;
|
sysDataIt->second.needsSave = true;
|
||||||
FileData* collectionEntry = children.at(key);
|
FileData* collectionEntry = children.at(key);
|
||||||
|
@ -316,7 +316,7 @@ void CollectionSystemManager::deleteCollectionFiles(FileData* file)
|
||||||
bool CollectionSystemManager::isThemeGenericCollectionCompatible(bool genericCustomCollections)
|
bool CollectionSystemManager::isThemeGenericCollectionCompatible(bool genericCustomCollections)
|
||||||
{
|
{
|
||||||
std::vector<std::string> cfgSys = getCollectionThemeFolders(genericCustomCollections);
|
std::vector<std::string> cfgSys = getCollectionThemeFolders(genericCustomCollections);
|
||||||
for(auto sysIt = cfgSys.begin(); sysIt != cfgSys.end(); sysIt++)
|
for(auto sysIt = cfgSys.cbegin(); sysIt != cfgSys.cend(); sysIt++)
|
||||||
{
|
{
|
||||||
if(!themeFolderExists(*sysIt))
|
if(!themeFolderExists(*sysIt))
|
||||||
return false;
|
return false;
|
||||||
|
@ -332,7 +332,7 @@ bool CollectionSystemManager::isThemeCustomCollectionCompatible(std::vector<std:
|
||||||
// get theme path
|
// get theme path
|
||||||
auto themeSets = ThemeData::getThemeSets();
|
auto themeSets = ThemeData::getThemeSets();
|
||||||
auto set = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
auto set = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||||
if(set != themeSets.end())
|
if(set != themeSets.cend())
|
||||||
{
|
{
|
||||||
std::string defaultThemeFilePath = set->second.path.string() + "/theme.xml";
|
std::string defaultThemeFilePath = set->second.path.string() + "/theme.xml";
|
||||||
if (fs::exists(defaultThemeFilePath))
|
if (fs::exists(defaultThemeFilePath))
|
||||||
|
@ -341,7 +341,7 @@ bool CollectionSystemManager::isThemeCustomCollectionCompatible(std::vector<std:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto sysIt = stringVector.begin(); sysIt != stringVector.end(); sysIt++)
|
for(auto sysIt = stringVector.cbegin(); sysIt != stringVector.cend(); sysIt++)
|
||||||
{
|
{
|
||||||
if(!themeFolderExists(*sysIt))
|
if(!themeFolderExists(*sysIt))
|
||||||
return false;
|
return false;
|
||||||
|
@ -380,10 +380,10 @@ std::string CollectionSystemManager::getValidNewCollectionName(std::string inNam
|
||||||
// get folders assigned to user collections
|
// get folders assigned to user collections
|
||||||
std::vector<std::string> userSys = getUserCollectionThemeFolders();
|
std::vector<std::string> userSys = getUserCollectionThemeFolders();
|
||||||
// add them all to the list of systems in use
|
// add them all to the list of systems in use
|
||||||
systemsInUse.insert(systemsInUse.end(), autoSys.begin(), autoSys.end());
|
systemsInUse.insert(systemsInUse.cend(), autoSys.cbegin(), autoSys.cend());
|
||||||
systemsInUse.insert(systemsInUse.end(), customSys.begin(), customSys.end());
|
systemsInUse.insert(systemsInUse.cend(), customSys.cbegin(), customSys.cend());
|
||||||
systemsInUse.insert(systemsInUse.end(), userSys.begin(), userSys.end());
|
systemsInUse.insert(systemsInUse.cend(), userSys.cbegin(), userSys.cend());
|
||||||
for(auto sysIt = systemsInUse.begin(); sysIt != systemsInUse.end(); sysIt++)
|
for(auto sysIt = systemsInUse.cbegin(); sysIt != systemsInUse.cend(); sysIt++)
|
||||||
{
|
{
|
||||||
if (*sysIt == name)
|
if (*sysIt == name)
|
||||||
{
|
{
|
||||||
|
@ -394,14 +394,14 @@ std::string CollectionSystemManager::getValidNewCollectionName(std::string inNam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if it matches one of the custom collections reserved names
|
// if it matches one of the custom collections reserved names
|
||||||
if (mCollectionSystemDeclsIndex.find(name) != mCollectionSystemDeclsIndex.end())
|
if (mCollectionSystemDeclsIndex.find(name) != mCollectionSystemDeclsIndex.cend())
|
||||||
return getValidNewCollectionName(name, index+1);
|
return getValidNewCollectionName(name, index+1);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionSystemManager::setEditMode(std::string collectionName)
|
void CollectionSystemManager::setEditMode(std::string collectionName)
|
||||||
{
|
{
|
||||||
if (mCustomCollectionSystemsData.find(collectionName) == mCustomCollectionSystemsData.end())
|
if (mCustomCollectionSystemsData.find(collectionName) == mCustomCollectionSystemsData.cend())
|
||||||
{
|
{
|
||||||
LOG(LogError) << "Tried to edit a non-existing collection: " << collectionName;
|
LOG(LogError) << "Tried to edit a non-existing collection: " << collectionName;
|
||||||
return;
|
return;
|
||||||
|
@ -449,7 +449,7 @@ bool CollectionSystemManager::toggleGameInCollection(FileData* file)
|
||||||
std::string key = file->getFullPath();
|
std::string key = file->getFullPath();
|
||||||
FileData* rootFolder = sysData->getRootFolder();
|
FileData* rootFolder = sysData->getRootFolder();
|
||||||
const std::unordered_map<std::string, FileData*>& children = rootFolder->getChildrenByFilename();
|
const std::unordered_map<std::string, FileData*>& children = rootFolder->getChildrenByFilename();
|
||||||
bool found = children.find(key) != children.end();
|
bool found = children.find(key) != children.cend();
|
||||||
FileFilterIndex* fileIndex = sysData->getIndex();
|
FileFilterIndex* fileIndex = sysData->getIndex();
|
||||||
std::string name = sysData->getName();
|
std::string name = sysData->getName();
|
||||||
|
|
||||||
|
@ -523,7 +523,7 @@ SystemData* CollectionSystemManager::getSystemToView(SystemData* sys)
|
||||||
const std::unordered_map<std::string, FileData*>& bundleChildren = bundleRootFolder->getChildrenByFilename();
|
const std::unordered_map<std::string, FileData*>& bundleChildren = bundleRootFolder->getChildrenByFilename();
|
||||||
|
|
||||||
// is the rootFolder bundled in the "My Collections" system?
|
// is the rootFolder bundled in the "My Collections" system?
|
||||||
bool sysFoundInBundle = bundleChildren.find(rootFolder->getKey()) != bundleChildren.end();
|
bool sysFoundInBundle = bundleChildren.find(rootFolder->getKey()) != bundleChildren.cend();
|
||||||
|
|
||||||
if (sysFoundInBundle && sys->isCollection())
|
if (sysFoundInBundle && sys->isCollection())
|
||||||
{
|
{
|
||||||
|
@ -536,7 +536,7 @@ SystemData* CollectionSystemManager::getSystemToView(SystemData* sys)
|
||||||
// loads Automatic Collection systems (All, Favorites, Last Played)
|
// loads Automatic Collection systems (All, Favorites, Last Played)
|
||||||
void CollectionSystemManager::initAutoCollectionSystems()
|
void CollectionSystemManager::initAutoCollectionSystems()
|
||||||
{
|
{
|
||||||
for(std::map<std::string, CollectionSystemDecl>::iterator it = mCollectionSystemDeclsIndex.begin() ; it != mCollectionSystemDeclsIndex.end() ; it++ )
|
for(std::map<std::string, CollectionSystemDecl>::const_iterator it = mCollectionSystemDeclsIndex.cbegin() ; it != mCollectionSystemDeclsIndex.cend() ; it++ )
|
||||||
{
|
{
|
||||||
CollectionSystemDecl sysDecl = it->second;
|
CollectionSystemDecl sysDecl = it->second;
|
||||||
if (!sysDecl.isCustom)
|
if (!sysDecl.isCustom)
|
||||||
|
@ -567,7 +567,7 @@ void CollectionSystemManager::updateCollectionFolderMetadata(SystemData* sys)
|
||||||
{
|
{
|
||||||
std::string games_list = "";
|
std::string games_list = "";
|
||||||
int games_counter = 0;
|
int games_counter = 0;
|
||||||
for(std::unordered_map<std::string, FileData*>::iterator iter = games.begin(); iter != games.end(); ++iter)
|
for(std::unordered_map<std::string, FileData*>::const_iterator iter = games.cbegin(); iter != games.cend(); ++iter)
|
||||||
{
|
{
|
||||||
games_counter++;
|
games_counter++;
|
||||||
FileData* file = iter->second;
|
FileData* file = iter->second;
|
||||||
|
@ -619,7 +619,7 @@ void CollectionSystemManager::updateCollectionFolderMetadata(SystemData* sys)
|
||||||
void CollectionSystemManager::initCustomCollectionSystems()
|
void CollectionSystemManager::initCustomCollectionSystems()
|
||||||
{
|
{
|
||||||
std::vector<std::string> systems = getCollectionsFromConfigFolder();
|
std::vector<std::string> systems = getCollectionsFromConfigFolder();
|
||||||
for (auto nameIt = systems.begin(); nameIt != systems.end(); nameIt++)
|
for (auto nameIt = systems.cbegin(); nameIt != systems.cend(); nameIt++)
|
||||||
{
|
{
|
||||||
addNewCustomCollection(*nameIt);
|
addNewCustomCollection(*nameIt);
|
||||||
}
|
}
|
||||||
|
@ -678,12 +678,12 @@ void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysDa
|
||||||
CollectionSystemDecl sysDecl = sysData->decl;
|
CollectionSystemDecl sysDecl = sysData->decl;
|
||||||
FileData* rootFolder = newSys->getRootFolder();
|
FileData* rootFolder = newSys->getRootFolder();
|
||||||
FileFilterIndex* index = newSys->getIndex();
|
FileFilterIndex* index = newSys->getIndex();
|
||||||
for(auto sysIt = SystemData::sSystemVector.begin(); sysIt != SystemData::sSystemVector.end(); sysIt++)
|
for(auto sysIt = SystemData::sSystemVector.cbegin(); sysIt != SystemData::sSystemVector.cend(); sysIt++)
|
||||||
{
|
{
|
||||||
// we won't iterate all collections
|
// we won't iterate all collections
|
||||||
if ((*sysIt)->isGameSystem() && !(*sysIt)->isCollection()) {
|
if ((*sysIt)->isGameSystem() && !(*sysIt)->isCollection()) {
|
||||||
std::vector<FileData*> files = (*sysIt)->getRootFolder()->getFilesRecursive(GAME);
|
std::vector<FileData*> files = (*sysIt)->getRootFolder()->getFilesRecursive(GAME);
|
||||||
for(auto gameIt = files.begin(); gameIt != files.end(); gameIt++)
|
for(auto gameIt = files.cbegin(); gameIt != files.cend(); gameIt++)
|
||||||
{
|
{
|
||||||
bool include = includeFileInAutoCollections((*gameIt));
|
bool include = includeFileInAutoCollections((*gameIt));
|
||||||
switch(sysDecl.type) {
|
switch(sysDecl.type) {
|
||||||
|
@ -736,8 +736,8 @@ void CollectionSystemManager::populateCustomCollection(CollectionSystemData* sys
|
||||||
|
|
||||||
for(std::string gameKey; getline(input, gameKey); )
|
for(std::string gameKey; getline(input, gameKey); )
|
||||||
{
|
{
|
||||||
std::unordered_map<std::string,FileData*>::iterator it = allFilesMap.find(gameKey);
|
std::unordered_map<std::string,FileData*>::const_iterator it = allFilesMap.find(gameKey);
|
||||||
if (it != allFilesMap.end()) {
|
if (it != allFilesMap.cend()) {
|
||||||
CollectionFileData* newGame = new CollectionFileData(it->second, newSys);
|
CollectionFileData* newGame = new CollectionFileData(it->second, newSys);
|
||||||
rootFolder->addChild(newGame);
|
rootFolder->addChild(newGame);
|
||||||
index->addToIndex(newGame);
|
index->addToIndex(newGame);
|
||||||
|
@ -755,7 +755,7 @@ void CollectionSystemManager::populateCustomCollection(CollectionSystemData* sys
|
||||||
void CollectionSystemManager::removeCollectionsFromDisplayedSystems()
|
void CollectionSystemManager::removeCollectionsFromDisplayedSystems()
|
||||||
{
|
{
|
||||||
// remove all Collection Systems
|
// remove all Collection Systems
|
||||||
for(auto sysIt = SystemData::sSystemVector.begin(); sysIt != SystemData::sSystemVector.end(); )
|
for(auto sysIt = SystemData::sSystemVector.cbegin(); sysIt != SystemData::sSystemVector.cend(); )
|
||||||
{
|
{
|
||||||
if ((*sysIt)->isCollection())
|
if ((*sysIt)->isCollection())
|
||||||
{
|
{
|
||||||
|
@ -771,7 +771,7 @@ void CollectionSystemManager::removeCollectionsFromDisplayedSystems()
|
||||||
// this should not delete the objects from memory!
|
// this should not delete the objects from memory!
|
||||||
FileData* customRoot = mCustomCollectionsBundle->getRootFolder();
|
FileData* customRoot = mCustomCollectionsBundle->getRootFolder();
|
||||||
std::vector<FileData*> mChildren = customRoot->getChildren();
|
std::vector<FileData*> mChildren = customRoot->getChildren();
|
||||||
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
|
for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
|
||||||
{
|
{
|
||||||
customRoot->removeChild(*it);
|
customRoot->removeChild(*it);
|
||||||
}
|
}
|
||||||
|
@ -866,11 +866,11 @@ std::vector<std::string> CollectionSystemManager::getSystemsFromTheme()
|
||||||
return systems;
|
return systems;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto set = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
std::map<std::string, ThemeSet>::const_iterator set = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||||
if(set == themeSets.end())
|
if(set == themeSets.cend())
|
||||||
{
|
{
|
||||||
// currently selected theme set is missing, so just pick the first available set
|
// currently selected theme set is missing, so just pick the first available set
|
||||||
set = themeSets.begin();
|
set = themeSets.cbegin();
|
||||||
Settings::getInstance()->setString("ThemeSet", set->first);
|
Settings::getInstance()->setString("ThemeSet", set->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,13 +912,13 @@ std::vector<std::string> CollectionSystemManager::getUnusedSystemsFromTheme()
|
||||||
// get folders assigned to user collections
|
// get folders assigned to user collections
|
||||||
std::vector<std::string> userSys = getUserCollectionThemeFolders();
|
std::vector<std::string> userSys = getUserCollectionThemeFolders();
|
||||||
// add them all to the list of systems in use
|
// add them all to the list of systems in use
|
||||||
systemsInUse.insert(systemsInUse.end(), autoSys.begin(), autoSys.end());
|
systemsInUse.insert(systemsInUse.cend(), autoSys.cbegin(), autoSys.cend());
|
||||||
systemsInUse.insert(systemsInUse.end(), customSys.begin(), customSys.end());
|
systemsInUse.insert(systemsInUse.cend(), customSys.cbegin(), customSys.cend());
|
||||||
systemsInUse.insert(systemsInUse.end(), userSys.begin(), userSys.end());
|
systemsInUse.insert(systemsInUse.cend(), userSys.cbegin(), userSys.cend());
|
||||||
|
|
||||||
for(auto sysIt = themeSys.begin(); sysIt != themeSys.end(); )
|
for(auto sysIt = themeSys.cbegin(); sysIt != themeSys.cend(); )
|
||||||
{
|
{
|
||||||
if (std::find(systemsInUse.begin(), systemsInUse.end(), *sysIt) != systemsInUse.end())
|
if (std::find(systemsInUse.cbegin(), systemsInUse.cend(), *sysIt) != systemsInUse.cend())
|
||||||
{
|
{
|
||||||
sysIt = themeSys.erase(sysIt);
|
sysIt = themeSys.erase(sysIt);
|
||||||
}
|
}
|
||||||
|
@ -967,7 +967,7 @@ std::vector<std::string> CollectionSystemManager::getCollectionsFromConfigFolder
|
||||||
std::vector<std::string> CollectionSystemManager::getCollectionThemeFolders(bool custom)
|
std::vector<std::string> CollectionSystemManager::getCollectionThemeFolders(bool custom)
|
||||||
{
|
{
|
||||||
std::vector<std::string> systems;
|
std::vector<std::string> systems;
|
||||||
for(std::map<std::string, CollectionSystemDecl>::iterator it = mCollectionSystemDeclsIndex.begin() ; it != mCollectionSystemDeclsIndex.end() ; it++ )
|
for(std::map<std::string, CollectionSystemDecl>::const_iterator it = mCollectionSystemDeclsIndex.cbegin() ; it != mCollectionSystemDeclsIndex.cend() ; it++ )
|
||||||
{
|
{
|
||||||
CollectionSystemDecl sysDecl = it->second;
|
CollectionSystemDecl sysDecl = it->second;
|
||||||
if (sysDecl.isCustom == custom)
|
if (sysDecl.isCustom == custom)
|
||||||
|
@ -982,7 +982,7 @@ std::vector<std::string> CollectionSystemManager::getCollectionThemeFolders(bool
|
||||||
std::vector<std::string> CollectionSystemManager::getUserCollectionThemeFolders()
|
std::vector<std::string> CollectionSystemManager::getUserCollectionThemeFolders()
|
||||||
{
|
{
|
||||||
std::vector<std::string> systems;
|
std::vector<std::string> systems;
|
||||||
for(std::map<std::string, CollectionSystemData>::iterator it = mCustomCollectionSystemsData.begin() ; it != mCustomCollectionSystemsData.end() ; it++ )
|
for(std::map<std::string, CollectionSystemData>::const_iterator it = mCustomCollectionSystemsData.cbegin() ; it != mCustomCollectionSystemsData.cend() ; it++ )
|
||||||
{
|
{
|
||||||
systems.push_back(it->second.decl.themeFolder);
|
systems.push_back(it->second.decl.themeFolder);
|
||||||
}
|
}
|
||||||
|
@ -993,7 +993,7 @@ std::vector<std::string> CollectionSystemManager::getUserCollectionThemeFolders(
|
||||||
bool CollectionSystemManager::themeFolderExists(std::string folder)
|
bool CollectionSystemManager::themeFolderExists(std::string folder)
|
||||||
{
|
{
|
||||||
std::vector<std::string> themeSys = getSystemsFromTheme();
|
std::vector<std::string> themeSys = getSystemsFromTheme();
|
||||||
return std::find(themeSys.begin(), themeSys.end(), folder) != themeSys.end();
|
return std::find(themeSys.cbegin(), themeSys.cend(), folder) != themeSys.cend();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CollectionSystemManager::includeFileInAutoCollections(FileData* file)
|
bool CollectionSystemManager::includeFileInAutoCollections(FileData* file)
|
||||||
|
@ -1020,7 +1020,7 @@ bool systemSort(SystemData* sys1, SystemData* sys2)
|
||||||
{
|
{
|
||||||
std::string name1 = sys1->getName();
|
std::string name1 = sys1->getName();
|
||||||
std::string name2 = sys2->getName();
|
std::string name2 = sys2->getName();
|
||||||
transform(name1.begin(), name1.end(), name1.begin(), ::toupper);
|
transform(name1.cbegin(), name1.cend(), name1.begin(), ::toupper);
|
||||||
transform(name2.begin(), name2.end(), name2.begin(), ::toupper);
|
transform(name2.cbegin(), name2.cend(), name2.begin(), ::toupper);
|
||||||
return name1.compare(name2) < 0;
|
return name1.compare(name2) < 0;
|
||||||
}
|
}
|
|
@ -88,7 +88,7 @@ const std::vector<FileData*>& FileData::getChildrenListToDisplay() {
|
||||||
FileFilterIndex* idx = CollectionSystemManager::get()->getSystemToView(mSystem)->getIndex();
|
FileFilterIndex* idx = CollectionSystemManager::get()->getSystemToView(mSystem)->getIndex();
|
||||||
if (idx->isFiltered()) {
|
if (idx->isFiltered()) {
|
||||||
mFilteredChildren.clear();
|
mFilteredChildren.clear();
|
||||||
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
|
for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
|
||||||
{
|
{
|
||||||
if (idx->showFile((*it))) {
|
if (idx->showFile((*it))) {
|
||||||
mFilteredChildren.push_back(*it);
|
mFilteredChildren.push_back(*it);
|
||||||
|
@ -167,7 +167,7 @@ std::vector<FileData*> FileData::getFilesRecursive(unsigned int typeMask, bool d
|
||||||
std::vector<FileData*> out;
|
std::vector<FileData*> out;
|
||||||
FileFilterIndex* idx = mSystem->getIndex();
|
FileFilterIndex* idx = mSystem->getIndex();
|
||||||
|
|
||||||
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
|
for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
|
||||||
{
|
{
|
||||||
if((*it)->getType() & typeMask)
|
if((*it)->getType() & typeMask)
|
||||||
{
|
{
|
||||||
|
@ -178,7 +178,7 @@ std::vector<FileData*> FileData::getFilesRecursive(unsigned int typeMask, bool d
|
||||||
if((*it)->getChildren().size() > 0)
|
if((*it)->getChildren().size() > 0)
|
||||||
{
|
{
|
||||||
std::vector<FileData*> subchildren = (*it)->getFilesRecursive(typeMask, displayedOnly);
|
std::vector<FileData*> subchildren = (*it)->getFilesRecursive(typeMask, displayedOnly);
|
||||||
out.insert(out.end(), subchildren.cbegin(), subchildren.cend());
|
out.insert(out.cend(), subchildren.cbegin(), subchildren.cend());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ void FileData::addChild(FileData* file)
|
||||||
assert(file->getParent() == NULL);
|
assert(file->getParent() == NULL);
|
||||||
|
|
||||||
const std::string key = file->getKey();
|
const std::string key = file->getKey();
|
||||||
if (mChildrenByFilename.find(key) == mChildrenByFilename.end())
|
if (mChildrenByFilename.find(key) == mChildrenByFilename.cend())
|
||||||
{
|
{
|
||||||
mChildrenByFilename[key] = file;
|
mChildrenByFilename[key] = file;
|
||||||
mChildren.push_back(file);
|
mChildren.push_back(file);
|
||||||
|
@ -213,7 +213,7 @@ void FileData::removeChild(FileData* file)
|
||||||
assert(mType == FOLDER);
|
assert(mType == FOLDER);
|
||||||
assert(file->getParent() == this);
|
assert(file->getParent() == this);
|
||||||
mChildrenByFilename.erase(file->getKey());
|
mChildrenByFilename.erase(file->getKey());
|
||||||
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
|
for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
|
||||||
{
|
{
|
||||||
if(*it == file)
|
if(*it == file)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +232,7 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending)
|
||||||
{
|
{
|
||||||
std::stable_sort(mChildren.begin(), mChildren.end(), comparator);
|
std::stable_sort(mChildren.begin(), mChildren.end(), comparator);
|
||||||
|
|
||||||
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
|
for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
|
||||||
{
|
{
|
||||||
if((*it)->getChildren().size() > 0)
|
if((*it)->getChildren().size() > 0)
|
||||||
(*it)->sort(comparator, ascending);
|
(*it)->sort(comparator, ascending);
|
||||||
|
|
|
@ -58,11 +58,11 @@ void FileFilterIndex::importIndex(FileFilterIndex* indexToImport)
|
||||||
|
|
||||||
std::vector<IndexImportStructure> indexImportDecl = std::vector<IndexImportStructure>(indexStructDecls, indexStructDecls + sizeof(indexStructDecls) / sizeof(indexStructDecls[0]));
|
std::vector<IndexImportStructure> indexImportDecl = std::vector<IndexImportStructure>(indexStructDecls, indexStructDecls + sizeof(indexStructDecls) / sizeof(indexStructDecls[0]));
|
||||||
|
|
||||||
for (std::vector<IndexImportStructure>::iterator indexesIt = indexImportDecl.begin(); indexesIt != indexImportDecl.end(); ++indexesIt )
|
for (std::vector<IndexImportStructure>::const_iterator indexesIt = indexImportDecl.cbegin(); indexesIt != indexImportDecl.cend(); ++indexesIt )
|
||||||
{
|
{
|
||||||
for (std::map<std::string, int>::iterator sourceIt = (*indexesIt).sourceIndex->begin(); sourceIt != (*indexesIt).sourceIndex->end(); ++sourceIt )
|
for (std::map<std::string, int>::const_iterator sourceIt = (*indexesIt).sourceIndex->cbegin(); sourceIt != (*indexesIt).sourceIndex->cend(); ++sourceIt )
|
||||||
{
|
{
|
||||||
if ((*indexesIt).destinationIndex->find((*sourceIt).first) == (*indexesIt).destinationIndex->end())
|
if ((*indexesIt).destinationIndex->find((*sourceIt).first) == (*indexesIt).destinationIndex->cend())
|
||||||
{
|
{
|
||||||
// entry doesn't exist
|
// entry doesn't exist
|
||||||
(*((*indexesIt).destinationIndex))[(*sourceIt).first] = (*sourceIt).second;
|
(*((*indexesIt).destinationIndex))[(*sourceIt).first] = (*sourceIt).second;
|
||||||
|
@ -211,15 +211,15 @@ void FileFilterIndex::setFilter(FilterIndexType type, std::vector<std::string>*
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (std::vector<FilterDataDecl>::iterator it = filterDataDecl.begin(); it != filterDataDecl.end(); ++it ) {
|
for (std::vector<FilterDataDecl>::const_iterator it = filterDataDecl.cbegin(); it != filterDataDecl.cend(); ++it ) {
|
||||||
if ((*it).type == type)
|
if ((*it).type == type)
|
||||||
{
|
{
|
||||||
FilterDataDecl filterData = (*it);
|
FilterDataDecl filterData = (*it);
|
||||||
*(filterData.filteredByRef) = values->size() > 0;
|
*(filterData.filteredByRef) = values->size() > 0;
|
||||||
filterData.currentFilteredKeys->clear();
|
filterData.currentFilteredKeys->clear();
|
||||||
for (std::vector<std::string>::iterator vit = values->begin(); vit != values->end(); ++vit ) {
|
for (std::vector<std::string>::const_iterator vit = values->cbegin(); vit != values->cend(); ++vit ) {
|
||||||
// check if exists
|
// check if exists
|
||||||
if (filterData.allIndexKeys->find(*vit) != filterData.allIndexKeys->end()) {
|
if (filterData.allIndexKeys->find(*vit) != filterData.allIndexKeys->cend()) {
|
||||||
filterData.currentFilteredKeys->push_back(std::string(*vit));
|
filterData.currentFilteredKeys->push_back(std::string(*vit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ void FileFilterIndex::setFilter(FilterIndexType type, std::vector<std::string>*
|
||||||
|
|
||||||
void FileFilterIndex::clearAllFilters()
|
void FileFilterIndex::clearAllFilters()
|
||||||
{
|
{
|
||||||
for (std::vector<FilterDataDecl>::iterator it = filterDataDecl.begin(); it != filterDataDecl.end(); ++it )
|
for (std::vector<FilterDataDecl>::const_iterator it = filterDataDecl.cbegin(); it != filterDataDecl.cend(); ++it )
|
||||||
{
|
{
|
||||||
FilterDataDecl filterData = (*it);
|
FilterDataDecl filterData = (*it);
|
||||||
*(filterData.filteredByRef) = false;
|
*(filterData.filteredByRef) = false;
|
||||||
|
@ -300,7 +300,7 @@ bool FileFilterIndex::showFile(FileData* game)
|
||||||
std::vector<FileData*> children = game->getChildren();
|
std::vector<FileData*> children = game->getChildren();
|
||||||
// iterate through all of the children, until there's a match
|
// iterate through all of the children, until there's a match
|
||||||
|
|
||||||
for (std::vector<FileData*>::iterator it = children.begin(); it != children.end(); ++it ) {
|
for (std::vector<FileData*>::const_iterator it = children.cbegin(); it != children.cend(); ++it ) {
|
||||||
if (showFile(*it))
|
if (showFile(*it))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -311,7 +311,7 @@ bool FileFilterIndex::showFile(FileData* game)
|
||||||
|
|
||||||
bool keepGoing = false;
|
bool keepGoing = false;
|
||||||
|
|
||||||
for (std::vector<FilterDataDecl>::iterator it = filterDataDecl.begin(); it != filterDataDecl.end(); ++it ) {
|
for (std::vector<FilterDataDecl>::const_iterator it = filterDataDecl.cbegin(); it != filterDataDecl.cend(); ++it ) {
|
||||||
FilterDataDecl filterData = (*it);
|
FilterDataDecl filterData = (*it);
|
||||||
if(*(filterData.filteredByRef))
|
if(*(filterData.filteredByRef))
|
||||||
{
|
{
|
||||||
|
@ -352,7 +352,7 @@ bool FileFilterIndex::isKeyBeingFilteredBy(std::string key, FilterIndexType type
|
||||||
{
|
{
|
||||||
if (filterTypes[i] == type)
|
if (filterTypes[i] == type)
|
||||||
{
|
{
|
||||||
for (std::vector<std::string>::iterator it = filterKeysList[i].begin(); it != filterKeysList[i].end(); ++it )
|
for (std::vector<std::string>::const_iterator it = filterKeysList[i].cbegin(); it != filterKeysList[i].cend(); ++it )
|
||||||
{
|
{
|
||||||
if (key == (*it))
|
if (key == (*it))
|
||||||
{
|
{
|
||||||
|
@ -503,7 +503,7 @@ void FileFilterIndex::manageIndexEntry(std::map<std::string, int>* index, std::s
|
||||||
return;
|
return;
|
||||||
if (remove) {
|
if (remove) {
|
||||||
// removing entry
|
// removing entry
|
||||||
if (index->find(key) == index->end())
|
if (index->find(key) == index->cend())
|
||||||
{
|
{
|
||||||
// this shouldn't happen
|
// this shouldn't happen
|
||||||
LOG(LogInfo) << "Couldn't find entry in index! " << key;
|
LOG(LogInfo) << "Couldn't find entry in index! " << key;
|
||||||
|
@ -519,7 +519,7 @@ void FileFilterIndex::manageIndexEntry(std::map<std::string, int>* index, std::s
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// adding entry
|
// adding entry
|
||||||
if (index->find(key) == index->end())
|
if (index->find(key) == index->cend())
|
||||||
{
|
{
|
||||||
(*index)[key] = 1;
|
(*index)[key] = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,8 @@ namespace FileSorts
|
||||||
// we compare the actual metadata name, as collection files have the system appended which messes up the order
|
// we compare the actual metadata name, as collection files have the system appended which messes up the order
|
||||||
std::string name1 = file1->metadata.get("name");
|
std::string name1 = file1->metadata.get("name");
|
||||||
std::string name2 = file2->metadata.get("name");
|
std::string name2 = file2->metadata.get("name");
|
||||||
transform(name1.begin(), name1.end(), name1.begin(), ::toupper);
|
transform(name1.cbegin(), name1.cend(), name1.begin(), ::toupper);
|
||||||
transform(name2.begin(), name2.end(), name2.begin(), ::toupper);
|
transform(name2.cbegin(), name2.cend(), name2.begin(), ::toupper);
|
||||||
return name1.compare(name2) < 0;
|
return name1.compare(name2) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ namespace FileSorts
|
||||||
{
|
{
|
||||||
std::string genre1 = file1->metadata.get("genre");
|
std::string genre1 = file1->metadata.get("genre");
|
||||||
std::string genre2 = file2->metadata.get("genre");
|
std::string genre2 = file2->metadata.get("genre");
|
||||||
transform(genre1.begin(), genre1.end(), genre1.begin(), ::toupper);
|
transform(genre1.cbegin(), genre1.cend(), genre1.begin(), ::toupper);
|
||||||
transform(genre2.begin(), genre2.end(), genre2.begin(), ::toupper);
|
transform(genre2.cbegin(), genre2.cend(), genre2.begin(), ::toupper);
|
||||||
return genre1.compare(genre2) < 0;
|
return genre1.compare(genre2) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,8 +99,8 @@ namespace FileSorts
|
||||||
{
|
{
|
||||||
std::string developer1 = file1->metadata.get("developer");
|
std::string developer1 = file1->metadata.get("developer");
|
||||||
std::string developer2 = file2->metadata.get("developer");
|
std::string developer2 = file2->metadata.get("developer");
|
||||||
transform(developer1.begin(), developer1.end(), developer1.begin(), ::toupper);
|
transform(developer1.cbegin(), developer1.cend(), developer1.begin(), ::toupper);
|
||||||
transform(developer2.begin(), developer2.end(), developer2.begin(), ::toupper);
|
transform(developer2.cbegin(), developer2.cend(), developer2.begin(), ::toupper);
|
||||||
return developer1.compare(developer2) < 0;
|
return developer1.compare(developer2) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ namespace FileSorts
|
||||||
{
|
{
|
||||||
std::string publisher1 = file1->metadata.get("publisher");
|
std::string publisher1 = file1->metadata.get("publisher");
|
||||||
std::string publisher2 = file2->metadata.get("publisher");
|
std::string publisher2 = file2->metadata.get("publisher");
|
||||||
transform(publisher1.begin(), publisher1.end(), publisher1.begin(), ::toupper);
|
transform(publisher1.cbegin(), publisher1.cend(), publisher1.begin(), ::toupper);
|
||||||
transform(publisher2.begin(), publisher2.end(), publisher2.begin(), ::toupper);
|
transform(publisher2.cbegin(), publisher2.cend(), publisher2.begin(), ::toupper);
|
||||||
return publisher1.compare(publisher2) < 0;
|
return publisher1.compare(publisher2) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ namespace FileSorts
|
||||||
{
|
{
|
||||||
std::string system1 = file1->getSystemName();
|
std::string system1 = file1->getSystemName();
|
||||||
std::string system2 = file2->getSystemName();
|
std::string system2 = file2->getSystemName();
|
||||||
transform(system1.begin(), system1.end(), system1.begin(), ::toupper);
|
transform(system1.cbegin(), system1.cend(), system1.begin(), ::toupper);
|
||||||
transform(system2.begin(), system2.end(), system2.begin(), ::toupper);
|
transform(system2.cbegin(), system2.cend(), system2.begin(), ::toupper);
|
||||||
return system1.compare(system2) < 0;
|
return system1.compare(system2) < 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@ FileData* findOrCreateFile(SystemData* system, const boost::filesystem::path& pa
|
||||||
const std::unordered_map<std::string, FileData*>& children = treeNode->getChildrenByFilename();
|
const std::unordered_map<std::string, FileData*>& children = treeNode->getChildrenByFilename();
|
||||||
|
|
||||||
std::string key = path_it->string();
|
std::string key = path_it->string();
|
||||||
found = children.find(key) != children.end();
|
found = children.find(key) != children.cend();
|
||||||
if (found) {
|
if (found) {
|
||||||
treeNode = children.at(key);
|
treeNode = children.at(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ MetaDataList::MetaDataList(MetaDataListType type)
|
||||||
: mType(type), mWasChanged(false)
|
: mType(type), mWasChanged(false)
|
||||||
{
|
{
|
||||||
const std::vector<MetaDataDecl>& mdd = getMDD();
|
const std::vector<MetaDataDecl>& mdd = getMDD();
|
||||||
for(auto iter = mdd.begin(); iter != mdd.end(); iter++)
|
for(auto iter = mdd.cbegin(); iter != mdd.cend(); iter++)
|
||||||
set(iter->key, iter->defaultValue);
|
set(iter->key, iter->defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ MetaDataList MetaDataList::createFromXML(MetaDataListType type, pugi::xml_node&
|
||||||
|
|
||||||
const std::vector<MetaDataDecl>& mdd = mdl.getMDD();
|
const std::vector<MetaDataDecl>& mdd = mdl.getMDD();
|
||||||
|
|
||||||
for(auto iter = mdd.begin(); iter != mdd.end(); iter++)
|
for(auto iter = mdd.cbegin(); iter != mdd.cend(); iter++)
|
||||||
{
|
{
|
||||||
pugi::xml_node md = node.child(iter->key.c_str());
|
pugi::xml_node md = node.child(iter->key.c_str());
|
||||||
if(md)
|
if(md)
|
||||||
|
@ -100,10 +100,10 @@ void MetaDataList::appendToXML(pugi::xml_node& parent, bool ignoreDefaults, cons
|
||||||
{
|
{
|
||||||
const std::vector<MetaDataDecl>& mdd = getMDD();
|
const std::vector<MetaDataDecl>& mdd = getMDD();
|
||||||
|
|
||||||
for(auto mddIter = mdd.begin(); mddIter != mdd.end(); mddIter++)
|
for(auto mddIter = mdd.cbegin(); mddIter != mdd.cend(); mddIter++)
|
||||||
{
|
{
|
||||||
auto mapIter = mMap.find(mddIter->key);
|
auto mapIter = mMap.find(mddIter->key);
|
||||||
if(mapIter != mMap.end())
|
if(mapIter != mMap.cend())
|
||||||
{
|
{
|
||||||
// we have this value!
|
// we have this value!
|
||||||
// if it's just the default (and we ignore defaults), don't write it
|
// if it's just the default (and we ignore defaults), don't write it
|
||||||
|
|
|
@ -68,7 +68,7 @@ int run_scraper_cmdline()
|
||||||
if(system_choice == "y" || system_choice == "Y")
|
if(system_choice == "y" || system_choice == "Y")
|
||||||
{
|
{
|
||||||
out << "Will scrape all platforms.\n";
|
out << "Will scrape all platforms.\n";
|
||||||
for(auto i = SystemData::sSystemVector.begin(); i != SystemData::sSystemVector.end(); i++)
|
for(auto i = SystemData::sSystemVector.cbegin(); i != SystemData::sSystemVector.cend(); i++)
|
||||||
{
|
{
|
||||||
out << " " << (*i)->getName() << " (" << (*i)->getGameCount() << " games)\n";
|
out << " " << (*i)->getName() << " (" << (*i)->getGameCount() << " games)\n";
|
||||||
systems.push_back(*i);
|
systems.push_back(*i);
|
||||||
|
@ -81,9 +81,9 @@ int run_scraper_cmdline()
|
||||||
out << "Type nothing and press enter when you are ready to continue.\n";
|
out << "Type nothing and press enter when you are ready to continue.\n";
|
||||||
|
|
||||||
do {
|
do {
|
||||||
for(auto i = SystemData::sSystemVector.begin(); i != SystemData::sSystemVector.end(); i++)
|
for(auto i = SystemData::sSystemVector.cbegin(); i != SystemData::sSystemVector.cend(); i++)
|
||||||
{
|
{
|
||||||
if(std::find(systems.begin(), systems.end(), (*i)) != systems.end())
|
if(std::find(systems.cbegin(), systems.cend(), (*i)) != systems.cend())
|
||||||
out << " C ";
|
out << " C ";
|
||||||
else
|
else
|
||||||
out << " ";
|
out << " ";
|
||||||
|
@ -97,7 +97,7 @@ int run_scraper_cmdline()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(auto i = SystemData::sSystemVector.begin(); i != SystemData::sSystemVector.end(); i++)
|
for(auto i = SystemData::sSystemVector.cbegin(); i != SystemData::sSystemVector.cend(); i++)
|
||||||
{
|
{
|
||||||
if((*i)->getName() == sys_name)
|
if((*i)->getName() == sys_name)
|
||||||
{
|
{
|
||||||
|
@ -145,14 +145,14 @@ int run_scraper_cmdline()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
std::shared_ptr<Scraper> scraper = Settings::getInstance()->getScraper();
|
std::shared_ptr<Scraper> scraper = Settings::getInstance()->getScraper();
|
||||||
for(auto sysIt = systems.begin(); sysIt != systems.end(); sysIt++)
|
for(auto sysIt = systems.cbegin(); sysIt != systems.cend(); sysIt++)
|
||||||
{
|
{
|
||||||
std::vector<FileData*> files = (*sysIt)->getRootFolder()->getFilesRecursive(GAME);
|
std::vector<FileData*> files = (*sysIt)->getRootFolder()->getFilesRecursive(GAME);
|
||||||
|
|
||||||
ScraperSearchParams params;
|
ScraperSearchParams params;
|
||||||
params.system = (*sysIt);
|
params.system = (*sysIt);
|
||||||
|
|
||||||
for(auto gameIt = files.begin(); gameIt != files.end(); gameIt++)
|
for(auto gameIt = files.cbegin(); gameIt != files.cend(); gameIt++)
|
||||||
{
|
{
|
||||||
params.nameOverride = "";
|
params.nameOverride = "";
|
||||||
params.game = *gameIt;
|
params.game = *gameIt;
|
||||||
|
@ -242,15 +242,15 @@ int run_scraper_cmdline()
|
||||||
out << "\n\n";
|
out << "\n\n";
|
||||||
out << "Downloading boxart...\n";
|
out << "Downloading boxart...\n";
|
||||||
|
|
||||||
for(auto sysIt = systems.begin(); sysIt != systems.end(); sysIt++)
|
for(auto sysIt = systems.cbegin(); sysIt != systems.cend(); sysIt++)
|
||||||
{
|
{
|
||||||
std::vector<FileData*> files = (*sysIt)->getRootFolder()->getFilesRecursive(GAME);
|
std::vector<FileData*> files = (*sysIt)->getRootFolder()->getFilesRecursive(GAME);
|
||||||
|
|
||||||
for(auto gameIt = files.begin(); gameIt != files.end(); gameIt++)
|
for(auto gameIt = files.cbegin(); gameIt != files.cend(); gameIt++)
|
||||||
{
|
{
|
||||||
FileData* game = *gameIt;
|
FileData* game = *gameIt;
|
||||||
const std::vector<MetaDataDecl>& mdd = game->metadata.getMDD();
|
const std::vector<MetaDataDecl>& mdd = game->metadata.getMDD();
|
||||||
for(auto i = mdd.begin(); i != mdd.end(); i++)
|
for(auto i = mdd.cbegin(); i != mdd.cend(); i++)
|
||||||
{
|
{
|
||||||
std::string key = i->key;
|
std::string key = i->key;
|
||||||
std::string url = game->metadata.get(key);
|
std::string url = game->metadata.get(key);
|
||||||
|
|
|
@ -122,7 +122,7 @@ void SystemData::populateFolder(FileData* folder)
|
||||||
//see issue #75: https://github.com/Aloshi/EmulationStation/issues/75
|
//see issue #75: https://github.com/Aloshi/EmulationStation/issues/75
|
||||||
|
|
||||||
isGame = false;
|
isGame = false;
|
||||||
if(std::find(mEnvData->mSearchExtensions.begin(), mEnvData->mSearchExtensions.end(), extension) != mEnvData->mSearchExtensions.end())
|
if(std::find(mEnvData->mSearchExtensions.cbegin(), mEnvData->mSearchExtensions.cend(), extension) != mEnvData->mSearchExtensions.cend())
|
||||||
{
|
{
|
||||||
// skip hidden files
|
// skip hidden files
|
||||||
if(!showHidden && isHidden(filePath))
|
if(!showHidden && isHidden(filePath))
|
||||||
|
@ -152,7 +152,7 @@ void SystemData::indexAllGameFilters(const FileData* folder)
|
||||||
{
|
{
|
||||||
const std::vector<FileData*>& children = folder->getChildren();
|
const std::vector<FileData*>& children = folder->getChildren();
|
||||||
|
|
||||||
for(std::vector<FileData*>::const_iterator it = children.begin(); it != children.end(); ++it)
|
for(std::vector<FileData*>::const_iterator it = children.cbegin(); it != children.cend(); ++it)
|
||||||
{
|
{
|
||||||
switch((*it)->getType())
|
switch((*it)->getType())
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ bool SystemData::loadConfig()
|
||||||
const char* platformList = system.child("platform").text().get();
|
const char* platformList = system.child("platform").text().get();
|
||||||
std::vector<std::string> platformStrs = readList(platformList);
|
std::vector<std::string> platformStrs = readList(platformList);
|
||||||
std::vector<PlatformIds::PlatformId> platformIds;
|
std::vector<PlatformIds::PlatformId> platformIds;
|
||||||
for(auto it = platformStrs.begin(); it != platformStrs.end(); it++)
|
for(auto it = platformStrs.cbegin(); it != platformStrs.cend(); it++)
|
||||||
{
|
{
|
||||||
const char* str = it->c_str();
|
const char* str = it->c_str();
|
||||||
PlatformIds::PlatformId platformId = PlatformIds::getPlatformId(str);
|
PlatformIds::PlatformId platformId = PlatformIds::getPlatformId(str);
|
||||||
|
@ -363,8 +363,8 @@ SystemData* SystemData::getNext() const
|
||||||
|
|
||||||
do {
|
do {
|
||||||
it++;
|
it++;
|
||||||
if (it == sSystemVector.end())
|
if (it == sSystemVector.cend())
|
||||||
it = sSystemVector.begin();
|
it = sSystemVector.cbegin();
|
||||||
} while ((*it)->getDisplayedGameCount() == 0);
|
} while ((*it)->getDisplayedGameCount() == 0);
|
||||||
// as we are starting in a valid gamelistview, this will always succeed, even if we have to come full circle.
|
// as we are starting in a valid gamelistview, this will always succeed, even if we have to come full circle.
|
||||||
|
|
||||||
|
@ -373,11 +373,12 @@ SystemData* SystemData::getNext() const
|
||||||
|
|
||||||
SystemData* SystemData::getPrev() const
|
SystemData* SystemData::getPrev() const
|
||||||
{
|
{
|
||||||
auto it = getRevIterator();
|
std::vector<SystemData*>::const_reverse_iterator it = getRevIterator();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
it++;
|
it++;
|
||||||
if (it == sSystemVector.rend())
|
if (it == sSystemVector.crend())
|
||||||
it = sSystemVector.rbegin();
|
it = sSystemVector.crbegin();
|
||||||
} while ((*it)->getDisplayedGameCount() == 0);
|
} while ((*it)->getDisplayedGameCount() == 0);
|
||||||
// as we are starting in a valid gamelistview, this will always succeed, even if we have to come full circle.
|
// as we are starting in a valid gamelistview, this will always succeed, even if we have to come full circle.
|
||||||
|
|
||||||
|
@ -439,7 +440,7 @@ SystemData* SystemData::getRandomSystem()
|
||||||
{
|
{
|
||||||
// this is a bit brute force. It might be more efficient to just to a while (!gameSystem) do random again...
|
// this is a bit brute force. It might be more efficient to just to a while (!gameSystem) do random again...
|
||||||
unsigned int total = 0;
|
unsigned int total = 0;
|
||||||
for(auto it = sSystemVector.begin(); it != sSystemVector.end(); it++)
|
for(auto it = sSystemVector.cbegin(); it != sSystemVector.cend(); it++)
|
||||||
{
|
{
|
||||||
if ((*it)->isGameSystem())
|
if ((*it)->isGameSystem())
|
||||||
total ++;
|
total ++;
|
||||||
|
@ -447,7 +448,7 @@ SystemData* SystemData::getRandomSystem()
|
||||||
|
|
||||||
// get random number in range
|
// get random number in range
|
||||||
int target = (int) std::round(((double)std::rand() / (double)RAND_MAX) * (total - 1));
|
int target = (int) std::round(((double)std::rand() / (double)RAND_MAX) * (total - 1));
|
||||||
for (auto it = sSystemVector.begin(); it != sSystemVector.end(); it++)
|
for (auto it = sSystemVector.cbegin(); it != sSystemVector.cend(); it++)
|
||||||
{
|
{
|
||||||
if ((*it)->isGameSystem())
|
if ((*it)->isGameSystem())
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
inline const std::string& getThemeFolder() const { return mThemeFolder; }
|
inline const std::string& getThemeFolder() const { return mThemeFolder; }
|
||||||
inline SystemEnvironmentData* getSystemEnvData() const { return mEnvData; }
|
inline SystemEnvironmentData* getSystemEnvData() const { return mEnvData; }
|
||||||
inline const std::vector<PlatformIds::PlatformId>& getPlatformIds() const { return mEnvData->mPlatformIds; }
|
inline const std::vector<PlatformIds::PlatformId>& getPlatformIds() const { return mEnvData->mPlatformIds; }
|
||||||
inline bool hasPlatformId(PlatformIds::PlatformId id) { if (!mEnvData) return false; return std::find(mEnvData->mPlatformIds.begin(), mEnvData->mPlatformIds.end(), id) != mEnvData->mPlatformIds.end(); }
|
inline bool hasPlatformId(PlatformIds::PlatformId id) { if (!mEnvData) return false; return std::find(mEnvData->mPlatformIds.cbegin(), mEnvData->mPlatformIds.cend(), id) != mEnvData->mPlatformIds.cend(); }
|
||||||
|
|
||||||
inline const std::shared_ptr<ThemeData>& getTheme() const { return mTheme; }
|
inline const std::shared_ptr<ThemeData>& getTheme() const { return mTheme; }
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ public:
|
||||||
|
|
||||||
static std::vector<SystemData*> sSystemVector;
|
static std::vector<SystemData*> sSystemVector;
|
||||||
|
|
||||||
inline std::vector<SystemData*>::const_iterator getIterator() const { return std::find(sSystemVector.begin(), sSystemVector.end(), this); };
|
inline std::vector<SystemData*>::const_iterator getIterator() const { return std::find(sSystemVector.cbegin(), sSystemVector.cend(), this); };
|
||||||
inline std::vector<SystemData*>::const_reverse_iterator getRevIterator() const { return std::find(sSystemVector.rbegin(), sSystemVector.rend(), this); };
|
inline std::vector<SystemData*>::const_reverse_iterator getRevIterator() const { return std::find(sSystemVector.crbegin(), sSystemVector.crend(), this); };
|
||||||
inline bool isCollection() { return mIsCollectionSystem; };
|
inline bool isCollection() { return mIsCollectionSystem; };
|
||||||
inline bool isGameSystem() { return mIsGameSystem; }
|
inline bool isGameSystem() { return mIsGameSystem; }
|
||||||
|
|
||||||
|
|
|
@ -259,8 +259,8 @@ void SystemScreenSaver::renderScreenSaver()
|
||||||
unsigned long SystemScreenSaver::countGameListNodes(const char *nodeName)
|
unsigned long SystemScreenSaver::countGameListNodes(const char *nodeName)
|
||||||
{
|
{
|
||||||
unsigned long nodeCount = 0;
|
unsigned long nodeCount = 0;
|
||||||
std::vector<SystemData*>:: iterator it;
|
std::vector<SystemData*>::const_iterator it;
|
||||||
for (it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); ++it)
|
for (it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); ++it)
|
||||||
{
|
{
|
||||||
// We only want images and videos from game systems that are not collections
|
// We only want images and videos from game systems that are not collections
|
||||||
if (!(*it)->isCollection() && (*it)->isGameSystem())
|
if (!(*it)->isCollection() && (*it)->isGameSystem())
|
||||||
|
@ -309,8 +309,8 @@ void SystemScreenSaver::countImages()
|
||||||
|
|
||||||
void SystemScreenSaver::pickGameListNode(unsigned long index, const char *nodeName, std::string& path)
|
void SystemScreenSaver::pickGameListNode(unsigned long index, const char *nodeName, std::string& path)
|
||||||
{
|
{
|
||||||
std::vector<SystemData*>:: iterator it;
|
std::vector<SystemData*>::const_iterator it;
|
||||||
for (it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); ++it)
|
for (it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); ++it)
|
||||||
{
|
{
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
pugi::xml_node root;
|
pugi::xml_node root;
|
||||||
|
@ -354,7 +354,7 @@ void SystemScreenSaver::pickGameListNode(unsigned long index, const char *nodeNa
|
||||||
const std::unordered_map<std::string, FileData*>& children = rootFileData->getChildrenByFilename();
|
const std::unordered_map<std::string, FileData*>& children = rootFileData->getChildrenByFilename();
|
||||||
std::unordered_map<std::string, FileData*>::const_iterator screenSaverGame = children.find(shortPath);
|
std::unordered_map<std::string, FileData*>::const_iterator screenSaverGame = children.find(shortPath);
|
||||||
|
|
||||||
if (screenSaverGame != children.end())
|
if (screenSaverGame != children.cend())
|
||||||
{
|
{
|
||||||
// Found the corresponding FileData
|
// Found the corresponding FileData
|
||||||
mCurrentGame = screenSaverGame->second;
|
mCurrentGame = screenSaverGame->second;
|
||||||
|
@ -365,10 +365,10 @@ void SystemScreenSaver::pickGameListNode(unsigned long index, const char *nodeNa
|
||||||
// iterate on children
|
// iterate on children
|
||||||
FileType type = GAME;
|
FileType type = GAME;
|
||||||
std::vector<FileData*> allFiles = rootFileData->getFilesRecursive(type);
|
std::vector<FileData*> allFiles = rootFileData->getFilesRecursive(type);
|
||||||
std::vector<FileData*>::iterator itf; // declare an iterator to a vector of strings
|
std::vector<FileData*>::const_iterator itf; // declare an iterator to a vector of strings
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(itf=allFiles.begin() ; itf < allFiles.end(); itf++,i++ ) {
|
for(itf=allFiles.cbegin() ; itf < allFiles.cend(); itf++,i++ ) {
|
||||||
if ((*itf)->getPath() == gamePath)
|
if ((*itf)->getPath() == gamePath)
|
||||||
{
|
{
|
||||||
mCurrentGame = (*itf);
|
mCurrentGame = (*itf);
|
||||||
|
|
|
@ -59,7 +59,7 @@ ScraperSearchComponent::ScraperSearchComponent(Window* window, SearchType type)
|
||||||
|
|
||||||
mMD_Grid = std::make_shared<ComponentGrid>(mWindow, Vector2i(2, mMD_Pairs.size()*2 - 1));
|
mMD_Grid = std::make_shared<ComponentGrid>(mWindow, Vector2i(2, mMD_Pairs.size()*2 - 1));
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for(auto it = mMD_Pairs.begin(); it != mMD_Pairs.end(); it++)
|
for(auto it = mMD_Pairs.cbegin(); it != mMD_Pairs.cend(); it++)
|
||||||
{
|
{
|
||||||
mMD_Grid->setEntry(it->first, Vector2i(0, i), false, true);
|
mMD_Grid->setEntry(it->first, Vector2i(0, i), false, true);
|
||||||
mMD_Grid->setEntry(it->second, Vector2i(1, i), false, it->resize);
|
mMD_Grid->setEntry(it->second, Vector2i(1, i), false, it->resize);
|
||||||
|
@ -136,7 +136,7 @@ void ScraperSearchComponent::resizeMetadata()
|
||||||
|
|
||||||
// update label fonts
|
// update label fonts
|
||||||
float maxLblWidth = 0;
|
float maxLblWidth = 0;
|
||||||
for(auto it = mMD_Pairs.begin(); it != mMD_Pairs.end(); it++)
|
for(auto it = mMD_Pairs.cbegin(); it != mMD_Pairs.cend(); it++)
|
||||||
{
|
{
|
||||||
it->first->setFont(fontLbl);
|
it->first->setFont(fontLbl);
|
||||||
it->first->setSize(0, 0);
|
it->first->setSize(0, 0);
|
||||||
|
|
|
@ -32,7 +32,7 @@ void GuiCollectionSystemsOptions::initializeMenu()
|
||||||
std::shared_ptr< OptionListComponent<std::string> > folderThemes = std::make_shared< OptionListComponent<std::string> >(mWindow, "SELECT THEME FOLDER", true);
|
std::shared_ptr< OptionListComponent<std::string> > folderThemes = std::make_shared< OptionListComponent<std::string> >(mWindow, "SELECT THEME FOLDER", true);
|
||||||
|
|
||||||
// add Custom Systems
|
// add Custom Systems
|
||||||
for(auto it = unusedFolders.begin() ; it != unusedFolders.end() ; it++ )
|
for(auto it = unusedFolders.cbegin() ; it != unusedFolders.cend() ; it++ )
|
||||||
{
|
{
|
||||||
ComponentListRow row;
|
ComponentListRow row;
|
||||||
std::string name = *it;
|
std::string name = *it;
|
||||||
|
@ -141,7 +141,7 @@ void GuiCollectionSystemsOptions::addSystemsToMenu()
|
||||||
autoOptionList = std::make_shared< OptionListComponent<std::string> >(mWindow, "SELECT COLLECTIONS", true);
|
autoOptionList = std::make_shared< OptionListComponent<std::string> >(mWindow, "SELECT COLLECTIONS", true);
|
||||||
|
|
||||||
// add Auto Systems
|
// add Auto Systems
|
||||||
for(std::map<std::string, CollectionSystemData>::iterator it = autoSystems.begin() ; it != autoSystems.end() ; it++ )
|
for(std::map<std::string, CollectionSystemData>::const_iterator it = autoSystems.cbegin() ; it != autoSystems.cend() ; it++ )
|
||||||
{
|
{
|
||||||
autoOptionList->add(it->second.decl.longName, it->second.decl.name, it->second.isEnabled);
|
autoOptionList->add(it->second.decl.longName, it->second.decl.name, it->second.isEnabled);
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ void GuiCollectionSystemsOptions::addSystemsToMenu()
|
||||||
customOptionList = std::make_shared< OptionListComponent<std::string> >(mWindow, "SELECT COLLECTIONS", true);
|
customOptionList = std::make_shared< OptionListComponent<std::string> >(mWindow, "SELECT COLLECTIONS", true);
|
||||||
|
|
||||||
// add Custom Systems
|
// add Custom Systems
|
||||||
for(std::map<std::string, CollectionSystemData>::iterator it = customSystems.begin() ; it != customSystems.end() ; it++ )
|
for(std::map<std::string, CollectionSystemData>::const_iterator it = customSystems.cbegin() ; it != customSystems.cend() ; it++ )
|
||||||
{
|
{
|
||||||
customOptionList->add(it->second.decl.longName, it->second.decl.name, it->second.isEnabled);
|
customOptionList->add(it->second.decl.longName, it->second.decl.name, it->second.isEnabled);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
|
||||||
// this is because of how GuiComponent::update works. if it was just delete this, this would happen when the metadata resolver is done:
|
// this is because of how GuiComponent::update works. if it was just delete this, this would happen when the metadata resolver is done:
|
||||||
// GuiGameScraper::update()
|
// GuiGameScraper::update()
|
||||||
// GuiComponent::update()
|
// GuiComponent::update()
|
||||||
// it = mChildren.begin();
|
// it = mChildren.cbegin();
|
||||||
// mBox::update()
|
// mBox::update()
|
||||||
// it++;
|
// it++;
|
||||||
// mSearchComponent::update()
|
// mSearchComponent::update()
|
||||||
|
@ -61,7 +61,7 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std::
|
||||||
// so instead we do this:
|
// so instead we do this:
|
||||||
// GuiGameScraper::update()
|
// GuiGameScraper::update()
|
||||||
// GuiComponent::update()
|
// GuiComponent::update()
|
||||||
// it = mChildren.begin();
|
// it = mChildren.cbegin();
|
||||||
// mBox::update()
|
// mBox::update()
|
||||||
// it++;
|
// it++;
|
||||||
// mSearchComponent::update()
|
// mSearchComponent::update()
|
||||||
|
|
|
@ -36,7 +36,7 @@ void GuiGamelistFilter::initializeMenu()
|
||||||
void GuiGamelistFilter::resetAllFilters()
|
void GuiGamelistFilter::resetAllFilters()
|
||||||
{
|
{
|
||||||
mFilterIndex->resetFilters();
|
mFilterIndex->resetFilters();
|
||||||
for (std::map<FilterIndexType, std::shared_ptr< OptionListComponent<std::string> >>::iterator it = mFilterOptions.begin(); it != mFilterOptions.end(); ++it ) {
|
for (std::map<FilterIndexType, std::shared_ptr< OptionListComponent<std::string> >>::const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it ) {
|
||||||
std::shared_ptr< OptionListComponent<std::string> > optionList = it->second;
|
std::shared_ptr< OptionListComponent<std::string> > optionList = it->second;
|
||||||
optionList->selectNone();
|
optionList->selectNone();
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ void GuiGamelistFilter::addFiltersToMenu()
|
||||||
if (ViewController::get()->isUIModeKid())
|
if (ViewController::get()->isUIModeKid())
|
||||||
skip = 2;
|
skip = 2;
|
||||||
|
|
||||||
for (std::vector<FilterDataDecl>::iterator it = decls.begin(); it != decls.end()-skip; ++it ) {
|
for (std::vector<FilterDataDecl>::const_iterator it = decls.cbegin(); it != decls.cend()-skip; ++it ) {
|
||||||
|
|
||||||
FilterIndexType type = (*it).type; // type of filter
|
FilterIndexType type = (*it).type; // type of filter
|
||||||
std::map<std::string, int>* allKeys = (*it).allIndexKeys; // all possible filters for this type
|
std::map<std::string, int>* allKeys = (*it).allIndexKeys; // all possible filters for this type
|
||||||
|
@ -84,7 +84,7 @@ void GuiGamelistFilter::addFiltersToMenu()
|
||||||
void GuiGamelistFilter::applyFilters()
|
void GuiGamelistFilter::applyFilters()
|
||||||
{
|
{
|
||||||
std::vector<FilterDataDecl> decls = mFilterIndex->getFilterDataDecls();
|
std::vector<FilterDataDecl> decls = mFilterIndex->getFilterDataDecls();
|
||||||
for (std::map<FilterIndexType, std::shared_ptr< OptionListComponent<std::string> >>::iterator it = mFilterOptions.begin(); it != mFilterOptions.end(); ++it ) {
|
for (std::map<FilterIndexType, std::shared_ptr< OptionListComponent<std::string> >>::const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it ) {
|
||||||
std::shared_ptr< OptionListComponent<std::string> > optionList = it->second;
|
std::shared_ptr< OptionListComponent<std::string> > optionList = it->second;
|
||||||
std::vector<std::string> filters = optionList->getSelectedObjects();
|
std::vector<std::string> filters = optionList->getSelectedObjects();
|
||||||
mFilterIndex->setFilter(it->first, &filters);
|
mFilterIndex->setFilter(it->first, &filters);
|
||||||
|
|
|
@ -85,7 +85,7 @@ GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system) : Gui
|
||||||
std::map<std::string, CollectionSystemData> customCollections = CollectionSystemManager::get()->getCustomCollectionSystems();
|
std::map<std::string, CollectionSystemData> customCollections = CollectionSystemManager::get()->getCustomCollectionSystems();
|
||||||
|
|
||||||
if(ViewController::get()->isUIModeFull() &&
|
if(ViewController::get()->isUIModeFull() &&
|
||||||
((customCollections.find(system->getName()) != customCollections.end() && CollectionSystemManager::get()->getEditingCollection() != system->getName()) ||
|
((customCollections.find(system->getName()) != customCollections.cend() && CollectionSystemManager::get()->getEditingCollection() != system->getName()) ||
|
||||||
CollectionSystemManager::get()->getCustomCollectionsBundle()->getName() == system->getName()))
|
CollectionSystemManager::get()->getCustomCollectionsBundle()->getName() == system->getName()))
|
||||||
{
|
{
|
||||||
row.elements.clear();
|
row.elements.clear();
|
||||||
|
|
|
@ -25,7 +25,7 @@ GuiGeneralScreensaverOptions::GuiGeneralScreensaverOptions(Window* window, const
|
||||||
screensavers.push_back("black");
|
screensavers.push_back("black");
|
||||||
screensavers.push_back("random video");
|
screensavers.push_back("random video");
|
||||||
screensavers.push_back("slideshow");
|
screensavers.push_back("slideshow");
|
||||||
for(auto it = screensavers.begin(); it != screensavers.end(); it++)
|
for(auto it = screensavers.cbegin(); it != screensavers.cend(); it++)
|
||||||
screensaver_behavior->add(*it, *it, Settings::getInstance()->getString("ScreenSaverBehavior") == *it);
|
screensaver_behavior->add(*it, *it, Settings::getInstance()->getString("ScreenSaverBehavior") == *it);
|
||||||
addWithLabel("SCREENSAVER BEHAVIOR", screensaver_behavior);
|
addWithLabel("SCREENSAVER BEHAVIOR", screensaver_behavior);
|
||||||
addSaveFunc([this, screensaver_behavior] {
|
addSaveFunc([this, screensaver_behavior] {
|
||||||
|
|
|
@ -54,7 +54,7 @@ void GuiMenu::openScraperSettings()
|
||||||
// scrape from
|
// scrape from
|
||||||
auto scraper_list = std::make_shared< OptionListComponent< std::string > >(mWindow, "SCRAPE FROM", false);
|
auto scraper_list = std::make_shared< OptionListComponent< std::string > >(mWindow, "SCRAPE FROM", false);
|
||||||
std::vector<std::string> scrapers = getScraperList();
|
std::vector<std::string> scrapers = getScraperList();
|
||||||
for(auto it = scrapers.begin(); it != scrapers.end(); it++)
|
for(auto it = scrapers.cbegin(); it != scrapers.cend(); it++)
|
||||||
scraper_list->add(*it, *it, *it == Settings::getInstance()->getString("Scraper"));
|
scraper_list->add(*it, *it, *it == Settings::getInstance()->getString("Scraper"));
|
||||||
|
|
||||||
s->addWithLabel("SCRAPE FROM", scraper_list);
|
s->addWithLabel("SCRAPE FROM", scraper_list);
|
||||||
|
@ -101,7 +101,7 @@ void GuiMenu::openSoundSettings()
|
||||||
transitions.push_back("PCM");
|
transitions.push_back("PCM");
|
||||||
transitions.push_back("Speaker");
|
transitions.push_back("Speaker");
|
||||||
transitions.push_back("Master");
|
transitions.push_back("Master");
|
||||||
for(auto it = transitions.begin(); it != transitions.end(); it++)
|
for(auto it = transitions.cbegin(); it != transitions.cend(); it++)
|
||||||
vol_dev->add(*it, *it, Settings::getInstance()->getString("AudioDevice") == *it);
|
vol_dev->add(*it, *it, Settings::getInstance()->getString("AudioDevice") == *it);
|
||||||
s->addWithLabel("AUDIO DEVICE", vol_dev);
|
s->addWithLabel("AUDIO DEVICE", vol_dev);
|
||||||
s->addSaveFunc([vol_dev] {
|
s->addSaveFunc([vol_dev] {
|
||||||
|
@ -141,7 +141,7 @@ void GuiMenu::openSoundSettings()
|
||||||
// USB audio
|
// USB audio
|
||||||
devices.push_back("alsa:hw:0,0");
|
devices.push_back("alsa:hw:0,0");
|
||||||
devices.push_back("alsa:hw:1,0");
|
devices.push_back("alsa:hw:1,0");
|
||||||
for (auto it = devices.begin(); it != devices.end(); it++)
|
for (auto it = devices.cbegin(); it != devices.cend(); it++)
|
||||||
omx_audio_dev->add(*it, *it, Settings::getInstance()->getString("OMXAudioDev") == *it);
|
omx_audio_dev->add(*it, *it, Settings::getInstance()->getString("OMXAudioDev") == *it);
|
||||||
s->addWithLabel("OMX PLAYER AUDIO DEVICE", omx_audio_dev);
|
s->addWithLabel("OMX PLAYER AUDIO DEVICE", omx_audio_dev);
|
||||||
s->addSaveFunc([omx_audio_dev] {
|
s->addSaveFunc([omx_audio_dev] {
|
||||||
|
@ -162,7 +162,7 @@ void GuiMenu::openUISettings()
|
||||||
//UI mode
|
//UI mode
|
||||||
auto UImodeSelection = std::make_shared< OptionListComponent<std::string> >(mWindow, "UI MODE", false);
|
auto UImodeSelection = std::make_shared< OptionListComponent<std::string> >(mWindow, "UI MODE", false);
|
||||||
std::vector<std::string> UImodes = ViewController::get()->getUIModes();
|
std::vector<std::string> UImodes = ViewController::get()->getUIModes();
|
||||||
for (auto it = UImodes.begin(); it != UImodes.end(); it++)
|
for (auto it = UImodes.cbegin(); it != UImodes.cend(); it++)
|
||||||
UImodeSelection->add(*it, *it, Settings::getInstance()->getString("UIMode") == *it);
|
UImodeSelection->add(*it, *it, Settings::getInstance()->getString("UIMode") == *it);
|
||||||
s->addWithLabel("UI MODE", UImodeSelection);
|
s->addWithLabel("UI MODE", UImodeSelection);
|
||||||
Window* window = mWindow;
|
Window* window = mWindow;
|
||||||
|
@ -220,7 +220,7 @@ void GuiMenu::openUISettings()
|
||||||
transitions.push_back("fade");
|
transitions.push_back("fade");
|
||||||
transitions.push_back("slide");
|
transitions.push_back("slide");
|
||||||
transitions.push_back("instant");
|
transitions.push_back("instant");
|
||||||
for(auto it = transitions.begin(); it != transitions.end(); it++)
|
for(auto it = transitions.cbegin(); it != transitions.cend(); it++)
|
||||||
transition_style->add(*it, *it, Settings::getInstance()->getString("TransitionStyle") == *it);
|
transition_style->add(*it, *it, Settings::getInstance()->getString("TransitionStyle") == *it);
|
||||||
s->addWithLabel("TRANSITION STYLE", transition_style);
|
s->addWithLabel("TRANSITION STYLE", transition_style);
|
||||||
s->addSaveFunc([transition_style] {
|
s->addSaveFunc([transition_style] {
|
||||||
|
@ -239,12 +239,12 @@ void GuiMenu::openUISettings()
|
||||||
|
|
||||||
if(!themeSets.empty())
|
if(!themeSets.empty())
|
||||||
{
|
{
|
||||||
auto selectedSet = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
std::map<std::string, ThemeSet>::const_iterator selectedSet = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||||
if(selectedSet == themeSets.end())
|
if(selectedSet == themeSets.cend())
|
||||||
selectedSet = themeSets.begin();
|
selectedSet = themeSets.cbegin();
|
||||||
|
|
||||||
auto theme_set = std::make_shared< OptionListComponent<std::string> >(mWindow, "THEME SET", false);
|
auto theme_set = std::make_shared< OptionListComponent<std::string> >(mWindow, "THEME SET", false);
|
||||||
for(auto it = themeSets.begin(); it != themeSets.end(); it++)
|
for(auto it = themeSets.cbegin(); it != themeSets.cend(); it++)
|
||||||
theme_set->add(it->first, it->first, it == selectedSet);
|
theme_set->add(it->first, it->first, it == selectedSet);
|
||||||
s->addWithLabel("THEME SET", theme_set);
|
s->addWithLabel("THEME SET", theme_set);
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void GuiMenu::openUISettings()
|
||||||
styles.push_back("basic");
|
styles.push_back("basic");
|
||||||
styles.push_back("detailed");
|
styles.push_back("detailed");
|
||||||
styles.push_back("video");
|
styles.push_back("video");
|
||||||
for (auto it = styles.begin(); it != styles.end(); it++)
|
for (auto it = styles.cbegin(); it != styles.cend(); it++)
|
||||||
gamelist_style->add(*it, *it, Settings::getInstance()->getString("GamelistViewStyle") == *it);
|
gamelist_style->add(*it, *it, Settings::getInstance()->getString("GamelistViewStyle") == *it);
|
||||||
s->addWithLabel("GAMELIST VIEW STYLE", gamelist_style);
|
s->addWithLabel("GAMELIST VIEW STYLE", gamelist_style);
|
||||||
s->addSaveFunc([gamelist_style] {
|
s->addSaveFunc([gamelist_style] {
|
||||||
|
@ -287,7 +287,7 @@ void GuiMenu::openUISettings()
|
||||||
// Optionally start in selected system
|
// Optionally start in selected system
|
||||||
auto systemfocus_list = std::make_shared< OptionListComponent<std::string> >(mWindow, "START ON SYSTEM", false);
|
auto systemfocus_list = std::make_shared< OptionListComponent<std::string> >(mWindow, "START ON SYSTEM", false);
|
||||||
systemfocus_list->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
systemfocus_list->add("NONE", "", Settings::getInstance()->getString("StartupSystem") == "");
|
||||||
for (auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++)
|
for (auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); it++)
|
||||||
{
|
{
|
||||||
if ("retropie" != (*it)->getName())
|
if ("retropie" != (*it)->getName())
|
||||||
{
|
{
|
||||||
|
@ -326,7 +326,7 @@ void GuiMenu::openOtherSettings()
|
||||||
modes.push_back("default");
|
modes.push_back("default");
|
||||||
modes.push_back("enhanced");
|
modes.push_back("enhanced");
|
||||||
modes.push_back("instant");
|
modes.push_back("instant");
|
||||||
for (auto it = modes.begin(); it != modes.end(); it++)
|
for (auto it = modes.cbegin(); it != modes.cend(); it++)
|
||||||
power_saver->add(*it, *it, Settings::getInstance()->getString("PowerSaverMode") == *it);
|
power_saver->add(*it, *it, Settings::getInstance()->getString("PowerSaverMode") == *it);
|
||||||
s->addWithLabel("POWER SAVER MODES", power_saver);
|
s->addWithLabel("POWER SAVER MODES", power_saver);
|
||||||
s->addSaveFunc([this, power_saver] {
|
s->addSaveFunc([this, power_saver] {
|
||||||
|
|
|
@ -47,7 +47,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window, MetaDataList* md, const std::vector
|
||||||
mGrid.setEntry(mList, Vector2i(0, 1), true, true);
|
mGrid.setEntry(mList, Vector2i(0, 1), true, true);
|
||||||
|
|
||||||
// populate list
|
// populate list
|
||||||
for(auto iter = mdd.begin(); iter != mdd.end(); iter++)
|
for(auto iter = mdd.cbegin(); iter != mdd.cend(); iter++)
|
||||||
{
|
{
|
||||||
std::shared_ptr<GuiComponent> ed;
|
std::shared_ptr<GuiComponent> ed;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
|
||||||
GuiScraperMulti::~GuiScraperMulti()
|
GuiScraperMulti::~GuiScraperMulti()
|
||||||
{
|
{
|
||||||
// view type probably changed (basic -> detailed)
|
// view type probably changed (basic -> detailed)
|
||||||
for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++)
|
for(auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); it++)
|
||||||
ViewController::get()->reloadGameListView(*it, false);
|
ViewController::get()->reloadGameListView(*it, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
|
||||||
|
|
||||||
//add systems (all with a platformid specified selected)
|
//add systems (all with a platformid specified selected)
|
||||||
mSystems = std::make_shared< OptionListComponent<SystemData*> >(mWindow, "SCRAPE THESE SYSTEMS", true);
|
mSystems = std::make_shared< OptionListComponent<SystemData*> >(mWindow, "SCRAPE THESE SYSTEMS", true);
|
||||||
for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++)
|
for(auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); it++)
|
||||||
{
|
{
|
||||||
if(!(*it)->hasPlatformId(PlatformIds::PLATFORM_IGNORE))
|
if(!(*it)->hasPlatformId(PlatformIds::PLATFORM_IGNORE))
|
||||||
mSystems->add((*it)->getFullName(), *it, !(*it)->getPlatformIds().empty());
|
mSystems->add((*it)->getFullName(), *it, !(*it)->getPlatformIds().empty());
|
||||||
|
@ -43,7 +43,7 @@ GuiScraperStart::GuiScraperStart(Window* window) : GuiComponent(window),
|
||||||
void GuiScraperStart::pressedStart()
|
void GuiScraperStart::pressedStart()
|
||||||
{
|
{
|
||||||
std::vector<SystemData*> sys = mSystems->getSelectedObjects();
|
std::vector<SystemData*> sys = mSystems->getSelectedObjects();
|
||||||
for(auto it = sys.begin(); it != sys.end(); it++)
|
for(auto it = sys.cbegin(); it != sys.cend(); it++)
|
||||||
{
|
{
|
||||||
if((*it)->getPlatformIds().empty())
|
if((*it)->getPlatformIds().empty())
|
||||||
{
|
{
|
||||||
|
@ -76,10 +76,10 @@ void GuiScraperStart::start()
|
||||||
std::queue<ScraperSearchParams> GuiScraperStart::getSearches(std::vector<SystemData*> systems, GameFilterFunc selector)
|
std::queue<ScraperSearchParams> GuiScraperStart::getSearches(std::vector<SystemData*> systems, GameFilterFunc selector)
|
||||||
{
|
{
|
||||||
std::queue<ScraperSearchParams> queue;
|
std::queue<ScraperSearchParams> queue;
|
||||||
for(auto sys = systems.begin(); sys != systems.end(); sys++)
|
for(auto sys = systems.cbegin(); sys != systems.cend(); sys++)
|
||||||
{
|
{
|
||||||
std::vector<FileData*> games = (*sys)->getRootFolder()->getFilesRecursive(GAME);
|
std::vector<FileData*> games = (*sys)->getRootFolder()->getFilesRecursive(GAME);
|
||||||
for(auto game = games.begin(); game != games.end(); game++)
|
for(auto game = games.cbegin(); game != games.cend(); game++)
|
||||||
{
|
{
|
||||||
if(selector((*sys), (*game)))
|
if(selector((*sys), (*game)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ void GuiScreensaverOptions::save()
|
||||||
if(!mSaveFuncs.size())
|
if(!mSaveFuncs.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(auto it = mSaveFuncs.begin(); it != mSaveFuncs.end(); it++)
|
for(auto it = mSaveFuncs.cbegin(); it != mSaveFuncs.cend(); it++)
|
||||||
(*it)();
|
(*it)();
|
||||||
|
|
||||||
Settings::getInstance()->saveFile();
|
Settings::getInstance()->saveFile();
|
||||||
|
|
|
@ -25,7 +25,7 @@ void GuiSettings::save()
|
||||||
if(!mSaveFuncs.size())
|
if(!mSaveFuncs.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(auto it = mSaveFuncs.begin(); it != mSaveFuncs.end(); it++)
|
for(auto it = mSaveFuncs.cbegin(); it != mSaveFuncs.cend(); it++)
|
||||||
(*it)();
|
(*it)();
|
||||||
|
|
||||||
Settings::getInstance()->saveFile();
|
Settings::getInstance()->saveFile();
|
||||||
|
|
|
@ -37,7 +37,7 @@ GuiVideoScreensaverOptions::GuiVideoScreensaverOptions(Window* window, const cha
|
||||||
info_type.push_back("always");
|
info_type.push_back("always");
|
||||||
info_type.push_back("start & end");
|
info_type.push_back("start & end");
|
||||||
info_type.push_back("never");
|
info_type.push_back("never");
|
||||||
for(auto it = info_type.begin(); it != info_type.end(); it++)
|
for(auto it = info_type.cbegin(); it != info_type.cend(); it++)
|
||||||
ss_info->add(*it, *it, Settings::getInstance()->getString("ScreenSaverGameInfo") == *it);
|
ss_info->add(*it, *it, Settings::getInstance()->getString("ScreenSaverGameInfo") == *it);
|
||||||
addWithLabel("SHOW GAME INFO ON SCREENSAVER", ss_info);
|
addWithLabel("SHOW GAME INFO ON SCREENSAVER", ss_info);
|
||||||
addSaveFunc([ss_info, this] { Settings::getInstance()->setString("ScreenSaverGameInfo", ss_info->getSelected()); });
|
addSaveFunc([ss_info, this] { Settings::getInstance()->setString("ScreenSaverGameInfo", ss_info->getSelected()); });
|
||||||
|
|
|
@ -104,11 +104,11 @@ void thegamesdb_generate_scraper_requests(const ScraperSearchParams& params, std
|
||||||
// because TheGamesDB API either sucks or I don't know how to use it properly...
|
// because TheGamesDB API either sucks or I don't know how to use it properly...
|
||||||
std::string urlBase = path;
|
std::string urlBase = path;
|
||||||
auto& platforms = params.system->getPlatformIds();
|
auto& platforms = params.system->getPlatformIds();
|
||||||
for(auto platformIt = platforms.begin(); platformIt != platforms.end(); platformIt++)
|
for(auto platformIt = platforms.cbegin(); platformIt != platforms.cend(); platformIt++)
|
||||||
{
|
{
|
||||||
path = urlBase;
|
path = urlBase;
|
||||||
auto mapIt = gamesdb_platformid_map.find(*platformIt);
|
auto mapIt = gamesdb_platformid_map.find(*platformIt);
|
||||||
if(mapIt != gamesdb_platformid_map.end())
|
if(mapIt != gamesdb_platformid_map.cend())
|
||||||
{
|
{
|
||||||
path += "&platform=";
|
path += "&platform=";
|
||||||
path += HttpReq::urlEncode(mapIt->second);
|
path += HttpReq::urlEncode(mapIt->second);
|
||||||
|
|
|
@ -26,7 +26,7 @@ std::unique_ptr<ScraperSearchHandle> startScraperSearch(const ScraperSearchParam
|
||||||
std::vector<std::string> getScraperList()
|
std::vector<std::string> getScraperList()
|
||||||
{
|
{
|
||||||
std::vector<std::string> list;
|
std::vector<std::string> list;
|
||||||
for(auto it = scraper_request_funcs.begin(); it != scraper_request_funcs.end(); it++)
|
for(auto it = scraper_request_funcs.cbegin(); it != scraper_request_funcs.cend(); it++)
|
||||||
{
|
{
|
||||||
list.push_back(it->first);
|
list.push_back(it->first);
|
||||||
}
|
}
|
||||||
|
@ -142,8 +142,8 @@ void MDResolveHandle::update()
|
||||||
if(mStatus == ASYNC_DONE || mStatus == ASYNC_ERROR)
|
if(mStatus == ASYNC_DONE || mStatus == ASYNC_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto it = mFuncs.begin();
|
auto it = mFuncs.cbegin();
|
||||||
while(it != mFuncs.end())
|
while(it != mFuncs.cend())
|
||||||
{
|
{
|
||||||
if(it->first->status() == ASYNC_ERROR)
|
if(it->first->status() == ASYNC_ERROR)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ void SystemView::populate()
|
||||||
{
|
{
|
||||||
mEntries.clear();
|
mEntries.clear();
|
||||||
|
|
||||||
for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++)
|
for(auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); it++)
|
||||||
{
|
{
|
||||||
const std::shared_ptr<ThemeData>& theme = (*it)->getTheme();
|
const std::shared_ptr<ThemeData>& theme = (*it)->getTheme();
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ void ViewController::goToStart()
|
||||||
auto requestedSystem = Settings::getInstance()->getString("StartupSystem");
|
auto requestedSystem = Settings::getInstance()->getString("StartupSystem");
|
||||||
if("" != requestedSystem && "retropie" != requestedSystem)
|
if("" != requestedSystem && "retropie" != requestedSystem)
|
||||||
{
|
{
|
||||||
for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++){
|
for(auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); it++){
|
||||||
if ((*it)->getName() == requestedSystem)
|
if ((*it)->getName() == requestedSystem)
|
||||||
{
|
{
|
||||||
goToGameList(*it);
|
goToGameList(*it);
|
||||||
|
@ -62,7 +62,7 @@ void ViewController::goToStart()
|
||||||
int ViewController::getSystemId(SystemData* system)
|
int ViewController::getSystemId(SystemData* system)
|
||||||
{
|
{
|
||||||
std::vector<SystemData*>& sysVec = SystemData::sSystemVector;
|
std::vector<SystemData*>& sysVec = SystemData::sSystemVector;
|
||||||
return std::find(sysVec.begin(), sysVec.end(), system) - sysVec.begin();
|
return std::find(sysVec.cbegin(), sysVec.cend(), system) - sysVec.cbegin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewController::goToSystemView(SystemData* system)
|
void ViewController::goToSystemView(SystemData* system)
|
||||||
|
@ -188,7 +188,7 @@ void ViewController::playViewTransition()
|
||||||
void ViewController::onFileChanged(FileData* file, FileChangeType change)
|
void ViewController::onFileChanged(FileData* file, FileChangeType change)
|
||||||
{
|
{
|
||||||
auto it = mGameListViews.find(file->getSystem());
|
auto it = mGameListViews.find(file->getSystem());
|
||||||
if(it != mGameListViews.end())
|
if(it != mGameListViews.cend())
|
||||||
it->second->onFileChanged(file, change);
|
it->second->onFileChanged(file, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ void ViewController::removeGameListView(SystemData* system)
|
||||||
{
|
{
|
||||||
//if we already made one, return that one
|
//if we already made one, return that one
|
||||||
auto exists = mGameListViews.find(system);
|
auto exists = mGameListViews.find(system);
|
||||||
if(exists != mGameListViews.end())
|
if(exists != mGameListViews.cend())
|
||||||
{
|
{
|
||||||
exists->second.reset();
|
exists->second.reset();
|
||||||
mGameListViews.erase(system);
|
mGameListViews.erase(system);
|
||||||
|
@ -260,7 +260,7 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
|
||||||
{
|
{
|
||||||
//if we already made one, return that one
|
//if we already made one, return that one
|
||||||
auto exists = mGameListViews.find(system);
|
auto exists = mGameListViews.find(system);
|
||||||
if(exists != mGameListViews.end())
|
if(exists != mGameListViews.cend())
|
||||||
return exists->second;
|
return exists->second;
|
||||||
|
|
||||||
//if we didn't, make it, remember it, and return it
|
//if we didn't, make it, remember it, and return it
|
||||||
|
@ -282,7 +282,7 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
|
||||||
if (selectedViewType == AUTOMATIC)
|
if (selectedViewType == AUTOMATIC)
|
||||||
{
|
{
|
||||||
std::vector<FileData*> files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER);
|
std::vector<FileData*> files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER);
|
||||||
for (auto it = files.begin(); it != files.end(); it++)
|
for (auto it = files.cbegin(); it != files.cend(); it++)
|
||||||
{
|
{
|
||||||
if (themeHasVideoView && !(*it)->getVideoPath().empty())
|
if (themeHasVideoView && !(*it)->getVideoPath().empty())
|
||||||
{
|
{
|
||||||
|
@ -318,7 +318,7 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
|
||||||
view->setTheme(system->getTheme());
|
view->setTheme(system->getTheme());
|
||||||
|
|
||||||
std::vector<SystemData*>& sysVec = SystemData::sSystemVector;
|
std::vector<SystemData*>& sysVec = SystemData::sSystemVector;
|
||||||
int id = std::find(sysVec.begin(), sysVec.end(), system) - sysVec.begin();
|
int id = std::find(sysVec.cbegin(), sysVec.cend(), system) - sysVec.cbegin();
|
||||||
view->setPosition(id * (float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight() * 2);
|
view->setPosition(id * (float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight() * 2);
|
||||||
|
|
||||||
addChild(view.get());
|
addChild(view.get());
|
||||||
|
@ -386,7 +386,7 @@ void ViewController::render(const Transform4x4f& parentTrans)
|
||||||
getSystemListView()->render(trans);
|
getSystemListView()->render(trans);
|
||||||
|
|
||||||
// draw gamelists
|
// draw gamelists
|
||||||
for(auto it = mGameListViews.begin(); it != mGameListViews.end(); it++)
|
for(auto it = mGameListViews.cbegin(); it != mGameListViews.cend(); it++)
|
||||||
{
|
{
|
||||||
// clipping
|
// clipping
|
||||||
Vector3f guiStart = it->second->getPosition();
|
Vector3f guiStart = it->second->getPosition();
|
||||||
|
@ -410,7 +410,7 @@ void ViewController::render(const Transform4x4f& parentTrans)
|
||||||
|
|
||||||
void ViewController::preload()
|
void ViewController::preload()
|
||||||
{
|
{
|
||||||
for(auto it = SystemData::sSystemVector.begin(); it != SystemData::sSystemVector.end(); it++)
|
for(auto it = SystemData::sSystemVector.cbegin(); it != SystemData::sSystemVector.cend(); it++)
|
||||||
{
|
{
|
||||||
(*it)->getIndex()->resetFilters();
|
(*it)->getIndex()->resetFilters();
|
||||||
getGameListView(*it);
|
getGameListView(*it);
|
||||||
|
@ -419,7 +419,7 @@ void ViewController::preload()
|
||||||
|
|
||||||
void ViewController::reloadGameListView(IGameListView* view, bool reloadTheme)
|
void ViewController::reloadGameListView(IGameListView* view, bool reloadTheme)
|
||||||
{
|
{
|
||||||
for(auto it = mGameListViews.begin(); it != mGameListViews.end(); it++)
|
for(auto it = mGameListViews.cbegin(); it != mGameListViews.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->second.get() == view)
|
if(it->second.get() == view)
|
||||||
{
|
{
|
||||||
|
@ -452,7 +452,7 @@ void ViewController::reloadAll()
|
||||||
{
|
{
|
||||||
// clear all gamelistviews
|
// clear all gamelistviews
|
||||||
std::map<SystemData*, FileData*> cursorMap;
|
std::map<SystemData*, FileData*> cursorMap;
|
||||||
for(auto it = mGameListViews.begin(); it != mGameListViews.end(); it++)
|
for(auto it = mGameListViews.cbegin(); it != mGameListViews.cend(); it++)
|
||||||
{
|
{
|
||||||
cursorMap[it->first] = it->second->getCursor();
|
cursorMap[it->first] = it->second->getCursor();
|
||||||
}
|
}
|
||||||
|
@ -460,7 +460,7 @@ void ViewController::reloadAll()
|
||||||
|
|
||||||
|
|
||||||
// load themes, create gamelistviews and reset filters
|
// load themes, create gamelistviews and reset filters
|
||||||
for(auto it = cursorMap.begin(); it != cursorMap.end(); it++)
|
for(auto it = cursorMap.cbegin(); it != cursorMap.cend(); it++)
|
||||||
{
|
{
|
||||||
it->first->loadTheme();
|
it->first->loadTheme();
|
||||||
it->first->getIndex()->resetFilters();
|
it->first->getIndex()->resetFilters();
|
||||||
|
|
|
@ -44,7 +44,7 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files)
|
||||||
mHeaderText.setText(mRoot->getSystem()->getFullName());
|
mHeaderText.setText(mRoot->getSystem()->getFullName());
|
||||||
if (files.size() > 0)
|
if (files.size() > 0)
|
||||||
{
|
{
|
||||||
for(auto it = files.begin(); it != files.end(); it++)
|
for(auto it = files.cbegin(); it != files.cend(); it++)
|
||||||
{
|
{
|
||||||
mList.add((*it)->getName(), *it, ((*it)->getType() == FOLDER));
|
mList.add((*it)->getName(), *it, ((*it)->getType() == FOLDER));
|
||||||
}
|
}
|
||||||
|
@ -109,9 +109,9 @@ void BasicGameListView::remove(FileData *game, bool deleteFile)
|
||||||
if (getCursor() == game) // Select next element in list, or prev if none
|
if (getCursor() == game) // Select next element in list, or prev if none
|
||||||
{
|
{
|
||||||
std::vector<FileData*> siblings = parent->getChildrenListToDisplay();
|
std::vector<FileData*> siblings = parent->getChildrenListToDisplay();
|
||||||
auto gameIter = std::find(siblings.begin(), siblings.end(), game);
|
auto gameIter = std::find(siblings.cbegin(), siblings.cend(), game);
|
||||||
unsigned int gamePos = std::distance(siblings.begin(), gameIter);
|
unsigned int gamePos = std::distance(siblings.cbegin(), gameIter);
|
||||||
if (gameIter != siblings.end())
|
if (gameIter != siblings.cend())
|
||||||
{
|
{
|
||||||
if ((gamePos + 1) < siblings.size())
|
if ((gamePos + 1) < siblings.size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -214,9 +214,9 @@ void DetailedGameListView::updateInfoPanel()
|
||||||
comps.push_back(&mImage);
|
comps.push_back(&mImage);
|
||||||
comps.push_back(&mDescription);
|
comps.push_back(&mDescription);
|
||||||
std::vector<TextComponent*> labels = getMDLabels();
|
std::vector<TextComponent*> labels = getMDLabels();
|
||||||
comps.insert(comps.end(), labels.begin(), labels.end());
|
comps.insert(comps.cend(), labels.cbegin(), labels.cend());
|
||||||
|
|
||||||
for(auto it = comps.begin(); it != comps.end(); it++)
|
for(auto it = comps.cbegin(); it != comps.cend(); it++)
|
||||||
{
|
{
|
||||||
GuiComponent* comp = *it;
|
GuiComponent* comp = *it;
|
||||||
// an animation is playing
|
// an animation is playing
|
||||||
|
|
|
@ -37,7 +37,7 @@ bool GridGameListView::input(InputConfig* config, Input input)
|
||||||
void GridGameListView::populateList(const std::vector<FileData*>& files)
|
void GridGameListView::populateList(const std::vector<FileData*>& files)
|
||||||
{
|
{
|
||||||
mGrid.clear();
|
mGrid.clear();
|
||||||
for(auto it = files.begin(); it != files.end(); it++)
|
for(auto it = files.cbegin(); it != files.cend(); it++)
|
||||||
{
|
{
|
||||||
mGrid.add((*it)->getName(), (*it)->getThumbnailPath(), *it);
|
mGrid.add((*it)->getName(), (*it)->getThumbnailPath(), *it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,9 +272,9 @@ void VideoGameListView::updateInfoPanel()
|
||||||
comps.push_back(&mDescription);
|
comps.push_back(&mDescription);
|
||||||
comps.push_back(&mImage);
|
comps.push_back(&mImage);
|
||||||
std::vector<TextComponent*> labels = getMDLabels();
|
std::vector<TextComponent*> labels = getMDLabels();
|
||||||
comps.insert(comps.end(), labels.begin(), labels.end());
|
comps.insert(comps.cend(), labels.cbegin(), labels.cend());
|
||||||
|
|
||||||
for(auto it = comps.begin(); it != comps.end(); it++)
|
for(auto it = comps.cbegin(); it != comps.cend(); it++)
|
||||||
{
|
{
|
||||||
GuiComponent* comp = *it;
|
GuiComponent* comp = *it;
|
||||||
// an animation is playing
|
// an animation is playing
|
||||||
|
|
|
@ -125,7 +125,7 @@ void AudioManager::unregisterSound(std::shared_ptr<Sound> & sound)
|
||||||
if(sSoundVector.at(i) == sound)
|
if(sSoundVector.at(i) == sound)
|
||||||
{
|
{
|
||||||
sSoundVector[i]->stop();
|
sSoundVector[i]->stop();
|
||||||
sSoundVector.erase(sSoundVector.begin() + i);
|
sSoundVector.erase(sSoundVector.cbegin() + i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,7 +185,7 @@ void GuiComponent::removeChild(GuiComponent* cmp)
|
||||||
|
|
||||||
cmp->setParent(NULL);
|
cmp->setParent(NULL);
|
||||||
|
|
||||||
for(auto i = mChildren.begin(); i != mChildren.end(); i++)
|
for(auto i = mChildren.cbegin(); i != mChildren.cend(); i++)
|
||||||
{
|
{
|
||||||
if(*i == cmp)
|
if(*i == cmp)
|
||||||
{
|
{
|
||||||
|
@ -235,7 +235,7 @@ unsigned char GuiComponent::getOpacity() const
|
||||||
void GuiComponent::setOpacity(unsigned char opacity)
|
void GuiComponent::setOpacity(unsigned char opacity)
|
||||||
{
|
{
|
||||||
mOpacity = opacity;
|
mOpacity = opacity;
|
||||||
for(auto it = mChildren.begin(); it != mChildren.end(); it++)
|
for(auto it = mChildren.cbegin(); it != mChildren.cend(); it++)
|
||||||
{
|
{
|
||||||
(*it)->setOpacity(opacity);
|
(*it)->setOpacity(opacity);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ std::string GuiComponent::getValue() const
|
||||||
|
|
||||||
void GuiComponent::textInput(const char* text)
|
void GuiComponent::textInput(const char* text)
|
||||||
{
|
{
|
||||||
for(auto iter = mChildren.begin(); iter != mChildren.end(); iter++)
|
for(auto iter = mChildren.cbegin(); iter != mChildren.cend(); iter++)
|
||||||
{
|
{
|
||||||
(*iter)->textInput(text);
|
(*iter)->textInput(text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,14 +72,14 @@ void InputConfig::mapInput(const std::string& name, Input input)
|
||||||
void InputConfig::unmapInput(const std::string& name)
|
void InputConfig::unmapInput(const std::string& name)
|
||||||
{
|
{
|
||||||
auto it = mNameMap.find(toLower(name));
|
auto it = mNameMap.find(toLower(name));
|
||||||
if(it != mNameMap.end())
|
if(it != mNameMap.cend())
|
||||||
mNameMap.erase(it);
|
mNameMap.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputConfig::getInputByName(const std::string& name, Input* result)
|
bool InputConfig::getInputByName(const std::string& name, Input* result)
|
||||||
{
|
{
|
||||||
auto it = mNameMap.find(toLower(name));
|
auto it = mNameMap.find(toLower(name));
|
||||||
if(it != mNameMap.end())
|
if(it != mNameMap.cend())
|
||||||
{
|
{
|
||||||
*result = it->second;
|
*result = it->second;
|
||||||
return true;
|
return true;
|
||||||
|
@ -115,8 +115,8 @@ std::vector<std::string> InputConfig::getMappedTo(Input input)
|
||||||
{
|
{
|
||||||
std::vector<std::string> maps;
|
std::vector<std::string> maps;
|
||||||
|
|
||||||
typedef std::map<std::string, Input>::iterator it_type;
|
typedef std::map<std::string, Input>::const_iterator it_type;
|
||||||
for(it_type iterator = mNameMap.begin(); iterator != mNameMap.end(); iterator++)
|
for(it_type iterator = mNameMap.cbegin(); iterator != mNameMap.cend(); iterator++)
|
||||||
{
|
{
|
||||||
Input chk = iterator->second;
|
Input chk = iterator->second;
|
||||||
|
|
||||||
|
@ -188,8 +188,8 @@ void InputConfig::writeToXML(pugi::xml_node& parent)
|
||||||
|
|
||||||
cfg.append_attribute("deviceGUID") = mDeviceGUID.c_str();
|
cfg.append_attribute("deviceGUID") = mDeviceGUID.c_str();
|
||||||
|
|
||||||
typedef std::map<std::string, Input>::iterator it_type;
|
typedef std::map<std::string, Input>::const_iterator it_type;
|
||||||
for(it_type iterator = mNameMap.begin(); iterator != mNameMap.end(); iterator++)
|
for(it_type iterator = mNameMap.cbegin(); iterator != mNameMap.cend(); iterator++)
|
||||||
{
|
{
|
||||||
if(!iterator->second.configured)
|
if(!iterator->second.configured)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -121,7 +121,7 @@ void InputManager::removeJoystickByJoystickID(SDL_JoystickID joyId)
|
||||||
|
|
||||||
// close the joystick
|
// close the joystick
|
||||||
auto joyIt = mJoysticks.find(joyId);
|
auto joyIt = mJoysticks.find(joyId);
|
||||||
if(joyIt != mJoysticks.end())
|
if(joyIt != mJoysticks.cend())
|
||||||
{
|
{
|
||||||
SDL_JoystickClose(joyIt->second);
|
SDL_JoystickClose(joyIt->second);
|
||||||
mJoysticks.erase(joyIt);
|
mJoysticks.erase(joyIt);
|
||||||
|
@ -135,19 +135,19 @@ void InputManager::deinit()
|
||||||
if(!initialized())
|
if(!initialized())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(auto iter = mJoysticks.begin(); iter != mJoysticks.end(); iter++)
|
for(auto iter = mJoysticks.cbegin(); iter != mJoysticks.cend(); iter++)
|
||||||
{
|
{
|
||||||
SDL_JoystickClose(iter->second);
|
SDL_JoystickClose(iter->second);
|
||||||
}
|
}
|
||||||
mJoysticks.clear();
|
mJoysticks.clear();
|
||||||
|
|
||||||
for(auto iter = mInputConfigs.begin(); iter != mInputConfigs.end(); iter++)
|
for(auto iter = mInputConfigs.cbegin(); iter != mInputConfigs.cend(); iter++)
|
||||||
{
|
{
|
||||||
delete iter->second;
|
delete iter->second;
|
||||||
}
|
}
|
||||||
mInputConfigs.clear();
|
mInputConfigs.clear();
|
||||||
|
|
||||||
for(auto iter = mPrevAxisValues.begin(); iter != mPrevAxisValues.end(); iter++)
|
for(auto iter = mPrevAxisValues.cbegin(); iter != mPrevAxisValues.cend(); iter++)
|
||||||
{
|
{
|
||||||
delete[] iter->second;
|
delete[] iter->second;
|
||||||
}
|
}
|
||||||
|
@ -453,7 +453,7 @@ bool InputManager::initialized() const
|
||||||
int InputManager::getNumConfiguredDevices()
|
int InputManager::getNumConfiguredDevices()
|
||||||
{
|
{
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for(auto it = mInputConfigs.begin(); it != mInputConfigs.end(); it++)
|
for(auto it = mInputConfigs.cbegin(); it != mInputConfigs.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->second->isConfigured())
|
if(it->second->isConfigured())
|
||||||
num++;
|
num++;
|
||||||
|
@ -477,7 +477,7 @@ std::string InputManager::getDeviceGUIDString(int deviceId)
|
||||||
return CEC_GUID_STRING;
|
return CEC_GUID_STRING;
|
||||||
|
|
||||||
auto it = mJoysticks.find(deviceId);
|
auto it = mJoysticks.find(deviceId);
|
||||||
if(it == mJoysticks.end())
|
if(it == mJoysticks.cend())
|
||||||
{
|
{
|
||||||
LOG(LogError) << "getDeviceGUIDString - deviceId " << deviceId << " not found!";
|
LOG(LogError) << "getDeviceGUIDString - deviceId " << deviceId << " not found!";
|
||||||
return "something went horribly wrong";
|
return "something went horribly wrong";
|
||||||
|
|
|
@ -132,10 +132,10 @@ void Settings::setDefaults()
|
||||||
template <typename K, typename V>
|
template <typename K, typename V>
|
||||||
void saveMap(pugi::xml_document& doc, std::map<K, V>& map, const char* type)
|
void saveMap(pugi::xml_document& doc, std::map<K, V>& map, const char* type)
|
||||||
{
|
{
|
||||||
for(auto iter = map.begin(); iter != map.end(); iter++)
|
for(auto iter = map.cbegin(); iter != map.cend(); iter++)
|
||||||
{
|
{
|
||||||
// key is on the "don't save" list, so don't save it
|
// key is on the "don't save" list, so don't save it
|
||||||
if(std::find(settings_dont_save.begin(), settings_dont_save.end(), iter->first) != settings_dont_save.end())
|
if(std::find(settings_dont_save.cbegin(), settings_dont_save.cend(), iter->first) != settings_dont_save.cend())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pugi::xml_node node = doc.append_child(type);
|
pugi::xml_node node = doc.append_child(type);
|
||||||
|
@ -155,7 +155,7 @@ void Settings::saveFile()
|
||||||
saveMap<std::string, float>(doc, mFloatMap, "float");
|
saveMap<std::string, float>(doc, mFloatMap, "float");
|
||||||
|
|
||||||
//saveMap<std::string, std::string>(doc, mStringMap, "string");
|
//saveMap<std::string, std::string>(doc, mStringMap, "string");
|
||||||
for(auto iter = mStringMap.begin(); iter != mStringMap.end(); iter++)
|
for(auto iter = mStringMap.cbegin(); iter != mStringMap.cend(); iter++)
|
||||||
{
|
{
|
||||||
pugi::xml_node node = doc.append_child("string");
|
pugi::xml_node node = doc.append_child("string");
|
||||||
node.append_attribute("name").set_value(iter->first.c_str());
|
node.append_attribute("name").set_value(iter->first.c_str());
|
||||||
|
@ -193,7 +193,7 @@ void Settings::loadFile()
|
||||||
//Print a warning message if the setting we're trying to get doesn't already exist in the map, then return the value in the map.
|
//Print a warning message if the setting we're trying to get doesn't already exist in the map, then return the value in the map.
|
||||||
#define SETTINGS_GETSET(type, mapName, getMethodName, setMethodName) type Settings::getMethodName(const std::string& name) \
|
#define SETTINGS_GETSET(type, mapName, getMethodName, setMethodName) type Settings::getMethodName(const std::string& name) \
|
||||||
{ \
|
{ \
|
||||||
if(mapName.find(name) == mapName.end()) \
|
if(mapName.find(name) == mapName.cend()) \
|
||||||
{ \
|
{ \
|
||||||
LOG(LogError) << "Tried to use unset setting " << name << "!"; \
|
LOG(LogError) << "Tried to use unset setting " << name << "!"; \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -10,7 +10,7 @@ std::map< std::string, std::shared_ptr<Sound> > Sound::sMap;
|
||||||
std::shared_ptr<Sound> Sound::get(const std::string& path)
|
std::shared_ptr<Sound> Sound::get(const std::string& path)
|
||||||
{
|
{
|
||||||
auto it = sMap.find(path);
|
auto it = sMap.find(path);
|
||||||
if(it != sMap.end())
|
if(it != sMap.cend())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
std::shared_ptr<Sound> sound = std::shared_ptr<Sound>(new Sound(path));
|
std::shared_ptr<Sound> sound = std::shared_ptr<Sound>(new Sound(path));
|
||||||
|
|
|
@ -215,7 +215,7 @@ void ThemeData::loadFile(std::map<std::string, std::string> sysDataMap, const st
|
||||||
mViews.clear();
|
mViews.clear();
|
||||||
mVariables.clear();
|
mVariables.clear();
|
||||||
|
|
||||||
mVariables.insert(sysDataMap.begin(), sysDataMap.end());
|
mVariables.insert(sysDataMap.cbegin(), sysDataMap.cend());
|
||||||
|
|
||||||
pugi::xml_document doc;
|
pugi::xml_document doc;
|
||||||
pugi::xml_parse_result res = doc.load_file(path.c_str());
|
pugi::xml_parse_result res = doc.load_file(path.c_str());
|
||||||
|
@ -286,7 +286,7 @@ void ThemeData::parseFeatures(const pugi::xml_node& root)
|
||||||
|
|
||||||
const std::string supportedAttr = node.attribute("supported").as_string();
|
const std::string supportedAttr = node.attribute("supported").as_string();
|
||||||
|
|
||||||
if (std::find(sSupportedFeatures.begin(), sSupportedFeatures.end(), supportedAttr) != sSupportedFeatures.end())
|
if (std::find(sSupportedFeatures.cbegin(), sSupportedFeatures.cend(), supportedAttr) != sSupportedFeatures.cend())
|
||||||
{
|
{
|
||||||
parseViews(node);
|
parseViews(node);
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ void ThemeData::parseViews(const pugi::xml_node& root)
|
||||||
prevOff = nameAttr.find_first_not_of(delim, off);
|
prevOff = nameAttr.find_first_not_of(delim, off);
|
||||||
off = nameAttr.find_first_of(delim, prevOff);
|
off = nameAttr.find_first_of(delim, prevOff);
|
||||||
|
|
||||||
if (std::find(sSupportedViews.begin(), sSupportedViews.end(), viewKey) != sSupportedViews.end())
|
if (std::find(sSupportedViews.cbegin(), sSupportedViews.cend(), viewKey) != sSupportedViews.cend())
|
||||||
{
|
{
|
||||||
ThemeView& view = mViews.insert(std::pair<std::string, ThemeView>(viewKey, ThemeView())).first->second;
|
ThemeView& view = mViews.insert(std::pair<std::string, ThemeView>(viewKey, ThemeView())).first->second;
|
||||||
parseView(node, view);
|
parseView(node, view);
|
||||||
|
@ -355,7 +355,7 @@ void ThemeData::parseView(const pugi::xml_node& root, ThemeView& view)
|
||||||
throw error << "Element of type \"" << node.name() << "\" missing \"name\" attribute!";
|
throw error << "Element of type \"" << node.name() << "\" missing \"name\" attribute!";
|
||||||
|
|
||||||
auto elemTypeIt = sElementMap.find(node.name());
|
auto elemTypeIt = sElementMap.find(node.name());
|
||||||
if(elemTypeIt == sElementMap.end())
|
if(elemTypeIt == sElementMap.cend())
|
||||||
throw error << "Unknown element of type \"" << node.name() << "\"!";
|
throw error << "Unknown element of type \"" << node.name() << "\"!";
|
||||||
|
|
||||||
const char* delim = " \t\r\n,";
|
const char* delim = " \t\r\n,";
|
||||||
|
@ -371,7 +371,7 @@ void ThemeData::parseView(const pugi::xml_node& root, ThemeView& view)
|
||||||
parseElement(node, elemTypeIt->second,
|
parseElement(node, elemTypeIt->second,
|
||||||
view.elements.insert(std::pair<std::string, ThemeElement>(elemKey, ThemeElement())).first->second);
|
view.elements.insert(std::pair<std::string, ThemeElement>(elemKey, ThemeElement())).first->second);
|
||||||
|
|
||||||
if(std::find(view.orderedKeys.begin(), view.orderedKeys.end(), elemKey) == view.orderedKeys.end())
|
if(std::find(view.orderedKeys.cbegin(), view.orderedKeys.cend(), elemKey) == view.orderedKeys.cend())
|
||||||
view.orderedKeys.push_back(elemKey);
|
view.orderedKeys.push_back(elemKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ void ThemeData::parseElement(const pugi::xml_node& root, const std::map<std::str
|
||||||
for(pugi::xml_node node = root.first_child(); node; node = node.next_sibling())
|
for(pugi::xml_node node = root.first_child(); node; node = node.next_sibling())
|
||||||
{
|
{
|
||||||
auto typeIt = typeMap.find(node.name());
|
auto typeIt = typeMap.find(node.name());
|
||||||
if(typeIt == typeMap.end())
|
if(typeIt == typeMap.cend())
|
||||||
throw error << "Unknown property type \"" << node.name() << "\" (for element of type " << root.name() << ").";
|
throw error << "Unknown property type \"" << node.name() << "\" (for element of type " << root.name() << ").";
|
||||||
|
|
||||||
std::string str = resolvePlaceholders(node.text().as_string());
|
std::string str = resolvePlaceholders(node.text().as_string());
|
||||||
|
@ -457,17 +457,17 @@ void ThemeData::parseElement(const pugi::xml_node& root, const std::map<std::str
|
||||||
bool ThemeData::hasView(const std::string& view)
|
bool ThemeData::hasView(const std::string& view)
|
||||||
{
|
{
|
||||||
auto viewIt = mViews.find(view);
|
auto viewIt = mViews.find(view);
|
||||||
return (viewIt != mViews.end());
|
return (viewIt != mViews.cend());
|
||||||
}
|
}
|
||||||
|
|
||||||
const ThemeData::ThemeElement* ThemeData::getElement(const std::string& view, const std::string& element, const std::string& expectedType) const
|
const ThemeData::ThemeElement* ThemeData::getElement(const std::string& view, const std::string& element, const std::string& expectedType) const
|
||||||
{
|
{
|
||||||
auto viewIt = mViews.find(view);
|
auto viewIt = mViews.find(view);
|
||||||
if(viewIt == mViews.end())
|
if(viewIt == mViews.cend())
|
||||||
return NULL; // not found
|
return NULL; // not found
|
||||||
|
|
||||||
auto elemIt = viewIt->second.elements.find(element);
|
auto elemIt = viewIt->second.elements.find(element);
|
||||||
if(elemIt == viewIt->second.elements.end()) return NULL;
|
if(elemIt == viewIt->second.elements.cend()) return NULL;
|
||||||
|
|
||||||
if(elemIt->second.type != expectedType && !expectedType.empty())
|
if(elemIt->second.type != expectedType && !expectedType.empty())
|
||||||
{
|
{
|
||||||
|
@ -509,10 +509,10 @@ std::vector<GuiComponent*> ThemeData::makeExtras(const std::shared_ptr<ThemeData
|
||||||
std::vector<GuiComponent*> comps;
|
std::vector<GuiComponent*> comps;
|
||||||
|
|
||||||
auto viewIt = theme->mViews.find(view);
|
auto viewIt = theme->mViews.find(view);
|
||||||
if(viewIt == theme->mViews.end())
|
if(viewIt == theme->mViews.cend())
|
||||||
return comps;
|
return comps;
|
||||||
|
|
||||||
for(auto it = viewIt->second.orderedKeys.begin(); it != viewIt->second.orderedKeys.end(); it++)
|
for(auto it = viewIt->second.orderedKeys.cbegin(); it != viewIt->second.orderedKeys.cend(); it++)
|
||||||
{
|
{
|
||||||
ThemeElement& elem = viewIt->second.elements.at(*it);
|
ThemeElement& elem = viewIt->second.elements.at(*it);
|
||||||
if(elem.extra)
|
if(elem.extra)
|
||||||
|
@ -572,11 +572,11 @@ fs::path ThemeData::getThemeFromCurrentSet(const std::string& system)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto set = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
std::map<std::string, ThemeSet>::const_iterator set = themeSets.find(Settings::getInstance()->getString("ThemeSet"));
|
||||||
if(set == themeSets.end())
|
if(set == themeSets.cend())
|
||||||
{
|
{
|
||||||
// currently selected theme set is missing, so just pick the first available set
|
// currently selected theme set is missing, so just pick the first available set
|
||||||
set = themeSets.begin();
|
set = themeSets.cbegin();
|
||||||
Settings::getInstance()->setString("ThemeSet", set->first);
|
Settings::getInstance()->setString("ThemeSet", set->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
inline void setFiles(const std::deque<boost::filesystem::path>& deque)
|
inline void setFiles(const std::deque<boost::filesystem::path>& deque)
|
||||||
{
|
{
|
||||||
*this << "from theme \"" << deque.front().string() << "\"\n";
|
*this << "from theme \"" << deque.front().string() << "\"\n";
|
||||||
for(auto it = deque.begin() + 1; it != deque.end(); it++)
|
for(auto it = deque.cbegin() + 1; it != deque.cend(); it++)
|
||||||
*this << " (from included file \"" << (*it).string() << "\")\n";
|
*this << " (from included file \"" << (*it).string() << "\")\n";
|
||||||
*this << " ";
|
*this << " ";
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T get(const std::string& prop) const { return boost::get<T>(properties.at(prop)); }
|
T get(const std::string& prop) const { return boost::get<T>(properties.at(prop)); }
|
||||||
|
|
||||||
inline bool has(const std::string& prop) const { return (properties.find(prop) != properties.end()); }
|
inline bool has(const std::string& prop) const { return (properties.find(prop) != properties.cend()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -276,7 +276,7 @@ std::string vectorToCommaString(std::vector<std::string> stringVector)
|
||||||
std::string out = "";
|
std::string out = "";
|
||||||
std::sort(stringVector.begin(), stringVector.end());
|
std::sort(stringVector.begin(), stringVector.end());
|
||||||
// from a vector of system names get comma separated string
|
// from a vector of system names get comma separated string
|
||||||
for(std::vector<std::string>::iterator it = stringVector.begin() ; it != stringVector.end() ; it++ )
|
for(std::vector<std::string>::const_iterator it = stringVector.cbegin() ; it != stringVector.cend() ; it++ )
|
||||||
{
|
{
|
||||||
out = out + (out == "" ? "" : ",") + (*it);
|
out = out + (out == "" ? "" : ",") + (*it);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,13 @@ void Window::pushGui(GuiComponent* gui)
|
||||||
|
|
||||||
void Window::removeGui(GuiComponent* gui)
|
void Window::removeGui(GuiComponent* gui)
|
||||||
{
|
{
|
||||||
for(auto i = mGuiStack.begin(); i != mGuiStack.end(); i++)
|
for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++)
|
||||||
{
|
{
|
||||||
if(*i == gui)
|
if(*i == gui)
|
||||||
{
|
{
|
||||||
i = mGuiStack.erase(i);
|
i = mGuiStack.erase(i);
|
||||||
|
|
||||||
if(i == mGuiStack.end() && mGuiStack.size()) // we just popped the stack and the stack is not empty
|
if(i == mGuiStack.cend() && mGuiStack.size()) // we just popped the stack and the stack is not empty
|
||||||
{
|
{
|
||||||
mGuiStack.back()->updateHelpPrompts();
|
mGuiStack.back()->updateHelpPrompts();
|
||||||
mGuiStack.back()->topWindow(true);
|
mGuiStack.back()->topWindow(true);
|
||||||
|
@ -99,7 +99,7 @@ bool Window::init(unsigned int width, unsigned int height)
|
||||||
void Window::deinit()
|
void Window::deinit()
|
||||||
{
|
{
|
||||||
// Hide all GUI elements on uninitialisation - this disable
|
// Hide all GUI elements on uninitialisation - this disable
|
||||||
for(auto i = mGuiStack.begin(); i != mGuiStack.end(); i++)
|
for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++)
|
||||||
{
|
{
|
||||||
(*i)->onHide();
|
(*i)->onHide();
|
||||||
}
|
}
|
||||||
|
@ -332,14 +332,14 @@ void Window::setHelpPrompts(const std::vector<HelpPrompt>& prompts, const HelpSt
|
||||||
|
|
||||||
std::map<std::string, bool> inputSeenMap;
|
std::map<std::string, bool> inputSeenMap;
|
||||||
std::map<std::string, int> mappedToSeenMap;
|
std::map<std::string, int> mappedToSeenMap;
|
||||||
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
for(auto it = prompts.cbegin(); it != prompts.cend(); it++)
|
||||||
{
|
{
|
||||||
// only add it if the same icon hasn't already been added
|
// only add it if the same icon hasn't already been added
|
||||||
if(inputSeenMap.emplace(it->first, true).second)
|
if(inputSeenMap.emplace(it->first, true).second)
|
||||||
{
|
{
|
||||||
// this symbol hasn't been seen yet, what about the action name?
|
// this symbol hasn't been seen yet, what about the action name?
|
||||||
auto mappedTo = mappedToSeenMap.find(it->second);
|
auto mappedTo = mappedToSeenMap.find(it->second);
|
||||||
if(mappedTo != mappedToSeenMap.end())
|
if(mappedTo != mappedToSeenMap.cend())
|
||||||
{
|
{
|
||||||
// yes, it has!
|
// yes, it has!
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ void Window::onWake()
|
||||||
|
|
||||||
bool Window::isProcessing()
|
bool Window::isProcessing()
|
||||||
{
|
{
|
||||||
return count_if(mGuiStack.begin(), mGuiStack.end(), [](GuiComponent* c) { return c->isProcessing(); }) > 0;
|
return count_if(mGuiStack.cbegin(), mGuiStack.cend(), [](GuiComponent* c) { return c->isProcessing(); }) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::startScreenSaver()
|
void Window::startScreenSaver()
|
||||||
|
@ -412,7 +412,7 @@ void Window::startScreenSaver()
|
||||||
if (mScreenSaver && !mRenderScreenSaver)
|
if (mScreenSaver && !mRenderScreenSaver)
|
||||||
{
|
{
|
||||||
// Tell the GUI components the screensaver is starting
|
// Tell the GUI components the screensaver is starting
|
||||||
for(auto i = mGuiStack.begin(); i != mGuiStack.end(); i++)
|
for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++)
|
||||||
(*i)->onScreenSaverActivate();
|
(*i)->onScreenSaverActivate();
|
||||||
|
|
||||||
mScreenSaver->startScreenSaver();
|
mScreenSaver->startScreenSaver();
|
||||||
|
@ -428,7 +428,7 @@ void Window::startScreenSaver()
|
||||||
mRenderScreenSaver = false;
|
mRenderScreenSaver = false;
|
||||||
|
|
||||||
// Tell the GUI components the screensaver has stopped
|
// Tell the GUI components the screensaver has stopped
|
||||||
for(auto i = mGuiStack.begin(); i != mGuiStack.end(); i++)
|
for(auto i = mGuiStack.cbegin(); i != mGuiStack.cend(); i++)
|
||||||
(*i)->onScreenSaverDeactivate();
|
(*i)->onScreenSaverDeactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ void AnimatedImageComponent::reset()
|
||||||
|
|
||||||
void AnimatedImageComponent::onSizeChanged()
|
void AnimatedImageComponent::onSizeChanged()
|
||||||
{
|
{
|
||||||
for(auto it = mFrames.begin(); it != mFrames.end(); it++)
|
for(auto it = mFrames.cbegin(); it != mFrames.cend(); it++)
|
||||||
{
|
{
|
||||||
it->first->setResize(mSize.x(), mSize.y());
|
it->first->setResize(mSize.x(), mSize.y());
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ void ComponentGrid::setEntry(const std::shared_ptr<GuiComponent>& comp, const Ve
|
||||||
|
|
||||||
bool ComponentGrid::removeEntry(const std::shared_ptr<GuiComponent>& comp)
|
bool ComponentGrid::removeEntry(const std::shared_ptr<GuiComponent>& comp)
|
||||||
{
|
{
|
||||||
for(auto it = mCells.begin(); it != mCells.end(); it++)
|
for(auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->component == comp)
|
if(it->component == comp)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ void ComponentGrid::updateSeparators()
|
||||||
|
|
||||||
Vector2f pos;
|
Vector2f pos;
|
||||||
Vector2f size;
|
Vector2f size;
|
||||||
for(auto it = mCells.begin(); it != mCells.end(); it++)
|
for(auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||||
{
|
{
|
||||||
if(!it->border && !drawAll)
|
if(!it->border && !drawAll)
|
||||||
continue;
|
continue;
|
||||||
|
@ -200,17 +200,17 @@ void ComponentGrid::updateSeparators()
|
||||||
|
|
||||||
void ComponentGrid::onSizeChanged()
|
void ComponentGrid::onSizeChanged()
|
||||||
{
|
{
|
||||||
for(auto it = mCells.begin(); it != mCells.end(); it++)
|
for(auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||||
updateCellComponent(*it);
|
updateCellComponent(*it);
|
||||||
|
|
||||||
updateSeparators();
|
updateSeparators();
|
||||||
}
|
}
|
||||||
|
|
||||||
ComponentGrid::GridEntry* ComponentGrid::getCellAt(int x, int y)
|
const ComponentGrid::GridEntry* ComponentGrid::getCellAt(int x, int y) const
|
||||||
{
|
{
|
||||||
assert(x >= 0 && x < mGridSize.x() && y >= 0 && y < mGridSize.y());
|
assert(x >= 0 && x < mGridSize.x() && y >= 0 && y < mGridSize.y());
|
||||||
|
|
||||||
for(auto it = mCells.begin(); it != mCells.end(); it++)
|
for(auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||||
{
|
{
|
||||||
int xmin = it->pos.x();
|
int xmin = it->pos.x();
|
||||||
int xmax = xmin + it->dim.x();
|
int xmax = xmin + it->dim.x();
|
||||||
|
@ -226,7 +226,7 @@ ComponentGrid::GridEntry* ComponentGrid::getCellAt(int x, int y)
|
||||||
|
|
||||||
bool ComponentGrid::input(InputConfig* config, Input input)
|
bool ComponentGrid::input(InputConfig* config, Input input)
|
||||||
{
|
{
|
||||||
GridEntry* cursorEntry = getCellAt(mCursor);
|
const GridEntry* cursorEntry = getCellAt(mCursor);
|
||||||
if(cursorEntry && cursorEntry->component->input(config, input))
|
if(cursorEntry && cursorEntry->component->input(config, input))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ void ComponentGrid::resetCursor()
|
||||||
if(!mCells.size())
|
if(!mCells.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(auto it = mCells.begin(); it != mCells.end(); it++)
|
for(auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->canFocus)
|
if(it->canFocus)
|
||||||
{
|
{
|
||||||
|
@ -276,7 +276,7 @@ bool ComponentGrid::moveCursor(Vector2i dir)
|
||||||
|
|
||||||
const Vector2i origCursor = mCursor;
|
const Vector2i origCursor = mCursor;
|
||||||
|
|
||||||
GridEntry* currentCursorEntry = getCellAt(mCursor);
|
const GridEntry* currentCursorEntry = getCellAt(mCursor);
|
||||||
|
|
||||||
Vector2i searchAxis(dir.x() == 0, dir.y() == 0);
|
Vector2i searchAxis(dir.x() == 0, dir.y() == 0);
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ bool ComponentGrid::moveCursor(Vector2i dir)
|
||||||
|
|
||||||
Vector2i curDirPos = mCursor;
|
Vector2i curDirPos = mCursor;
|
||||||
|
|
||||||
GridEntry* cursorEntry;
|
const GridEntry* cursorEntry;
|
||||||
//spread out on search axis+
|
//spread out on search axis+
|
||||||
while(mCursor.x() < mGridSize.x() && mCursor.y() < mGridSize.y()
|
while(mCursor.x() < mGridSize.x() && mCursor.y() < mGridSize.y()
|
||||||
&& mCursor.x() >= 0 && mCursor.y() >= 0)
|
&& mCursor.x() >= 0 && mCursor.y() >= 0)
|
||||||
|
@ -326,29 +326,29 @@ bool ComponentGrid::moveCursor(Vector2i dir)
|
||||||
|
|
||||||
void ComponentGrid::onFocusLost()
|
void ComponentGrid::onFocusLost()
|
||||||
{
|
{
|
||||||
GridEntry* cursorEntry = getCellAt(mCursor);
|
const GridEntry* cursorEntry = getCellAt(mCursor);
|
||||||
if(cursorEntry)
|
if(cursorEntry)
|
||||||
cursorEntry->component->onFocusLost();
|
cursorEntry->component->onFocusLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentGrid::onFocusGained()
|
void ComponentGrid::onFocusGained()
|
||||||
{
|
{
|
||||||
GridEntry* cursorEntry = getCellAt(mCursor);
|
const GridEntry* cursorEntry = getCellAt(mCursor);
|
||||||
if(cursorEntry)
|
if(cursorEntry)
|
||||||
cursorEntry->component->onFocusGained();
|
cursorEntry->component->onFocusGained();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ComponentGrid::cursorValid()
|
bool ComponentGrid::cursorValid()
|
||||||
{
|
{
|
||||||
GridEntry* e = getCellAt(mCursor);
|
const GridEntry* e = getCellAt(mCursor);
|
||||||
return (e != NULL && e->canFocus);
|
return (e != NULL && e->canFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentGrid::update(int deltaTime)
|
void ComponentGrid::update(int deltaTime)
|
||||||
{
|
{
|
||||||
// update ALL THE THINGS
|
// update ALL THE THINGS
|
||||||
GridEntry* cursorEntry = getCellAt(mCursor);
|
const GridEntry* cursorEntry = getCellAt(mCursor);
|
||||||
for(auto it = mCells.begin(); it != mCells.end(); it++)
|
for(auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->updateType == UPDATE_ALWAYS || (it->updateType == UPDATE_WHEN_SELECTED && cursorEntry == &(*it)))
|
if(it->updateType == UPDATE_ALWAYS || (it->updateType == UPDATE_WHEN_SELECTED && cursorEntry == &(*it)))
|
||||||
it->component->update(deltaTime);
|
it->component->update(deltaTime);
|
||||||
|
@ -384,14 +384,14 @@ void ComponentGrid::render(const Transform4x4f& parentTrans)
|
||||||
|
|
||||||
void ComponentGrid::textInput(const char* text)
|
void ComponentGrid::textInput(const char* text)
|
||||||
{
|
{
|
||||||
GridEntry* selectedEntry = getCellAt(mCursor);
|
const GridEntry* selectedEntry = getCellAt(mCursor);
|
||||||
if(selectedEntry != NULL && selectedEntry->canFocus)
|
if(selectedEntry != NULL && selectedEntry->canFocus)
|
||||||
selectedEntry->component->textInput(text);
|
selectedEntry->component->textInput(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComponentGrid::onCursorMoved(Vector2i from, Vector2i to)
|
void ComponentGrid::onCursorMoved(Vector2i from, Vector2i to)
|
||||||
{
|
{
|
||||||
GridEntry* cell = getCellAt(from);
|
const GridEntry* cell = getCellAt(from);
|
||||||
if(cell)
|
if(cell)
|
||||||
cell->component->onFocusLost();
|
cell->component->onFocusLost();
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ void ComponentGrid::onCursorMoved(Vector2i from, Vector2i to)
|
||||||
|
|
||||||
void ComponentGrid::setCursorTo(const std::shared_ptr<GuiComponent>& comp)
|
void ComponentGrid::setCursorTo(const std::shared_ptr<GuiComponent>& comp)
|
||||||
{
|
{
|
||||||
for(auto it = mCells.begin(); it != mCells.end(); it++)
|
for(auto it = mCells.cbegin(); it != mCells.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->component == comp)
|
if(it->component == comp)
|
||||||
{
|
{
|
||||||
|
@ -422,13 +422,13 @@ void ComponentGrid::setCursorTo(const std::shared_ptr<GuiComponent>& comp)
|
||||||
std::vector<HelpPrompt> ComponentGrid::getHelpPrompts()
|
std::vector<HelpPrompt> ComponentGrid::getHelpPrompts()
|
||||||
{
|
{
|
||||||
std::vector<HelpPrompt> prompts;
|
std::vector<HelpPrompt> prompts;
|
||||||
GridEntry* e = getCellAt(mCursor);
|
const GridEntry* e = getCellAt(mCursor);
|
||||||
if(e)
|
if(e)
|
||||||
prompts = e->component->getHelpPrompts();
|
prompts = e->component->getHelpPrompts();
|
||||||
|
|
||||||
bool canScrollVert = mGridSize.y() > 1;
|
bool canScrollVert = mGridSize.y() > 1;
|
||||||
bool canScrollHoriz = mGridSize.x() > 1;
|
bool canScrollHoriz = mGridSize.x() > 1;
|
||||||
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
for(auto it = prompts.cbegin(); it != prompts.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->first == "up/down/left/right")
|
if(it->first == "up/down/left/right")
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
|
|
||||||
inline std::shared_ptr<GuiComponent> getSelectedComponent()
|
inline std::shared_ptr<GuiComponent> getSelectedComponent()
|
||||||
{
|
{
|
||||||
GridEntry* e = getCellAt(mCursor);
|
const GridEntry* e = getCellAt(mCursor);
|
||||||
if(e)
|
if(e)
|
||||||
return e->component;
|
return e->component;
|
||||||
else
|
else
|
||||||
|
@ -110,8 +110,8 @@ private:
|
||||||
void updateCellComponent(const GridEntry& cell);
|
void updateCellComponent(const GridEntry& cell);
|
||||||
void updateSeparators();
|
void updateSeparators();
|
||||||
|
|
||||||
GridEntry* getCellAt(int x, int y);
|
const GridEntry* getCellAt(int x, int y) const;
|
||||||
inline GridEntry* getCellAt(const Vector2i& pos) { return getCellAt(pos.x(), pos.y()); }
|
inline const GridEntry* getCellAt(const Vector2i& pos) const { return getCellAt(pos.x(), pos.y()); }
|
||||||
|
|
||||||
Vector2i mGridSize;
|
Vector2i mGridSize;
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ void ComponentList::addRow(const ComponentListRow& row, bool setCursorHere)
|
||||||
|
|
||||||
this->add(e);
|
this->add(e);
|
||||||
|
|
||||||
for(auto it = mEntries.back().data.elements.begin(); it != mEntries.back().data.elements.end(); it++)
|
for(auto it = mEntries.back().data.elements.cbegin(); it != mEntries.back().data.elements.cend(); it++)
|
||||||
addChild(it->component.get());
|
addChild(it->component.get());
|
||||||
|
|
||||||
updateElementSize(mEntries.back().data);
|
updateElementSize(mEntries.back().data);
|
||||||
|
@ -35,7 +35,7 @@ void ComponentList::addRow(const ComponentListRow& row, bool setCursorHere)
|
||||||
|
|
||||||
void ComponentList::onSizeChanged()
|
void ComponentList::onSizeChanged()
|
||||||
{
|
{
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||||
{
|
{
|
||||||
updateElementSize(it->data);
|
updateElementSize(it->data);
|
||||||
updateElementPosition(it->data);
|
updateElementPosition(it->data);
|
||||||
|
@ -99,7 +99,7 @@ void ComponentList::update(int deltaTime)
|
||||||
if(size())
|
if(size())
|
||||||
{
|
{
|
||||||
// update our currently selected row
|
// update our currently selected row
|
||||||
for(auto it = mEntries.at(mCursor).data.elements.begin(); it != mEntries.at(mCursor).data.elements.end(); it++)
|
for(auto it = mEntries.at(mCursor).data.elements.cbegin(); it != mEntries.at(mCursor).data.elements.cend(); it++)
|
||||||
it->component->update(deltaTime);
|
it->component->update(deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ void ComponentList::onCursorChanged(const CursorState& state)
|
||||||
// this is terribly inefficient but we don't know what we came from so...
|
// this is terribly inefficient but we don't know what we came from so...
|
||||||
if(size())
|
if(size())
|
||||||
{
|
{
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||||
it->data.elements.back().component->onFocusLost();
|
it->data.elements.back().component->onFocusLost();
|
||||||
|
|
||||||
mEntries.at(mCursor).data.elements.back().component->onFocusGained();
|
mEntries.at(mCursor).data.elements.back().component->onFocusGained();
|
||||||
|
@ -181,7 +181,7 @@ void ComponentList::render(const Transform4x4f& parentTrans)
|
||||||
{
|
{
|
||||||
auto& entry = mEntries.at(i);
|
auto& entry = mEntries.at(i);
|
||||||
drawAll = !mFocused || i != (unsigned int)mCursor;
|
drawAll = !mFocused || i != (unsigned int)mCursor;
|
||||||
for(auto it = entry.data.elements.begin(); it != entry.data.elements.end(); it++)
|
for(auto it = entry.data.elements.cbegin(); it != entry.data.elements.cend(); it++)
|
||||||
{
|
{
|
||||||
if(drawAll || it->invert_when_selected)
|
if(drawAll || it->invert_when_selected)
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@ void ComponentList::render(const Transform4x4f& parentTrans)
|
||||||
Renderer::drawRect(0.0f, mSelectorBarOffset, 2.0f, selectedRowHeight, 0x878787FF);
|
Renderer::drawRect(0.0f, mSelectorBarOffset, 2.0f, selectedRowHeight, 0x878787FF);
|
||||||
Renderer::drawRect(mSize.x() - 2.0f, mSelectorBarOffset, 2.0f, selectedRowHeight, 0x878787FF);
|
Renderer::drawRect(mSize.x() - 2.0f, mSelectorBarOffset, 2.0f, selectedRowHeight, 0x878787FF);
|
||||||
|
|
||||||
for(auto it = drawAfterCursor.begin(); it != drawAfterCursor.end(); it++)
|
for(auto it = drawAfterCursor.cbegin(); it != drawAfterCursor.cend(); it++)
|
||||||
(*it)->render(trans);
|
(*it)->render(trans);
|
||||||
|
|
||||||
// reset matrix if one of these components changed it
|
// reset matrix if one of these components changed it
|
||||||
|
@ -249,7 +249,7 @@ float ComponentList::getRowHeight(const ComponentListRow& row) const
|
||||||
float ComponentList::getTotalRowHeight() const
|
float ComponentList::getTotalRowHeight() const
|
||||||
{
|
{
|
||||||
float height = 0;
|
float height = 0;
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||||
{
|
{
|
||||||
height += getRowHeight(it->data);
|
height += getRowHeight(it->data);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ float ComponentList::getTotalRowHeight() const
|
||||||
void ComponentList::updateElementPosition(const ComponentListRow& row)
|
void ComponentList::updateElementPosition(const ComponentListRow& row)
|
||||||
{
|
{
|
||||||
float yOffset = 0;
|
float yOffset = 0;
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end() && &it->data != &row; it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend() && &it->data != &row; it++)
|
||||||
{
|
{
|
||||||
yOffset += getRowHeight(it->data);
|
yOffset += getRowHeight(it->data);
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ void ComponentList::updateElementSize(const ComponentListRow& row)
|
||||||
float width = mSize.x() - TOTAL_HORIZONTAL_PADDING_PX;
|
float width = mSize.x() - TOTAL_HORIZONTAL_PADDING_PX;
|
||||||
std::vector< std::shared_ptr<GuiComponent> > resizeVec;
|
std::vector< std::shared_ptr<GuiComponent> > resizeVec;
|
||||||
|
|
||||||
for(auto it = row.elements.begin(); it != row.elements.end(); it++)
|
for(auto it = row.elements.cbegin(); it != row.elements.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->resize_width)
|
if(it->resize_width)
|
||||||
resizeVec.push_back(it->component);
|
resizeVec.push_back(it->component);
|
||||||
|
@ -294,7 +294,7 @@ void ComponentList::updateElementSize(const ComponentListRow& row)
|
||||||
|
|
||||||
// redistribute the "unused" width equally among the components with resize_width set to true
|
// redistribute the "unused" width equally among the components with resize_width set to true
|
||||||
width = width / resizeVec.size();
|
width = width / resizeVec.size();
|
||||||
for(auto it = resizeVec.begin(); it != resizeVec.end(); it++)
|
for(auto it = resizeVec.cbegin(); it != resizeVec.cend(); it++)
|
||||||
{
|
{
|
||||||
(*it)->setSize(width, (*it)->getSize().y());
|
(*it)->setSize(width, (*it)->getSize().y());
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ std::vector<HelpPrompt> ComponentList::getHelpPrompts()
|
||||||
if(size() > 1)
|
if(size() > 1)
|
||||||
{
|
{
|
||||||
bool addMovePrompt = true;
|
bool addMovePrompt = true;
|
||||||
for(auto it = prompts.begin(); it != prompts.end(); it++)
|
for(auto it = prompts.cbegin(); it != prompts.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->first == "up/down" || it->first == "up/down/left/right")
|
if(it->first == "up/down" || it->first == "up/down/left/right")
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,7 @@ void HelpComponent::updateGrid()
|
||||||
|
|
||||||
float width = 0;
|
float width = 0;
|
||||||
const float height = round(font->getLetterHeight() * 1.25f);
|
const float height = round(font->getLetterHeight() * 1.25f);
|
||||||
for(auto it = mPrompts.begin(); it != mPrompts.end(); it++)
|
for(auto it = mPrompts.cbegin(); it != mPrompts.cend(); it++)
|
||||||
{
|
{
|
||||||
auto icon = std::make_shared<ImageComponent>(mWindow);
|
auto icon = std::make_shared<ImageComponent>(mWindow);
|
||||||
icon->setImage(getIconTexture(it->first.c_str()));
|
icon->setImage(getIconTexture(it->first.c_str()));
|
||||||
|
@ -101,11 +101,11 @@ void HelpComponent::updateGrid()
|
||||||
std::shared_ptr<TextureResource> HelpComponent::getIconTexture(const char* name)
|
std::shared_ptr<TextureResource> HelpComponent::getIconTexture(const char* name)
|
||||||
{
|
{
|
||||||
auto it = mIconCache.find(name);
|
auto it = mIconCache.find(name);
|
||||||
if(it != mIconCache.end())
|
if(it != mIconCache.cend())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
auto pathLookup = ICON_PATH_MAP.find(name);
|
auto pathLookup = ICON_PATH_MAP.find(name);
|
||||||
if(pathLookup == ICON_PATH_MAP.end())
|
if(pathLookup == ICON_PATH_MAP.cend())
|
||||||
{
|
{
|
||||||
LOG(LogError) << "Unknown help icon \"" << name << "\"!";
|
LOG(LogError) << "Unknown help icon \"" << name << "\"!";
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -129,21 +129,21 @@ public:
|
||||||
return mEntries.at(mCursor).object;
|
return mEntries.at(mCursor).object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCursor(typename std::vector<Entry>::iterator& it)
|
void setCursor(typename std::vector<Entry>::const_iterator& it)
|
||||||
{
|
{
|
||||||
assert(it != mEntries.end());
|
assert(it != mEntries.cend());
|
||||||
mCursor = it - mEntries.begin();
|
mCursor = it - mEntries.cbegin();
|
||||||
onCursorChanged(CURSOR_STOPPED);
|
onCursorChanged(CURSOR_STOPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns true if successful (select is in our list), false if not
|
// returns true if successful (select is in our list), false if not
|
||||||
bool setCursor(const UserData& obj)
|
bool setCursor(const UserData& obj)
|
||||||
{
|
{
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||||
{
|
{
|
||||||
if((*it).object == obj)
|
if((*it).object == obj)
|
||||||
{
|
{
|
||||||
mCursor = it - mEntries.begin();
|
mCursor = it - mEntries.cbegin();
|
||||||
onCursorChanged(CURSOR_STOPPED);
|
onCursorChanged(CURSOR_STOPPED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ public:
|
||||||
|
|
||||||
bool remove(const UserData& obj)
|
bool remove(const UserData& obj)
|
||||||
{
|
{
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||||
{
|
{
|
||||||
if((*it).object == obj)
|
if((*it).object == obj)
|
||||||
{
|
{
|
||||||
|
@ -175,9 +175,9 @@ public:
|
||||||
inline int size() const { return mEntries.size(); }
|
inline int size() const { return mEntries.size(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void remove(typename std::vector<Entry>::iterator& it)
|
void remove(typename std::vector<Entry>::const_iterator& it)
|
||||||
{
|
{
|
||||||
if(mCursor > 0 && it - mEntries.begin() <= mCursor)
|
if(mCursor > 0 && it - mEntries.cbegin() <= mCursor)
|
||||||
{
|
{
|
||||||
mCursor--;
|
mCursor--;
|
||||||
onCursorChanged(CURSOR_STOPPED);
|
onCursorChanged(CURSOR_STOPPED);
|
||||||
|
|
|
@ -62,7 +62,7 @@ private:
|
||||||
Vector2f squareSize(32, 32);
|
Vector2f squareSize(32, 32);
|
||||||
|
|
||||||
// calc biggest square size
|
// calc biggest square size
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||||
{
|
{
|
||||||
Vector2f chkSize = getSquareSize(it->data.texture);
|
Vector2f chkSize = getSquareSize(it->data.texture);
|
||||||
if(chkSize.x() > squareSize.x())
|
if(chkSize.x() > squareSize.x())
|
||||||
|
|
|
@ -219,7 +219,7 @@ public:
|
||||||
std::vector<T> getSelectedObjects()
|
std::vector<T> getSelectedObjects()
|
||||||
{
|
{
|
||||||
std::vector<T> ret;
|
std::vector<T> ret;
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->selected)
|
if(it->selected)
|
||||||
ret.push_back(it->object);
|
ret.push_back(it->object);
|
||||||
|
@ -298,7 +298,7 @@ private:
|
||||||
mParent->onSizeChanged();
|
mParent->onSizeChanged();
|
||||||
}else{
|
}else{
|
||||||
// display currently selected + l/r cursors
|
// display currently selected + l/r cursors
|
||||||
for(auto it = mEntries.begin(); it != mEntries.end(); it++)
|
for(auto it = mEntries.cbegin(); it != mEntries.cend(); it++)
|
||||||
{
|
{
|
||||||
if(it->selected)
|
if(it->selected)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ GuiMsgBox::GuiMsgBox(Window* window, const std::string& text,
|
||||||
{
|
{
|
||||||
mAcceleratorFunc = mButtons.front()->getPressedFunc();
|
mAcceleratorFunc = mButtons.front()->getPressedFunc();
|
||||||
}else{
|
}else{
|
||||||
for(auto it = mButtons.begin(); it != mButtons.end(); it++)
|
for(auto it = mButtons.cbegin(); it != mButtons.cend(); it++)
|
||||||
{
|
{
|
||||||
if(strToUpper((*it)->getText()) == "OK" || strToUpper((*it)->getText()) == "NO")
|
if(strToUpper((*it)->getText()) == "OK" || strToUpper((*it)->getText()) == "NO")
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,10 +39,10 @@ void Font::initLibrary()
|
||||||
size_t Font::getMemUsage() const
|
size_t Font::getMemUsage() const
|
||||||
{
|
{
|
||||||
size_t memUsage = 0;
|
size_t memUsage = 0;
|
||||||
for(auto it = mTextures.begin(); it != mTextures.end(); it++)
|
for(auto it = mTextures.cbegin(); it != mTextures.cend(); it++)
|
||||||
memUsage += it->textureSize.x() * it->textureSize.y() * 4;
|
memUsage += it->textureSize.x() * it->textureSize.y() * 4;
|
||||||
|
|
||||||
for(auto it = mFaceCache.begin(); it != mFaceCache.end(); it++)
|
for(auto it = mFaceCache.cbegin(); it != mFaceCache.cend(); it++)
|
||||||
memUsage += it->second->data.length;
|
memUsage += it->second->data.length;
|
||||||
|
|
||||||
return memUsage;
|
return memUsage;
|
||||||
|
@ -52,8 +52,8 @@ size_t Font::getTotalMemUsage()
|
||||||
{
|
{
|
||||||
size_t total = 0;
|
size_t total = 0;
|
||||||
|
|
||||||
auto it = sFontMap.begin();
|
auto it = sFontMap.cbegin();
|
||||||
while(it != sFontMap.end())
|
while(it != sFontMap.cend())
|
||||||
{
|
{
|
||||||
if(it->second.expired())
|
if(it->second.expired())
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ std::shared_ptr<Font> Font::get(int size, const std::string& path)
|
||||||
|
|
||||||
std::pair<std::string, int> def(canonicalPath.empty() ? getDefaultPath() : canonicalPath, size);
|
std::pair<std::string, int> def(canonicalPath.empty() ? getDefaultPath() : canonicalPath, size);
|
||||||
auto foundFont = sFontMap.find(def);
|
auto foundFont = sFontMap.find(def);
|
||||||
if(foundFont != sFontMap.end())
|
if(foundFont != sFontMap.cend())
|
||||||
{
|
{
|
||||||
if(!foundFont->second.expired())
|
if(!foundFont->second.expired())
|
||||||
return foundFont->second.lock();
|
return foundFont->second.lock();
|
||||||
|
@ -284,7 +284,7 @@ FT_Face Font::getFaceForChar(unsigned int id)
|
||||||
{
|
{
|
||||||
auto fit = mFaceCache.find(i);
|
auto fit = mFaceCache.find(i);
|
||||||
|
|
||||||
if(fit == mFaceCache.end()) // doesn't exist yet
|
if(fit == mFaceCache.cend()) // doesn't exist yet
|
||||||
{
|
{
|
||||||
// i == 0 -> mPath
|
// i == 0 -> mPath
|
||||||
// otherwise, take from fallbackFonts
|
// otherwise, take from fallbackFonts
|
||||||
|
@ -299,7 +299,7 @@ FT_Face Font::getFaceForChar(unsigned int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// nothing has a valid glyph - return the "real" face so we get a "missing" character
|
// nothing has a valid glyph - return the "real" face so we get a "missing" character
|
||||||
return mFaceCache.begin()->second->face;
|
return mFaceCache.cbegin()->second->face;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Font::clearFaceCache()
|
void Font::clearFaceCache()
|
||||||
|
@ -311,7 +311,7 @@ Font::Glyph* Font::getGlyph(unsigned int id)
|
||||||
{
|
{
|
||||||
// is it already loaded?
|
// is it already loaded?
|
||||||
auto it = mGlyphMap.find(id);
|
auto it = mGlyphMap.find(id);
|
||||||
if(it != mGlyphMap.end())
|
if(it != mGlyphMap.cend())
|
||||||
return &it->second;
|
return &it->second;
|
||||||
|
|
||||||
// nope, need to make a glyph
|
// nope, need to make a glyph
|
||||||
|
@ -376,7 +376,7 @@ void Font::rebuildTextures()
|
||||||
}
|
}
|
||||||
|
|
||||||
// reupload the texture data
|
// reupload the texture data
|
||||||
for(auto it = mGlyphMap.begin(); it != mGlyphMap.end(); it++)
|
for(auto it = mGlyphMap.cbegin(); it != mGlyphMap.cend(); it++)
|
||||||
{
|
{
|
||||||
FT_Face face = getFaceForChar(it->first);
|
FT_Face face = getFaceForChar(it->first);
|
||||||
FT_GlyphSlot glyphSlot = face->glyph;
|
FT_GlyphSlot glyphSlot = face->glyph;
|
||||||
|
@ -406,7 +406,7 @@ void Font::renderTextCache(TextCache* cache)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto it = cache->vertexLists.begin(); it != cache->vertexLists.end(); it++)
|
for(auto it = cache->vertexLists.cbegin(); it != cache->vertexLists.cend(); it++)
|
||||||
{
|
{
|
||||||
assert(*it->textureIdPtr != 0);
|
assert(*it->textureIdPtr != 0);
|
||||||
|
|
||||||
|
@ -675,7 +675,7 @@ TextCache* Font::buildTextCache(const std::string& text, Vector2f offset, unsign
|
||||||
cache->metrics = { sizeText(text, lineSpacing) };
|
cache->metrics = { sizeText(text, lineSpacing) };
|
||||||
|
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
for(auto it = vertMap.begin(); it != vertMap.end(); it++)
|
for(auto it = vertMap.cbegin(); it != vertMap.cend(); it++)
|
||||||
{
|
{
|
||||||
TextCache::VertexList& vertList = cache->vertexLists.at(i);
|
TextCache::VertexList& vertList = cache->vertexLists.at(i);
|
||||||
|
|
||||||
|
@ -698,8 +698,8 @@ TextCache* Font::buildTextCache(const std::string& text, float offsetX, float of
|
||||||
|
|
||||||
void TextCache::setColor(unsigned int color)
|
void TextCache::setColor(unsigned int color)
|
||||||
{
|
{
|
||||||
for(auto it = vertexLists.begin(); it != vertexLists.end(); it++)
|
for(auto it = vertexLists.cbegin(); it != vertexLists.cend(); it++)
|
||||||
Renderer::buildGLColorArray(it->colors.data(), color, it->verts.size());
|
Renderer::buildGLColorArray((GLubyte*)(it->colors.data()), color, it->verts.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Font> Font::getFromTheme(const ThemeData::ThemeElement* elem, unsigned int properties, const std::shared_ptr<Font>& orig)
|
std::shared_ptr<Font> Font::getFromTheme(const ThemeData::ThemeElement* elem, unsigned int properties, const std::shared_ptr<Font>& orig)
|
||||||
|
|
|
@ -27,7 +27,7 @@ const ResourceData ResourceManager::getFileData(const std::string& path) const
|
||||||
{
|
{
|
||||||
//check if its embedded
|
//check if its embedded
|
||||||
|
|
||||||
if(res2hMap.find(path) != res2hMap.end())
|
if(res2hMap.find(path) != res2hMap.cend())
|
||||||
{
|
{
|
||||||
//it is
|
//it is
|
||||||
Res2hEntry embeddedEntry = res2hMap.find(path)->second;
|
Res2hEntry embeddedEntry = res2hMap.find(path)->second;
|
||||||
|
@ -70,7 +70,7 @@ ResourceData ResourceManager::loadFile(const std::string& path) const
|
||||||
bool ResourceManager::fileExists(const std::string& path) const
|
bool ResourceManager::fileExists(const std::string& path) const
|
||||||
{
|
{
|
||||||
//if it exists as an embedded file, return true
|
//if it exists as an embedded file, return true
|
||||||
if(res2hMap.find(path) != res2hMap.end())
|
if(res2hMap.find(path) != res2hMap.cend())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return fs::exists(path);
|
return fs::exists(path);
|
||||||
|
@ -78,8 +78,8 @@ bool ResourceManager::fileExists(const std::string& path) const
|
||||||
|
|
||||||
void ResourceManager::unloadAll()
|
void ResourceManager::unloadAll()
|
||||||
{
|
{
|
||||||
auto iter = mReloadables.begin();
|
auto iter = mReloadables.cbegin();
|
||||||
while(iter != mReloadables.end())
|
while(iter != mReloadables.cend())
|
||||||
{
|
{
|
||||||
if(!iter->expired())
|
if(!iter->expired())
|
||||||
{
|
{
|
||||||
|
@ -93,8 +93,8 @@ void ResourceManager::unloadAll()
|
||||||
|
|
||||||
void ResourceManager::reloadAll()
|
void ResourceManager::reloadAll()
|
||||||
{
|
{
|
||||||
auto iter = mReloadables.begin();
|
auto iter = mReloadables.cbegin();
|
||||||
while(iter != mReloadables.end())
|
while(iter != mReloadables.cend())
|
||||||
{
|
{
|
||||||
if(!iter->expired())
|
if(!iter->expired())
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ std::shared_ptr<TextureData> TextureDataManager::add(const TextureResource* key,
|
||||||
remove(key);
|
remove(key);
|
||||||
std::shared_ptr<TextureData> data(new TextureData(tiled));
|
std::shared_ptr<TextureData> data(new TextureData(tiled));
|
||||||
mTextures.push_front(data);
|
mTextures.push_front(data);
|
||||||
mTextureLookup[key] = mTextures.begin();
|
mTextureLookup[key] = mTextures.cbegin();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void TextureDataManager::remove(const TextureResource* key)
|
||||||
{
|
{
|
||||||
// Find the entry in the list
|
// Find the entry in the list
|
||||||
auto it = mTextureLookup.find(key);
|
auto it = mTextureLookup.find(key);
|
||||||
if (it != mTextureLookup.end())
|
if (it != mTextureLookup.cend())
|
||||||
{
|
{
|
||||||
// Remove the list entry
|
// Remove the list entry
|
||||||
mTextures.erase((*it).second);
|
mTextures.erase((*it).second);
|
||||||
|
@ -52,7 +52,7 @@ std::shared_ptr<TextureData> TextureDataManager::get(const TextureResource* key)
|
||||||
// move it to the top
|
// move it to the top
|
||||||
std::shared_ptr<TextureData> tex;
|
std::shared_ptr<TextureData> tex;
|
||||||
auto it = mTextureLookup.find(key);
|
auto it = mTextureLookup.find(key);
|
||||||
if (it != mTextureLookup.end())
|
if (it != mTextureLookup.cend())
|
||||||
{
|
{
|
||||||
tex = *(*it).second;
|
tex = *(*it).second;
|
||||||
// Remove the list entry
|
// Remove the list entry
|
||||||
|
@ -60,7 +60,7 @@ std::shared_ptr<TextureData> TextureDataManager::get(const TextureResource* key)
|
||||||
// Put it at the top
|
// Put it at the top
|
||||||
mTextures.push_front(tex);
|
mTextures.push_front(tex);
|
||||||
// Store it back in the lookup
|
// Store it back in the lookup
|
||||||
mTextureLookup[key] = mTextures.begin();
|
mTextureLookup[key] = mTextures.cbegin();
|
||||||
|
|
||||||
// Make sure it's loaded or queued for loading
|
// Make sure it's loaded or queued for loading
|
||||||
load(tex);
|
load(tex);
|
||||||
|
@ -109,7 +109,7 @@ void TextureDataManager::load(std::shared_ptr<TextureData> tex, bool block)
|
||||||
size_t size = TextureResource::getTotalMemUsage();
|
size_t size = TextureResource::getTotalMemUsage();
|
||||||
size_t max_texture = (size_t)Settings::getInstance()->getInt("MaxVRAM") * 1024 * 1024;
|
size_t max_texture = (size_t)Settings::getInstance()->getInt("MaxVRAM") * 1024 * 1024;
|
||||||
|
|
||||||
for (auto it = mTextures.rbegin(); it != mTextures.rend(); ++it)
|
for (auto it = mTextures.crbegin(); it != mTextures.crend(); ++it)
|
||||||
{
|
{
|
||||||
if (size < max_texture)
|
if (size < max_texture)
|
||||||
break;
|
break;
|
||||||
|
@ -187,7 +187,7 @@ void TextureLoader::load(std::shared_ptr<TextureData> textureData)
|
||||||
std::unique_lock<std::mutex> lock(mMutex);
|
std::unique_lock<std::mutex> lock(mMutex);
|
||||||
// Remove it from the queue if it is already there
|
// Remove it from the queue if it is already there
|
||||||
auto td = mTextureDataLookup.find(textureData.get());
|
auto td = mTextureDataLookup.find(textureData.get());
|
||||||
if (td != mTextureDataLookup.end())
|
if (td != mTextureDataLookup.cend())
|
||||||
{
|
{
|
||||||
mTextureDataQ.erase((*td).second);
|
mTextureDataQ.erase((*td).second);
|
||||||
mTextureDataLookup.erase(td);
|
mTextureDataLookup.erase(td);
|
||||||
|
@ -195,7 +195,7 @@ void TextureLoader::load(std::shared_ptr<TextureData> textureData)
|
||||||
|
|
||||||
// Put it on the start of the queue as we want the newly requested textures to load first
|
// Put it on the start of the queue as we want the newly requested textures to load first
|
||||||
mTextureDataQ.push_front(textureData);
|
mTextureDataQ.push_front(textureData);
|
||||||
mTextureDataLookup[textureData.get()] = mTextureDataQ.begin();
|
mTextureDataLookup[textureData.get()] = mTextureDataQ.cbegin();
|
||||||
mEvent.notify_one();
|
mEvent.notify_one();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ void TextureLoader::remove(std::shared_ptr<TextureData> textureData)
|
||||||
// Just remove it from the queue so we don't attempt to load it
|
// Just remove it from the queue so we don't attempt to load it
|
||||||
std::unique_lock<std::mutex> lock(mMutex);
|
std::unique_lock<std::mutex> lock(mMutex);
|
||||||
auto td = mTextureDataLookup.find(textureData.get());
|
auto td = mTextureDataLookup.find(textureData.get());
|
||||||
if (td != mTextureDataLookup.end())
|
if (td != mTextureDataLookup.cend())
|
||||||
{
|
{
|
||||||
mTextureDataQ.erase((*td).second);
|
mTextureDataQ.erase((*td).second);
|
||||||
mTextureDataLookup.erase(td);
|
mTextureDataLookup.erase(td);
|
||||||
|
|
|
@ -28,7 +28,7 @@ private:
|
||||||
void threadProc();
|
void threadProc();
|
||||||
|
|
||||||
std::list<std::shared_ptr<TextureData> > mTextureDataQ;
|
std::list<std::shared_ptr<TextureData> > mTextureDataQ;
|
||||||
std::map<TextureData*, std::list<std::shared_ptr<TextureData> >::iterator > mTextureDataLookup;
|
std::map<TextureData*, std::list<std::shared_ptr<TextureData> >::const_iterator > mTextureDataLookup;
|
||||||
|
|
||||||
std::thread* mThread;
|
std::thread* mThread;
|
||||||
std::mutex mMutex;
|
std::mutex mMutex;
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::list<std::shared_ptr<TextureData> > mTextures;
|
std::list<std::shared_ptr<TextureData> > mTextures;
|
||||||
std::map<const TextureResource*, std::list<std::shared_ptr<TextureData> >::iterator > mTextureLookup;
|
std::map<const TextureResource*, std::list<std::shared_ptr<TextureData> >::const_iterator > mTextureLookup;
|
||||||
std::shared_ptr<TextureData> mBlank;
|
std::shared_ptr<TextureData> mBlank;
|
||||||
TextureLoader* mLoader;
|
TextureLoader* mLoader;
|
||||||
};
|
};
|
||||||
|
|
|
@ -114,7 +114,7 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path, b
|
||||||
|
|
||||||
TextureKeyType key(canonicalPath, tile);
|
TextureKeyType key(canonicalPath, tile);
|
||||||
auto foundTexture = sTextureMap.find(key);
|
auto foundTexture = sTextureMap.find(key);
|
||||||
if(foundTexture != sTextureMap.end())
|
if(foundTexture != sTextureMap.cend())
|
||||||
{
|
{
|
||||||
if(!foundTexture->second.expired())
|
if(!foundTexture->second.expired())
|
||||||
return foundTexture->second.lock();
|
return foundTexture->second.lock();
|
||||||
|
|
Loading…
Reference in a new issue