From 735ce398120da314253048c1982b63cba4f4f16b Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 19 Jan 2021 22:29:13 +0100 Subject: [PATCH] Some cosmetic code cleanup. --- es-app/src/CollectionSystemsManager.cpp | 10 +++++----- es-app/src/SystemData.cpp | 4 ++-- es-app/src/SystemScreensaver.cpp | 4 ++-- es-app/src/guis/GuiGamelistFilter.cpp | 4 ++-- es-app/src/guis/GuiInfoPopup.cpp | 6 +++--- es-app/src/main.cpp | 10 +++++----- es-app/src/scrapers/GamesDBJSONScraper.cpp | 8 ++++---- es-app/src/scrapers/GamesDBJSONScraperResources.cpp | 4 ++-- es-app/src/views/gamelist/BasicGameListView.cpp | 4 ++-- es-app/src/views/gamelist/GridGameListView.cpp | 12 ++++++------ 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/es-app/src/CollectionSystemsManager.cpp b/es-app/src/CollectionSystemsManager.cpp index 76c964523..7a0c1f10e 100644 --- a/es-app/src/CollectionSystemsManager.cpp +++ b/es-app/src/CollectionSystemsManager.cpp @@ -61,7 +61,7 @@ CollectionSystemsManager::CollectionSystemsManager(Window* window) : mWindow(win (systemDecls, systemDecls + sizeof(systemDecls) / sizeof(systemDecls[0])); for (std::vector::const_iterator it = tempSystemDecl.cbegin(); - it != tempSystemDecl.cend(); ++it ) + it != tempSystemDecl.cend(); it++) mCollectionSystemDeclsIndex[(*it).name] = (*it); // Setup the standard environment. @@ -171,8 +171,8 @@ void CollectionSystemsManager::saveCustomCollection(SystemData* sys) configFileIn.close(); for (std::unordered_map::const_iterator - iter = games.cbegin(); iter != games.cend(); ++iter) { - std::string path = iter->first; + it = games.cbegin(); it != games.cend(); it++) { + std::string path = it->first; // If the ROM path of the game begins with the path from the setting // ROMDirectory (or the default ROM directory), then replace it with %ROMPATH%. if (path.find(rompath) == 0) @@ -1303,7 +1303,7 @@ std::vector CollectionSystemsManager::getSystemsFromTheme() Utils::FileSystem::stringList dirContent = Utils::FileSystem::getDirContent(themePath); for (Utils::FileSystem::stringList::const_iterator - it = dirContent.cbegin(); it != dirContent.cend(); ++it) { + it = dirContent.cbegin(); it != dirContent.cend(); it++) { if (Utils::FileSystem::isDirectory(*it)) { // ... here you have a directory. std::string folder = *it; @@ -1328,7 +1328,7 @@ std::vector CollectionSystemsManager::getCollectionsFromConfigFolde Utils::FileSystem::stringList dirContent = Utils::FileSystem::getDirContent(configPath); for (Utils::FileSystem::stringList::const_iterator - it = dirContent.cbegin(); it != dirContent.cend(); ++it) { + it = dirContent.cbegin(); it != dirContent.cend(); it++) { if (Utils::FileSystem::isRegularFile(*it)) { // It's a file. std::string filename = Utils::FileSystem::getFileName(*it); diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index 7af9336f9..029ad62d3 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -138,7 +138,7 @@ bool SystemData::populateFolder(FileData* folder) return false; for (Utils::FileSystem::stringList::const_iterator it = dirContent.cbegin(); - it != dirContent.cend(); ++it) { + it != dirContent.cend(); it++) { filePath = *it; // Skip hidden files and folders. @@ -190,7 +190,7 @@ void SystemData::indexAllGameFilters(const FileData* folder) const std::vector& children = folder->getChildren(); for (std::vector::const_iterator it = children.cbegin(); - it != children.cend(); ++it) { + it != children.cend(); it++) { switch ((*it)->getType()) { case GAME: { mFilterIndex->addToIndex(*it); diff --git a/es-app/src/SystemScreensaver.cpp b/es-app/src/SystemScreensaver.cpp index 9feee5657..9813d0576 100644 --- a/es-app/src/SystemScreensaver.cpp +++ b/es-app/src/SystemScreensaver.cpp @@ -441,7 +441,7 @@ void SystemScreensaver::update(int deltaTime) void SystemScreensaver::generateImageList() { for (auto it = SystemData::sSystemVector.cbegin(); - it != SystemData::sSystemVector.cend(); ++it) { + it != SystemData::sSystemVector.cend(); it++) { // We only want nodes from game systems that are not collections. if (!(*it)->isGameSystem() || (*it)->isCollection()) continue; @@ -458,7 +458,7 @@ void SystemScreensaver::generateImageList() void SystemScreensaver::generateVideoList() { for (auto it = SystemData::sSystemVector.cbegin(); - it != SystemData::sSystemVector.cend(); ++it) { + it != SystemData::sSystemVector.cend(); it++) { // We only want nodes from game systems that are not collections. if (!(*it)->isGameSystem() || (*it)->isCollection()) continue; diff --git a/es-app/src/guis/GuiGamelistFilter.cpp b/es-app/src/guis/GuiGamelistFilter.cpp index 9102a161e..e5076be27 100644 --- a/es-app/src/guis/GuiGamelistFilter.cpp +++ b/es-app/src/guis/GuiGamelistFilter.cpp @@ -55,7 +55,7 @@ void GuiGamelistFilter::resetAllFilters() { mFilterIndex->resetFilters(); for (std::map>>:: - const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it ) { + const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); it++) { std::shared_ptr> optionList = it->second; optionList->selectNone(); } @@ -138,7 +138,7 @@ void GuiGamelistFilter::applyFilters() { std::vector decls = mFilterIndex->getFilterDataDecls(); for (std::map>>:: - const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it ) { + const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); it++) { std::shared_ptr> optionList = it->second; std::vector filters = optionList->getSelectedObjects(); mFilterIndex->setFilter(it->first, &filters); diff --git a/es-app/src/guis/GuiInfoPopup.cpp b/es-app/src/guis/GuiInfoPopup.cpp index 74aa4efe1..a1f30baa0 100644 --- a/es-app/src/guis/GuiInfoPopup.cpp +++ b/es-app/src/guis/GuiInfoPopup.cpp @@ -51,7 +51,7 @@ GuiInfoPopup::GuiInfoPopup( mSize[0] = mSize.x() + paddingX; mSize[1] = mSize.y() + paddingY; - float posX = Renderer::getScreenWidth()*0.5f - mSize.x()*0.5f; + float posX = Renderer::getScreenWidth()* 0.5f - mSize.x() * 0.5f; float posY = Renderer::getScreenHeight() * 0.02f; setPosition(posX, posY, 0); @@ -106,13 +106,13 @@ bool GuiInfoPopup::updateState() return false; } else if (curTime - mStartTime <= 500) { - alpha = ((curTime - mStartTime)*255/500); + alpha = ((curTime - mStartTime) * 255 / 500); } else if (curTime - mStartTime < mDuration - 500) { alpha = 255; } else { - alpha = ((-(curTime - mStartTime - mDuration)*255)/500); + alpha = ((-(curTime - mStartTime - mDuration) * 255) / 500); } mGrid->setOpacity(static_cast(alpha)); diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 7a9bf0f28..31833894b 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -173,7 +173,7 @@ bool parseArgs(int argc, char* argv[]) int width = atoi(argv[i + 1]); int height = atoi(argv[i + 2]); - i += 2; // skip the argument value + i += 2; // Skip the argument value. Settings::getInstance()->setInt("WindowWidth", width); Settings::getInstance()->setInt("WindowHeight", height); } @@ -185,7 +185,7 @@ bool parseArgs(int argc, char* argv[]) int width = atoi(argv[i + 1]); int height = atoi(argv[i + 2]); - i += 2; // skip the argument value + i += 2; // Skip the argument value. Settings::getInstance()->setInt("ScreenWidth", width); Settings::getInstance()->setInt("ScreenHeight", height); } @@ -197,7 +197,7 @@ bool parseArgs(int argc, char* argv[]) int x = atoi(argv[i + 1]); int y = atoi(argv[i + 2]); - i += 2; // skip the argument value + i += 2; // Skip the argument value. Settings::getInstance()->setInt("ScreenOffsetX", x); Settings::getInstance()->setInt("ScreenOffsetY", y); } @@ -208,7 +208,7 @@ bool parseArgs(int argc, char* argv[]) } int rotate = atoi(argv[i + 1]); - ++i; // skip the argument value + i++; // Skip the argument value. Settings::getInstance()->setInt("ScreenRotate", rotate); } else if (strcmp(argv[i], "--max-vram") == 0) { @@ -218,7 +218,7 @@ bool parseArgs(int argc, char* argv[]) } int maxVRAM = atoi(argv[i + 1]); Settings::getInstance()->setInt("MaxVRAM", maxVRAM); - ++i; // skip the argument value + i++; // Skip the argument value. } else if (strcmp(argv[i], "--gamelist-only") == 0) { Settings::getInstance()->setBool("ParseGamelistOnly", true); diff --git a/es-app/src/scrapers/GamesDBJSONScraper.cpp b/es-app/src/scrapers/GamesDBJSONScraper.cpp index 105a78199..699698868 100644 --- a/es-app/src/scrapers/GamesDBJSONScraper.cpp +++ b/es-app/src/scrapers/GamesDBJSONScraper.cpp @@ -232,7 +232,7 @@ std::string getDeveloperString(const Value& v) std::string out = ""; bool first = true; - for (int i = 0; i < static_cast(v.Size()); ++i) { + for (int i = 0; i < static_cast(v.Size()); i++) { auto mapIt = resources.gamesdb_new_developers_map.find(getIntOrThrow(v[i])); if (mapIt == resources.gamesdb_new_developers_map.cend()) @@ -254,7 +254,7 @@ std::string getPublisherString(const Value& v) std::string out = ""; bool first = true; - for (int i = 0; i < static_cast(v.Size()); ++i) { + for (int i = 0; i < static_cast(v.Size()); i++) { auto mapIt = resources.gamesdb_new_publishers_map.find(getIntOrThrow(v[i])); if (mapIt == resources.gamesdb_new_publishers_map.cend()) @@ -276,7 +276,7 @@ std::string getGenreString(const Value& v) std::string out = ""; bool first = true; - for (int i = 0; i < static_cast(v.Size()); ++i) { + for (int i = 0; i < static_cast(v.Size()); i++) { auto mapIt = resources.gamesdb_new_genres_map.find(getIntOrThrow(v[i])); if (mapIt == resources.gamesdb_new_genres_map.cend()) @@ -448,7 +448,7 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr& req, const Value& games = doc["data"]["games"]; resources.ensureResources(); - for (int i = 0; i < static_cast(games.Size()); ++i) { + for (int i = 0; i < static_cast(games.Size()); i++) { auto& v = games[i]; try { processGame(v, results); diff --git a/es-app/src/scrapers/GamesDBJSONScraperResources.cpp b/es-app/src/scrapers/GamesDBJSONScraperResources.cpp index 6cd0b85c1..28335b38b 100644 --- a/es-app/src/scrapers/GamesDBJSONScraperResources.cpp +++ b/es-app/src/scrapers/GamesDBJSONScraperResources.cpp @@ -88,7 +88,7 @@ void TheGamesDBJSONRequestResources::ensureResources() if (checkLoaded()) return; - for (int i = 0; i < MAX_WAIT_ITER; ++i) { + for (int i = 0; i < MAX_WAIT_ITER; i++) { if (gamesdb_developers_resource_request && saveResource(gamesdb_developers_resource_request.get(), @@ -187,7 +187,7 @@ int TheGamesDBJSONRequestResources::loadResource( } auto& data = doc["data"][resource_name.c_str()]; - for (Value::ConstMemberIterator itr = data.MemberBegin(); itr != data.MemberEnd(); ++itr) { + for (Value::ConstMemberIterator itr = data.MemberBegin(); itr != data.MemberEnd(); itr++) { auto& entry = itr->value; if (!entry.IsObject() || !entry.HasMember("id") || !entry["id"].IsInt() || !entry.HasMember("name") || !entry["name"].IsString()) diff --git a/es-app/src/views/gamelist/BasicGameListView.cpp b/es-app/src/views/gamelist/BasicGameListView.cpp index 6fdfe9c61..dc35e1dad 100644 --- a/es-app/src/views/gamelist/BasicGameListView.cpp +++ b/es-app/src/views/gamelist/BasicGameListView.cpp @@ -189,7 +189,7 @@ void BasicGameListView::launch(FileData* game) ViewController::get()->triggerGameLaunch(game); } -void BasicGameListView::remove(FileData *game, bool deleteFile) +void BasicGameListView::remove(FileData* game, bool deleteFile) { // Delete the game file on the filesystem. if (deleteFile) @@ -228,7 +228,7 @@ void BasicGameListView::remove(FileData *game, bool deleteFile) } } -void BasicGameListView::removeMedia(FileData *game) +void BasicGameListView::removeMedia(FileData* game) { // Remove all game media files on the filesystem. if (Utils::FileSystem::exists(game->getVideoPath())) diff --git a/es-app/src/views/gamelist/GridGameListView.cpp b/es-app/src/views/gamelist/GridGameListView.cpp index fd27554b7..31bfa0b9c 100644 --- a/es-app/src/views/gamelist/GridGameListView.cpp +++ b/es-app/src/views/gamelist/GridGameListView.cpp @@ -108,7 +108,7 @@ GridGameListView::GridGameListView( addChild(&mName); mDescContainer.setPosition(mSize.x() * padding, mSize.y() * 0.65f); - mDescContainer.setSize(mSize.x() * (0.50f - 2*padding), mSize.y() - + mDescContainer.setSize(mSize.x() * (0.50f - 2 * padding), mSize.y() - mDescContainer.getPosition().y()); mDescContainer.setAutoScroll(true); mDescContainer.setDefaultZIndex(40); @@ -120,21 +120,21 @@ GridGameListView::GridGameListView( mMarquee.setOrigin(0.5f, 0.5f); mMarquee.setPosition(mSize.x() * 0.25f, mSize.y() * 0.10f); - mMarquee.setMaxSize(mSize.x() * (0.5f - 2*padding), mSize.y() * 0.18f); + mMarquee.setMaxSize(mSize.x() * (0.5f - 2 * padding), mSize.y() * 0.18f); mMarquee.setDefaultZIndex(35); mMarquee.setVisible(false); addChild(&mMarquee); mImage.setOrigin(0.5f, 0.5f); mImage.setPosition(2.0f, 2.0f); - mImage.setMaxSize(mSize.x() * (0.50f - 2*padding), mSize.y() * 0.4f); + mImage.setMaxSize(mSize.x() * (0.50f - 2 * padding), mSize.y() * 0.4f); mImage.setDefaultZIndex(10); mImage.setVisible(false); addChild(&mImage); mVideo->setOrigin(0.5f, 0.5f); mVideo->setPosition(mSize.x() * 0.25f, mSize.y() * 0.4f); - mVideo->setSize(mSize.x() * (0.5f - 2*padding), mSize.y() * 0.4f); + mVideo->setSize(mSize.x() * (0.5f - 2 * padding), mSize.y() * 0.4f); mVideo->setDefaultZIndex(15); mVideo->setVisible(false); addChild(mVideo); @@ -538,7 +538,7 @@ void GridGameListView::launch(FileData* game) ViewController::get()->triggerGameLaunch(game); } -void GridGameListView::remove(FileData *game, bool deleteFile) +void GridGameListView::remove(FileData* game, bool deleteFile) { // Delete the game file on the filesystem. if (deleteFile) @@ -572,7 +572,7 @@ void GridGameListView::remove(FileData *game, bool deleteFile) onFileChanged(parent, false); } -void GridGameListView::removeMedia(FileData *game) +void GridGameListView::removeMedia(FileData* game) { // Remove all game media files on the filesystem. if (Utils::FileSystem::exists(game->getVideoPath()))