delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / workspace / plasma / wallpapers / image / image.h
blob8e3951ca35e6d3619b12a6c50df85d176542b1bd
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
3 Copyright (c) 2008 by Petri Damsten <damu@iki.fi>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef IMAGE_HEADER
12 #define IMAGE_HEADER
14 #include <QTimer>
15 #include <QPixmap>
16 #include <QStringList>
17 #include <Plasma/Wallpaper>
18 #include "backgroundpackage.h"
19 #include "renderthread.h"
20 #include "ui_imageconfig.h"
21 #include "ui_slideshowconfig.h"
23 class KFileDialog;
24 class BackgroundContainer;
25 class BackgroundListModel;
27 class Image : public Plasma::Wallpaper
29 Q_OBJECT
30 public:
31 Image(QObject* parent, const QVariantList& args);
32 ~Image();
34 virtual void save(KConfigGroup &config);
35 virtual void paint(QPainter* painter, const QRectF& exposedRect);
36 virtual QWidget* createConfigurationInterface(QWidget* parent);
38 protected slots:
39 void timeChanged(const QTime& time);
40 void positioningChanged(int index);
41 void slotAddDir();
42 void slotRemoveDir();
43 void getNewWallpaper();
44 void colorChanged(const QColor& color);
45 void pictureChanged(int index);
46 void browse();
47 void nextSlide();
48 void updateBackground(int token, const QImage &img);
49 void showFileDialog();
50 void updateScreenshot(QPersistentModelIndex index);
51 void removeBackground(const QString &path);
53 protected:
54 void init(const KConfigGroup &config);
55 void updateDirs();
56 void startSlideshow();
57 void fillMetaInfo(Background* b);
58 bool setMetadata(QLabel *label, const QString &text);
59 void render(const QString& image = QString());
60 void suspendStartup(bool suspend); // for ksmserver
61 void calculateGeometry();
62 void setSingleImage();
64 private:
65 int m_delay;
66 Background::ResizeMethod m_resizeMethod;
67 QStringList m_dirs;
68 QString m_wallpaper;
69 QColor m_color;
70 QStringList m_usersWallpapers;
72 QWidget* m_widget;
73 Ui::ImageConfig m_uiImage;
74 Ui::SlideshowConfig m_uiSlideshow;
75 QString m_mode;
76 QList<Background *> m_slideshowBackgrounds;
77 QTimer m_timer;
78 QPixmap m_pixmap;
79 int m_currentSlide;
80 qreal m_ratio;
81 BackgroundListModel *m_model;
82 KFileDialog *m_dialog;
83 RenderThread m_renderer;
84 int m_rendererToken;
85 QSize m_size;
86 QString m_img;
87 QDateTime m_previousModified;
88 bool m_randomize;
91 K_EXPORT_PLASMA_WALLPAPER(image, Image)
93 #endif