Add loading and saving video loop state

This commit is contained in:
Krisjanis Rijnieks
2018-08-10 19:06:34 +02:00
parent 67de16ab91
commit ab595fd42a
3 changed files with 18 additions and 0 deletions
+13
View File
@@ -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<VideoSource *>(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<VideoSource *>(surface->getSource());
xmlSettings->addValue("source-loop", vid->getLoop());
}
xmlSettings->popTag(); // source
// Save surface options
+4
View File
@@ -48,6 +48,10 @@ void VideoSource::setLoop(bool loop){
#endif
}
bool VideoSource::getLoop(){
return _loop;
}
void VideoSource::clear(){
texture = 0;
+1
View File
@@ -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();