[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/plasma/applets/frame
From:       Gaƫl Beaudoin <gaboo () gaboo ! org>
Date:       2008-03-28 19:03:45
Message-ID: 1206731025.873888.12617.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 791215 by gaboo:

Allow slideshow to be recursive
BUG: 155926


 M  +7 -0      config.ui  
 M  +6 -1      frame.cpp  
 M  +1 -0      frame.h  
 M  +19 -5     slideshow.cpp  
 M  +2 -1      slideshow.h  


--- trunk/extragear/plasma/applets/frame/config.ui #791214:791215
@@ -206,6 +206,13 @@
            </layout>
           </item>
           <item>
+           <widget class="QCheckBox" name="recursiveCheckBox" >
+            <property name="text" >
+             <string>&amp;Include subdirectories</string>
+            </property>
+           </widget>
+          </item>
+          <item>
            <layout class="QHBoxLayout" >
             <item>
              <widget class="QLabel" name="label_2" >
--- trunk/extragear/plasma/applets/frame/frame.cpp #791214:791215
@@ -95,6 +95,7 @@
     m_shadow = cg.readEntry("shadow", true);
     m_roundCorners = cg.readEntry("roundCorners", false);
     m_slideShow = cg.readEntry("slideshow", false);
+    m_recursiveSlideShow = cg.readEntry("recursive slideshow", false);
     m_slideShowPaths = cg.readEntry("slideshow paths", QStringList());
     m_slideshowTime = cg.readEntry("slideshow time", 10); // default to 10 seconds
     m_currentUrl = cg.readEntry("url", "Default");
@@ -188,6 +189,8 @@
     else
 	m_configDialog->ui.pictureComboBox->setCurrentIndex(0);
 
+    m_configDialog->ui.recursiveCheckBox->setCheckState(m_recursiveSlideShow ? \
Qt::Checked : Qt::Unchecked); +
     m_configDialog->ui.potdComboBox->setCurrentIndex( \
m_configDialog->ui.potdComboBox->findData(m_potdProvider) );  
     m_configDialog->setCurrentUrl(m_currentUrl);
@@ -233,6 +236,8 @@
     m_currentUrl = m_configDialog->currentUrl();
     cg.writeEntry("url", m_currentUrl);
     cg.writeEntry("slideshow", m_slideShow);
+    m_recursiveSlideShow = m_configDialog->ui.recursiveCheckBox->checkState() == \
Qt::Checked ? true : false; +    cg.writeEntry("recursive slideshow", \
m_recursiveSlideShow);  m_slideShowPaths.clear();
     QStringList dirs;
     for (int i = 0; i < m_configDialog->ui.slideShowDirList->count(); i++) {
@@ -257,7 +262,7 @@
 void Frame::initSlideShow()
 {
     if (m_slideShow) {
-	    m_mySlideShow->setDirs(m_slideShowPaths);
+	    m_mySlideShow->setDirs(m_slideShowPaths, m_recursiveSlideShow);
 	    m_slideShowTimer->start();
     } else if (m_potd) {
 	Plasma::DataEngine *engine = dataEngine( "potd" );
--- trunk/extragear/plasma/applets/frame/frame.h #791214:791215
@@ -100,6 +100,7 @@
         int m_swOutline;
         /// Slideshow
         bool m_slideShow;
+        bool m_recursiveSlideShow;
         SlideShow* m_mySlideShow;
 };
 
--- trunk/extragear/plasma/applets/frame/slideshow.cpp #791214:791215
@@ -34,12 +34,16 @@
 {
 }
 
-void SlideShow::setDirs(const QStringList &slideShowPath)
+void SlideShow::setDirs(const QStringList &slideShowPath, bool recursive)
 {
-	m_pictures.clear();
-	foreach (const QString &path, slideShowPath) {
-		addDir(path);
-	}
+    m_pictures.clear();
+    foreach (const QString &path, slideShowPath) {
+        if (recursive) {
+            addRecursiveDir(path);
+        } else {
+            addDir(path);
+        }
+    }
 }
 
 void SlideShow::setImage(const QString &imagePath) 
@@ -65,6 +69,16 @@
 	}
 }
 
+void SlideShow::addRecursiveDir(const QString &path)
+{
+    addDir(path);
+    QDir dir(path);
+
+    foreach (const QString &subDir, dir.entryList(QDir::Dirs | \
QDir::NoDotAndDotDot)) { +        addRecursiveDir(path + "/" + subDir);
+    }
+}
+
 QImage SlideShow::getImage() 
 {
 	KUrl url = getUrl();
--- trunk/extragear/plasma/applets/frame/slideshow.h #791214:791215
@@ -32,7 +32,7 @@
 		SlideShow();
 		~SlideShow();
 		
-		void setDirs(const QStringList &slideShowPaths);
+		void setDirs(const QStringList &slideShowPaths, bool recursive = false);
 		void setImage(const QString &imagePath);
 		QImage getImage();
 		
@@ -43,6 +43,7 @@
 		
 		void addImage(const QString &imagePath);
 		void addDir(const QString &path);
+		void addRecursiveDir(const QString &path);
 		KUrl getUrl();
 
 };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic