mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-21 21:55:38 +00:00
Some cosmetic code cleanup and some small documentation updates.
This commit is contained in:
parent
162d893ea0
commit
2c3b452401
1
NEWS.md
1
NEWS.md
|
@ -48,6 +48,7 @@ Many bugs have been fixed, and numerous features that were only partially implem
|
||||||
* GUI-configurable option to sort favorite games above non-favorite games (favorites marked with stars)
|
* GUI-configurable option to sort favorite games above non-favorite games (favorites marked with stars)
|
||||||
* GUI-configurable option to sort folders on top of the gamelists
|
* GUI-configurable option to sort folders on top of the gamelists
|
||||||
* Added a gamelist info text field displaying the game count, any applied filters as well as an icon if a folder has been entered
|
* Added a gamelist info text field displaying the game count, any applied filters as well as an icon if a folder has been entered
|
||||||
|
* Expanded the gamelist filter functionality to include completed and broken games as well as the ability to filter on game names (via free text entry)
|
||||||
* Expanded the metadata for folders and made it possible to mark them as favorites
|
* Expanded the metadata for folders and made it possible to mark them as favorites
|
||||||
* Added new component GuiComplexTextEditPopup to handle changes to configuration file entries and similar
|
* Added new component GuiComplexTextEditPopup to handle changes to configuration file entries and similar
|
||||||
* Speed improvements and optimizations, the application now starts faster and feels more responsive
|
* Speed improvements and optimizations, the application now starts faster and feels more responsive
|
||||||
|
|
|
@ -647,7 +647,7 @@ This setting enables the 'Y' button for quickly toggling a game as favorite. Alt
|
||||||
|
|
||||||
**Enable gamelist filters**
|
**Enable gamelist filters**
|
||||||
|
|
||||||
Activating or deactivating the ability to filter your gamelists. Can normally be left on.
|
Activating or deactivating the ability to filter your gamelists. This can normally be left enabled.
|
||||||
|
|
||||||
**Enable quick system select**
|
**Enable quick system select**
|
||||||
|
|
||||||
|
@ -896,6 +896,8 @@ Choosing this entry opens a separate screen where it's possible to apply a filte
|
||||||
|
|
||||||
The following filters can be applied:
|
The following filters can be applied:
|
||||||
|
|
||||||
|
**Text Filter (Game Name)**
|
||||||
|
|
||||||
**Favorites**
|
**Favorites**
|
||||||
|
|
||||||
**Genre**
|
**Genre**
|
||||||
|
@ -914,9 +916,9 @@ The following filters can be applied:
|
||||||
|
|
||||||
**Hidden**
|
**Hidden**
|
||||||
|
|
||||||
All possible filter values are assembled from metadata from the actual gamelist, so if there for instance are no games marked as completed, the Completed filter will only have the selectable option 'False', meaning 'True' will be missing.
|
With the exception of the text filter, all available filter values are assembled from metadata from the actual gamelist, so if there for instance are no games marked as completed, the Completed filter will only have the selectable option 'False', i.e. 'True' will be missing.
|
||||||
|
|
||||||
Be aware that although folders can have most of these metadata values set, the filters are only applied to files. So if you for example set a filter to only display your favorite games, any folder that contains a favorite game will be displayed, and other folders which are themselves marked as favorite but that do not contain any favorite games will be hidden.
|
Be aware that although folders can have most of the metadata values set, the filters are only applied to files (this is also true for the text/game name filter). So if you for example set a filter to only display your favorite games, any folder that contains a favorite game will be displayed, and other folders which are themselves marked as favorites but that do not contain any favorite games will be hidden.
|
||||||
|
|
||||||
The filters are always applied for the complete game system, including all folder contents.
|
The filters are always applied for the complete game system, including all folder contents.
|
||||||
|
|
||||||
|
|
|
@ -463,16 +463,6 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionSystemManager::trimCollectionCount(FileData* rootFolder, int limit)
|
|
||||||
{
|
|
||||||
SystemData* curSys = rootFolder->getSystem();
|
|
||||||
while (static_cast<int>(rootFolder->getChildrenListToDisplay().size()) > limit) {
|
|
||||||
CollectionFileData* gameToRemove =
|
|
||||||
(CollectionFileData*)rootFolder->getChildrenListToDisplay().back();
|
|
||||||
ViewController::get()->getGameListView(curSys).get()->remove(gameToRemove, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete all collection files from collection systems related to the source file.
|
// Delete all collection files from collection systems related to the source file.
|
||||||
void CollectionSystemManager::deleteCollectionFiles(FileData* file)
|
void CollectionSystemManager::deleteCollectionFiles(FileData* file)
|
||||||
{
|
{
|
||||||
|
@ -742,22 +732,6 @@ SystemData* CollectionSystemManager::getSystemToView(SystemData* sys)
|
||||||
return systemToView;
|
return systemToView;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions below to Handle loading of collection systems, creating empty ones,
|
|
||||||
// and populating on demand.
|
|
||||||
|
|
||||||
// Loads Automatic Collection systems (All, Favorites, Last Played).
|
|
||||||
void CollectionSystemManager::initAutoCollectionSystems()
|
|
||||||
{
|
|
||||||
for (std::map<std::string, CollectionSystemDecl, stringComparator>::const_iterator
|
|
||||||
it = mCollectionSystemDeclsIndex.cbegin();
|
|
||||||
it != mCollectionSystemDeclsIndex.cend() ; it++ ) {
|
|
||||||
CollectionSystemDecl sysDecl = it->second;
|
|
||||||
|
|
||||||
if (!sysDecl.isCustom)
|
|
||||||
createNewCollectionEntry(sysDecl.name, sysDecl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used to generate a description of the collection, all other metadata fields are hidden.
|
// Used to generate a description of the collection, all other metadata fields are hidden.
|
||||||
FileData* CollectionSystemManager::updateCollectionFolderMetadata(SystemData* sys)
|
FileData* CollectionSystemManager::updateCollectionFolderMetadata(SystemData* sys)
|
||||||
{
|
{
|
||||||
|
@ -846,6 +820,59 @@ FileData* CollectionSystemManager::updateCollectionFolderMetadata(SystemData* sy
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return the unused folders from current theme path.
|
||||||
|
std::vector<std::string> CollectionSystemManager::getUnusedSystemsFromTheme()
|
||||||
|
{
|
||||||
|
// Get used systems in es_systems.cfg.
|
||||||
|
std::vector<std::string> systemsInUse = getSystemsFromConfig();
|
||||||
|
// Get available folders in theme.
|
||||||
|
std::vector<std::string> themeSys = getSystemsFromTheme();
|
||||||
|
// Get folders assigned to custom collections.
|
||||||
|
std::vector<std::string> autoSys = getCollectionThemeFolders(false);
|
||||||
|
// Get folder assigned to custom collections.
|
||||||
|
std::vector<std::string> customSys = getCollectionThemeFolders(true);
|
||||||
|
// Get folders assigned to user collections.
|
||||||
|
std::vector<std::string> userSys = getUserCollectionThemeFolders();
|
||||||
|
// Add them all to the list of systems in use.
|
||||||
|
systemsInUse.insert(systemsInUse.cend(), autoSys.cbegin(), autoSys.cend());
|
||||||
|
systemsInUse.insert(systemsInUse.cend(), customSys.cbegin(), customSys.cend());
|
||||||
|
systemsInUse.insert(systemsInUse.cend(), userSys.cbegin(), userSys.cend());
|
||||||
|
|
||||||
|
for (auto sysIt = themeSys.cbegin(); sysIt != themeSys.cend(); ) {
|
||||||
|
if (std::find(systemsInUse.cbegin(), systemsInUse.cend(), *sysIt) != systemsInUse.cend())
|
||||||
|
sysIt = themeSys.erase(sysIt);
|
||||||
|
else
|
||||||
|
sysIt++;
|
||||||
|
}
|
||||||
|
return themeSys;
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemData* CollectionSystemManager::addNewCustomCollection(std::string name)
|
||||||
|
{
|
||||||
|
CollectionSystemDecl decl = mCollectionSystemDeclsIndex[myCollectionsName];
|
||||||
|
decl.themeFolder = name;
|
||||||
|
decl.name = name;
|
||||||
|
decl.longName = name;
|
||||||
|
|
||||||
|
return createNewCollectionEntry(name, decl, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Functions below to Handle loading of collection systems, creating empty ones,
|
||||||
|
// and populating on demand.
|
||||||
|
|
||||||
|
// Loads Automatic Collection systems (All, Favorites, Last Played).
|
||||||
|
void CollectionSystemManager::initAutoCollectionSystems()
|
||||||
|
{
|
||||||
|
for (std::map<std::string, CollectionSystemDecl, stringComparator>::const_iterator
|
||||||
|
it = mCollectionSystemDeclsIndex.cbegin();
|
||||||
|
it != mCollectionSystemDeclsIndex.cend() ; it++ ) {
|
||||||
|
CollectionSystemDecl sysDecl = it->second;
|
||||||
|
|
||||||
|
if (!sysDecl.isCustom)
|
||||||
|
createNewCollectionEntry(sysDecl.name, sysDecl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CollectionSystemManager::initCustomCollectionSystems()
|
void CollectionSystemManager::initCustomCollectionSystems()
|
||||||
{
|
{
|
||||||
std::vector<std::string> systems = getCollectionsFromConfigFolder();
|
std::vector<std::string> systems = getCollectionsFromConfigFolder();
|
||||||
|
@ -863,16 +890,6 @@ SystemData* CollectionSystemManager::getAllGamesCollection()
|
||||||
return allSysData->system;
|
return allSysData->system;
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemData* CollectionSystemManager::addNewCustomCollection(std::string name)
|
|
||||||
{
|
|
||||||
CollectionSystemDecl decl = mCollectionSystemDeclsIndex[myCollectionsName];
|
|
||||||
decl.themeFolder = name;
|
|
||||||
decl.name = name;
|
|
||||||
decl.longName = name;
|
|
||||||
|
|
||||||
return createNewCollectionEntry(name, decl, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create a new empty collection system based on the name and declaration.
|
// Create a new empty collection system based on the name and declaration.
|
||||||
SystemData* CollectionSystemManager::createNewCollectionEntry(
|
SystemData* CollectionSystemManager::createNewCollectionEntry(
|
||||||
std::string name, CollectionSystemDecl sysDecl, bool index, bool custom)
|
std::string name, CollectionSystemDecl sysDecl, bool index, bool custom)
|
||||||
|
@ -1156,33 +1173,6 @@ std::vector<std::string> CollectionSystemManager::getSystemsFromTheme()
|
||||||
return systems;
|
return systems;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the unused folders from current theme path.
|
|
||||||
std::vector<std::string> CollectionSystemManager::getUnusedSystemsFromTheme()
|
|
||||||
{
|
|
||||||
// Get used systems in es_systems.cfg.
|
|
||||||
std::vector<std::string> systemsInUse = getSystemsFromConfig();
|
|
||||||
// Get available folders in theme.
|
|
||||||
std::vector<std::string> themeSys = getSystemsFromTheme();
|
|
||||||
// Get folders assigned to custom collections.
|
|
||||||
std::vector<std::string> autoSys = getCollectionThemeFolders(false);
|
|
||||||
// Get folder assigned to custom collections.
|
|
||||||
std::vector<std::string> customSys = getCollectionThemeFolders(true);
|
|
||||||
// Get folders assigned to user collections.
|
|
||||||
std::vector<std::string> userSys = getUserCollectionThemeFolders();
|
|
||||||
// Add them all to the list of systems in use.
|
|
||||||
systemsInUse.insert(systemsInUse.cend(), autoSys.cbegin(), autoSys.cend());
|
|
||||||
systemsInUse.insert(systemsInUse.cend(), customSys.cbegin(), customSys.cend());
|
|
||||||
systemsInUse.insert(systemsInUse.cend(), userSys.cbegin(), userSys.cend());
|
|
||||||
|
|
||||||
for (auto sysIt = themeSys.cbegin(); sysIt != themeSys.cend(); ) {
|
|
||||||
if (std::find(systemsInUse.cbegin(), systemsInUse.cend(), *sysIt) != systemsInUse.cend())
|
|
||||||
sysIt = themeSys.erase(sysIt);
|
|
||||||
else
|
|
||||||
sysIt++;
|
|
||||||
}
|
|
||||||
return themeSys;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return which collection config files exist in the user folder.
|
// Return which collection config files exist in the user folder.
|
||||||
std::vector<std::string> CollectionSystemManager::getCollectionsFromConfigFolder()
|
std::vector<std::string> CollectionSystemManager::getCollectionsFromConfigFolder()
|
||||||
{
|
{
|
||||||
|
@ -1240,6 +1230,16 @@ std::vector<std::string> CollectionSystemManager::getUserCollectionThemeFolders(
|
||||||
return systems;
|
return systems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CollectionSystemManager::trimCollectionCount(FileData* rootFolder, int limit)
|
||||||
|
{
|
||||||
|
SystemData* curSys = rootFolder->getSystem();
|
||||||
|
while (static_cast<int>(rootFolder->getChildrenListToDisplay().size()) > limit) {
|
||||||
|
CollectionFileData* gameToRemove =
|
||||||
|
(CollectionFileData*)rootFolder->getChildrenListToDisplay().back();
|
||||||
|
ViewController::get()->getGameListView(curSys).get()->remove(gameToRemove, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Return whether a specific folder exists in the theme.
|
// Return whether a specific folder exists in the theme.
|
||||||
bool CollectionSystemManager::themeFolderExists(std::string folder)
|
bool CollectionSystemManager::themeFolderExists(std::string folder)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,8 +86,8 @@ public:
|
||||||
inline std::map<std::string, CollectionSystemData, stringComparator>
|
inline std::map<std::string, CollectionSystemData, stringComparator>
|
||||||
getCustomCollectionSystems() { return mCustomCollectionSystemsData; };
|
getCustomCollectionSystems() { return mCustomCollectionSystemsData; };
|
||||||
inline SystemData* getCustomCollectionsBundle() { return mCustomCollectionsBundle; };
|
inline SystemData* getCustomCollectionsBundle() { return mCustomCollectionsBundle; };
|
||||||
std::vector<std::string> getUnusedSystemsFromTheme();
|
inline bool isEditing() { return mIsEditingCustom; };
|
||||||
SystemData* addNewCustomCollection(std::string name);
|
inline std::string getEditingCollection() { return mEditingCollection; };
|
||||||
|
|
||||||
bool isThemeGenericCollectionCompatible(bool genericCustomCollections);
|
bool isThemeGenericCollectionCompatible(bool genericCustomCollections);
|
||||||
bool isThemeCustomCollectionCompatible(std::vector<std::string> stringVector);
|
bool isThemeCustomCollectionCompatible(std::vector<std::string> stringVector);
|
||||||
|
@ -95,13 +95,14 @@ public:
|
||||||
|
|
||||||
void setEditMode(std::string collectionName);
|
void setEditMode(std::string collectionName);
|
||||||
void exitEditMode();
|
void exitEditMode();
|
||||||
inline bool isEditing() { return mIsEditingCustom; };
|
|
||||||
inline std::string getEditingCollection() { return mEditingCollection; };
|
|
||||||
bool inCustomCollection(const std::string& collectionName, FileData* gameFile);
|
bool inCustomCollection(const std::string& collectionName, FileData* gameFile);
|
||||||
bool toggleGameInCollection(FileData* file);
|
bool toggleGameInCollection(FileData* file);
|
||||||
|
|
||||||
SystemData* getSystemToView(SystemData* sys);
|
SystemData* getSystemToView(SystemData* sys);
|
||||||
FileData* updateCollectionFolderMetadata(SystemData* sys);
|
FileData* updateCollectionFolderMetadata(SystemData* sys);
|
||||||
|
std::vector<std::string> getUnusedSystemsFromTheme();
|
||||||
|
|
||||||
|
SystemData* addNewCustomCollection(std::string name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static CollectionSystemManager* sInstance;
|
static CollectionSystemManager* sInstance;
|
||||||
|
|
|
@ -18,27 +18,18 @@
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "SystemData.h"
|
#include "SystemData.h"
|
||||||
|
|
||||||
|
#include <rapidjson/document.h>
|
||||||
|
#include <rapidjson/error/en.h>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <pugixml.hpp>
|
#include <pugixml.hpp>
|
||||||
|
|
||||||
// When raspbian will get an up to date version of rapidjson we'll be
|
|
||||||
// able to have it throw in case of error with the following:
|
|
||||||
//ifndef RAPIDJSON_ASSERT
|
|
||||||
//#define RAPIDJSON_ASSERT(x) \
|
|
||||||
// if (!(x)) { \
|
|
||||||
// throw std::runtime_error("rapidjson internal assertion failure: " #x); \
|
|
||||||
// }
|
|
||||||
//#endif // RAPIDJSON_ASSERT
|
|
||||||
|
|
||||||
#include <rapidjson/document.h>
|
|
||||||
#include <rapidjson/error/en.h>
|
|
||||||
|
|
||||||
using namespace PlatformIds;
|
using namespace PlatformIds;
|
||||||
using namespace rapidjson;
|
using namespace rapidjson;
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
TheGamesDBJSONRequestResources resources;
|
{
|
||||||
|
TheGamesDBJSONRequestResources resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::map<PlatformId, std::string> gamesdb_new_platformid_map {
|
const std::map<PlatformId, std::string> gamesdb_new_platformid_map {
|
||||||
|
@ -117,8 +108,7 @@ const std::map<PlatformId, std::string> gamesdb_new_platformid_map {
|
||||||
{ TANDY, "4941" },
|
{ TANDY, "4941" },
|
||||||
};
|
};
|
||||||
|
|
||||||
void thegamesdb_generate_json_scraper_requests(
|
void thegamesdb_generate_json_scraper_requests(const ScraperSearchParams& params,
|
||||||
const ScraperSearchParams& params,
|
|
||||||
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
||||||
std::vector<ScraperSearchResult>& results)
|
std::vector<ScraperSearchResult>& results)
|
||||||
{
|
{
|
||||||
|
@ -242,7 +232,7 @@ std::string getDeveloperString(const Value& v)
|
||||||
|
|
||||||
std::string out = "";
|
std::string out = "";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (int i = 0; i < (int)v.Size(); ++i) {
|
for (int i = 0; i < static_cast<int>(v.Size()); ++i) {
|
||||||
auto mapIt = resources.gamesdb_new_developers_map.find(getIntOrThrow(v[i]));
|
auto mapIt = resources.gamesdb_new_developers_map.find(getIntOrThrow(v[i]));
|
||||||
|
|
||||||
if (mapIt == resources.gamesdb_new_developers_map.cend())
|
if (mapIt == resources.gamesdb_new_developers_map.cend())
|
||||||
|
@ -264,7 +254,7 @@ std::string getPublisherString(const Value& v)
|
||||||
|
|
||||||
std::string out = "";
|
std::string out = "";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (int i = 0; i < (int)v.Size(); ++i) {
|
for (int i = 0; i < static_cast<int>(v.Size()); ++i) {
|
||||||
auto mapIt = resources.gamesdb_new_publishers_map.find(getIntOrThrow(v[i]));
|
auto mapIt = resources.gamesdb_new_publishers_map.find(getIntOrThrow(v[i]));
|
||||||
|
|
||||||
if (mapIt == resources.gamesdb_new_publishers_map.cend())
|
if (mapIt == resources.gamesdb_new_publishers_map.cend())
|
||||||
|
@ -286,8 +276,9 @@ std::string getGenreString(const Value& v)
|
||||||
|
|
||||||
std::string out = "";
|
std::string out = "";
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (int i = 0; i < (int)v.Size(); ++i) {
|
for (int i = 0; i < static_cast<int>(v.Size()); ++i) {
|
||||||
auto mapIt = resources.gamesdb_new_genres_map.find(getIntOrThrow(v[i]));
|
auto mapIt = resources.gamesdb_new_genres_map.find(getIntOrThrow(v[i]));
|
||||||
|
|
||||||
if (mapIt == resources.gamesdb_new_genres_map.cend())
|
if (mapIt == resources.gamesdb_new_genres_map.cend())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -457,7 +448,7 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr<HttpReq>& req,
|
||||||
const Value& games = doc["data"]["games"];
|
const Value& games = doc["data"]["games"];
|
||||||
resources.ensureResources();
|
resources.ensureResources();
|
||||||
|
|
||||||
for (int i = 0; i < (int)games.Size(); ++i) {
|
for (int i = 0; i < static_cast<int>(games.Size()); ++i) {
|
||||||
auto& v = games[i];
|
auto& v = games[i];
|
||||||
try {
|
try {
|
||||||
processGame(v, results);
|
processGame(v, results);
|
||||||
|
|
|
@ -13,23 +13,21 @@
|
||||||
#include "scrapers/Scraper.h"
|
#include "scrapers/Scraper.h"
|
||||||
|
|
||||||
namespace pugi {
|
namespace pugi {
|
||||||
class xml_document;
|
class xml_document;
|
||||||
}
|
}
|
||||||
|
|
||||||
void thegamesdb_generate_json_scraper_requests(
|
void thegamesdb_generate_json_scraper_requests(const ScraperSearchParams& params,
|
||||||
const ScraperSearchParams& params,
|
|
||||||
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
||||||
std::vector<ScraperSearchResult>& results);
|
std::vector<ScraperSearchResult>& results);
|
||||||
|
|
||||||
void thegamesdb_generate_json_scraper_requests(
|
void thegamesdb_generate_json_scraper_requests(const std::string& gameIDs,
|
||||||
const std::string& gameIDs,
|
|
||||||
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
||||||
std::vector<ScraperSearchResult>& results);
|
std::vector<ScraperSearchResult>& results);
|
||||||
|
|
||||||
class TheGamesDBJSONRequest : public ScraperHttpRequest
|
class TheGamesDBJSONRequest : public ScraperHttpRequest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// ctor for a GetGameList request.
|
// Constructor for a GetGameList request.
|
||||||
TheGamesDBJSONRequest(
|
TheGamesDBJSONRequest(
|
||||||
std::queue<std::unique_ptr<ScraperRequest>>& requestsWrite,
|
std::queue<std::unique_ptr<ScraperRequest>>& requestsWrite,
|
||||||
std::vector<ScraperSearchResult>& resultsWrite,
|
std::vector<ScraperSearchResult>& resultsWrite,
|
||||||
|
@ -38,18 +36,13 @@ class TheGamesDBJSONRequest : public ScraperHttpRequest
|
||||||
mRequestQueue(&requestsWrite)
|
mRequestQueue(&requestsWrite)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// ctor for a GetGame request
|
// Constructior for a GetGame request
|
||||||
TheGamesDBJSONRequest(
|
TheGamesDBJSONRequest(std::vector<ScraperSearchResult>& resultsWrite, const std::string& url)
|
||||||
std::vector<ScraperSearchResult>& resultsWrite,
|
: ScraperHttpRequest(resultsWrite, url), mRequestQueue(nullptr)
|
||||||
const std::string& url)
|
|
||||||
: ScraperHttpRequest(resultsWrite, url),
|
|
||||||
mRequestQueue(nullptr)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//void retrieveMediaURLs()
|
|
||||||
|
|
||||||
void process(const std::unique_ptr<HttpReq>& req,
|
void process(const std::unique_ptr<HttpReq>& req,
|
||||||
std::vector<ScraperSearchResult>& results) override;
|
std::vector<ScraperSearchResult>& results) override;
|
||||||
bool isGameRequest() { return !mRequestQueue; }
|
bool isGameRequest() { return !mRequestQueue; }
|
||||||
|
|
|
@ -23,7 +23,6 @@ namespace GridFlags
|
||||||
|
|
||||||
enum Border : unsigned int {
|
enum Border : unsigned int {
|
||||||
BORDER_NONE = 0,
|
BORDER_NONE = 0,
|
||||||
|
|
||||||
BORDER_TOP = 1,
|
BORDER_TOP = 1,
|
||||||
BORDER_BOTTOM = 2,
|
BORDER_BOTTOM = 2,
|
||||||
BORDER_LEFT = 4,
|
BORDER_LEFT = 4,
|
||||||
|
@ -96,11 +95,22 @@ private:
|
||||||
GridFlags::UpdateType updateType;
|
GridFlags::UpdateType updateType;
|
||||||
unsigned int border;
|
unsigned int border;
|
||||||
|
|
||||||
GridEntry(const Vector2i& p = Vector2i::Zero(), const Vector2i& d = Vector2i::Zero(),
|
GridEntry(
|
||||||
const std::shared_ptr<GuiComponent>& cmp = nullptr, bool f = false, bool r = true,
|
const Vector2i& p = Vector2i::Zero(),
|
||||||
GridFlags::UpdateType u = GridFlags::UPDATE_ALWAYS, unsigned int b =
|
const Vector2i& d = Vector2i::Zero(),
|
||||||
GridFlags::BORDER_NONE) :
|
const std::shared_ptr<GuiComponent>& cmp = nullptr,
|
||||||
pos(p), dim(d), component(cmp), canFocus(f), resize(r), updateType(u), border(b)
|
bool f = false,
|
||||||
|
bool r = true,
|
||||||
|
GridFlags::UpdateType u = GridFlags::UPDATE_ALWAYS,
|
||||||
|
unsigned int b =
|
||||||
|
GridFlags::BORDER_NONE)
|
||||||
|
: pos(p),
|
||||||
|
dim(d),
|
||||||
|
component(cmp),
|
||||||
|
canFocus(f),
|
||||||
|
resize(r),
|
||||||
|
updateType(u),
|
||||||
|
border(b)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
operator bool() const
|
operator bool() const
|
||||||
|
|
|
@ -141,7 +141,7 @@ void ImageComponent::resize()
|
||||||
mSize[0] = Math::round(mSize.x());
|
mSize[0] = Math::round(mSize.x());
|
||||||
mSize[1] = Math::round(mSize.y());
|
mSize[1] = Math::round(mSize.y());
|
||||||
// mSize.y() should already be rounded.
|
// mSize.y() should already be rounded.
|
||||||
mTexture->rasterizeAt((size_t)mSize.x(), (size_t)mSize.y());
|
mTexture->rasterizeAt(static_cast<size_t>(mSize.x()), static_cast<size_t>(mSize.y()));
|
||||||
|
|
||||||
onSizeChanged();
|
onSizeChanged();
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,8 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, const s
|
||||||
if (elem->has("colorEnd"))
|
if (elem->has("colorEnd"))
|
||||||
setColorShiftEnd(elem->get<unsigned int>("colorEnd"));
|
setColorShiftEnd(elem->get<unsigned int>("colorEnd"));
|
||||||
if (elem->has("gradientType"))
|
if (elem->has("gradientType"))
|
||||||
setColorGradientHorizontal(!(elem->get<std::string>("gradientType").compare("horizontal")));
|
setColorGradientHorizontal(!(elem->
|
||||||
|
get<std::string>("gradientType").compare("horizontal")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
#ifndef ES_CORE_COMPONENTS_IMAGE_COMPONENT_H
|
#ifndef ES_CORE_COMPONENTS_IMAGE_COMPONENT_H
|
||||||
#define ES_CORE_COMPONENTS_IMAGE_COMPONENT_H
|
#define ES_CORE_COMPONENTS_IMAGE_COMPONENT_H
|
||||||
|
|
||||||
#include "renderers/Renderer.h"
|
|
||||||
#include "math/Vector2i.h"
|
#include "math/Vector2i.h"
|
||||||
|
#include "renderers/Renderer.h"
|
||||||
#include "GuiComponent.h"
|
#include "GuiComponent.h"
|
||||||
|
|
||||||
class TextureResource;
|
class TextureResource;
|
||||||
|
|
Loading…
Reference in a new issue