00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __BGSettings_h_Included__
00012 #define __BGSettings_h_Included__
00013
00014
00015 #include <tqstringlist.h>
00016 #include <tqcolor.h>
00017 #include <tqvaluevector.h>
00018
00019 template <class TQString, class T> class TQMap;
00020 class KStandardDirs;
00021 class KSimpleConfig;
00022 class KConfig;
00023 class TQString;
00024 class TQImage;
00025
00032 class KBackgroundPattern
00033 {
00034 public:
00035 KBackgroundPattern(TQString name=TQString::null);
00036 ~KBackgroundPattern();
00037
00038 void copyConfig(const KBackgroundPattern*);
00039
00040 TQString name() const { return m_Name; }
00041 void load(TQString name);
00042
00043 void setComment(const TQString &comment);
00044 TQString comment() const {return m_Comment; }
00045
00046 void setPattern(TQString file);
00047 TQString pattern() const { return m_Pattern; }
00048
00049 void readSettings();
00050 void writeSettings();
00051
00052 bool isAvailable();
00053 bool isGlobal()const { return m_bReadOnly; }
00054 bool remove();
00055
00056 int hash();
00057
00058 static TQStringList list();
00059
00060 private:
00061 void init(bool force_rw=false);
00062 TQString fingerprint();
00063
00064 bool dirty, hashdirty;
00065 bool m_bReadOnly;
00066 int m_Hash;
00067 TQString m_Name, m_Comment;
00068 TQString m_Pattern, m_File;
00069 KStandardDirs *m_pDirs;
00070 KSimpleConfig *m_pConfig;
00071 };
00072
00073
00090 class KBackgroundProgram
00091 {
00092 public:
00093 KBackgroundProgram(TQString name=TQString::null);
00094 ~KBackgroundProgram();
00095
00096 void copyConfig(const KBackgroundProgram*);
00097
00098 TQString name()const { return m_Name; }
00099 void load(const TQString & name);
00100
00101 void setComment(const TQString &comment);
00102 TQString comment()const { return m_Comment; }
00103
00104 void setCommand(const TQString &command);
00105 TQString command()const { return m_Command; }
00106
00107 void setPreviewCommand(const TQString &command);
00108 TQString previewCommand()const { return m_PreviewCommand; }
00109
00110 void setRefresh(int refresh);
00111 int refresh()const { return m_Refresh; }
00112
00113 void setExecutable(const TQString &executable);
00114 TQString executable()const { return m_Executable; }
00115
00116 void readSettings();
00117 void writeSettings();
00118
00119 void update();
00120 bool needUpdate();
00121
00122 int hash();
00123
00124 bool isAvailable();
00125 bool isGlobal()const { return m_bReadOnly; }
00126 bool remove();
00127
00128 static TQStringList list();
00129
00130 private:
00131 void init(bool force_rw=false);
00132 TQString fingerprint();
00133
00134 bool dirty, hashdirty;
00135 bool m_bReadOnly;
00136 int m_Refresh, m_Hash, m_LastChange;
00137 TQString m_Name, m_Command;
00138 TQString m_PreviewCommand, m_Comment;
00139 TQString m_Executable, m_File;
00140 KStandardDirs *m_pDirs;
00141 KSimpleConfig *m_pConfig;
00142 };
00143
00144
00149 class KBackgroundSettings
00150 : public KBackgroundPattern,
00151 public KBackgroundProgram
00152 {
00153 public:
00159 KBackgroundSettings(int desk, int screen, bool drawBackgroundPerScreen, KConfig *config);
00160 ~KBackgroundSettings();
00161
00162 void copyConfig(const KBackgroundSettings*);
00163
00164 bool drawBackgroundPerScreen() const { return m_bDrawBackgroundPerScreen; }
00165 void setDrawBackgroundPerScreen(bool draw);
00166
00167 int desk() const { return m_Desk; }
00168 int screen() const { return m_Screen; }
00169
00170 void load(int desk, int screen, bool drawBackgroundPerScreen, bool reparseConfig);
00171
00172 void setColorA(const TQColor &color);
00173 TQColor colorA() const { return m_ColorA; }
00174 void setColorB(const TQColor &color);
00175 TQColor colorB() const { return m_ColorB; }
00176
00177 void setProgram(TQString program);
00178 void setPatternName(TQString pattern);
00179
00180 enum BackgroundMode {
00181 Flat, Pattern, Program,
00182 HorizontalGradient, VerticalGradient, PyramidGradient,
00183 PipeCrossGradient, EllipticGradient, lastBackgroundMode
00184 };
00185 void setBackgroundMode(int mode);
00186 int backgroundMode() const { return m_BackgroundMode; }
00187
00188 enum BlendMode {
00189 NoBlending, FlatBlending,
00190 HorizontalBlending, VerticalBlending, PyramidBlending,
00191 PipeCrossBlending, EllipticBlending,
00192 IntensityBlending, SaturateBlending, ContrastBlending,
00193 HueShiftBlending, lastBlendMode
00194 };
00195 void setBlendMode(int mode);
00196 int blendMode() const { return m_BlendMode; }
00197
00198 void setReverseBlending(bool value);
00199 bool reverseBlending() const { return m_ReverseBlending; }
00200
00201 void setBlendBalance(int value);
00202 int blendBalance() const { return m_BlendBalance; }
00203
00204 void setWallpaper(TQString name);
00205 TQString wallpaper() const { return m_Wallpaper; }
00206
00207 enum WallpaperMode {
00208 NoWallpaper, Centred, Tiled, CenterTiled, CentredMaxpect, TiledMaxpect,
00209 Scaled, CentredAutoFit, ScaleAndCrop, lastWallpaperMode
00210 };
00211 void setWallpaperMode(int mode);
00212 int wallpaperMode() const { return m_WallpaperMode; }
00213
00214 void setWallpaperList(TQStringList);
00215 TQStringList wallpaperList() const;
00216 TQStringList wallpaperFiles() const;
00217
00218 void setWallpaperChangeInterval(int);
00219 int wallpaperChangeInterval() const { return m_Interval; }
00220
00221 enum MultiMode {
00222 NoMulti, InOrder, Random, NoMultiRandom
00223 };
00224 void setMultiWallpaperMode(int mode);
00225 int multiWallpaperMode() const { return m_MultiMode; }
00226
00227 enum MinOptDepth {
00228 AlwaysOpt, Opt16bpp, Opt15bpp, NeverOpt };
00229
00230 void setMinOptimizationDepth( int mode );
00231 int minOptimizationDepth() const { return m_MinOptimizationDepth; }
00232 bool optimize() const;
00233
00234 void setUseShm( bool use );
00235 bool useShm() const { return m_bShm; }
00236
00237 void changeWallpaper(bool init=false);
00238 void updateWallpaperFiles();
00239 void randomizeWallpaperFiles();
00240
00241 TQString currentWallpaper() const;
00245 bool discardCurrentWallpaper();
00246 int lastWallpaperChange() const { return m_LastChange; }
00247 bool needWallpaperChange();
00248
00249 void readSettings(bool reparse=false);
00250 void writeSettings();
00251 TQString configGroupName() const;
00252
00253 int hash();
00254 TQString fingerprint();
00255
00256 void setEnabled( const bool enable );
00257 bool enabled() const { return m_bEnabled; }
00258
00259 private:
00260 void updateHash();
00261
00262 bool dirty;
00263 bool hashdirty;
00264 int m_Screen, m_Desk, m_Hash;
00265
00266 TQColor m_ColorA, defColorA;
00267 TQColor m_ColorB, defColorB;
00268 TQString m_Wallpaper;
00269 TQStringList m_WallpaperList, m_WallpaperFiles;
00270
00271 int m_BackgroundMode, defBackgroundMode;
00272 int m_WallpaperMode, defWallpaperMode;
00273 int m_BlendMode, defBlendMode;
00274 int m_BlendBalance, defBlendBalance;
00275 bool m_ReverseBlending, defReverseBlending;
00276 int m_MinOptimizationDepth;
00277 bool m_bShm;
00278 bool m_bDrawBackgroundPerScreen;
00279
00280 int m_MultiMode, defMultiMode;
00281 int m_Interval, m_LastChange;
00282 int m_CurrentWallpaper;
00283 TQString m_CurrentWallpaperName;
00284
00285 KConfig *m_pConfig;
00286 KStandardDirs *m_pDirs;
00287 bool m_bDeleteConfig;
00288 bool m_bEnabled;
00289
00290 public:
00291 TQMap<TQString,int> m_BMMap;
00292 TQMap<TQString,int> m_WMMap;
00293 TQMap<TQString,int> m_MMMap;
00294 TQMap<TQString,int> m_BlMMap;
00295 char *m_BMRevMap[16];
00296 char *m_WMRevMap[16];
00297 char *m_MMRevMap[16];
00298 char *m_BlMRevMap[16];
00299 };
00300
00301
00305 class KGlobalBackgroundSettings
00306 {
00307 public:
00308 KGlobalBackgroundSettings(KConfig *config);
00309
00310 TQString deskName(int desk);
00311
00312
00313 int cacheSize() { return m_CacheSize; }
00314 void setCacheSize(int size);
00315
00316 bool drawBackgroundPerScreen(int desk) const;
00317 void setDrawBackgroundPerScreen(int desk, bool perScreen);
00318
00319 bool limitCache() { return m_bLimitCache; }
00320 void setLimitCache(bool limit);
00321
00322 bool commonScreenBackground() { return m_bCommonScreen; }
00323 void setCommonScreenBackground(bool common);
00324
00325 bool commonDeskBackground() { return m_bCommonDesk; }
00326 void setCommonDeskBackground(bool common);
00327
00328 bool dockPanel() { return m_bDock; }
00329 void setDockPanel(bool dock);
00330
00331 bool exportBackground() {return m_bExport; }
00332 void setExportBackground(bool _export);
00333
00334 void setTextColor(TQColor _color);
00335 TQColor textColor() const { return m_TextColor; }
00336
00337 void setTextBackgroundColor(TQColor _color);
00338 TQColor textBackgroundColor() const { return m_TextBackgroundColor; }
00339
00340 void setShadowEnabled(bool enabled);
00341 bool shadowEnabled() const { return m_shadowEnabled; }
00342
00343 void setTextLines(int lines);
00344 int textLines() const { return m_textLines; }
00345 void setTextWidth(int width);
00346 int textWidth() const { return m_textWidth; }
00347
00348 void readSettings();
00349 void writeSettings();
00350 KConfig* getConfig() { return m_pConfig; }
00351
00352 private:
00353 bool dirty;
00354 bool m_bCommonDesk;
00355 bool m_bCommonScreen;
00356 bool m_bDock;
00357 bool m_bLimitCache, m_bExport;
00358 int m_CacheSize;
00359 TQStringList m_Names;
00360
00361 TQColor m_TextColor;
00362 TQColor m_TextBackgroundColor;
00363 bool m_shadowEnabled;
00364 int m_textLines;
00365 int m_textWidth;
00366 KConfig *m_pConfig;
00367 bool m_bDeleteConfig;
00368 TQValueVector<bool> m_bDrawBackgroundPerScreen;
00369 };
00370
00371
00372 #endif // __BGSettings_h_Included__