diff --git a/RetroFE/Source/Collection/CollectionInfo.cpp b/RetroFE/Source/Collection/CollectionInfo.cpp index 8475fa5..6cecba7 100644 --- a/RetroFE/Source/Collection/CollectionInfo.cpp +++ b/RetroFE/Source/Collection/CollectionInfo.cpp @@ -45,35 +45,11 @@ CollectionInfo::~CollectionInfo() } } -std::string CollectionInfo::GetName() const -{ - return Name; -} - std::string CollectionInfo::GetSettingsPath() const { - return Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", GetName()); + return Utils::CombinePath(Configuration::AbsolutePath, "collections", Name); } -std::string CollectionInfo::GetListPath() const -{ - return ListPath; -} - -std::string CollectionInfo::GetMetadataType() const -{ - return MetadataType; -} - -std::string CollectionInfo::GetMetadataPath() const -{ - return MetadataPath; -} - -std::string CollectionInfo::GetExtensions() const -{ - return Extensions; -} void CollectionInfo::GetExtensions(std::vector &extensions) { @@ -85,14 +61,11 @@ void CollectionInfo::GetExtensions(std::vector &extensions) extensions.push_back(token); } } -std::vector *CollectionInfo::GetItems() -{ - return &Items; -} -bool CollectionInfo::ItemIsLess(Item const *lhs, Item const *rhs) + +bool CollectionInfo::ItemIsLess(Item *lhs, Item *rhs) { - return lhs->GetLCFullTitle() < rhs->GetLCFullTitle(); + return lhs->LCFullTitle() < rhs->LCFullTitle(); } void CollectionInfo::SortItems() diff --git a/RetroFE/Source/Collection/CollectionInfo.h b/RetroFE/Source/Collection/CollectionInfo.h index 494f025..c1df426 100644 --- a/RetroFE/Source/Collection/CollectionInfo.h +++ b/RetroFE/Source/Collection/CollectionInfo.h @@ -25,23 +25,17 @@ class CollectionInfo public: CollectionInfo(std::string name, std::string listPath, std::string extensions, std::string metadataType, std::string metadataPath); virtual ~CollectionInfo(); - std::string GetName() const; std::string GetSettingsPath() const; - std::string GetListPath() const; - std::string GetMetadataType() const; - std::string GetMetadataPath() const; - std::string GetExtensions() const; - std::vector *GetItems(); void SortItems(); void GetExtensions(std::vector &extensions); - -private: - static bool ItemIsLess(Item const *lhs, Item const *rhs); - std::string Name; std::string ListPath; std::string Extensions; std::string MetadataType; std::string MetadataPath; std::vector Items; + +private: + static bool ItemIsLess(Item *lhs, Item *rhs); + }; diff --git a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp index c1fefab..febb395 100644 --- a/RetroFE/Source/Collection/CollectionInfoBuilder.cpp +++ b/RetroFE/Source/Collection/CollectionInfoBuilder.cpp @@ -47,7 +47,7 @@ CollectionInfoBuilder::~CollectionInfoBuilder() bool CollectionInfoBuilder::CreateCollectionDirectory(std::string name) { - std::string collectionPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", name); + std::string collectionPath = Utils::CombinePath(Configuration::AbsolutePath, "collections", name); std::vector paths; paths.push_back(collectionPath); @@ -215,11 +215,10 @@ bool CollectionInfoBuilder::ImportBasicList(CollectionInfo * /*info*/, std::stri line.erase( std::remove(line.begin(), line.end(), '\r'), line.end() ); - i->SetFullTitle(line); - i->SetName(line); - i->SetFullTitle(line); - i->SetTitle(line); - i->SetLauncher(launcher); + i->FullTitle = line; + i->Name = line; + i->Title = line; + i->Launcher = launcher; list[line] = i; } @@ -232,16 +231,16 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info) { DIR *dp; struct dirent *dirp; - std::string path = info->GetListPath(); + std::string path = info->ListPath; std::map includeFilter; std::map excludeFilter; - std::string includeFile = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", info->GetName(), "include.txt"); - std::string excludeFile = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", info->GetName(), "exclude.txt"); + std::string includeFile = Utils::CombinePath(Configuration::AbsolutePath, "collections", info->Name, "include.txt"); + std::string excludeFile = Utils::CombinePath(Configuration::AbsolutePath, "collections", info->Name, "exclude.txt"); std::string launcher; bool showMissing = false; - (void)Conf.GetProperty("collections." + info->GetName() + ".launcher", launcher); - (void)Conf.GetProperty("collections." + info->GetName() + ".list.includeMissingItems", showMissing); + (void)Conf.GetProperty("collections." + info->Name + ".launcher", launcher); + (void)Conf.GetProperty("collections." + info->Name + ".list.includeMissingItems", showMissing); ImportBasicList(info, includeFile, launcher, includeFilter); ImportBasicList(info, excludeFile, launcher, excludeFilter); @@ -267,7 +266,7 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info) { if(excludeFilter.find(it->first) == excludeFilter.end()) { - info->GetItems()->push_back(it->second); + info->Items.push_back(it->second); } } } @@ -295,11 +294,11 @@ bool CollectionInfoBuilder::ImportDirectory(CollectionInfo *info) if(file.compare(start, comparator.length(), *extensionsIt) == 0) { Item *i = new Item(); - i->SetName(basename); - i->SetFullTitle(basename); - i->SetTitle(basename); - i->SetLauncher(launcher); - info->GetItems()->push_back(i); + i->Name = basename; + i->FullTitle = basename; + i->Title = basename; + i->Launcher = launcher; + info->Items.push_back(i); } } } diff --git a/RetroFE/Source/Collection/Item.cpp b/RetroFE/Source/Collection/Item.cpp index ef54f2e..160b24f 100644 --- a/RetroFE/Source/Collection/Item.cpp +++ b/RetroFE/Source/Collection/Item.cpp @@ -28,142 +28,24 @@ Item::~Item() { } -const std::string Item::GetFileName() const +std::string Item::FileName() { return Utils::GetFileName(FilePath); } -const std::string& Item::GetFilePath() const -{ - return FilePath; -} - -void Item::SetFilePath(const std::string& filepath) -{ - FilePath = filepath; -} - -const std::string& Item::GetLauncher() const -{ - return Launcher; -} - -void Item::SetLauncher(const std::string& launcher) -{ - Launcher = launcher; -} - -const std::string& Item::GetManufacturer() const -{ - return Manufacturer; -} - -void Item::SetManufacturer(const std::string& manufacturer) -{ - Manufacturer = manufacturer; -} - -const std::string& Item::GetGenre() const -{ - return Genre; -} - -void Item::SetGenre(const std::string& genre) -{ - Genre = genre; -} - -const std::string& Item::GetName() const -{ - return Name; -} - -void Item::SetName(const std::string& name) -{ - Name = name; -} - -std::string Item::GetNumberButtons() const -{ - return NumberButtons; -} -void Item::SetNumberButtons(std::string numberbuttons) +std::string Item::LCTitle() { - NumberButtons = numberbuttons; + std::string lcstr = Title; + std::transform(lcstr.begin(), lcstr.end(), lcstr.begin(), ::tolower); + return lcstr; } -std::string Item::GetNumberPlayers() const +std::string Item::LCFullTitle() { - return NumberPlayers; + std::string lcstr = FullTitle; + std::transform(lcstr.begin(), lcstr.end(), lcstr.begin(), ::tolower); + return lcstr; } -void Item::SetNumberPlayers(std::string numberplayers) -{ - NumberPlayers = numberplayers; -} - -const std::string& Item::GetTitle() const -{ - return Title; -} - -const std::string& Item::GetLCTitle() const -{ - return LCTitle; -} - -const std::string& Item::GetLCFullTitle() const -{ - return LCFullTitle; -} - -void Item::SetTitle(const std::string& title) -{ - Title = title; - LCTitle = Title; - std::transform(LCTitle.begin(), LCTitle.end(), LCTitle.begin(), ::tolower); -} - -const std::string& Item::GetYear() const -{ - return Year; -} - -void Item::SetYear(const std::string& year) -{ - Year = year; -} - -bool Item::IsLeaf() const -{ - return Leaf; -} - -void Item::SetIsLeaf(bool leaf) -{ - Leaf = leaf; -} - -const std::string& Item::GetFullTitle() const -{ - return FullTitle; -} - -void Item::SetFullTitle(const std::string& fulltitle) -{ - FullTitle = fulltitle; - LCFullTitle = fulltitle; - std::transform(LCFullTitle.begin(), LCFullTitle.end(), LCFullTitle.begin(), ::tolower); -} - -const std::string& Item::GetCloneOf() const -{ - return CloneOf; -} - -void Item::SetCloneOf(const std::string& cloneOf) -{ - CloneOf = cloneOf; -} diff --git a/RetroFE/Source/Collection/Item.h b/RetroFE/Source/Collection/Item.h index b157592..4caa026 100644 --- a/RetroFE/Source/Collection/Item.h +++ b/RetroFE/Source/Collection/Item.h @@ -22,42 +22,14 @@ class Item public: Item(); virtual ~Item(); - const std::string GetFileName() const; - const std::string& GetFilePath() const; - void SetFilePath(const std::string& filepath); - const std::string& GetLauncher() const; - void SetLauncher(const std::string& launcher); - const std::string& GetManufacturer() const; - void SetManufacturer(const std::string& manufacturer); - const std::string& GetGenre() const; - void SetGenre(const std::string& genre); - const std::string& GetName() const; - void SetName(const std::string& name); - void SetNumberButtons(std::string numberbuttons); - std::string GetNumberButtons() const; - void SetNumberPlayers(std::string numberplayers); - std::string GetNumberPlayers() const; - const std::string& GetTitle() const; - const std::string& GetLCTitle() const; - void SetTitle(const std::string& title); - const std::string& GetYear() const; - void SetYear(const std::string& year); - bool IsLeaf() const; - void SetIsLeaf(bool leaf); - const std::string& GetFullTitle() const; - const std::string& GetLCFullTitle() const; - void SetFullTitle(const std::string& fulltitle); - const std::string& GetCloneOf() const; - void SetCloneOf(const std::string& cloneOf); - -private: + std::string FileName(); + std::string LCTitle() ; + std::string LCFullTitle(); + std::string Name; std::string Launcher; std::string FilePath; - std::string Name; std::string Title; - std::string LCTitle; std::string FullTitle; - std::string LCFullTitle; std::string Year; std::string Manufacturer; std::string Genre; diff --git a/RetroFE/Source/Collection/MenuParser.cpp b/RetroFE/Source/Collection/MenuParser.cpp index 2174b66..a11cbcb 100644 --- a/RetroFE/Source/Collection/MenuParser.cpp +++ b/RetroFE/Source/Collection/MenuParser.cpp @@ -26,9 +26,9 @@ #include #include -bool VectorSort(const Item *d1, const Item *d2) +bool VectorSort(Item *d1, Item *d2) { - return d1->GetLCTitle() < d2->GetLCTitle(); + return d1->LCTitle() < d2->LCTitle(); } MenuParser::MenuParser() @@ -44,7 +44,7 @@ bool MenuParser::GetMenuItems(CollectionInfo *collection) { bool retVal = false; //todo: magic string - std::string menuFilename = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections", collection->GetName(), "menu.xml"); + std::string menuFilename = Utils::CombinePath(Configuration::AbsolutePath, "collections", collection->Name, "menu.xml"); rapidxml::xml_document<> doc; rapidxml::xml_node<> * rootNode; @@ -88,11 +88,11 @@ bool MenuParser::GetMenuItems(CollectionInfo *collection) //todo, check for empty string std::string title = collectionAttribute->value(); Item *item = new Item(); - item->SetTitle(title); - item->SetFullTitle(title); - item->SetName(collectionAttribute->value()); - item->SetIsLeaf(false); - collection->GetItems()->push_back(item); + item->Title = title; + item->FullTitle = title; + item->Name = collectionAttribute->value(); + item->Leaf = false; + collection->Items.push_back(item); } else @@ -106,7 +106,7 @@ bool MenuParser::GetMenuItems(CollectionInfo *collection) } // todo: sorting should occur within the collection itself, not externally - std::vector *items = collection->GetItems(); + std::vector *items = &collection->Items; std::sort( items->begin(), items->end(), VectorSort); retVal = true; diff --git a/RetroFE/Source/Database/Configuration.cpp b/RetroFE/Source/Database/Configuration.cpp index 0256061..fbf8c1c 100644 --- a/RetroFE/Source/Database/Configuration.cpp +++ b/RetroFE/Source/Database/Configuration.cpp @@ -46,7 +46,7 @@ void Configuration::Initialize() if (environment != NULL) { environmentStr = environment; - Configuration::SetAbsolutePath(environment); + AbsolutePath = environment; } else { @@ -66,7 +66,7 @@ void Configuration::Initialize() #endif - Configuration::SetAbsolutePath(sPath); + AbsolutePath = sPath; } } @@ -194,8 +194,8 @@ bool Configuration::GetProperty(std::string key, std::string &value) { bool retVal = GetRawProperty(key, value); - std::string baseMediaPath = GetAbsolutePath(); - std::string baseItemPath = GetAbsolutePath(); + std::string baseMediaPath = AbsolutePath; + std::string baseItemPath = AbsolutePath; std::string collectionName; GetRawProperty("baseMediaPath", baseMediaPath); @@ -328,7 +328,7 @@ bool Configuration::GetPropertyAbsolutePath(std::string key, std::string &value) if(retVal) { - value = ConvertToAbsolutePath(GetAbsolutePath(), value); + value = ConvertToAbsolutePath(AbsolutePath, value); } return retVal; @@ -355,7 +355,7 @@ void Configuration::GetMediaPropertyAbsolutePath(std::string collectionName, std if(!GetPropertyAbsolutePath("baseMediaPath", baseMediaPath)) { // base media path was not specified, assume media files are in the collection - baseMediaPath = Utils::CombinePath(GetAbsolutePath(), "collections"); + baseMediaPath = Utils::CombinePath(AbsolutePath, "collections"); } if(mediaType == "manufacturer") @@ -404,20 +404,10 @@ void Configuration::GetCollectionAbsolutePath(std::string collectionName, std::s return; } - value = Utils::CombinePath(GetAbsolutePath(), "collections", collectionName, "roms"); + value = Utils::CombinePath(AbsolutePath, "collections", collectionName, "roms"); } -void Configuration::SetAbsolutePath(std::string absolutePath) -{ - AbsolutePath = absolutePath; -} - -std::string Configuration::GetAbsolutePath() -{ - return AbsolutePath; -} - bool Configuration::IsVerbose() const { return Verbose; diff --git a/RetroFE/Source/Database/Configuration.h b/RetroFE/Source/Database/Configuration.h index dfb15c2..729f346 100644 --- a/RetroFE/Source/Database/Configuration.h +++ b/RetroFE/Source/Database/Configuration.h @@ -25,8 +25,6 @@ public: Configuration(); virtual ~Configuration(); static void Initialize(); - static void SetAbsolutePath(std::string absolutePath); - static std::string GetAbsolutePath(); static std::string ConvertToAbsolutePath(std::string prefix, std::string path); void SetStatus(std::string status); std::string GetStatus(); @@ -47,6 +45,7 @@ public: void GetCollectionAbsolutePath(std::string collectionName, std::string &value); bool IsVerbose() const; void SetVerbose(bool verbose); + static std::string AbsolutePath; private: bool GetRawProperty(std::string key, std::string &value); @@ -56,7 +55,6 @@ private: typedef std::pair PropertiesPair; bool Verbose; - static std::string AbsolutePath; std::string CurrentCollection; PropertiesType Properties; std::string Status; diff --git a/RetroFE/Source/Database/DB.cpp b/RetroFE/Source/Database/DB.cpp index 48e4935..1326e5b 100644 --- a/RetroFE/Source/Database/DB.cpp +++ b/RetroFE/Source/Database/DB.cpp @@ -20,8 +20,8 @@ #include DB::DB(std::string dbFile) - : Path(dbFile) - , Handle(NULL) + : Handle(NULL) +, Path(dbFile) { } diff --git a/RetroFE/Source/Database/DB.h b/RetroFE/Source/Database/DB.h index aa2a707..a36f807 100644 --- a/RetroFE/Source/Database/DB.h +++ b/RetroFE/Source/Database/DB.h @@ -24,13 +24,9 @@ public: bool Initialize(); void DeInitialize(); virtual ~DB(); - sqlite3 *GetHandle() - { - return Handle; - } + sqlite3 *Handle; private: std::string Path; - sqlite3 *Handle; }; diff --git a/RetroFE/Source/Database/MetadataDatabase.cpp b/RetroFE/Source/Database/MetadataDatabase.cpp index 4c03ac3..b0c3ab9 100644 --- a/RetroFE/Source/Database/MetadataDatabase.cpp +++ b/RetroFE/Source/Database/MetadataDatabase.cpp @@ -48,7 +48,7 @@ bool MetadataDatabase::ResetDatabase() { int rc; char *error = NULL; - sqlite3 *handle = DBInstance.GetHandle(); + sqlite3 *handle = DBInstance.Handle; Logger::Write(Logger::ZONE_INFO, "Metadata", "Erasing"); @@ -72,7 +72,7 @@ bool MetadataDatabase::Initialize() { int rc; char *error = NULL; - sqlite3 *handle = DBInstance.GetHandle(); + sqlite3 *handle = DBInstance.Handle; std::string sql; sql.append("CREATE TABLE IF NOT EXISTS Meta("); @@ -110,8 +110,8 @@ bool MetadataDatabase::ImportDirectory() { DIR *dp; struct dirent *dirp; - std::string hyperListPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "meta", "hyperlist"); - std::string mameListPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "meta", "mamelist"); + std::string hyperListPath = Utils::CombinePath(Configuration::AbsolutePath, "meta", "hyperlist"); + std::string mameListPath = Utils::CombinePath(Configuration::AbsolutePath, "meta", "mamelist"); dp = opendir(hyperListPath.c_str()); @@ -183,7 +183,7 @@ bool MetadataDatabase::ImportDirectory() void MetadataDatabase::InjectMetadata(CollectionInfo *collection) { - sqlite3 *handle = DBInstance.GetHandle(); + sqlite3 *handle = DBInstance.Handle; int rc; sqlite3_stmt *stmt; @@ -195,12 +195,12 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection) // items into a hash to make it easily searchable - std::vector *items = collection->GetItems(); + std::vector *items = &collection->Items; std::map itemMap; for(std::vector::iterator it = items->begin(); it != items->end(); it++) { - itemMap[(*it)->GetName()] = *it; + itemMap[(*it)->Name] = *it; } //todo: program crashes if this query fails @@ -209,7 +209,7 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection) "FROM Meta WHERE collectionName=? ORDER BY title ASC;", -1, &stmt, 0); - sqlite3_bind_text(stmt, 1, collection->GetMetadataType().c_str(), -1, SQLITE_TRANSIENT); + sqlite3_bind_text(stmt, 1, collection->MetadataType.c_str(), -1, SQLITE_TRANSIENT); rc = sqlite3_step(stmt); @@ -265,14 +265,14 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection) if(it != itemMap.end()) { Item *item = it->second; - item->SetTitle(title); - item->SetFullTitle(fullTitle); - item->SetYear(year); - item->SetManufacturer(manufacturer); - item->SetGenre(genre); - item->SetNumberPlayers(numberPlayers); - item->SetNumberButtons(numberButtons); - item->SetCloneOf(cloneOf); + item->Title = title; + item->FullTitle = fullTitle; + item->Year = year; + item->Manufacturer = manufacturer; + item->Genre = genre; + item->NumberPlayers = numberPlayers; + item->NumberButtons = numberButtons; + item->CloneOf = cloneOf; } rc = sqlite3_step(stmt); } @@ -280,7 +280,7 @@ void MetadataDatabase::InjectMetadata(CollectionInfo *collection) bool MetadataDatabase::NeedsRefresh() { - sqlite3 *handle = DBInstance.GetHandle(); + sqlite3 *handle = DBInstance.Handle; sqlite3_stmt *stmt; sqlite3_prepare_v2(handle, @@ -323,7 +323,7 @@ bool MetadataDatabase::ImportHyperList(std::string hyperlistFile, std::string co Logger::Write(Logger::ZONE_ERROR, "Metadata", "Does not appear to be a HyperList file (missing tag)"); return false; } - sqlite3 *handle = DBInstance.GetHandle(); + sqlite3 *handle = DBInstance.Handle; sqlite3_exec(handle, "BEGIN IMMEDIATE TRANSACTION;", NULL, NULL, &error); for(rapidxml::xml_node<> *game = root->first_node("game"); game; game = game->next_sibling("game")) { @@ -395,7 +395,7 @@ bool MetadataDatabase::ImportMameList(std::string filename, std::string collecti rapidxml::xml_document<> doc; rapidxml::xml_node<> * rootNode; char *error = NULL; - sqlite3 *handle = DBInstance.GetHandle(); + sqlite3 *handle = DBInstance.Handle; Config.SetStatus("Scraping data from \"" + filename + "\" (this will take a while)"); diff --git a/RetroFE/Source/Execute/AttractMode.cpp b/RetroFE/Source/Execute/AttractMode.cpp index 9652f33..23442ed 100644 --- a/RetroFE/Source/Execute/AttractMode.cpp +++ b/RetroFE/Source/Execute/AttractMode.cpp @@ -19,17 +19,13 @@ #include AttractMode::AttractMode() - : IsActive(false) + : IdleTime(0) + , IsActive(false) , ElapsedTime(0) , ActiveTime(0) - , IdleTime(0) { } -void AttractMode::SetIdleTime(float time) -{ - IdleTime = time; -} void AttractMode::Reset() { ElapsedTime = 0; @@ -60,4 +56,4 @@ void AttractMode::Update(float dt, Page &page) page.SetScrolling(Page::ScrollDirectionIdle); } } -} \ No newline at end of file +} diff --git a/RetroFE/Source/Execute/AttractMode.h b/RetroFE/Source/Execute/AttractMode.h index 642fa06..dbe8e74 100644 --- a/RetroFE/Source/Execute/AttractMode.h +++ b/RetroFE/Source/Execute/AttractMode.h @@ -21,14 +21,13 @@ class AttractMode { public: AttractMode(); - void SetIdleTime(float time); void Reset(); void Update(float dt, Page &page); + float IdleTime; private: bool IsActive; float ElapsedTime; float ActiveTime; - float IdleTime; }; diff --git a/RetroFE/Source/Execute/Launcher.cpp b/RetroFE/Source/Execute/Launcher.cpp index 5a80a29..43411d8 100644 --- a/RetroFE/Source/Execute/Launcher.cpp +++ b/RetroFE/Source/Execute/Launcher.cpp @@ -38,7 +38,7 @@ Launcher::Launcher(RetroFE &p, Configuration &c) bool Launcher::Run(std::string collection, Item *collectionItem) { - std::string launcherName = collectionItem->GetLauncher(); + std::string launcherName = collectionItem->Launcher; std::string executablePath; std::string selectedItemsDirectory; std::string selectedItemsPath; @@ -67,29 +67,29 @@ bool Launcher::Run(std::string collection, Item *collectionItem) Logger::Write(Logger::ZONE_ERROR, "Launcher", "No launcher arguments specified for launcher " + launcherName); return false; } - if(!FindFile(selectedItemsPath, matchedExtension, selectedItemsDirectory, collectionItem->GetName(), extensions)) + if(!FindFile(selectedItemsPath, matchedExtension, selectedItemsDirectory, collectionItem->Name, extensions)) { // FindFile() prints out diagnostic messages for us, no need to print anything here return false; } args = ReplaceVariables(args, selectedItemsPath, - collectionItem->GetName(), - collectionItem->GetFileName(), + collectionItem->Name, + collectionItem->FileName(), selectedItemsDirectory, collection); executablePath = ReplaceVariables(executablePath, selectedItemsPath, - collectionItem->GetName(), - collectionItem->GetFileName(), + collectionItem->Name, + collectionItem->FileName(), selectedItemsDirectory, collection); currentDirectory = ReplaceVariables(currentDirectory, selectedItemsPath, - collectionItem->GetName(), - collectionItem->GetFileName(), + collectionItem->Name, + collectionItem->FileName(), selectedItemsDirectory, collection); @@ -114,11 +114,11 @@ std::string Launcher::ReplaceVariables(std::string str, str = Utils::Replace(str, "%ITEM_FILENAME%", itemFilename); str = Utils::Replace(str, "%ITEM_DIRECTORY%", itemDirectory); str = Utils::Replace(str, "%ITEM_COLLECTION_NAME%", itemCollectionName); - str = Utils::Replace(str, "%RETROFE_PATH%", Configuration::GetAbsolutePath()); + str = Utils::Replace(str, "%RETROFE_PATH%", Configuration::AbsolutePath); #ifdef WIN32 - str = Utils::Replace(str, "%RETROFE_EXEC_PATH%", Utils::CombinePath(Configuration::GetAbsolutePath(), "RetroFE.exe")); + str = Utils::Replace(str, "%RETROFE_EXEC_PATH%", Utils::CombinePath(Configuration::AbsolutePath, "RetroFE.exe")); #else - str = Utils::Replace(str, "%RETROFE_EXEC_PATH%", Utils::CombinePath(Configuration::GetAbsolutePath(), "RetroFE")); + str = Utils::Replace(str, "%RETROFE_EXEC_PATH%", Utils::CombinePath(Configuration::AbsolutePath, "RetroFE")); #endif return str; diff --git a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp index d4d5427..ed2052f 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp @@ -150,12 +150,12 @@ void ReloadableMedia::ReloadTexture() { std::vector names; - names.push_back(selectedItem->GetName()); - names.push_back(selectedItem->GetFullTitle()); + names.push_back(selectedItem->Name); + names.push_back(selectedItem->FullTitle); - if(selectedItem->GetCloneOf().length() > 0) + if(selectedItem->CloneOf.length() > 0) { - names.push_back(selectedItem->GetCloneOf()); + names.push_back(selectedItem->CloneOf); } for(unsigned int n = 0; n < names.size() && !found; ++n) @@ -197,27 +197,27 @@ void ReloadableMedia::ReloadTexture() if(typeLC == "numberButtons") { - imageBasename = selectedItem->GetNumberButtons(); + imageBasename = selectedItem->NumberButtons; } else if(typeLC == "numberPlayers") { - imageBasename = selectedItem->GetNumberPlayers(); + imageBasename = selectedItem->NumberPlayers; } else if(typeLC == "year") { - imageBasename = selectedItem->GetYear(); + imageBasename = selectedItem->Year; } else if(typeLC == "title") { - imageBasename = selectedItem->GetTitle(); + imageBasename = selectedItem->Title; } else if(typeLC == "manufacturer") { - imageBasename = selectedItem->GetManufacturer(); + imageBasename = selectedItem->Manufacturer; } else if(typeLC == "genre") { - imageBasename = selectedItem->GetGenre(); + imageBasename = selectedItem->Genre; } Utils::ReplaceSlashesWithUnderscores(imageBasename); diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.cpp b/RetroFE/Source/Graphics/Component/ReloadableText.cpp index 5ba4d99..87c4b60 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableText.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableText.cpp @@ -137,22 +137,22 @@ void ReloadableText::ReloadTexture() switch(Type) { case TextTypeNumberButtons: - ss << selectedItem->GetNumberButtons(); + ss << selectedItem->NumberButtons; break; case TextTypeNumberPlayers: - ss << selectedItem->GetNumberPlayers(); + ss << selectedItem->NumberPlayers; break; case TextTypeYear: - ss << selectedItem->GetYear(); + ss << selectedItem->Year; break; case TextTypeTitle: - ss << selectedItem->GetTitle(); + ss << selectedItem->Title; break; case TextTypeManufacturer: - ss << selectedItem->GetManufacturer(); + ss << selectedItem->Manufacturer; break; case TextTypeGenre: - ss << selectedItem->GetGenre(); + ss << selectedItem->Genre; break; default: break; diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.cpp b/RetroFE/Source/Graphics/Component/ScrollingList.cpp index e1a1470..6e7b3bd 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.cpp +++ b/RetroFE/Source/Graphics/Component/ScrollingList.cpp @@ -409,7 +409,7 @@ void ScrollingList::LetterUp() // Select the previous item in the list in case we are at the top of all the items // for the currently selected letter. CircularDecrement(FirstSpriteIndex, SpriteList); - std::string startname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle(); + std::string startname = GetSelectedCollectionItemSprite()->GetCollectionItem()->LCFullTitle(); ++i; bool done = false; @@ -418,7 +418,7 @@ void ScrollingList::LetterUp() while(!done && i < SpriteList->size()) { CircularDecrement(FirstSpriteIndex, SpriteList); - std::string endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle(); + std::string endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->LCFullTitle(); ++i; // check if we are changing characters from a-z, or changing from alpha character to non-alpha character @@ -450,7 +450,7 @@ void ScrollingList::LetterDown() if(SpriteList && ScrollPoints) { - std::string startname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle(); + std::string startname = GetSelectedCollectionItemSprite()->GetCollectionItem()->LCFullTitle(); std::string endname = startname; unsigned int i = 0; @@ -458,7 +458,7 @@ void ScrollingList::LetterDown() while(!done && i < SpriteList->size()) { CircularIncrement(FirstSpriteIndex, SpriteList); - endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->GetLCFullTitle(); + endname = GetSelectedCollectionItemSprite()->GetCollectionItem()->LCFullTitle(); ++i; // check if we are changing characters from a-z, or changing from alpha character to non-alpha character @@ -792,21 +792,21 @@ bool ScrollingList::AllocateTexture(ComponentItemBinding *s) ImageBuilder imageBuild; Config.GetMediaPropertyAbsolutePath(GetCollectionName(), ImageType, false, imagePath); - t = imageBuild.CreateImage(imagePath, item->GetName(), ScaleX, ScaleY); + t = imageBuild.CreateImage(imagePath, item->Name, ScaleX, ScaleY); if(!t) { - Config.GetMediaPropertyAbsolutePath(item->GetName(), ImageType, true, imagePath); + Config.GetMediaPropertyAbsolutePath(item->Name, ImageType, true, imagePath); t = imageBuild.CreateImage(imagePath, ImageType, ScaleX, ScaleY); } - if(!t && item->GetTitle() != item->GetFullTitle()) + if(!t && item->Title != item->FullTitle) { - t = imageBuild.CreateImage(imagePath, item->GetFullTitle(), ScaleX, ScaleY); + t = imageBuild.CreateImage(imagePath, item->FullTitle, ScaleX, ScaleY); } if (!t) { - t = new Text(item->GetTitle(), FontInst, ScaleX, ScaleY); + t = new Text(item->Title, FontInst, ScaleX, ScaleY); } if(t) diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index 123a9a8..7279706 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -411,7 +411,7 @@ void Page::LetterScroll(ScrollDirection direction) bool Page::PushCollection(CollectionInfo *collection) { Collections.push_back(collection); - std::vector *sprites = ComponentItemBindingBuilder::BuildCollectionItems(collection->GetItems()); + std::vector *sprites = ComponentItemBindingBuilder::BuildCollectionItems(&collection->Items); int menuExitIndex = -1; int menuEnterIndex = -1; @@ -434,7 +434,7 @@ bool Page::PushCollection(CollectionInfo *collection) } ActiveMenu = Menus[MenuDepth]; - ActiveMenu->SetCollectionName(collection->GetName()); + ActiveMenu->SetCollectionName(collection->Name); ActiveMenu->DestroyItems(); ActiveMenu->SetItems(sprites); ActiveMenu->TriggerMenuEnterEvent(); @@ -449,7 +449,7 @@ bool Page::PushCollection(CollectionInfo *collection) { for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) { - (*it)->SetCollectionName(collection->GetName()); + (*it)->SetCollectionName(collection->Name); if(menuEnterIndex >= 0) { (*it)->TriggerMenuEnterEvent(menuEnterIndex); @@ -500,7 +500,7 @@ bool Page::PopCollection() { for(std::vector::iterator it = LayerComponents[i].begin(); it != LayerComponents[i].end(); ++it) { - (*it)->SetCollectionName(collection->GetName()); + (*it)->SetCollectionName(collection->Name); if(menuEnterIndex >= 0) { @@ -571,7 +571,7 @@ std::string Page::GetCollectionName() if(info) { - return info->GetName(); + return info->Name; } return ""; diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index c497a8b..a2bee57 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -77,7 +77,7 @@ Page *PageBuilder::BuildPage() std::string layoutFile; std::string layoutName = LayoutKey; - LayoutPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "layouts", layoutName); + LayoutPath = Utils::CombinePath(Configuration::AbsolutePath, "layouts", layoutName); layoutFile = Utils::CombinePath(LayoutPath, LayoutPage + ".xml"); Logger::Write(Logger::ZONE_INFO, "Layout", "Initializing " + layoutFile); @@ -125,7 +125,7 @@ Page *PageBuilder::BuildPage() if(fontXml) { FontName = Config.ConvertToAbsolutePath( - Utils::CombinePath(Config.GetAbsolutePath(), "layouts", LayoutKey, ""), + Utils::CombinePath(Config.AbsolutePath, "layouts", LayoutKey, ""), fontXml->value()); } @@ -503,7 +503,7 @@ Font *PageBuilder::AddFont(xml_node<> *component, xml_node<> *defaults) if(fontXml) { fontName = Config.ConvertToAbsolutePath( - Utils::CombinePath(Config.GetAbsolutePath(), "layouts", LayoutKey,""), + Utils::CombinePath(Config.AbsolutePath, "layouts", LayoutKey,""), fontXml->value()); Logger::Write(Logger::ZONE_DEBUG, "Layout", "loading font " + fontName ); diff --git a/RetroFE/Source/Main.cpp b/RetroFE/Source/Main.cpp index 9962884..e10b017 100644 --- a/RetroFE/Source/Main.cpp +++ b/RetroFE/Source/Main.cpp @@ -72,9 +72,9 @@ int main(int argc, char **argv) bool ImportConfiguration(Configuration *c) { - std::string configPath = Configuration::GetAbsolutePath(); - std::string launchersPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "launchers"); - std::string collectionsPath = Utils::CombinePath(Configuration::GetAbsolutePath(), "collections"); + std::string configPath = Configuration::AbsolutePath; + std::string launchersPath = Utils::CombinePath(Configuration::AbsolutePath, "launchers"); + std::string collectionsPath = Utils::CombinePath(Configuration::AbsolutePath, "collections"); DIR *dp; struct dirent *dirp; @@ -162,7 +162,7 @@ bool ImportConfiguration(Configuration *c) bool StartLogging() { - std::string logFile = Utils::CombinePath(Configuration::GetAbsolutePath(), "log.txt"); + std::string logFile = Utils::CombinePath(Configuration::AbsolutePath, "log.txt"); if(!Logger::Initialize(logFile)) { @@ -178,7 +178,7 @@ bool StartLogging() Logger::Write(Logger::ZONE_INFO, "RetroFE", "OS: Linux"); #endif - Logger::Write(Logger::ZONE_INFO, "RetroFE", "Absolute path: " + Configuration::GetAbsolutePath()); + Logger::Write(Logger::ZONE_INFO, "RetroFE", "Absolute path: " + Configuration::AbsolutePath); return true; } diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index 74f16f7..d030467 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -85,7 +85,7 @@ int RetroFE::Initialize(void *context) return -1; } - instance->Db = new DB(Utils::CombinePath(Configuration::GetAbsolutePath(), "meta.db")); + instance->Db = new DB(Utils::CombinePath(Configuration::AbsolutePath, "meta.db")); if(!instance->Db->Initialize()) { @@ -220,7 +220,7 @@ void RetroFE::Run() Config.GetProperty("attractModeTime", attractModeTime); Config.GetProperty("firstCollection", firstCollection); - Attract.SetIdleTime(static_cast(attractModeTime)); + Attract.IdleTime = static_cast(attractModeTime); int initializeStatus = 0; @@ -452,22 +452,22 @@ RetroFE::RETROFE_STATE RetroFE::ProcessUserInput(Page *page) if(NextPageItem) { - if(NextPageItem->IsLeaf()) + if(NextPageItem->Leaf) { state = RETROFE_LAUNCH_REQUEST; } else { - Config.SetCurrentCollection(NextPageItem->GetName()); - CollectionInfo *info = GetCollection(NextPageItem->GetName()); + Config.SetCurrentCollection(NextPageItem->Name); + CollectionInfo *info = GetCollection(NextPageItem->Name); MenuParser mp; mp.GetMenuItems(info); page->PushCollection(info); - if(rememberMenu && LastMenuOffsets.find(NextPageItem->GetName()) != LastMenuOffsets.end()) + if(rememberMenu && LastMenuOffsets.find(NextPageItem->Name) != LastMenuOffsets.end()) { - page->SetScrollOffsetIndex(LastMenuOffsets[NextPageItem->GetName()]); + page->SetScrollOffsetIndex(LastMenuOffsets[NextPageItem->Name]); } state = RETROFE_NEXT_PAGE_REQUEST; diff --git a/RetroFE/Source/Utility/Utils.cpp b/RetroFE/Source/Utility/Utils.cpp index 57e83b3..903ed98 100644 --- a/RetroFE/Source/Utility/Utils.cpp +++ b/RetroFE/Source/Utility/Utils.cpp @@ -134,7 +134,7 @@ bool Utils::FindMatchingFile(std::string prefix, std::vector &exten for(unsigned int i = 0; i < extensions.size(); ++i) { std::string temp = prefix + "." + extensions[i]; - temp = Configuration::ConvertToAbsolutePath(Configuration::GetAbsolutePath(), temp); + temp = Configuration::ConvertToAbsolutePath(Configuration::AbsolutePath, temp); std::ifstream f(temp.c_str()); diff --git a/RetroFE/Source/Video/GStreamerVideo.cpp b/RetroFE/Source/Video/GStreamerVideo.cpp index 42a0538..6357a0c 100644 --- a/RetroFE/Source/Video/GStreamerVideo.cpp +++ b/RetroFE/Source/Video/GStreamerVideo.cpp @@ -135,7 +135,7 @@ bool GStreamerVideo::Initialize() return true; } - std::string path = Utils::CombinePath(Configuration::GetAbsolutePath(), "Core"); + std::string path = Utils::CombinePath(Configuration::AbsolutePath, "Core"); gst_init(NULL, NULL); #ifdef WIN32 @@ -208,7 +208,7 @@ bool GStreamerVideo::Play(std::string file) } else { - Configuration::ConvertToAbsolutePath(Configuration::GetAbsolutePath(), file); + Configuration::ConvertToAbsolutePath(Configuration::AbsolutePath, file); file = uriFile; if(!Playbin)