File indexing completed on 2024-05-05 04:22:00
0001 // krazy:skip 0002 0003 // SPDX-FileCopyrightText: 2009, 2012 Jesper K. Pedersen <blackie@kde.org> 0004 // 0005 // SPDX-License-Identifier: LicenseRef-KDE-Accepted-GPL 0006 0007 #ifndef IMAGEMANAGER_DOCUMENTATION 0008 #define IMAGEMANAGER_DOCUMENTATION 0009 /** 0010 \namespace ImageManager 0011 \brief Manages creation and caching of thumbnails, as well as (raw) image decoding. 0012 0013 <h2>Loading Thumbnails</h2> 0014 0015 To use the \ref AsyncLoader for loading an Image, the receiving class must implement 0016 the \ref ImageClientInterface interface. When a widget needs a preview image for a 0017 file, it typically performs the following steps: 0018 -# Create an \ref ImageRequest. 0019 -# Adjust the \ref Priority for the request (optional). 0020 -# Queue the request with the \ref AsyncLoader. 0021 -# The \ref AsyncLoader then processes the request according to its priority, 0022 and eventually calls either the \ref ImageClientInterface::pixmapLoaded or the 0023 \ref ImageClientInterface::requestCanceled method. 0024 0025 <h3>Example</h3> 0026 0027 void Foo::requestPreview( ImageInfoPtr info ) { 0028 ImageManager::ImageRequest* request = new ImageManager::ImageRequest( info->fileName(), QSize(256,256), info->angle(), this ); 0029 request->setPriority( ImageManager::Viewer ); 0030 ImageManager::AsyncLoader::instance()->load( request ); 0031 } 0032 0033 void Foo::pixmapLoaded( const DB::FileName& fileName, const QSize& imgSize, const QSize& fullSize, 0034 int angle, const QImage& img, const bool loadedOK ) { 0035 if (loadedOK) 0036 useResultImage(); 0037 } // 0038 0039 0040 **/ 0041 0042 #endif // IMAGEMANAGER_DOCUMENTATION 0043 // vi:expandtab:tabstop=4 shiftwidth=4: