1 /* Copyright (C) 2003-2006 Jesper K. Pedersen <blackie@kde.org>
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public
5 License as published by the Free Software Foundation; either
6 version 2 of the License, or (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; see the file COPYING. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
18 #ifndef IMAGEREQUEST_H
19 #define IMAGEREQUEST_H
21 #include <q3deepcopy.h>
26 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
28 // This class is shared among the image loader thead and the GUI tread, if
29 // you don't know the implication of this stay out of this class!
31 // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
33 namespace ImageManager
37 /** @short Priority of an image request
39 * The higher the priority, the sooner the image is expected to be decoded
42 BuildThumbnails
, //< @short Requests generated through the "Rebuild Thumbnails" command
43 BuildScopeThumbnails
, //< @short thumbnails in current search scope to be rebuidl
44 ThumbnailInvisible
, //< @short Thumbnails in current search scope, but invisible
45 ViewerPreload
, // < @short Image that will be displayed later
46 BatchTask
, /**< @short Requests like resizing images for HTML pages
48 * As they are requested by user, they are expected to finish
49 * sooner than invisible thumbnails */
50 ThumbnailVisible
, /**< @short Thumbnail visible on screen right now (might get invalidated later) */
51 Viewer
/**< @short Image is visible in the viewer right now */,
52 LastPriority
/**< @short Boundary for list of queues */
57 ImageRequest( const QString
& fileName
, const QSize
& size
, int angle
, ImageClient
* client
);
58 virtual ~ImageRequest() {}
61 QString
fileName() const;
66 ImageClient
* client() const;
68 QSize
fullSize() const;
69 void setFullSize( const QSize
& );
70 void setLoadedOK( bool ok
);
71 bool loadedOK() const;
73 void setPriority( const Priority prio
);
74 Priority
priority() const;
76 bool operator<( const ImageRequest
& other
) const;
77 bool operator==( const ImageRequest
& other
) const;
79 virtual bool stillNeeded() const;
81 bool doUpScale() const;
82 void setUpScale( bool b
);
86 mutable Q3DeepCopy
<QString
> _fileName
; // PENDING(blackie) I don't think this deep copy is needed anymore!
87 mutable QMutex _fileNameLock
;
99 inline uint
qHash(const ImageRequest
& ir
)
101 return ::qHash(ir
.fileName()) ^ ::qHash(ir
.width()) ^ ::qHash(ir
.angle());
106 #endif /* IMAGEREQUEST_H */