[KimDaBa] Speeding up scrolling

Jesper K. Pedersen blackie at blackie.dk
Tue Jan 11 07:33:08 CET 2005


I'm not sure I like this soluion, simply because whoever asked for an image 
might rightfully expect it to show up eventually.
Nevertheless it sounds like when a new item gets in, the old one is paused, 
while the new is processes, which is of course wrong.

I'm currently fighting the *beeeeeeeep* thumbnail view, and all my kimdaba 
time today will likely go in that direction, but I'll have a look at it when 
I'm done. Till then, please be gentle with your pagedown key ;-)

On Tuesday 11 January 2005 04:33, Robert L Krawitz wrote:
| Just as an experiment, I tried deleting all low priority requests
| whenever the viewport is scrolled.  Scrolling is much faster.  This
| isn't entirely right, because if you scroll slowly (rather than full
| pages at a time) some of the images never do get displayed, but it
| suggests a way we might proceed.  The code looks like this:
|
| --- imagemanager.cpp~   2005-01-08 18:53:55.000000000 -0500
| +++ imagemanager.cpp    2005-01-10 22:24:19.709073392 -0500
| @@ -220,7 +220,9 @@
|          LoadInfo key = it.key();
|          ImageClient* data = it.data();
|          ++it; // We need to increase it before removing the element.
| -        if ( data == client && ( action == StopAll || !key.priority() ) )
| +        if ( action == StopAllLoads ||
| +            ( action == StopAllNonPriorityLoads && !key.priority() ) ||
| +            ( data == client && ( action == StopAll || !key.priority() ) )
| ) _clientMap.remove( key );
|      }
|
| @@ -229,7 +231,9 @@
|      for( QValueList<LoadInfo>::Iterator it = _loadList.begin(); it !=
| _loadList.end(); ) { LoadInfo li = *it;
|          ++it;
| -        if ( li.client() == client && ( action == StopAll ||
| !li.priority() ) ) +        if ( action == StopAllLoads ||
| +            ( action == StopAllNonPriorityLoads && !li.priority() ) ||
| +            ( li.client() == client && ( action == StopAll ||
| !li.priority() ) ) ) _loadList.remove( li );
|      }
|      _lock->unlock();
| --- imagemanager.h~     2005-01-08 18:53:02.000000000 -0500
| +++ imagemanager.h      2005-01-10 22:14:51.613567110 -0500
| @@ -86,7 +86,8 @@
|      Q_OBJECT
|
|  public:
| -    enum StopAction { StopAll, StopOnlyNonPriorityLoads };
| +    enum StopAction { StopAll, StopOnlyNonPriorityLoads,
| +                     StopAllLoads, StopAllNonPriorityLoads };
|
|      void load( const QString& fileName, ImageClient* client, int angle,
| int width, int height, bool cache, bool priority );
| --- thumbnailview.cpp~  2005-01-02 15:38:10.000000000 -0500
| +++ thumbnailview.cpp   2005-01-10 22:23:47.545160969 -0500
| @@ -33,6 +33,7 @@
|  #include <qpainter.h>
|  #include "imagedaterange.h"
|  #include "imageinfo.h"
| +#include "imagemanager.h"
|
|  ThumbNailView* ThumbNailView::_instance = 0;
|
| @@ -323,6 +324,7 @@
|  {
|      if ( _blockMoveSignals )
|          return;
| +    ImageManager::instance()->stop(NULL,
| ImageManager::StopAllNonPriorityLoads);
|
|      QIconViewItem* item = findFirstVisibleItem( QRect( contentsX(),
| contentsY(), width(), height() ) ); if ( item ) {

-- 
Having trouble finding a given image in your collection containing
thousands of images?

http://ktown.kde.org/kimdaba might be the answer.



More information about the KimDaBa mailing list