src/gui/image/qimagereader.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 0 1918ee327afb
child 8 3f74d0d4af4c
equal deleted inserted replaced
3:41300fa6a67c 4:3b1da2848fc7
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   469     device = 0;
   469     device = 0;
   470     deleteDevice = false;
   470     deleteDevice = false;
   471     handler = 0;
   471     handler = 0;
   472     quality = -1;
   472     quality = -1;
   473     imageReaderError = QImageReader::UnknownError;
   473     imageReaderError = QImageReader::UnknownError;
   474     errorString = QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unknown error"));
       
   475 
   474 
   476     q = qq;
   475     q = qq;
   477 }
   476 }
   478 
   477 
   479 /*!
   478 /*!
  1212         return false;
  1211         return false;
  1213     return d->handler->jumpToImage(imageNumber);
  1212     return d->handler->jumpToImage(imageNumber);
  1214 }
  1213 }
  1215 
  1214 
  1216 /*!
  1215 /*!
  1217     For image formats that support animation, this function returns
  1216     For image formats that support animation, this function returns the number
  1218     the number of times the animation should loop. Otherwise, it
  1217     of times the animation should loop. If this function returns -1, it can
  1219     returns -1.
  1218     either mean the animation should loop forever, or that an error occurred.
  1220 
  1219     If an error occurred, canRead() will return false.
  1221     \sa supportsAnimation(), QImageIOHandler::loopCount()
  1220 
       
  1221     \sa supportsAnimation(), QImageIOHandler::loopCount(), canRead()
  1222 */
  1222 */
  1223 int QImageReader::loopCount() const
  1223 int QImageReader::loopCount() const
  1224 {
  1224 {
  1225     if (!d->initHandler())
  1225     if (!d->initHandler())
  1226         return -1;
  1226         return -1;
  1227     return d->handler->loopCount();
  1227     return d->handler->loopCount();
  1228 }
  1228 }
  1229 
  1229 
  1230 /*!
  1230 /*!
  1231     For image formats that support animation, this function returns
  1231     For image formats that support animation, this function returns the total
  1232     the total number of images in the animation.
  1232     number of images in the animation. If the format does not support
  1233 
  1233     animation, 0 is returned.
  1234     Certain animation formats do not support this feature, in which
  1234 
  1235     case 0 is returned.
  1235     This function returns -1 if an error occurred.
  1236 
  1236 
  1237     \sa supportsAnimation(), QImageIOHandler::imageCount()
  1237     \sa supportsAnimation(), QImageIOHandler::imageCount(), canRead()
  1238 */
  1238 */
  1239 int QImageReader::imageCount() const
  1239 int QImageReader::imageCount() const
  1240 {
  1240 {
  1241     if (!d->initHandler())
  1241     if (!d->initHandler())
  1242         return -1;
  1242         return -1;
  1243     return d->handler->imageCount();
  1243     return d->handler->imageCount();
  1244 }
  1244 }
  1245 
  1245 
  1246 /*!
  1246 /*!
  1247     For image formats that support animation, this function returns
  1247     For image formats that support animation, this function returns the number
  1248     the number of milliseconds to wait until displaying the next frame
  1248     of milliseconds to wait until displaying the next frame in the animation.
  1249     in the animation. Otherwise, 0 is returned.
  1249     If the image format doesn't support animation, 0 is returned.
  1250 
  1250 
  1251     \sa supportsAnimation(), QImageIOHandler::nextImageDelay()
  1251     This function returns -1 if an error occurred.
       
  1252 
       
  1253     \sa supportsAnimation(), QImageIOHandler::nextImageDelay(), canRead()
  1252 */
  1254 */
  1253 int QImageReader::nextImageDelay() const
  1255 int QImageReader::nextImageDelay() const
  1254 {
  1256 {
  1255     if (!d->initHandler())
  1257     if (!d->initHandler())
  1256         return -1;
  1258         return -1;
  1257     return d->handler->nextImageDelay();
  1259     return d->handler->nextImageDelay();
  1258 }
  1260 }
  1259 
  1261 
  1260 /*!
  1262 /*!
  1261     For image formats that support animation, this function returns
  1263     For image formats that support animation, this function returns the
  1262     the sequence number of the current frame. Otherwise, -1 is
  1264     sequence number of the current frame. If the image format doesn't support
  1263     returned.
  1265     animation, 0 is returned.
  1264 
  1266 
  1265     \sa supportsAnimation(), QImageIOHandler::currentImageNumber()
  1267     This function returns -1 if an error occurred.
       
  1268 
       
  1269     \sa supportsAnimation(), QImageIOHandler::currentImageNumber(), canRead()
  1266 */
  1270 */
  1267 int QImageReader::currentImageNumber() const
  1271 int QImageReader::currentImageNumber() const
  1268 {
  1272 {
  1269     if (!d->initHandler())
  1273     if (!d->initHandler())
  1270         return -1;
  1274         return -1;
  1300 
  1304 
  1301     \sa error()
  1305     \sa error()
  1302 */
  1306 */
  1303 QString QImageReader::errorString() const
  1307 QString QImageReader::errorString() const
  1304 {
  1308 {
       
  1309     if (d->errorString.isEmpty())
       
  1310         return QLatin1String(QT_TRANSLATE_NOOP(QImageReader, "Unknown error"));
  1305     return d->errorString;
  1311     return d->errorString;
  1306 }
  1312 }
  1307 
  1313 
  1308 /*!
  1314 /*!
  1309     \since 4.2
  1315     \since 4.2