Plasma
image.h
Go to the documentation of this file.00001 /* 00002 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com> 00003 Copyright (c) 2008 by Petri Damsten <damu@iki.fi> 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 */ 00010 00011 #ifndef IMAGE_HEADER 00012 #define IMAGE_HEADER 00013 00014 #include <QTimer> 00015 #include <QPixmap> 00016 #include <QStringList> 00017 #include <Plasma/Wallpaper> 00018 #include "backgroundpackage.h" 00019 #include "renderthread.h" 00020 #include "ui_imageconfig.h" 00021 #include "ui_slideshowconfig.h" 00022 00023 class KFileDialog; 00024 class BackgroundContainer; 00025 class BackgroundListModel; 00026 00027 class Image : public Plasma::Wallpaper 00028 { 00029 Q_OBJECT 00030 public: 00031 Image(QObject* parent, const QVariantList& args); 00032 ~Image(); 00033 00034 virtual void save(KConfigGroup &config); 00035 virtual void paint(QPainter* painter, const QRectF& exposedRect); 00036 virtual QWidget* createConfigurationInterface(QWidget* parent); 00037 00038 protected slots: 00039 void timeChanged(const QTime& time); 00040 void positioningChanged(int index); 00041 void slotAddDir(); 00042 void slotRemoveDir(); 00043 void getNewWallpaper(); 00044 void colorChanged(const QColor& color); 00045 void pictureChanged(int index); 00046 void browse(); 00047 void nextSlide(); 00048 void updateBackground(int token, const QImage &img); 00049 void showFileDialog(); 00050 void updateScreenshot(QPersistentModelIndex index); 00051 void removeBackground(const QString &path); 00052 00053 protected: 00054 void init(const KConfigGroup &config); 00055 void updateDirs(); 00056 void startSlideshow(); 00057 void fillMetaInfo(Background* b); 00058 bool setMetadata(QLabel *label, const QString &text); 00059 void render(const QString& image = QString()); 00060 void suspendStartup(bool suspend); // for ksmserver 00061 void calculateGeometry(); 00062 void setSingleImage(); 00063 00064 private: 00065 int m_delay; 00066 Background::ResizeMethod m_resizeMethod; 00067 QStringList m_dirs; 00068 QString m_wallpaper; 00069 QColor m_color; 00070 QStringList m_usersWallpapers; 00071 00072 QWidget* m_widget; 00073 Ui::ImageConfig m_uiImage; 00074 Ui::SlideshowConfig m_uiSlideshow; 00075 QString m_mode; 00076 QList<Background *> m_slideshowBackgrounds; 00077 QTimer m_timer; 00078 QPixmap m_pixmap; 00079 int m_currentSlide; 00080 qreal m_ratio; 00081 BackgroundListModel *m_model; 00082 KFileDialog *m_dialog; 00083 RenderThread m_renderer; 00084 int m_rendererToken; 00085 QSize m_size; 00086 QString m_img; 00087 QDateTime m_previousModified; 00088 bool m_randomize; 00089 }; 00090 00091 K_EXPORT_PLASMA_WALLPAPER(image, Image) 00092 00093 #endif