#include <wallpaperdescriptor.h>
Public Types | |
enum | ImageVariant { Landscape = 0, Portrait, OriginalLandscape, OriginalPortrait, NVariants } |
Public Slots | |
void | initiateThumbnailer () |
Signals | |
void | thumbnailLoaded (WallpaperDescriptor *desc) |
void | changed (WallpaperDescriptor *desc) |
Public Member Functions | |
WallpaperDescriptor (QObject *parent=NULL) | |
WallpaperDescriptor (const QString &filename) | |
WallpaperDescriptor (const WallpaperDescriptor &orig) | |
void | setFilename (const QString &filename, ImageVariant variant=WallpaperDescriptor::Portrait) |
QString | filename (ImageVariant variant=WallpaperDescriptor::Portrait) const |
void | setMimeType (const QString &mimeType, ImageVariant variant=WallpaperDescriptor::Portrait) |
QString | mimeType (ImageVariant variant=WallpaperDescriptor::Portrait) const |
void | setImageID (const QString &imageID, ImageVariant variant=WallpaperDescriptor::Portrait) |
QString | imageID (ImageVariant variant=WallpaperDescriptor::Portrait) const |
void | setUrl (const QString &urlString, ImageVariant variant=WallpaperDescriptor::Portrait) |
QString | basename (ImageVariant variant=WallpaperDescriptor::Portrait) const |
QString | extension (ImageVariant variant=WallpaperDescriptor::Portrait) const |
virtual bool | isCurrent () const |
virtual int | version () const |
virtual QString | suggestedOutputFilename (M::Orientation orientation, int ver=-1) const |
virtual QString | suggestedOutputMimeType (M::Orientation orientation) |
virtual QString | originalImageFile (M::Orientation orientation) const |
virtual bool | valid () const |
bool | isThumbnailLoaded (ImageVariant variant=WallpaperDescriptor::Portrait) const |
QPixmap | thumbnailPixmap () const |
void | cache (ImageVariant variant=WallpaperDescriptor::Portrait) |
void | unCache (ImageVariant variant) |
void | unCache () |
bool | loading () const |
void | setLoading (bool loading=true) |
QImage & | image (ImageVariant variant=WallpaperDescriptor::Portrait) |
void | loadAll () |
Protected Attributes | |
QVector< Image > | m_Images |
QPointer< Thumbnailer > | m_Thumbnailer |
bool | m_Loading |
This class is used to represent a potential wallpaper image with all its attributes. The WallpaperList is using this class to visualize the wallpaper images.
QString WallpaperDescriptor::extension | ( | ImageVariant | variant = WallpaperDescriptor::Portrait |
) | const |
The filename extension is used when the applet creates a new file to save the edited image. The edited file will use the same extension used in the original filename.
void WallpaperDescriptor::initiateThumbnailer | ( | ) | [slot] |
This function will initiate the thumbnail generation. The thumbnail will be loaded into the pixmap that is returned by the thumbnailPixmap() function. I guess the pixmap will notify the
bool WallpaperDescriptor::isCurrent | ( | ) | const [virtual] |
Reimplemented in WallpaperCurrentDescriptor.
void WallpaperDescriptor::loadAll | ( | ) |
This method might be called from the non-GUI thread. In that case the method will load the image files as QImage objects, because the QImage can be handled from the secondary threads while QPixmap not.
void WallpaperDescriptor::setFilename | ( | const QString & | filename, | |
ImageVariant | variant = WallpaperDescriptor::Portrait | |||
) |
filename | The full path filename for the image file | |
variant | The purpose of the image file |
Sets the image file name for the given purpose in the descriptor.
int WallpaperDescriptor::version | ( | ) | const [virtual] |
Applications need to listen the wallpaper GConf items, so whenever we save a file we need to modify the filename of the saved images. We could re-use the filename, but then the GConf key would not be changed, so the applications would not be able to recognize the change.
For this purpose we use a version number in the filenames. The WallpaperDescriptor returns one default value for version number, the WallpaperCurrentDescriptor on the other hand reads the version number from the desktop file.
Reimplemented in WallpaperCurrentDescriptor.