Krazy/EBN: fix i18n warnings
[kphotoalbum.git] / ImageManager / ImageRequest.cpp
blob6e7220416e859d71e4a9eb9cb8c7d8561ff69cb6
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 )
23 : _null( false ),
24 _fileName( fileName ),
25 _width( size.width() ),
26 _height( size.height() ),
27 _client( client ),
28 _angle( angle ),
29 _priority( ThumbnailVisible ),
30 _loadedOK( false ),
31 _dontUpScale( false )
35 bool ImageManager::ImageRequest::loadedOK() const
37 return _loadedOK;
40 bool ImageManager::ImageRequest::isNull() const
42 return _null;
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 );
49 return _fileName;
52 int ImageManager::ImageRequest::width() const
54 return _width;
57 int ImageManager::ImageRequest::height() const
59 return _height;
62 bool ImageManager::ImageRequest::operator<( const ImageRequest& other ) const
64 const QString fileA = fileName();
65 const QString fileB = other.fileName();
67 if ( fileA != fileB )
68 return fileA < fileB;
69 else if ( _width != other._width )
70 return _width < other._width;
71 else if ( _height != other._height )
72 return _height < other._height;
73 else
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
88 return _client;
91 int ImageManager::ImageRequest::angle() const
93 return _angle;
96 QSize ImageManager::ImageRequest::fullSize() const
98 return _fullSize;
101 void ImageManager::ImageRequest::setFullSize( const QSize& size )
103 _fullSize = size;
106 void ImageManager::ImageRequest::setLoadedOK( bool ok )
108 _loadedOK = ok;
111 ImageManager::Priority ImageManager::ImageRequest::priority() const
113 return _priority;
116 void ImageManager::ImageRequest::setPriority( const Priority prio )
118 _priority = prio;
121 bool ImageManager::ImageRequest::stillNeeded() const
123 return true;
126 bool ImageManager::ImageRequest::doUpScale() const
128 return !_dontUpScale;
131 void ImageManager::ImageRequest::setUpScale( bool b )
133 _dontUpScale = !b;