Krazy/EBN: fix i18n warnings
[kphotoalbum.git] / ImageManager / ImageRequest.h
blob59e30612cba95d4b01faa7d5a40b9ec9c377153d
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
20 #include <qstring.h>
21 #include <q3deepcopy.h>
22 #include <qsize.h>
23 #include <qmutex.h>
24 #include <QHash>
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
35 class ImageClient;
37 /** @short Priority of an image request
39 * The higher the priority, the sooner the image is expected to be decoded
40 * */
41 enum Priority {
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 */
55 class ImageRequest {
56 public:
57 ImageRequest( const QString& fileName, const QSize& size, int angle, ImageClient* client);
58 virtual ~ImageRequest() {}
60 bool isNull() const;
61 QString fileName() const;
62 int width() const;
63 int height() const;
64 int angle() 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 );
84 private:
85 bool _null;
86 mutable Q3DeepCopy<QString> _fileName; // PENDING(blackie) I don't think this deep copy is needed anymore!
87 mutable QMutex _fileNameLock;
89 int _width;
90 int _height;
91 ImageClient* _client;
92 int _angle;
93 QSize _fullSize;
94 Priority _priority;
95 bool _loadedOK;
96 bool _dontUpScale;
99 inline uint qHash(const ImageRequest& ir)
101 return ::qHash(ir.fileName()) ^ ::qHash(ir.width()) ^ ::qHash(ir.angle());
106 #endif /* IMAGEREQUEST_H */