From bdb69bb35e10cb0d517bf351ea66fa98934c94c9 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 21 Oct 2014 14:39:11 -0400 Subject: Add randomization to the wallpaper image that is used on first start of a desktop. --- lumina-desktop/LDesktop.cpp | 2 +- lumina-desktop/LSession.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lumina-desktop') diff --git a/lumina-desktop/LDesktop.cpp b/lumina-desktop/LDesktop.cpp index 81d57cb8..c64f327f 100644 --- a/lumina-desktop/LDesktop.cpp +++ b/lumina-desktop/LDesktop.cpp @@ -395,7 +395,7 @@ void LDesktop::UpdateBackground(){ } //Determine which background to use next int index = bgL.indexOf(CBG); - if( (index < 0) || (index >= bgL.length()-1) ){ index = 0; } //use the first file + if( (index < 0) || (index >= bgL.length()-1) ){ index = ( qrand() % bgL.length() ); } //pick a random file else{ index++; } //use the next file in the list QString bgFile; if( bgL.isEmpty() && CBG.isEmpty()){ bgFile = "default"; } diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index 0507f920..00728d23 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -10,6 +10,7 @@ #include #include #include +#include //X includes (these need to be last due to Qt compile issues) #include @@ -57,6 +58,8 @@ LSession::~LSession(){ void LSession::setupSession(){ qDebug() << "Initializing Session"; + //Seed random number generator (if needed) + qsrand( QTime::currentTime().msec() ); //Setup the QSettings default paths QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina"); sessionsettings = new QSettings("LuminaDE", "sessionsettings"); -- cgit