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

List:       kde-commits
Subject:    extragear/plasma/applets/frame
From:       Anne-Marie Mahfouf <annma () kde ! org>
Date:       2008-01-29 10:06:30
Message-ID: 1201601190.815476.27348.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 768074 by annma:

more refactoring


 M  +3 -12     frame.cpp  
 M  +19 -3     picture.cpp  
 M  +5 -1      picture.h  


--- trunk/extragear/plasma/applets/frame/frame.cpp #768073:768074
@@ -101,18 +101,9 @@
 
 void Frame::setSlideShow()
 {
-    QStringList picList;
-
-    foreach (const QString &path, m_slideShowPaths) {
-        QDir dir(path);
-        QStringList filters;
-        filters << "*.jpeg" << "*.jpg" << "*.png" << "*.svg" << "*.svgz"; // use \
                mime types?
-        dir.setNameFilters(filters);
-        foreach (const QString &imageFile, dir.entryList(QDir::Files)) {
-            picList.append(path + "/" + imageFile);
-        }
-    }
-
+    Picture myPicture;
+    QStringList picList=myPicture.findSlideShowPics(m_slideShowPaths);
+    kDebug() <<"picList = " << picList <<endl;
     if (!picList.isEmpty()) {
         KUrl currentUrl(picList.at(m_slideNumber % picList.count()));
         m_slideNumber++;
--- trunk/extragear/plasma/applets/frame/picture.cpp #768073:768074
@@ -19,12 +19,12 @@
 
 #include "picture.h"
 
+#include <QDir>
 #include <QPainter>
 #include <QPixmap>
-#include <QSvgRenderer>
 
 #include <KUrl>
-#include <kstandarddirs.h>
+#include <KStandardDirs>
 
 
 Picture::Picture()
@@ -35,7 +35,7 @@
 {
 }
 
-QImage Picture::defaultPicture(QString message)
+QImage Picture::defaultPicture(const QString &message)
 {
     // Create a QImage with same axpect ratio of default svg and current pixelSize
     QString defaultFile = KGlobal::dirs()->findResource("data", \
"plasma-frame/picture-frame-default.jpg"); @@ -72,3 +72,19 @@
         }
     }
 }
+
+QStringList Picture::findSlideShowPics(const QStringList &slideShowPaths)
+{
+    QStringList picList;
+
+    foreach (const QString &path, slideShowPaths) {
+        QDir dir(path);
+        QStringList filters;
+        filters << "*.jpeg" << "*.jpg" << "*.png" << "*.svg" << "*.svgz"; // use \
mime types? +        dir.setNameFilters(filters);
+        foreach (const QString &imageFile, dir.entryList(QDir::Files)) {
+            picList.append(path + "/" + imageFile);
+        }
+    }
+    return picList;
+}
--- trunk/extragear/plasma/applets/frame/picture.h #768073:768074
@@ -42,11 +42,15 @@
 	* Set Default picture with written message @p message if no picture or folder was \
                choosen 
 	* by the user
 	**/
-	QImage defaultPicture(QString message);
+	QImage defaultPicture(const QString &message);
 	/** 
 	* Set picture from location @p currentUrl 
 	**/
 	QImage setPicture( KUrl currentUrl);
+	/**
+	* Find all the pictures in each of the dirs that are listed in @p slideShowPaths
+	**/
+	QStringList findSlideShowPics(const QStringList &slideShowPaths);
 
     private:
         QImage getPicture(){return m_picture;};


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

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