mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Added checks for valid imageType property values to ImageComponent and VideoComponent.
This commit is contained in:
parent
9d2a9ed9d9
commit
0b34bd8991
|
@ -555,6 +555,32 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
imageTypes = Utils::String::replace(imageTypes, ",,", ",");
|
||||
mThemeImageTypes = Utils::String::delimitedStringToVector(imageTypes, ",");
|
||||
|
||||
if (mThemeImageTypes.empty()) {
|
||||
LOG(LogError) << "ImageComponent: Invalid theme configuration, property <imageType> "
|
||||
"contains no values";
|
||||
}
|
||||
|
||||
for (std::string& type : mThemeImageTypes) {
|
||||
if (std::find(supportedImageTypes.cbegin(), supportedImageTypes.cend(), type) ==
|
||||
supportedImageTypes.cend()) {
|
||||
LOG(LogError)
|
||||
<< "ImageComponent: Invalid theme configuration, property <imageType> "
|
||||
"defined as \""
|
||||
<< type << "\"";
|
||||
mThemeImageTypes.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> sortedTypes {mThemeImageTypes};
|
||||
std::stable_sort(sortedTypes.begin(), sortedTypes.end());
|
||||
|
||||
if (std::adjacent_find(sortedTypes.begin(), sortedTypes.end()) != sortedTypes.end()) {
|
||||
LOG(LogError) << "ImageComponent: Invalid theme configuration, property <imageType> "
|
||||
"contains duplicate values";
|
||||
mThemeImageTypes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("metadataElement") && elem->get<bool>("metadataElement"))
|
||||
|
|
|
@ -128,6 +128,10 @@ private:
|
|||
|
||||
std::string mDefaultPath;
|
||||
|
||||
static inline std::vector<std::string> supportedImageTypes {
|
||||
"image", "miximage", "marquee", "screenshot", "titlescreen",
|
||||
"cover", "backcover", "3dbox", "physicalmedia", "fanart"};
|
||||
|
||||
std::shared_ptr<TextureResource> mTexture;
|
||||
float mFadeOpacity;
|
||||
float mReflectionsFalloff;
|
||||
|
|
|
@ -206,6 +206,32 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
imageTypes = Utils::String::replace(imageTypes, ",,", ",");
|
||||
mThemeImageTypes = Utils::String::delimitedStringToVector(imageTypes, ",");
|
||||
|
||||
if (mThemeImageTypes.empty()) {
|
||||
LOG(LogError) << "VideoComponent: Invalid theme configuration, property <imageType> "
|
||||
"contains no values";
|
||||
}
|
||||
|
||||
for (std::string& type : mThemeImageTypes) {
|
||||
if (std::find(supportedImageTypes.cbegin(), supportedImageTypes.cend(), type) ==
|
||||
supportedImageTypes.cend()) {
|
||||
LOG(LogError)
|
||||
<< "VideoComponent: Invalid theme configuration, property <imageType> "
|
||||
"defined as \""
|
||||
<< type << "\"";
|
||||
mThemeImageTypes.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> sortedTypes {mThemeImageTypes};
|
||||
std::stable_sort(sortedTypes.begin(), sortedTypes.end());
|
||||
|
||||
if (std::adjacent_find(sortedTypes.begin(), sortedTypes.end()) != sortedTypes.end()) {
|
||||
LOG(LogError) << "VideoComponent: Invalid theme configuration, property <imageType> "
|
||||
"contains duplicate values";
|
||||
mThemeImageTypes.clear();
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("pillarboxes"))
|
||||
|
|
|
@ -113,6 +113,10 @@ protected:
|
|||
std::string mStaticImagePath;
|
||||
std::string mDefaultImagePath;
|
||||
|
||||
static inline std::vector<std::string> supportedImageTypes {
|
||||
"image", "miximage", "marquee", "screenshot", "titlescreen",
|
||||
"cover", "backcover", "3dbox", "physicalmedia", "fanart"};
|
||||
|
||||
std::string mVideoPath;
|
||||
unsigned mStartTime;
|
||||
std::atomic<bool> mIsPlaying;
|
||||
|
|
Loading…
Reference in a new issue