mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +00:00
Added a defaultFolderImage property to the carousel and grid elements.
This commit is contained in:
parent
2aca8b5912
commit
f511faff07
|
@ -600,14 +600,17 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
|
|||
auto theme = mRoot->getSystem()->getTheme();
|
||||
std::string name;
|
||||
std::string defaultImage;
|
||||
std::string defaultFolderImage;
|
||||
|
||||
if (mCarousel != nullptr) {
|
||||
defaultImage = mCarousel->getDefaultCarouselImage();
|
||||
defaultFolderImage = mCarousel->getDefaultCarouselFolderImage();
|
||||
if (!ResourceManager::getInstance().fileExists(defaultImage))
|
||||
defaultImage = "";
|
||||
}
|
||||
else if (mGrid != nullptr) {
|
||||
defaultImage = mGrid->getDefaultGridImage();
|
||||
defaultFolderImage = mGrid->getDefaultGridFolderImage();
|
||||
if (!ResourceManager::getInstance().fileExists(defaultImage))
|
||||
defaultImage = "";
|
||||
}
|
||||
|
@ -642,8 +645,15 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
|
|||
if (isCollection && mSystemNameSuffix)
|
||||
nameSuffixFunc(it, carouselEntry.name);
|
||||
|
||||
if (defaultImage != "")
|
||||
if ((*it)->getType() == FOLDER) {
|
||||
if (defaultFolderImage != "")
|
||||
carouselEntry.data.defaultImagePath = defaultFolderImage;
|
||||
else if (defaultImage != "")
|
||||
carouselEntry.data.defaultImagePath = defaultImage;
|
||||
}
|
||||
else if (defaultImage != "") {
|
||||
carouselEntry.data.defaultImagePath = defaultImage;
|
||||
}
|
||||
|
||||
mCarousel->addEntry(carouselEntry, theme);
|
||||
}
|
||||
|
@ -662,8 +672,15 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
|
|||
if (isCollection && mSystemNameSuffix)
|
||||
nameSuffixFunc(it, gridEntry.name);
|
||||
|
||||
if (defaultImage != "")
|
||||
if ((*it)->getType() == FOLDER) {
|
||||
if (defaultFolderImage != "")
|
||||
gridEntry.data.defaultImagePath = defaultFolderImage;
|
||||
else if (defaultImage != "")
|
||||
gridEntry.data.defaultImagePath = defaultImage;
|
||||
}
|
||||
else if (defaultImage != "") {
|
||||
gridEntry.data.defaultImagePath = defaultImage;
|
||||
}
|
||||
|
||||
mGrid->addEntry(gridEntry, theme);
|
||||
}
|
||||
|
|
|
@ -176,6 +176,9 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
|||
mCarousel = std::make_unique<CarouselComponent<FileData*>>();
|
||||
if (element.second.has("defaultImage"))
|
||||
mCarousel->setDefaultImage(element.second.get<std::string>("defaultImage"));
|
||||
if (element.second.has("defaultFolderImage"))
|
||||
mCarousel->setDefaultFolderImage(
|
||||
element.second.get<std::string>("defaultFolderImage"));
|
||||
mPrimary = mCarousel.get();
|
||||
}
|
||||
mPrimary->setCursorChangedCallback(
|
||||
|
@ -189,6 +192,9 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
|||
mGrid = std::make_unique<GridComponent<FileData*>>();
|
||||
if (element.second.has("defaultImage"))
|
||||
mGrid->setDefaultImage(element.second.get<std::string>("defaultImage"));
|
||||
if (element.second.has("defaultFolderImage"))
|
||||
mGrid->setDefaultFolderImage(
|
||||
element.second.get<std::string>("defaultFolderImage"));
|
||||
mPrimary = mGrid.get();
|
||||
}
|
||||
mPrimary->setCursorChangedCallback(
|
||||
|
|
|
@ -135,6 +135,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"staticImage", PATH},
|
||||
{"imageType", STRING},
|
||||
{"defaultImage", PATH},
|
||||
{"defaultFolderImage", PATH},
|
||||
{"maxItemCount", FLOAT},
|
||||
{"maxLogoCount", FLOAT}, // For backward compatibility with legacy themes.
|
||||
{"itemsBeforeCenter", UNSIGNED_INTEGER},
|
||||
|
@ -199,6 +200,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"staticImage", PATH},
|
||||
{"imageType", STRING},
|
||||
{"defaultImage", PATH},
|
||||
{"defaultFolderImage", PATH},
|
||||
{"itemSize", NORMALIZED_PAIR},
|
||||
{"itemScale", FLOAT},
|
||||
{"itemSpacing", NORMALIZED_PAIR},
|
||||
|
|
|
@ -62,7 +62,9 @@ public:
|
|||
void onDemandTextureLoad() override;
|
||||
const CarouselType getType() { return mType; }
|
||||
const std::string& getDefaultCarouselImage() const { return mDefaultImage; }
|
||||
const std::string& getDefaultCarouselFolderImage() const { return mDefaultFolderImage; }
|
||||
void setDefaultImage(std::string defaultImage) { mDefaultImage = defaultImage; }
|
||||
void setDefaultFolderImage(std::string defaultImage) { mDefaultFolderImage = defaultImage; }
|
||||
bool isScrolling() const override { return List::isScrolling(); }
|
||||
const LetterCase getLetterCase() const override { return mLetterCase; }
|
||||
const LetterCase getLetterCaseAutoCollections() const override
|
||||
|
@ -143,6 +145,7 @@ private:
|
|||
CarouselType mType;
|
||||
std::vector<std::string> mImageTypes;
|
||||
std::string mDefaultImage;
|
||||
std::string mDefaultFolderImage;
|
||||
float mMaxItemCount;
|
||||
int mItemsBeforeCenter;
|
||||
int mItemsAfterCenter;
|
||||
|
|
|
@ -72,7 +72,9 @@ public:
|
|||
return mLetterCaseSystemNameSuffix;
|
||||
}
|
||||
const std::string& getDefaultGridImage() const { return mDefaultImage; }
|
||||
const std::string& getDefaultGridFolderImage() const { return mDefaultFolderImage; }
|
||||
void setDefaultImage(std::string defaultImage) { mDefaultImage = defaultImage; }
|
||||
void setDefaultFolderImage(std::string defaultImage) { mDefaultFolderImage = defaultImage; }
|
||||
bool input(InputConfig* config, Input input) override;
|
||||
void update(int deltaTime) override;
|
||||
void render(const glm::mat4& parentTrans) override;
|
||||
|
@ -144,6 +146,7 @@ private:
|
|||
|
||||
std::vector<std::string> mImageTypes;
|
||||
std::string mDefaultImage;
|
||||
std::string mDefaultFolderImage;
|
||||
glm::vec2 mItemSize;
|
||||
float mItemScale;
|
||||
glm::vec2 mItemSpacing;
|
||||
|
|
Loading…
Reference in a new issue