aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/VideoSlideshow.h
diff options
context:
space:
mode:
authorZackaryWelch <welch.zackary@gmail.com>2017-09-11 18:38:03 -0400
committerZackaryWelch <welch.zackary@gmail.com>2017-09-11 18:38:03 -0400
commit654bd8a4022b31a3e3c4c28c55a5703a51f43838 (patch)
tree1b219c7c17e7e3905147704fb0c356daa28a669d /src-qt5/core/lumina-desktop-unified/src-screensaver/animations/VideoSlideshow.h
parentAdded video extension detection support with hardcoded input (diff)
downloadlumina-654bd8a4022b31a3e3c4c28c55a5703a51f43838.tar.gz
lumina-654bd8a4022b31a3e3c4c28c55a5703a51f43838.tar.bz2
lumina-654bd8a4022b31a3e3c4c28c55a5703a51f43838.zip
Added the option of playing multiple videos or one video in a loop
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-screensaver/animations/VideoSlideshow.h')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/VideoSlideshow.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/VideoSlideshow.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/VideoSlideshow.h
index 1f9c4cbc..358b4bfb 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/VideoSlideshow.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/VideoSlideshow.h
@@ -13,11 +13,11 @@
class VideoAnimation: public BaseAnimGroup{
Q_OBJECT
private:
- QString videoPath;
+ QString videoPath, singleVideo;
QVideoWidget *videoWidget;
QMediaPlayer *video;
QStringList videoFiles;
- //bool multimonitor;
+ bool multiple;
private slots:
@@ -33,6 +33,8 @@ public:
//Load the path of the videos from the configuration file (default /usr/local/videos/)
videoPath = readSetting("path","/usr/local/videos").toString();
+ singleVideo = readSetting("videoLocation","").toString();
+ multiple = readSetting("multiple",true).toBool();
if(!videoPath.endsWith("/")){ videoPath.append("/"); }
//Set whether to copy videos on two monitors or play different videos
@@ -51,21 +53,31 @@ public:
return;
}
+ if(singleVideo.isNull())
+ singleVideo = videoPath+videoFiles[0];
+
//Loading a random file from a directory
QDesktopWidget *dw = new QDesktopWidget();
- QMediaPlaylist *playlist = new QMediaPlaylist();
- for(int i = 0; i < videoFiles.size(); i++){
- playlist->addMedia(QUrl::fromLocalFile(videoPath+videoFiles[i]));
- }
- playlist->setCurrentIndex(qrand() % videoFiles.size());
- playlist->setPlaybackMode(QMediaPlaylist::Random);
+ QMediaPlaylist *playlist = new QMediaPlaylist();
+ if(multiple) {
+ for(int i = 0; i < videoFiles.size(); i++){
+ playlist->addMedia(QUrl::fromLocalFile(videoPath+videoFiles[i]));
+ }
+ playlist->shuffle();
+ }else{
+ playlist->addMedia(QUrl::fromLocalFile(singleVideo));
+ playlist->setPlaybackMode(QMediaPlaylist::CurrentItemInLoop);
+ }
videoWidget->show();
- video->setPlaylist(playlist);
+ if(multiple)
+ video->setPlaylist(playlist);
+
//Only play sound for one monitor to prevent messed up audio
if(dw->screenNumber(canvas) == 0)
video->setVolume(100);
else
video->setVolume(0);
+
video->play();
}
bgstack15