mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 09:35:39 +00:00
The defaultImage property can now be used to display a static image in case no video file was found.
Also fixed a bug where the static image would not get displayed in the grouped custom collections view if there was no game found for the system and the previously selected entry already had it's video playing when navigating away from it.
This commit is contained in:
parent
c59606e01d
commit
251e826589
|
@ -561,14 +561,14 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fadingOut = false;
|
bool fadingOut {false};
|
||||||
if (file == nullptr) {
|
if (file == nullptr) {
|
||||||
if (mVideoPlaying) {
|
if (mVideoPlaying) {
|
||||||
for (auto& video : mVideoComponents) {
|
for (auto& video : mVideoComponents) {
|
||||||
video->stopVideoPlayer(!mStaticVideoAudio);
|
video->stopVideoPlayer(!mStaticVideoAudio);
|
||||||
video->setVideo("");
|
video->setVideo("");
|
||||||
if (!video->hasStartDelay())
|
if (!video->hasStartDelay())
|
||||||
video->setImage("");
|
video->setImageNoDefault("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mVideoPlaying = false;
|
mVideoPlaying = false;
|
||||||
|
@ -588,7 +588,6 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
|
|
||||||
for (auto& video : mVideoComponents) {
|
for (auto& video : mVideoComponents) {
|
||||||
setGameImage(mRandomGame, video.get());
|
setGameImage(mRandomGame, video.get());
|
||||||
|
|
||||||
video->stopVideoPlayer(!mStaticVideoAudio);
|
video->stopVideoPlayer(!mStaticVideoAudio);
|
||||||
|
|
||||||
if (video->hasStaticVideo())
|
if (video->hasStaticVideo())
|
||||||
|
@ -609,12 +608,15 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
video->stopVideoPlayer(!mStaticVideoAudio);
|
video->stopVideoPlayer(!mStaticVideoAudio);
|
||||||
video->setImage("");
|
video->setImage("");
|
||||||
video->setVideo("");
|
video->setVideo("");
|
||||||
|
|
||||||
if (video->hasStaticVideo()) {
|
if (video->hasStaticVideo()) {
|
||||||
video->setStaticVideo();
|
video->setStaticVideo();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
video->setDefaultVideo();
|
video->setDefaultVideo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
video->startVideoPlayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -991,6 +993,6 @@ void GamelistView::setGameImage(FileData* file, GuiComponent* comp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This is needed so the default image is set if no game media was found.
|
// This is needed so the default image is set if no game media was found.
|
||||||
if (path == "" && comp->getThemeImageTypes().size() > 0)
|
if (path == "" && (comp->getThemeImageTypes().size() > 0 || comp->getDefaultImage() != ""))
|
||||||
comp->setImage("");
|
comp->setImage("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1046,7 +1046,8 @@ void SystemView::updateGameSelectors()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& video : mSystemElements[cursor].videoComponents) {
|
for (auto& video : mSystemElements[cursor].videoComponents) {
|
||||||
if (video->hasStaticVideo() || video->getThemeImageTypes().size() == 0)
|
if (video->hasStaticVideo() ||
|
||||||
|
(video->getThemeImageTypes().size() == 0 && video->getDefaultImage() == ""))
|
||||||
continue;
|
continue;
|
||||||
GameSelectorComponent* gameSelector {nullptr};
|
GameSelectorComponent* gameSelector {nullptr};
|
||||||
if (multipleSelectors) {
|
if (multipleSelectors) {
|
||||||
|
@ -1155,7 +1156,8 @@ void SystemView::updateGameSelectors()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This is needed so the default image is set if no game media was found.
|
// This is needed so the default image is set if no game media was found.
|
||||||
if (path == "" && video->getThemeImageTypes().size() > 0)
|
if (path == "" &&
|
||||||
|
(video->getThemeImageTypes().size() > 0 || video->getDefaultImage() != ""))
|
||||||
video->setImage("");
|
video->setImage("");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -261,6 +261,7 @@ public:
|
||||||
const std::vector<std::string>& getThemeImageTypes() { return mThemeImageTypes; }
|
const std::vector<std::string>& getThemeImageTypes() { return mThemeImageTypes; }
|
||||||
const std::string& getThemeGameSelector() const { return mThemeGameSelector; }
|
const std::string& getThemeGameSelector() const { return mThemeGameSelector; }
|
||||||
const unsigned int getThemeGameSelectorEntry() const { return mThemeGameSelectorEntry; }
|
const unsigned int getThemeGameSelectorEntry() const { return mThemeGameSelectorEntry; }
|
||||||
|
virtual const std::string getDefaultImage() const { return ""; }
|
||||||
|
|
||||||
virtual std::shared_ptr<Font> getFont() const { return nullptr; }
|
virtual std::shared_ptr<Font> getFont() const { return nullptr; }
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,16 @@ void VideoComponent::setImage(const std::string& path, bool tile)
|
||||||
mStaticImagePath = imagePath;
|
mStaticImagePath = imagePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoComponent::setImageNoDefault(const std::string& path)
|
||||||
|
{
|
||||||
|
// Check if the image has changed.
|
||||||
|
if (path == mStaticImagePath)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mStaticImage.setImage(path, false);
|
||||||
|
mStaticImagePath = path;
|
||||||
|
}
|
||||||
|
|
||||||
void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
const std::string& view,
|
const std::string& view,
|
||||||
const std::string& element,
|
const std::string& element,
|
||||||
|
@ -257,6 +267,9 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mThemeImageTypes.empty())
|
||||||
|
mConfig.startDelay = 0;
|
||||||
|
|
||||||
if (elem->has("color")) {
|
if (elem->has("color")) {
|
||||||
mColorShift = elem->get<unsigned int>("color");
|
mColorShift = elem->get<unsigned int>("color");
|
||||||
mColorShiftEnd = mColorShift;
|
mColorShiftEnd = mColorShift;
|
||||||
|
|
|
@ -41,6 +41,8 @@ public:
|
||||||
void setStaticVideo() { setVideo(mConfig.staticVideoPath); }
|
void setStaticVideo() { setVideo(mConfig.staticVideoPath); }
|
||||||
// Loads a static image that is displayed if the video cannot be played.
|
// Loads a static image that is displayed if the video cannot be played.
|
||||||
void setImage(const std::string& path, bool tile = false) override;
|
void setImage(const std::string& path, bool tile = false) override;
|
||||||
|
// Same as setImage() but does not set the default image if the path argument is empty.
|
||||||
|
void setImageNoDefault(const std::string& path);
|
||||||
// Sets whether we're in media viewer mode.
|
// Sets whether we're in media viewer mode.
|
||||||
void setMediaViewerMode(bool isMediaViewer) { mMediaViewerMode = isMediaViewer; }
|
void setMediaViewerMode(bool isMediaViewer) { mMediaViewerMode = isMediaViewer; }
|
||||||
// Sets whether we're in screensaver mode.
|
// Sets whether we're in screensaver mode.
|
||||||
|
|
|
@ -53,6 +53,8 @@ public:
|
||||||
void handleLooping() override;
|
void handleLooping() override;
|
||||||
// Used to immediately mute audio even if there are samples to play in the buffer.
|
// Used to immediately mute audio even if there are samples to play in the buffer.
|
||||||
void muteVideoPlayer() override;
|
void muteVideoPlayer() override;
|
||||||
|
// Needed to be able to display the default image even if no image types have been defined.
|
||||||
|
const std::string getDefaultImage() const override { return mDefaultImagePath; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void startVideoStream() override;
|
void startVideoStream() override;
|
||||||
|
|
Loading…
Reference in a new issue