Summary: | kslideshow says "No images found" after awhile when "Random Order" is selected | ||
---|---|---|---|
Product: | kscreensaver | Reporter: | Mark <mcguyver> |
Component: | general | Assignee: | kscreensaver bugs tracking <kscreensaver-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Mark
2003-05-01 05:13:27 UTC
looks like Chris Howells didn't or couldn't test his latest cvs commit to kslideshow Subject: Re: New: kslideshow says "No images found" after awhile when "Random Order" is selected
Hi,
On Thursday 01 May 2003 04:13, Mark wrote:
> the following diff fixed my problem. but i'm not sure if that was the
> correct way to fix it
Not quite; that will potentially allow the screensaver to show the same image
more than once. I have another fix in mind but it's a bit hacky. Hopefully
I'll be able to work on it within the next few days.
Subject: Re: kslideshow says "No images found" after awhile when "Random Order" is selected
Hi,
On Thursday 01 May 2003 10:01, Mark wrote:
> looks like Chris Howells didn't or couldn't test his latest cvs commit to
> kslideshow
I did test, unfortunately fixing issues usually breaks other things :)
Subject: Re: kslideshow says "No images found" after awhile when "Random Order" is selected Revision 1.13 / (download) - annotate - [select for diffs], Thu Apr 24 15:16:38 2003 UTC (7 days, 2 hours ago) by howells Branch: MAIN CVS Tags: HEAD Changes since 1.12: +4 -7 lines Diff to previous 1.12 (colored) Get rid of one of the QStringLists, I see absolutely no need why one is needed for random mode and one for "normal" mode. can't you just reverse that commit? On Thu, 1 May 2003, Chris Howells wrote: > On Thursday 01 May 2003 04:13, Mark wrote: > > the following diff fixed my problem. but i'm not sure if that was the > > correct way to fix it > > Not quite; that will potentially allow the screensaver to show the same image > more than once. I have another fix in mind but it's a bit hacky. Hopefully > I'll be able to work on it within the next few days. > Subject: kdeartwork/kscreensaver/kdesavers CVS commit by howells: Don't run out of images in random mode. CCMAIL: 57930-done@bugs.kde.org M +12 -5 slideshow.cpp 1.14 M +1 -0 slideshow.h 1.7 --- kdeartwork/kscreensaver/kdesavers/slideshow.cpp #1.13:1.14 @@ -772,17 +772,21 @@ void kSlideShowSaver::loadNextImage() { QString fname; - int num, i, j; + int num; if (mShowRandom) { num = mFileList.count(); - if (num <= 0) + if (num <= 0) //no files in the directory { - num = mFileList.count(); + return; } - if (num <= 0) return; mFileIdx = rand() % num; fname = mFileList[mFileIdx]; mFileList.remove(fname); + if (num == 1) //we're about to run out of images + { + mFileList = mRandomList; + num = mFileList.count(); + } } else @@ -797,9 +801,11 @@ void kSlideShowSaver::loadNextImage() kdDebug() << "Failed to load image " << fname << endl; mFileList.remove(fname); - if (!mFileList.isEmpty()) loadNextImage(); + if (!mFileList.isEmpty()) + loadNextImage(); return; } mFileIdx++; + int i, j; i = fname.findRev('.'); if (i < 0) i = 32767; @@ -816,4 +822,5 @@ void kSlideShowSaver::loadDirectory() mFileList.clear(); traverseDirectory(mDirectory); + mRandomList = mFileList; } --- kdeartwork/kscreensaver/kdesavers/slideshow.h #1.6:1.7 @@ -90,4 +90,5 @@ protected: int mColorContext; QStringList mFileList; + QStringList mRandomList; int mFileIdx; QImage mImage; |