2 * kate: space-indent on; tab-width 8; indent-width 4; indent-mode cstyle;
4 * This file is part of the KDE project, module kdesktop.
5 * Copyright (C) 1999 Geert Jansen <g.t.jansen@stud.tue.nl>
7 * You can Freely distribute this program under the GNU Library General
8 * Public License. See the file "COPYING.LIB" for the exact licensing terms.
11 #ifndef BGRender_h_Included
12 #define BGRender_h_Included
18 #include <ksharedconfig.h>
20 #include "bgsettings.h"
31 * This class renders a desktop background to a QImage. The operation is
32 * asynchronous: connect to the signal imageDone() to find out when the
33 * rendering is finished. It also has support for preview images, like
34 * the monitor in kcmdisplay.
36 class KBackgroundRenderer
:
38 public KBackgroundSettings
43 KBackgroundRenderer(int screen
, bool drawBackgroundPerScreen
, const KSharedConfigPtr
&config
);
44 ~KBackgroundRenderer();
46 void load(int screen
, bool drawBackgroundPerScreen
, bool reparseConfig
=true);
48 void setPreview(const QSize
&size
);
49 void setSize(const QSize
&size
);
53 bool isActive() { return m_State
& Rendering
; }
56 void enableTiling( bool enable
) { m_TilingEnabled
= enable
; }
59 void start(bool enableBusyCursor
= false);
61 void desktopResized();
64 void imageDone(int screen
);
65 void programFailure(int exitstatus
); //Guaranteed either programFailure or
66 void programSuccess(); //programSuccess is emitted after imageDone
69 void slotBackgroundDone(int exitCode
, QProcess::ExitStatus exitStatus
);
74 enum { Error
, Wait
, WaitUpdate
, Done
};
75 enum { Rendering
= 1, InitCheck
= 2,
76 BackgroundStarted
= 4, BackgroundDone
= 8,
77 WallpaperStarted
= 0x10, WallpaperDone
= 0x20,
80 QString
buildCommand();
81 void createTempFile();
82 void tile(QImage
& dst
, const QRect
&rect
, const QImage
& src
);
83 void blend(QImage
& dst
, const QRect
&dr
, const QImage
& src
, const QPoint
&soffs
= QPoint(0, 0), int blendFactor
=100);
85 void wallpaperBlend();
86 void fastWallpaperBlend();
87 void fullWallpaperBlend();
89 int doBackground(bool quit
=false);
90 int doWallpaper(bool quit
=false);
91 void setBusyCursor(bool isBusy
);
92 QString
cacheFileName();
93 bool useCacheFile() const;
97 bool m_enableBusyCursor
;
101 bool m_TilingEnabled
;
103 KTemporaryFile
* m_Tempfile
;
104 QSize m_Size
, m_rSize
;
105 QRect m_WallpaperRect
;
106 QImage m_Image
, m_Background
, m_Wallpaper
;
110 KStandardDirs
*m_pDirs
;
115 #endif // BGRender_h_Included