diff --git a/src/Application/SettingsLoader.cpp b/src/Application/SettingsLoader.cpp index 098a42b..38d0fb2 100644 --- a/src/Application/SettingsLoader.cpp +++ b/src/Application/SettingsLoader.cpp @@ -86,6 +86,13 @@ bool SettingsLoader::load( // Load media by using full path source = mediaServer.loadMedia(sourcePath, typeEnum); + + if(typeEnum == SourceType::SOURCE_TYPE_VIDEO){ + // Attempt to set loop for this type of source + bool loop = xmlSettings->getValue("source-loop", true); + VideoSource * vid = dynamic_cast(source); + vid->setLoop(loop); + } } } @@ -212,6 +219,12 @@ bool SettingsLoader::save(SurfaceManager & surfaceManager, std::string fileName) xmlSettings->addValue("source-type", sourceTypeName); std::string sourceName = surface->getSource()->getName(); xmlSettings->addValue("source-name", (sourceName == "") ? "none" : sourceName); + + if(surface->getSource()->getType() == SOURCE_TYPE_VIDEO){ + VideoSource * vid = dynamic_cast(surface->getSource()); + xmlSettings->addValue("source-loop", vid->getLoop()); + } + xmlSettings->popTag(); // source // Save surface options diff --git a/src/Sources/VideoSource.cpp b/src/Sources/VideoSource.cpp index acdc771..fc0df92 100644 --- a/src/Sources/VideoSource.cpp +++ b/src/Sources/VideoSource.cpp @@ -48,6 +48,10 @@ void VideoSource::setLoop(bool loop){ #endif } +bool VideoSource::getLoop(){ + return _loop; +} + void VideoSource::clear(){ texture = 0; diff --git a/src/Sources/VideoSource.h b/src/Sources/VideoSource.h index 423c165..d0cea99 100644 --- a/src/Sources/VideoSource.h +++ b/src/Sources/VideoSource.h @@ -25,6 +25,7 @@ class VideoSource : public BaseSource { std::string & getPath(); void loadVideo(std::string & path); void setLoop(bool loop); + bool getLoop(); void clear(); void togglePause(); void stop();