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 #include "ImageRequest.h"
20 ImageManager::ImageRequest::ImageRequest( const QString
& fileName
,
21 const QSize
& size
, int angle
,
22 ImageManager::ImageClient
* client
)
24 _fileName( fileName
),
25 _width( size
.width() ),
26 _height( size
.height() ),
29 _priority( ThumbnailVisible
),
35 bool ImageManager::ImageRequest::loadedOK() const
40 bool ImageManager::ImageRequest::isNull() const
45 QString
ImageManager::ImageRequest::fileName() const
47 // We need a lock here to avoid a race condition in Operator T() of QDeepCopy
48 QMutexLocker
dummy( &_fileNameLock
);
52 int ImageManager::ImageRequest::width() const
57 int ImageManager::ImageRequest::height() const
62 bool ImageManager::ImageRequest::operator<( const ImageRequest
& other
) const
64 const QString fileA
= fileName();
65 const QString fileB
= other
.fileName();
69 else if ( _width
!= other
._width
)
70 return _width
< other
._width
;
71 else if ( _height
!= other
._height
)
72 return _height
< other
._height
;
74 return _angle
< other
._angle
;
77 bool ImageManager::ImageRequest::operator==( const ImageRequest
& other
) const
79 // Compare all atributes but the pixmap.
80 return ( _null
== other
._null
&& fileName() == other
.fileName() &&
81 _width
== other
._width
&& _height
== other
._height
&&
82 _angle
== other
._angle
&& _client
== other
._client
&&
83 _priority
== other
._priority
);
86 ImageManager::ImageClient
* ImageManager::ImageRequest::client() const
91 int ImageManager::ImageRequest::angle() const
96 QSize
ImageManager::ImageRequest::fullSize() const
101 void ImageManager::ImageRequest::setFullSize( const QSize
& size
)
106 void ImageManager::ImageRequest::setLoadedOK( bool ok
)
111 ImageManager::Priority
ImageManager::ImageRequest::priority() const
116 void ImageManager::ImageRequest::setPriority( const Priority prio
)
121 bool ImageManager::ImageRequest::stillNeeded() const
126 bool ImageManager::ImageRequest::doUpScale() const
128 return !_dontUpScale
;
131 void ImageManager::ImageRequest::setUpScale( bool b
)