2
* kate: space-indent on; 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 __BGSettings_h_Included__
12
#define __BGSettings_h_Included__
17
#include <ksharedconfig.h>
19
template <class QString, class T> class QMap;
25
* A class to manipulate/read/write/list KDE desktop patterns.
27
* A pattern is a raster image. An entry for earch pattern is
28
* stored as a .desktop file in $(datadir)/kdesktop/patterns.
30
class KBackgroundPattern {
32
explicit KBackgroundPattern(const QString &name = QString());
33
~KBackgroundPattern();
35
void copyConfig(const KBackgroundPattern *);
37
QString name() const { return m_Name; }
38
void load(const QString &name);
40
void setComment(const QString &comment);
41
QString comment() const {return m_Comment; }
43
void setPattern(const QString &file);
44
QString pattern() const { return m_Pattern; }
50
bool isGlobal()const { return m_bReadOnly; }
55
static QStringList list();
58
void init(bool force_rw = false);
59
QString fingerprint();
61
bool dirty, hashdirty;
64
QString m_Name, m_Comment;
65
QString m_Pattern, m_File;
66
KStandardDirs *m_pDirs;
67
KDesktopFile *m_pConfig;
72
* A class to manipulate/read/write/list KDE desktop programs (a la xearth).
74
* A program is described by a string like:
76
* a_program -xres %x -yres %y -outfile %f
78
* Possible escape sequences:
80
* %x Horizontal resolution in pixels.
81
* %y Vertical resolution in pixels.
82
* %f Filename to dump to.
84
* An entry for each program is stored as a .desktop file in
85
* $(datadir)/kdesktop/programs.
87
class KBackgroundProgram {
89
explicit KBackgroundProgram(const QString &name = QString());
90
~KBackgroundProgram();
92
void copyConfig(const KBackgroundProgram *);
94
QString name()const { return m_Name; }
95
void load(const QString & name);
97
void setComment(const QString &comment);
98
QString comment()const { return m_Comment; }
100
void setCommand(const QString &command);
101
QString command()const { return m_Command; }
103
void setPreviewCommand(const QString &command);
104
QString previewCommand()const { return m_PreviewCommand; }
106
void setRefresh(int refresh);
107
int refresh()const { return m_Refresh; }
109
void setExecutable(const QString &executable);
110
QString executable()const { return m_Executable; }
113
void writeSettings();
121
bool isGlobal()const { return m_bReadOnly; }
124
static QStringList list();
127
void init(bool force_rw = false);
128
QString fingerprint();
130
bool dirty, hashdirty;
132
int m_Refresh, m_Hash, m_LastChange;
133
QString m_Name, m_Command;
134
QString m_PreviewCommand, m_Comment;
135
QString m_Executable, m_File;
136
KStandardDirs *m_pDirs;
137
KDesktopFile *m_pConfig;
142
* KBackgroundSettings: A class to read/write/manipulate
143
* KDE desktop settings.
145
class KBackgroundSettings
146
: public KBackgroundPattern,
147
public KBackgroundProgram {
150
* @param drawBackgroundPerScreen if false, then all screens (in xinerama
151
* mode) will be treated as one big display, and the "screen" paramater
154
KBackgroundSettings(int screen, bool drawBackgroundPerScreen, const KSharedConfigPtr &config);
155
~KBackgroundSettings();
157
void copyConfig(const KBackgroundSettings *);
159
bool drawBackgroundPerScreen() const { return m_bDrawBackgroundPerScreen; }
160
void setDrawBackgroundPerScreen(bool draw);
162
int screen() const { return m_Screen; }
163
void load(int screen, bool drawBackgroundPerScreen, bool reparseConfig);
165
void setColorA(const QColor &color);
166
QColor colorA() const { return m_ColorA; }
167
void setColorB(const QColor &color);
168
QColor colorB() const { return m_ColorB; }
170
void setProgram(const QString &program);
171
void setPatternName(const QString &pattern);
173
enum BackgroundMode {
174
Flat, Pattern, Program,
175
HorizontalGradient, VerticalGradient, PyramidGradient,
176
PipeCrossGradient, EllipticGradient, lastBackgroundMode
178
void setBackgroundMode(int mode);
179
int backgroundMode() const { return m_BackgroundMode; }
182
NoBlending, FlatBlending,
183
HorizontalBlending, VerticalBlending, PyramidBlending,
184
PipeCrossBlending, EllipticBlending,
185
IntensityBlending, SaturateBlending, ContrastBlending,
186
HueShiftBlending, lastBlendMode
188
void setBlendMode(int mode);
189
int blendMode() const { return m_BlendMode; }
191
void setReverseBlending(bool value);
192
bool reverseBlending() const { return m_ReverseBlending; }
194
void setBlendBalance(int value);
195
int blendBalance() const { return m_BlendBalance; }
197
void setWallpaper(const QString &name);
198
QString wallpaper() const { return m_Wallpaper; }
201
NoWallpaper, Centred, Tiled, CenterTiled, CentredMaxpect, TiledMaxpect,
202
Scaled, CentredAutoFit, ScaleAndCrop, lastWallpaperMode
204
void setWallpaperMode(int mode);
205
int wallpaperMode() const { return m_WallpaperMode; }
207
void setWallpaperList(const QStringList&);
208
QStringList wallpaperList() const;
209
QStringList wallpaperFiles() const;
211
void setWallpaperChangeInterval(int);
212
int wallpaperChangeInterval() const { return m_Interval; }
215
NoMulti, InOrder, Random, NoMultiRandom
217
void setMultiWallpaperMode(int mode);
218
int multiWallpaperMode() const { return m_MultiMode; }
221
AlwaysOpt, Opt16bpp, Opt15bpp, NeverOpt
224
void setMinOptimizationDepth(int mode);
225
int minOptimizationDepth() const { return m_MinOptimizationDepth; }
226
bool optimize() const;
228
void setUseShm(bool use);
229
bool useShm() const { return m_bShm; }
231
void changeWallpaper(bool init = false);
232
void updateWallpaperFiles();
233
void randomizeWallpaperFiles();
235
QString currentWallpaper() const;
237
* @return true if the currentWallpaper has changed
239
bool discardCurrentWallpaper();
240
int lastWallpaperChange() const { return m_LastChange; }
241
bool needWallpaperChange();
243
void readSettings(bool reparse = false);
244
void writeSettings();
245
QString configGroupName() const;
248
QString fingerprint();
250
void setEnabled(const bool enable);
251
bool enabled() const { return m_bEnabled; }
258
int m_Screen, m_Hash;
260
QColor m_ColorA, defColorA;
261
QColor m_ColorB, defColorB;
263
QStringList m_WallpaperList, m_WallpaperFiles;
265
int m_BackgroundMode, defBackgroundMode;
266
int m_WallpaperMode, defWallpaperMode;
267
int m_BlendMode, defBlendMode;
268
int m_BlendBalance, defBlendBalance;
269
bool m_ReverseBlending, defReverseBlending;
270
int m_MinOptimizationDepth;
272
bool m_bDrawBackgroundPerScreen;
274
int m_MultiMode, defMultiMode;
275
int m_Interval, m_LastChange;
276
int m_CurrentWallpaper;
277
QString m_CurrentWallpaperName;
279
KSharedConfigPtr m_pConfig;
280
KStandardDirs *m_pDirs;
281
bool m_bDeleteConfig;
285
QMap<QString, int> m_BMMap;
286
QMap<QString, int> m_WMMap;
287
QMap<QString, int> m_MMMap;
288
QMap<QString, int> m_BlMMap;
289
char *m_BMRevMap[16];
290
char *m_WMRevMap[16];
291
char *m_MMRevMap[16];
292
char *m_BlMRevMap[16];
297
* A class to read/modify the global desktop background settings.
299
class KGlobalBackgroundSettings {
301
KGlobalBackgroundSettings(const KSharedConfigPtr &config);
303
int cacheSize() { return m_CacheSize; }
304
void setCacheSize(int size);
306
bool drawBackgroundPerScreen() const;
307
void setDrawBackgroundPerScreen(bool perScreen);
309
bool limitCache() { return m_bLimitCache; }
310
void setLimitCache(bool limit);
312
bool commonScreenBackground() { return m_bCommonScreen; }
313
void setCommonScreenBackground(bool common);
316
void writeSettings();
320
bool m_bCommonScreen;
324
KSharedConfigPtr m_pConfig;
325
bool m_bDrawBackgroundPerScreen;
328
#endif // __BGSettings_h_Included__