Changeset View
Changeset View
Standalone View
Standalone View
src/ColorScheme.h
Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Line(s) | |||||
186 | 186 | | |||
187 | private: | 187 | private: | ||
188 | // specifies how much a particular color can be randomized by | 188 | // specifies how much a particular color can be randomized by | ||
189 | class RandomizationRange | 189 | class RandomizationRange | ||
190 | { | 190 | { | ||
191 | public: | 191 | public: | ||
192 | RandomizationRange() : hue(0), | 192 | RandomizationRange() : hue(0), | ||
193 | saturation(0), | 193 | saturation(0), | ||
194 | value(0) | 194 | lightness(0) | ||
195 | { | 195 | { | ||
196 | } | 196 | } | ||
197 | 197 | | |||
198 | bool isNull() const | 198 | bool isNull() const | ||
199 | { | 199 | { | ||
200 | return hue == 0 && saturation == 0 && value == 0; | 200 | return qFuzzyIsNull(hue) && qFuzzyIsNull(saturation) && qFuzzyIsNull(lightness); | ||
201 | } | 201 | } | ||
202 | 202 | | |||
203 | quint16 hue; | 203 | double hue; | ||
204 | quint8 saturation; | 204 | double saturation; | ||
205 | quint8 value; | 205 | double lightness; | ||
206 | }; | 206 | }; | ||
207 | 207 | | |||
208 | // returns the active color table. if none has been set specifically, | 208 | // returns the active color table. if none has been set specifically, | ||
209 | // this is the default color table. | 209 | // this is the default color table. | ||
210 | const ColorEntry *colorTable() const; | 210 | const ColorEntry *colorTable() const; | ||
211 | 211 | | |||
212 | // reads a single color entry from a KConfig source | 212 | // reads a single color entry from a KConfig source | ||
213 | // and sets the palette entry at 'index' to the entry read. | 213 | // and sets the palette entry at 'index' to the entry read. | ||
214 | void readColorEntry(const KConfig &config, int index); | 214 | void readColorEntry(const KConfig &config, int index); | ||
215 | // writes a single color entry to a KConfig source | 215 | // writes a single color entry to a KConfig source | ||
216 | void writeColorEntry(KConfig &config, int index) const; | 216 | void writeColorEntry(KConfig &config, int index) const; | ||
217 | 217 | | |||
218 | // sets the amount of randomization allowed for a particular color | 218 | // sets the amount of randomization allowed for a particular color | ||
219 | // in the palette. creates the randomization table if | 219 | // in the palette. creates the randomization table if | ||
220 | // it does not already exist | 220 | // it does not already exist | ||
221 | void setRandomizationRange(int index, quint16 hue, quint8 saturation, quint8 value); | 221 | void setRandomizationRange(int index, double hue, double saturation, double lightness); | ||
222 | 222 | | |||
223 | QString _description; | 223 | QString _description; | ||
224 | QString _name; | 224 | QString _name; | ||
225 | 225 | | |||
226 | // pointer to custom color table, or 0 if the default color table is | 226 | // pointer to custom color table, or 0 if the default color table is | ||
227 | // being used | 227 | // being used | ||
228 | ColorEntry *_table; | 228 | ColorEntry *_table; | ||
229 | 229 | | |||
230 | // pointer to randomization table, or 0 if no colors in the color | 230 | // pointer to randomization table, or 0 if no colors in the color | ||
231 | // scheme support randomization | 231 | // scheme support randomization | ||
232 | RandomizationRange *_randomTable; | 232 | RandomizationRange *_randomTable; | ||
233 | 233 | | |||
234 | qreal _opacity; | 234 | qreal _opacity; | ||
235 | 235 | | |||
236 | // enables blur behind the terminal window | 236 | // enables blur behind the terminal window | ||
237 | bool _blur; | 237 | bool _blur; | ||
238 | 238 | | |||
239 | ColorSchemeWallpaper::Ptr _wallpaper; | 239 | ColorSchemeWallpaper::Ptr _wallpaper; | ||
240 | 240 | | |||
241 | static const quint16 MAX_HUE = 340; | | |||
242 | | ||||
243 | static const char * const colorNames[TABLE_COLORS]; | 241 | static const char * const colorNames[TABLE_COLORS]; | ||
244 | static const char * const translatedColorNames[TABLE_COLORS]; | 242 | static const char * const translatedColorNames[TABLE_COLORS]; | ||
245 | }; | 243 | }; | ||
246 | } | 244 | } | ||
247 | 245 | | |||
248 | Q_DECLARE_METATYPE(const Konsole::ColorScheme *) | 246 | Q_DECLARE_METATYPE(const Konsole::ColorScheme *) | ||
249 | 247 | | |||
250 | #endif //COLORSCHEME_H | 248 | #endif //COLORSCHEME_H |