1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
|
/* vi: ts=8 sts=4 sw=4
* kate: space-indent on; indent-width 4; indent-mode cstyle;
*
* This file is part of the KDE project, module kdesktop.
* Copyright (C) 1999 Geert Jansen <[email protected]>
*
* You can Freely distribute this program under the GNU Library General
* Public License. See the file "COPYING.LIB" for the exact licensing terms.
*/
#ifndef __BGSettings_h_Included__
#define __BGSettings_h_Included__
#include <tqstringlist.h>
#include <tqcolor.h>
#include <tqvaluevector.h>
template <class TQString, class T> class TQMap;
class KStandardDirs;
class KSimpleConfig;
class KConfig;
class TQString;
class TQImage;
/**
* A class to manipulate/read/write/list KDE desktop patterns.
*
* A pattern is a raster image. An entry for earch pattern is
* stored as a .desktop file in $(datadir)/kdesktop/patterns.
*/
class KBackgroundPattern
{
public:
KBackgroundPattern(TQString name=TQString::null);
~KBackgroundPattern();
void copyConfig(const KBackgroundPattern*);
TQString name() const { return m_Name; }
void load(TQString name);
void setComment(const TQString &comment);
TQString comment() const {return m_Comment; }
void setPattern(TQString file);
TQString pattern() const { return m_Pattern; }
void readSettings();
void writeSettings();
bool isAvailable();
bool isGlobal()const { return m_bReadOnly; }
bool remove();
int hash();
static TQStringList list();
private:
void init(bool force_rw=false);
TQString fingerprint();
bool dirty, hashdirty;
bool m_bReadOnly;
int m_Hash;
TQString m_Name, m_Comment;
TQString m_Pattern, m_File;
KStandardDirs *m_pDirs;
KSimpleConfig *m_pConfig;
};
/**
* A class to manipulate/read/write/list KDE desktop programs (a la xearth).
*
* A program is described by a string like:
*
* a_program -xres %x -yres %y -outfile %f
*
* Possible escape sequences:
*
* %x Horizontal resolution in pixels.
* %y Vertical resulution in pixels.
* %f Filename to dump to.
*
* An entry for each program is stored as a .desktop file in
* $(datadir)/kdesktop/programs.
*/
class KBackgroundProgram
{
public:
KBackgroundProgram(TQString name=TQString::null);
~KBackgroundProgram();
void copyConfig(const KBackgroundProgram*);
TQString name()const { return m_Name; }
void load(const TQString & name);
void setComment(const TQString &comment);
TQString comment()const { return m_Comment; }
void setCommand(const TQString &command);
TQString command()const { return m_Command; }
void setPreviewCommand(const TQString &command);
TQString previewCommand()const { return m_PreviewCommand; }
void setRefresh(int refresh);
int refresh()const { return m_Refresh; }
void setExecutable(const TQString &executable);
TQString executable()const { return m_Executable; }
void readSettings();
void writeSettings();
void update();
bool needUpdate();
int hash();
bool isAvailable();
bool isGlobal()const { return m_bReadOnly; }
bool remove();
static TQStringList list();
private:
void init(bool force_rw=false);
TQString fingerprint();
bool dirty, hashdirty;
bool m_bReadOnly;
int m_Refresh, m_Hash, m_LastChange;
TQString m_Name, m_Command;
TQString m_PreviewCommand, m_Comment;
TQString m_Executable, m_File;
KStandardDirs *m_pDirs;
KSimpleConfig *m_pConfig;
};
/**
* KBackgroundSettings: A class to read/write/manipulate
* KDE desktop settings.
*/
class KBackgroundSettings
: public KBackgroundPattern,
public KBackgroundProgram
{
public:
/**
* @param drawBackgroundPerScreen if false, then all screens (in xinerama
* mode) will be treated as one big display, and the "screen" paramater
* will be ignored.
*/
KBackgroundSettings(int desk, int screen, bool drawBackgroundPerScreen, KConfig *config);
~KBackgroundSettings();
void copyConfig(const KBackgroundSettings*);
bool drawBackgroundPerScreen() const { return m_bDrawBackgroundPerScreen; }
void setDrawBackgroundPerScreen(bool draw);
int desk() const { return m_Desk; }
int screen() const { return m_Screen; }
// void load(int desk, int screen, bool drawBackgroundPerScreen, bool reparseConfig=true);
void load(int desk, int screen, bool drawBackgroundPerScreen, bool reparseConfig);
void setColorA(const TQColor &color);
TQColor colorA() const { return m_ColorA; }
void setColorB(const TQColor &color);
TQColor colorB() const { return m_ColorB; }
void setProgram(TQString program);
void setPatternName(TQString pattern);
enum BackgroundMode {
Flat, Pattern, Program,
HorizontalGradient, VerticalGradient, PyramidGradient,
PipeCrossGradient, EllipticGradient, lastBackgroundMode
};
void setBackgroundMode(int mode);
int backgroundMode() const { return m_BackgroundMode; }
enum BlendMode {
NoBlending, FlatBlending,
HorizontalBlending, VerticalBlending, PyramidBlending,
PipeCrossBlending, EllipticBlending,
IntensityBlending, SaturateBlending, ContrastBlending,
HueShiftBlending, lastBlendMode
};
void setBlendMode(int mode);
int blendMode() const { return m_BlendMode; }
void setReverseBlending(bool value);
bool reverseBlending() const { return m_ReverseBlending; }
void setBlendBalance(int value);
int blendBalance() const { return m_BlendBalance; }
void setWallpaper(TQString name);
TQString wallpaper() const { return m_Wallpaper; }
enum WallpaperMode {
NoWallpaper, Centred, Tiled, CenterTiled, CentredMaxpect, TiledMaxpect,
Scaled, CentredAutoFit, ScaleAndCrop, lastWallpaperMode
};
void setWallpaperMode(int mode);
int wallpaperMode() const { return m_WallpaperMode; }
void setWallpaperList(TQStringList);
TQStringList wallpaperList() const;
TQStringList wallpaperFiles() const;
void setWallpaperChangeInterval(int);
int wallpaperChangeInterval() const { return m_Interval; }
enum MultiMode {
NoMulti, InOrder, Random, NoMultiRandom
};
void setMultiWallpaperMode(int mode);
int multiWallpaperMode() const { return m_MultiMode; }
enum MinOptDepth {
AlwaysOpt, Opt16bpp, Opt15bpp, NeverOpt };
void setMinOptimizationDepth( int mode );
int minOptimizationDepth() const { return m_MinOptimizationDepth; }
bool optimize() const;
void setUseShm( bool use );
bool useShm() const { return m_bShm; }
void changeWallpaper(bool init=false);
void updateWallpaperFiles();
void randomizeWallpaperFiles();
TQString currentWallpaper() const;
/**
* @return true if the currentWallpaper has changed
*/
bool discardCurrentWallpaper();
int lastWallpaperChange() const { return m_LastChange; }
bool needWallpaperChange();
void readSettings(bool reparse=false);
void writeSettings();
TQString configGroupName() const;
int hash();
TQString fingerprint();
void setEnabled( const bool enable );
bool enabled() const { return m_bEnabled; }
private:
void updateHash();
bool dirty;
bool hashdirty;
int m_Screen, m_Desk, m_Hash;
TQColor m_ColorA, defColorA;
TQColor m_ColorB, defColorB;
TQString m_Wallpaper;
TQStringList m_WallpaperList, m_WallpaperFiles;
int m_BackgroundMode, defBackgroundMode;
int m_WallpaperMode, defWallpaperMode;
int m_BlendMode, defBlendMode;
int m_BlendBalance, defBlendBalance;
bool m_ReverseBlending, defReverseBlending;
int m_MinOptimizationDepth;
bool m_bShm;
bool m_bDrawBackgroundPerScreen;
int m_MultiMode, defMultiMode;
int m_Interval, m_LastChange;
int m_CurrentWallpaper;
TQString m_CurrentWallpaperName;
KConfig *m_pConfig;
KStandardDirs *m_pDirs;
bool m_bDeleteConfig;
bool m_bEnabled;
public:
TQMap<TQString,int> m_BMMap;
TQMap<TQString,int> m_WMMap;
TQMap<TQString,int> m_MMMap;
TQMap<TQString,int> m_BlMMap;
char *m_BMRevMap[16];
char *m_WMRevMap[16];
char *m_MMRevMap[16];
char *m_BlMRevMap[16];
};
/**
* A class to read/modify the global desktop background settings.
*/
class KGlobalBackgroundSettings
{
public:
KGlobalBackgroundSettings(KConfig *config);
TQString deskName(int desk);
//void setDeskName(int desk, TQString name);
int cacheSize() { return m_CacheSize; }
void setCacheSize(int size);
bool drawBackgroundPerScreen(int desk) const;
void setDrawBackgroundPerScreen(int desk, bool perScreen);
bool limitCache() { return m_bLimitCache; }
void setLimitCache(bool limit);
bool commonScreenBackground() { return m_bCommonScreen; }
void setCommonScreenBackground(bool common);
bool commonDeskBackground() { return m_bCommonDesk; }
void setCommonDeskBackground(bool common);
bool dockPanel() { return m_bDock; }
void setDockPanel(bool dock);
bool exportBackground() {return m_bExport; }
void setExportBackground(bool _export);
void setTextColor(TQColor _color);
TQColor textColor() const { return m_TextColor; }
void setTextBackgroundColor(TQColor _color);
TQColor textBackgroundColor() const { return m_TextBackgroundColor; }
void setShadowEnabled(bool enabled);
bool shadowEnabled() const { return m_shadowEnabled; }
void setTextLines(int lines);
int textLines() const { return m_textLines; }
void setTextWidth(int width);
int textWidth() const { return m_textWidth; }
void readSettings();
void writeSettings();
KConfig* getConfig() { return m_pConfig; }
private:
bool dirty;
bool m_bCommonDesk;
bool m_bCommonScreen;
bool m_bDock;
bool m_bLimitCache, m_bExport;
int m_CacheSize;
TQStringList m_Names;
TQColor m_TextColor;
TQColor m_TextBackgroundColor;
bool m_shadowEnabled;
int m_textLines;
int m_textWidth;
KConfig *m_pConfig;
bool m_bDeleteConfig;
TQValueVector<bool> m_bDrawBackgroundPerScreen; // m_bDrawBackgroundPerScreen[desk]
};
#endif // __BGSettings_h_Included__
|