From kde-commits Fri Mar 28 19:03:45 2008 From: =?utf-8?q?Ga=C3=ABl=20Beaudoin?= Date: Fri, 28 Mar 2008 19:03:45 +0000 To: kde-commits Subject: extragear/plasma/applets/frame Message-Id: <1206731025.873888.12617.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=120673105508820 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 @@ + + + &Include subdirectories + + + + --- 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(); };