delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / workspace / plasma / wallpapers / image / renderthread.h
blobd0b4270623d8a895cbe170fa8cc6f24b7ff80cb3
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 */
10 #ifndef RENDERTHREAD_H
11 #define RENDERTHREAD_H
13 #include "backgroundpackage.h"
14 #include <QColor>
15 #include <QImage>
16 #include <QMutex>
17 #include <QThread>
18 #include <QWaitCondition>
20 class RenderThread : public QThread
22 Q_OBJECT
23 public:
24 RenderThread();
25 virtual ~RenderThread();
27 int render(const QString &file,
28 const QColor &color,
29 Background::ResizeMethod method,
30 Qt::TransformationMode mode);
32 void setSize(const QSize &size);
33 void setRatio(float ratio);
35 protected:
36 virtual void run();
38 private:
39 QMutex m_mutex; // to protect parameters
40 QWaitCondition m_condition;
42 // protected by mutex
43 int m_current_token;
44 QString m_file;
45 QColor m_color;
46 QSize m_size;
47 float m_ratio;
48 Background::ResizeMethod m_method;
49 Qt::TransformationMode m_mode;
51 bool m_abort;
52 bool m_restart;
54 signals:
55 void done(int token, const QImage &pixmap);
58 #endif // RENDERTHREAD_H