summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/check_on.pngbin0 -> 178 bytes
-rw-r--r--common/check_x_on.pngbin0 -> 153 bytes
-rw-r--r--common/common.h955
-rw-r--r--common/config_file.c1238
-rw-r--r--common/config_file.c-orig1238
-rwxr-xr-xcommon/mkpkg7
-rw-r--r--common/radio_frame.pngbin0 -> 418 bytes
-rw-r--r--common/radio_light.pngbin0 -> 235 bytes
-rw-r--r--common/radio_on.pngbin0 -> 230 bytes
-rw-r--r--common/slider.pngbin0 -> 310 bytes
-rw-r--r--common/slider_light.pngbin0 -> 198 bytes
-rw-r--r--common/slider_light_v.pngbin0 -> 203 bytes
-rw-r--r--common/slider_v.pngbin0 -> 309 bytes
13 files changed, 3438 insertions, 0 deletions
diff --git a/common/check_on.png b/common/check_on.png
new file mode 100644
index 0000000..4f28ac6
--- /dev/null
+++ b/common/check_on.png
Binary files differ
diff --git a/common/check_x_on.png b/common/check_x_on.png
new file mode 100644
index 0000000..dfc62df
--- /dev/null
+++ b/common/check_x_on.png
Binary files differ
diff --git a/common/common.h b/common/common.h
new file mode 100644
index 0000000..21f6bae
--- /dev/null
+++ b/common/common.h
@@ -0,0 +1,955 @@
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+/*
+ QtCurve (C) Craig Drummond, 2003 - 2007 [email protected]
+
+ ----
+
+ This program is free software; you can redistr ibute it and/or
+ modify it under the terms of the GNU General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+/* This file is quite 'hacky' as it contains lots of static function definitions - but I want to share the code
+ between Qt and Gtk, but not polute the namespace with exported functions... */
+
+#include <string.h>
+#include <math.h>
+#include "config.h"
+
+/*
+ The following #define disables the rounding when scrollbar type==none.
+#define QTC_SIMPLE_SCROLLBARS
+*/
+
+/*
+ The following #define disables the custom focus rectangle
+#define QTC_PLAIN_FOCUS_ONLY
+*/
+
+/*
+ The following #define controls whether a scrollbar's slider should overlap
+ the scrollbar buttons when at min/max. This removes the thick looking line
+ between the slider and the buttons.
+*/
+#define QTC_INCREASE_SB_SLIDER
+
+/*
+ Enable this to do focus highlighting for scrollviews... NOTE: Gtk2 currently does not do this.
+#define QTC_HIGHLIGHT_SCROLVIEWS
+*/
+
+/*
+ Control shading used for glass variants.
+ 0 => As used in 0.51.1 +
+ 1 => As used in 0.51
+ 2 => As used in <0.51
+*/
+#define QTC_GLASS_SHADING 0
+
+typedef enum
+{
+ SHADING_SIMPLE=0,
+ SHADING_HSL=1,
+ SHADING_HSV=2
+} EShading;
+
+#if (!defined QTC_CONFIG_DIALOG) && (!defined QTC_KWIN)
+static EShading shading=SHADING_HSL;
+#endif
+
+#ifdef __cplusplus
+#include <qconfig.h>
+#ifdef QTC_CONFIG_DIALOG
+#include <qapplication.h>
+#endif
+#else
+#include <glib.h>
+#endif
+
+#ifdef __cplusplus
+typedef QColor color;
+#else
+typedef gboolean bool;
+typedef GdkColor color;
+#define true TRUE
+#define false FALSE
+#endif
+
+#define QTC_GROUP "Settings"
+/*#define QTC_DESCR_GROUP "Description"*/
+
+/* qtc_<theme name>.themerc support */
+#define KDE_PREFIX(V) ((4==(V)) ? KDE4PREFIX : KDE3PREFIX)
+#define QTC_THEME_DIR "/share/apps/kstyle/themes/"
+#define QTC_THEME_PREFIX "qtc_"
+#define QTC_THEME_SUFFIX ".themerc"
+
+
+#define QTC_CHECK_SIZE 13
+#define QTC_RADIO_SIZE 13
+#define QTC_MIN_BTN_SIZE 8
+#define QTC_LV_SIZE 7
+
+#define LARGE_ARR_WIDTH 7
+#define LARGE_ARR_HEIGHT 4
+#define SMALL_ARR_WIDTH 5
+#define SMALL_ARR_HEIGHT 3
+
+#define NUM_STD_SHADES 6
+#define NUM_EXTRA_SHADES 3
+
+#define TOTAL_SHADES NUM_STD_SHADES+NUM_EXTRA_SHADES
+#define ORIGINAL_SHADE TOTAL_SHADES
+
+#define SHADE_ORIG_HIGHLIGHT NUM_STD_SHADES
+#define SHADE_4_HIGHLIGHT NUM_STD_SHADES+1
+#define SHADE_2_HIGHLIGHT NUM_STD_SHADES+2
+
+/* 3d effect - i.e. buttons, etc */
+#define QTC_SHADES \
+ static const double shades[2][11][NUM_STD_SHADES]=\
+ { \
+ { /* HSV & HSL */ \
+ { 1.05, 1.04, 0.90, 0.800, 0.830, 0.82 }, \
+ { 1.06, 1.04, 0.90, 0.790, 0.831, 0.78 }, \
+ { 1.07, 1.04, 0.90, 0.785, 0.832, 0.75 }, \
+ { 1.08, 1.05, 0.90, 0.782, 0.833, 0.72 }, \
+ { 1.09, 1.05, 0.90, 0.782, 0.834, 0.70 }, \
+ { 1.10, 1.06, 0.90, 0.782, 0.836, 0.68 }, \
+ { 1.12, 1.06, 0.90, 0.782, 0.838, 0.63 }, \
+ { 1.16, 1.07, 0.90, 0.782, 0.840, 0.62 }, /* default */ \
+ { 1.18, 1.07, 0.90, 0.783, 0.842, 0.60 }, \
+ { 1.20, 1.08, 0.90, 0.784, 0.844, 0.58 }, \
+ { 1.22, 1.08, 0.90, 0.786, 0.848, 0.55 } \
+ }, \
+ { /* SIMPLE */ \
+ { 1.07, 1.03, 0.91, 0.780, 0.834, 0.75 }, \
+ { 1.08, 1.03, 0.91, 0.781, 0.835, 0.74 }, \
+ { 1.09, 1.03, 0.91, 0.782, 0.836, 0.73 }, \
+ { 1.10, 1.04, 0.91, 0.783, 0.837, 0.72 }, \
+ { 1.11, 1.04, 0.91, 0.784, 0.838, 0.71 }, \
+ { 1.12, 1.05, 0.91, 0.785, 0.840, 0.70 }, \
+ { 1.13, 1.05, 0.91, 0.786, 0.842, 0.69 }, \
+ { 1.14, 1.06, 0.91, 0.787, 0.844, 0.68 }, /* default */ \
+ { 1.16, 1.06, 0.91, 0.788, 0.846, 0.66 }, \
+ { 1.18, 1.07, 0.91, 0.789, 0.848, 0.64 }, \
+ { 1.20, 1.07, 0.91, 0.790, 0.850, 0.62 } \
+ } \
+ } ;
+
+#define QTC_SIMPLE_SHADING (!shading)
+
+#define QT_STD_BORDER 5
+#define QT_DISABLED_BORDER QT_STD_BORDER /*3*/
+#define QT_BORDER(E) (/*(E) ?*/ QT_STD_BORDER/* : QT_DISABLED_BORDER*/)
+
+#define QT_FRAME_DARK_SHADOW 2
+#define QT_FOCUS 3
+
+#define QTC_SHADE(c, s) \
+ (c>10 || c<0 || s>=NUM_STD_SHADES || s<0 \
+ ? 1.0 \
+ : opts.darkerBorders && (QT_STD_BORDER==i || QT_DISABLED_BORDER==i) \
+ ? shades[SHADING_SIMPLE==shading ? 1 : 0][c][s] - 0.1 \
+ : shades[SHADING_SIMPLE==shading ? 1 : 0][c][s] )
+
+#define TAB_APPEARANCE(A) (A) /* (APPEARANCE_GLASS==(A) ? APPEARANCE_GRADIENT : (A)) */
+#define QTC_COLOR_SEL_TAB_FACTOR 1.2
+
+#define QTC_ROUNDED (ROUND_NONE!=opts.round)
+
+#define QTC_ETCHED_DARK 0.95
+#define SHADE_BEVEL_GRAD_LIGHT (QTC_SIMPLE_SHADING ? 1.05 : 1.07)
+#define SHADE_BEVEL_GRAD_DARK (QTC_SIMPLE_SHADING ? 0.93 : 0.91)
+#define SHADE_BEVEL_GRAD_SEL_LIGHT (QTC_SIMPLE_SHADING ? 1.05 : 1.07)
+#define SHADE_BEVEL_GRAD_SEL_DARK (QTC_SIMPLE_SHADING ? 0.95 : 0.93)
+
+#define SHADE_BEVEL_MENU_ITEM_LIGHT (QTC_SIMPLE_SHADING ? 1.07 : 1.09)
+#define SHADE_BEVEL_MENU_ITEM_DARK (QTC_SIMPLE_SHADING ? 0.85 : 0.83)
+
+#define SHADE_SLIDER_LIGHT 1.1
+#define SHADE_SLIDER_DARK 0.8
+
+#define SHADE_SBAR_LIGHT 1.02
+#define SHADE_SBAR_DARK 0.95
+
+#define SHADE_MENU_LIGHT 1.02
+#define SHADE_MENU_DARK 0.96
+
+#define SHADE_TAB_SEL_LIGHT 1.1
+#define SHADE_TAB_SEL_DARK 1.0
+
+#define SHADE_BOTTOM_TAB_SEL_LIGHT 1.0
+#define SHADE_BOTTOM_TAB_SEL_DARK 0.96
+
+#define SPLIT_GRADIENT_FACTOR 0.415
+
+#if !defined QTC_GLASS_SHADING || QTC_GLASS_SHADING==0
+
+ #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
+ ? (WIDGET_DEF_BUTTON==W ? 0.99 : 0.98) \
+ : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.55))
+ #define SHADE_GLASS_TOP_B(A, W) (APPEARANCE_DULL_GLASS==A \
+ ? (WIDGET_DEF_BUTTON==W ? 0.94 : 0.92) \
+ : 0.92)
+ #define SHADE_GLASS_BOT_A(A) (APPEARANCE_DULL_GLASS==A ? 1.02 : 0.99)
+ #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.10 : 1.16)
+
+#elif QTC_GLASS_SHADING==1
+
+ #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
+ ? (WIDGET_DEF_BUTTON==W ? 1.0 : 1.0) \
+ : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.7))
+ #define SHADE_GLASS_TOP_B(A, W) (APPEARANCE_DULL_GLASS==A ? 0.96 : 0.96)
+ #define SHADE_GLASS_BOT_A(A) 0.99
+ #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.08 : 1.16)
+
+#else
+
+ #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \
+ ? (WIDGET_DEF_BUTTON==W ? 1.05 : 1.05) \
+ : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.7))
+ #define SHADE_GLASS_TOP_B(A, W) 0.96
+ #define SHADE_GLASS_BOT_A(A) 0.99
+ #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.08 : 1.16)
+
+#endif
+
+#define IS_GLASS(A) (APPEARANCE_DULL_GLASS==A || APPEARANCE_SHINY_GLASS==A)
+#define IS_FLAT(A) (APPEARANCE_FLAT==A || APPEARANCE_RAISED==A)
+#define SHADE_SELECTION_TOP 1.15
+#define SHADE_SELECTION_BOT 0.9
+
+#ifdef __cplusplus
+#define MENUBAR_DARK_LIMIT 160
+#define TOO_DARK(A) ((A).red()<MENUBAR_DARK_LIMIT || (A).green()<MENUBAR_DARK_LIMIT || (A).blue()<MENUBAR_DARK_LIMIT)
+#else
+#define MENUBAR_DARK_LIMIT (160<<8)
+#define TOO_DARK(A) ((A).red<MENUBAR_DARK_LIMIT || (A).green<MENUBAR_DARK_LIMIT || (A).blue<MENUBAR_DARK_LIMIT)
+#endif
+
+#define DEFAULT_HIGHLIGHT_FACTOR 1.05
+#define MAX_HIGHLIGHT_FACTOR 50
+#define MIN_HIGHLIGHT_FACTOR -50
+#define MENUBAR_DARK_FACTOR 0.97
+#define POPUPMENU_LIGHT_FACTOR 1.15
+#define INACTIVE_HIGHLIGHT_FACTOR 1.20
+
+#define USE_SHADED_MENU_BAR_COLORS (SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars)
+#define MENUBAR_GLASS_SELECTED_DARK_FACTOR 0.9
+#define GLASS_BORDER 0.4
+#define BEVEL_BORDER(w) (WIDGET_LISTVIEW_HEADER==w ? 6 : 4)
+#define SHADE_BEVEL_TOP 1.07
+#define SHADE_BEVEL_MID_TOP 1.03
+#define SHADE_BEVEL_MID_BOT 0.975
+#define SHADE_BEVEL_BOT(w) (WIDGET_LISTVIEW_HEADER==(w) ? 0.88 : 0.90)
+
+#define NUM_SPLITTER_DASHES 21
+
+#define WIDGET_BUTTON(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w || WIDGET_CHECKBOX==w)
+#ifdef __cplusplus
+#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w)
+#else
+#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w || \
+ WIDGET_SPIN_UP==w || WIDGET_SPIN_DOWN==w)
+#endif
+#define COLORED_BORDER_SIZE 3
+#define PROGRESS_CHUNK_WIDTH 10
+#define QTC_DRAW_LIGHT_BORDER(SUKEN, WIDGET, APP) \
+ ((!SUKEN && IS_GLASS(APP) && WIDGET_MENU_ITEM!=WIDGET && WIDGET_DEF_BUTTON!=WIDGET) || \
+ (WIDGET_PROGRESSBAR==WIDGET && APPEARANCE_FLAT!=APP && \
+ APPEARANCE_RAISED!=APP && APPEARANCE_INVERTED!=APP))
+
+#define PROGRESS_ANIMATION 100
+#define MIN_SLIDER_SIZE(A) (LINE_DOTS==A ? 24 : 20)
+
+#define QTC_NORM_TAB_APP (APPEARANCE_BEVELLED==opts.tabAppearance || APPEARANCE_SPLIT_GRADIENT==opts.appearance \
+ ? APPEARANCE_GRADIENT : opts.tabAppearance)
+#define QTC_SEL_TAB_APP (APPEARANCE_INVERTED==opts.tabAppearance ? APPEARANCE_FLAT : (QTC_NORM_TAB_APP))
+#define QTC_SLIDER_MO_SHADE (SHADE_SELECTED==opts.shadeSliders ? 1 : (SHADE_BLEND_SELECTED==opts.shadeSliders ? 0 : ORIGINAL_SHADE))
+#define QTC_SLIDER_MO_BORDER (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 2 : 1)
+#define QTC_SLIDER_MO_LEN (SLIDER_TRIANGULAR==opts.sliderStyle ? 2 : (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 4 : 3))
+#define QTC_SB_SLIDER_MO_LEN(A) ((A)<22 && ROUND_FULL!=opts.round \
+ ? 2 \
+ : ((A)<32 || (SHADE_SELECTED!=opts.shadeSliders && SHADE_BLEND_SELECTED!=opts.shadeSliders) \
+ ? 4 \
+ : 6))
+
+#define QTC_CR_MO_FILL (SHADE_BLEND_SELECTED==opts.shadeCheckRadio || SHADE_SELECTED==opts.shadeCheckRadio ? 1 : 2)
+#define QTC_MO_DEF_BTN 2
+#define QTC_MO_PLASTIK_DARK(W) (WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 3 : 2) /*? 2 : 1) */
+#define QTC_MO_PLASTIK_LIGHT(W) (WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 4 : 1) /*? 2 : 0) */
+
+#define QTC_MO_STD_DARK(W) QTC_MO_PLASTIK_DARK(W) /*(WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 4 : 1) */
+#define QTC_MO_STD_LIGHT(W, S) QTC_MO_PLASTIK_LIGHT(W) /*(WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 2 : (S ? 1 : 0))*/
+
+#define QTC_DO_EFFECT (ROUND_FULL==opts.round && EFFECT_NONE!=opts.buttonEffect)
+
+#ifdef __cplusplus
+#include <qstyle.h>
+typedef enum
+{
+ QtC_Round = QStyle::PM_CustomBase
+} QtCMetrics;
+#endif
+
+typedef enum
+{
+ EFFECT_NONE,
+ EFFECT_ETCH,
+ EFFECT_SHADOW
+} EEffect;
+
+typedef enum
+{
+ PIX_RADIO_BORDER,
+ PIX_RADIO_LIGHT,
+ PIX_RADIO_ON,
+ PIX_CHECK,
+ PIX_SLIDER,
+ PIX_SLIDER_LIGHT,
+ PIX_SLIDER_V,
+ PIX_SLIDER_LIGHT_V
+} EPixmap;
+
+typedef enum
+{
+ WIDGET_TAB_TOP,
+ WIDGET_TAB_BOT,
+ WIDGET_STD_BUTTON,
+ WIDGET_DEF_BUTTON,
+ WIDGET_LISTVIEW_HEADER,
+ WIDGET_SLIDER,
+ WIDGET_SLIDER_TROUGH,
+ WIDGET_SB_SLIDER,
+ WIDGET_SB_BUTTON,
+ WIDGET_TROUGH,
+ WIDGET_CHECKBOX,
+ WIDGET_TOGGLE_BUTTON,
+ WIDGET_MENU_ITEM,
+ WIDGET_PROGRESSBAR,
+#ifndef __cplusplus
+ WIDGET_SPIN_UP,
+ WIDGET_SPIN_DOWN,
+#endif
+ WIDGET_SPIN,
+#ifdef __cplusplus
+ WIDGET_CHECKBUTTON, // Qt4 only
+ WIDGET_MDI_WINDOW, // Qt4 only
+ WIDGET_MDI_WINDOW_TITLE, // Qt4 only
+ WIDGET_ENTRY,
+ WIDGET_FRAME,
+ WIDGET_NO_ETCH_BTN,
+#endif
+ WIDGET_OTHER
+} EWidget;
+
+typedef enum
+{
+ APPEARANCE_FLAT,
+ APPEARANCE_RAISED,
+ APPEARANCE_DULL_GLASS,
+ APPEARANCE_SHINY_GLASS,
+ APPEARANCE_GRADIENT,
+ APPEARANCE_INVERTED,
+ APPEARANCE_SPLIT_GRADIENT,
+ APPEARANCE_BEVELLED
+} EAppearance;
+
+#define IS_SLIDER(W) (WIDGET_SLIDER==W || WIDGET_SB_SLIDER==W)
+#define IS_TOGGLE_BUTTON(W) (WIDGET_TOGGLE_BUTTON==W || WIDGET_CHECKBOX==W)
+
+typedef enum
+{
+ CORNER_TL = 0x1,
+ CORNER_TR = 0x2,
+ CORNER_BR = 0x4,
+ CORNER_BL = 0x8
+} ECornerBits;
+
+#define ROUNDED_NONE 0x0
+#define ROUNDED_TOP (CORNER_TL|CORNER_TR)
+#define ROUNDED_BOTTOM (CORNER_BL|CORNER_BR)
+#define ROUNDED_LEFT (CORNER_TL|CORNER_BL)
+#define ROUNDED_RIGHT (CORNER_TR|CORNER_BR)
+#define ROUNDED_TOPRIGHT CORNER_TR
+#define ROUNDED_BOTTOMRIGHT CORNER_BR
+#define ROUNDED_TOPLEFT CORNER_TL
+#define ROUNDED_BOTTOMLEFT CORNER_BL
+#define ROUNDED_ALL (CORNER_TL|CORNER_TR|CORNER_BR|CORNER_BL)
+
+typedef enum
+{
+ IND_CORNER,
+ IND_FONT_COLOR,
+ IND_COLORED,
+ IND_NONE
+} EDefBtnIndicator;
+
+typedef enum
+{
+ LINE_SUNKEN,
+ LINE_FLAT,
+ LINE_DOTS,
+ LINE_DASHES
+} ELine;
+
+#define LINE_NONE LINE_DASHES
+
+typedef enum
+{
+ TB_NONE,
+ TB_LIGHT,
+ TB_DARK,
+ TB_LIGHT_ALL,
+ TB_DARK_ALL,
+} ETBarBorder;
+
+typedef enum
+{
+ BORDER_FLAT,
+ BORDER_RAISED,
+ BORDER_SUNKEN
+} EBorder;
+
+/*
+ This whole EShade enum is a complete mess!
+ For menubars, we dont blend - so blend is selected, and selected is darken
+ For check/radios - we dont blend, so blend is selected, and we dont allow darken
+*/
+typedef enum
+{
+ SHADE_NONE,
+ SHADE_CUSTOM,
+ SHADE_BLEND_SELECTED, /* In the case of check/radios this is SHADE_SELECTED */
+ SHADE_SELECTED,
+ SHADE_DARKEN = SHADE_SELECTED , /* For menubar only! */
+} EShade;
+
+typedef enum
+{
+ ROUND_NONE,
+ ROUND_SLIGHT,
+ ROUND_FULL
+} ERound;
+
+typedef enum
+{
+ SCROLLBAR_KDE,
+ SCROLLBAR_WINDOWS,
+ SCROLLBAR_PLATINUM,
+ SCROLLBAR_NEXT,
+ SCROLLBAR_NONE
+} EScrollbar;
+
+typedef enum
+{
+ MO_NONE,
+ MO_COLORED,
+ MO_PLASTIK
+} EMouseOver;
+
+typedef enum
+{
+ STRIPE_NONE,
+ STRIPE_PLAIN,
+ STRIPE_DIAGONAL
+} EStripe;
+
+typedef enum
+{
+ SLIDER_PLAIN,
+ SLIDER_ROUND,
+ SLIDER_TRIANGULAR,
+} ESliderStyle;
+
+#define DEF_IND_STR "fontcolor"
+#define DEF_LINE_STR "dots"
+#define DEF_TB_BORDER "none"
+#define DEF_APPEARANCE_STR "bevelled"
+#define DEF_MENU_APPEARANCE_STR "gradient"
+#define DEF_TOOLBAR_APPEARANCE_STR "gradient"
+#define DEF_SLIDER_SHADE_STR "selected"
+#define DEF_TBS_STR "dots"
+#define DEF_COLOR_STR "background"
+#define DEF_TOOLBAR_SHADE_STR "none"
+
+#ifdef QTC_COMMON_FUNCTIONS
+static double getWidgetShade(EWidget w, bool light, bool sunken, EAppearance app)
+{
+ switch(w)
+ {
+ case WIDGET_TROUGH:
+ return light ? SHADE_SBAR_LIGHT : SHADE_SBAR_DARK;
+ case WIDGET_SLIDER_TROUGH:
+ return light ? SHADE_SLIDER_LIGHT : SHADE_SLIDER_DARK;
+ case WIDGET_MENU_ITEM:
+ if(APPEARANCE_DULL_GLASS!=app && APPEARANCE_SHINY_GLASS!=app)
+ return light ? SHADE_BEVEL_MENU_ITEM_LIGHT : SHADE_BEVEL_MENU_ITEM_DARK;
+ default:
+ return light
+ ? sunken
+ ? SHADE_BEVEL_GRAD_SEL_LIGHT
+ : SHADE_BEVEL_GRAD_LIGHT
+ : sunken
+ ? SHADE_BEVEL_GRAD_SEL_DARK
+ : SHADE_BEVEL_GRAD_DARK;
+ }
+}
+
+#define QTC_MIN(a, b) ((a) < (b) ? (a) : (b))
+#define QTC_MAX(a, b) ((b) < (a) ? (a) : (b))
+
+static bool equal(double d1, double d2)
+{
+ return (fabs(d1 - d2) < 0.0001);
+}
+
+/* Taken from rgb->hsl routines taken from KColor
+ Copyright 2007 Matthew Woehlke <[email protected]>
+*/
+static inline double normalize(double a)
+{
+ return (a < 0.0 ? 0.0 : a > 1.0 ? 1.0 : a);
+}
+
+static inline double mix(double a, double b, double k)
+{
+ return a + ( ( b - a ) * k );
+}
+
+static inline double wrap(double a, double d)
+{
+ register double r = fmod( a, d );
+ return ( r < 0.0 ? d + r : ( r > 0.0 ? r : 0.0 ) );
+}
+
+static inline double h2c(double h, double m1, double m2)
+{
+ h = wrap( h, 6.0 );
+
+ if ( h < 1.0 )
+ return mix( m1, m2, h );
+ if ( h < 3.0 )
+ return m2;
+ if ( h < 4.0 )
+ return mix( m1, m2, 4.0 - h );
+ return m1;
+}
+
+static inline void rgbToHsl(double r, double g, double b, double *h, double *s, double *l)
+{
+ double min=QTC_MIN(QTC_MIN(r, g), b),
+ max=QTC_MAX(QTC_MAX(r, g), b);
+
+ *l = 0.5 * (max + min);
+ *s = 0.0;
+ *h = 0.0;
+
+ if (max != min)
+ {
+ double delta = max - min;
+
+ if ( *l <= 0.5 )
+ *s = delta / ( max + min );
+ else
+ *s = delta / ( 2.0 - max - min );
+
+ if ( r == max )
+ *h = ( g - b ) / delta;
+ else if ( g == max )
+ *h = 2.0 + ( b - r ) / delta;
+ else if ( b == max )
+ *h = 4.0 + ( r - g ) / delta;
+
+ *h /= 6.0;
+ if ( *h < 0.0 )
+ (*h) += 1.0;
+ }
+}
+
+static inline void hslToRgb(double h, double s, double l, double *r, double *g, double *b)
+{
+ double m1, m2;
+
+ // TODO h2rgb( h, r, g, b );
+ h *= 6.0;
+
+ if ( l <= 0.5 )
+ m2 = l * ( 1.0 + s );
+ else
+ m2 = l + s * ( 1.0 - l );
+ m1 = 2.0 * l - m2;
+
+ *r = h2c( h + 2.0, m1, m2 );
+ *g = h2c( h, m1, m2 );
+ *b = h2c( h - 2.0, m1, m2 );
+}
+
+static void rgbToHsv(double r, double g, double b, double *h, double *s, double *v)
+{
+ double min=QTC_MIN(QTC_MIN(r, g), b),
+ max=QTC_MAX(QTC_MAX(r, g), b),
+ delta=max - min;
+
+ *v=max;
+ if(max != 0)
+ *s=delta / max;
+ else
+ {
+ /* r=g=b=0 s=0, v is undefined */
+ *s=0;
+ *h=-1;
+ return;
+ }
+ if(r == max)
+ *h=(g - b) / delta; /* between yellow & magenta */
+ else if(g == max)
+ *h=2 + (b - r) / delta; /* between cyan & yellow */
+ else
+ *h=4 + (r - g) / delta; /* between magenta & cyan */
+ *h *= 60; /* degrees */
+ if(*h < 0)
+ *h += 360;
+}
+
+static void hsvToRgb(double *r, double *g, double *b, double h, double s, double v)
+{
+ if(0==s)
+ *r=*g=*b=v;
+ else
+ {
+ int i;
+ double f,
+ p;
+
+ h /= 60; /* sector 0 to 5 */
+ i=(int)floor(h);
+ f=h - i; /* factorial part of h */
+ p=v * (1 - s);
+ switch(i)
+ {
+ case 0:
+ *r=v;
+ *g=v * (1 - s * (1 - f));
+ *b=p;
+ break;
+ case 1:
+ *r=v * (1 - s * f);
+ *g=v;
+ *b=p;
+ break;
+ case 2:
+ *r=p;
+ *g=v;
+ *b=v * (1 - s * (1 - f));
+ break;
+ case 3:
+ *r=p;
+ *g=v * (1 - s * f);
+ *b=v;
+ break;
+ case 4:
+ *r=v * (1 - s * (1 - f));
+ *g=p;
+ *b=v;
+ break;
+ /* case 5: */
+ default:
+ *r=v;
+ *g=p;
+ *b=v * (1 - s * f);
+ break;
+ }
+ }
+}
+
+#ifdef __cplusplus
+inline int limit(double c)
+{
+ return c < 0.0 ? 0 : (c > 255.0 ? 255 : (int)c);
+}
+#else
+inline int limit(double c)
+{
+ return c < 0.0
+ ? 0
+ : c > 65535.0
+ ? 65535
+ : (int)c;
+}
+#endif
+
+#ifdef __cplusplus
+static void shade(const color &ca, color *cb, double k)
+#else
+static void shade(const color *ca, color *cb, double k)
+#endif
+{
+ if(equal(k, 1.0))
+ {
+#ifdef __cplusplus
+ *cb=ca;
+#else
+ cb->red = ca->red;
+ cb->green = ca->green;
+ cb->blue = ca->blue;
+#endif
+ }
+ else
+ switch(shading)
+ {
+ case SHADING_SIMPLE:
+ {
+ #ifdef __cplusplus
+ int v=(int)(255.0*(k-1.0));
+
+ cb->setRgb(limit(ca.red()+v), limit(ca.green()+v), limit(ca.blue()+v));
+ #else
+ double v=65535.0*(k-1.0);
+
+ cb->red = limit(ca->red+v);
+ cb->green = limit(ca->green+v);
+ cb->blue = limit(ca->blue+v);
+ #endif
+ break;
+ }
+ case SHADING_HSL:
+ {
+ #ifdef __cplusplus
+ double r(ca.red()/255.0),
+ g(ca.green()/255.0),
+ b(ca.blue()/255.0);
+ #else
+ double r=ca->red/65535.0,
+ g=ca->green/65535.0,
+ b=ca->blue/65535.0;
+ #endif
+ double h, s, l;
+
+ rgbToHsl(r, g, b, &h, &s, &l);
+ l=normalize(l*k);
+ s=normalize(s*k);
+ hslToRgb(h, s, l, &r, &g, &b);
+ #ifdef __cplusplus
+ cb->setRgb(limit(r*255.0), limit(g*255.0), limit(b*255.0));
+ #else
+ cb->red=limit(r*65535.0);
+ cb->green=limit(g*65535.0);
+ cb->blue=limit(b*65535.0);
+ #endif
+ break;
+ }
+ case SHADING_HSV:
+ {
+ #ifdef __cplusplus
+ double r(ca.red()/255.0),
+ g(ca.green()/255.0),
+ b(ca.blue()/255.0);
+ #else
+ double r=ca->red/65535.0,
+ g=ca->green/65535.0,
+ b=ca->blue/65535.0;
+ #endif
+ double h, s, v;
+
+ rgbToHsv(r, g, b, &h, &s, &v);
+
+ v*=k;
+ if (v > 1.0)
+ {
+ s -= v - 1.0;
+ if (s < 0)
+ s = 0;
+ v = 1.0;
+ }
+ hsvToRgb(&r, &g, &b, h, s, v);
+ #ifdef __cplusplus
+ cb->setRgb(limit(r*255.0), limit(g*255.0), limit(b*255.0));
+ #else
+ cb->red=limit(r*65535.0);
+ cb->green=limit(g*65535.0);
+ cb->blue=limit(b*65535.0);
+ #endif
+ }
+ }
+}
+
+static unsigned char checkBounds(int num)
+{
+ return num < 0 ? 0 :
+ num > 255 ? 255 :
+ num;
+}
+
+static void adjustPix(unsigned char *data, int numChannels, int w, int h, int stride,
+ int ro, int go, int bo, double shade)
+{
+ int width=w*numChannels,
+ offset=0,
+ row,
+ r=(int)((ro*shade)+0.5),
+ g=(int)((go*shade)+0.5),
+ b=(int)((bo*shade)+0.5);
+
+ for(row=0; row<h; ++row)
+ {
+ int column;
+
+ for(column=0; column<width; column+=numChannels)
+ {
+ unsigned char source=data[offset+column+1];
+
+#if defined __cplusplus
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ /* ARGB */
+ data[offset+column+1] = checkBounds(r-source);
+ data[offset+column+2] = checkBounds(g-source);
+ data[offset+column+3] = checkBounds(b-source);
+#else
+ /* BGRA */
+ data[offset+column] = checkBounds(b-source);
+ data[offset+column+1] = checkBounds(g-source);
+ data[offset+column+2] = checkBounds(r-source);
+#endif
+#else
+ /* GdkPixbuf is RGBA */
+ data[offset+column] = checkBounds(r-source);
+ data[offset+column+1] = checkBounds(g-source);
+ data[offset+column+2] = checkBounds(b-source);
+#endif
+
+ }
+ offset+=stride;
+ }
+}
+#endif /* QTC_COMMON_NO_FUNCTIONS */
+
+#ifdef __cplusplus
+struct Options
+#else
+typedef struct
+#endif
+{
+ int contrast,
+ passwordChar;
+ double highlightFactor;
+ ERound round;
+ bool embolden,
+ lighterPopupMenuBgnd,
+ highlightTab,
+ colorSelTab,
+ animatedProgress,
+ fixParentlessDialogs,
+ customMenuTextColor,
+ menubarMouseOver,
+ shadeMenubarOnlyWhenActive,
+ thinnerMenuItems,
+#ifndef QTC_PLAIN_FOCUS_ONLY
+ stdFocus,
+#endif
+ lvLines,
+ drawStatusBarFrames,
+ fillSlider,
+ roundMbTopOnly,
+ gradientPbGroove,
+#ifdef __cplusplus
+ stdSidebarButtons,
+ gtkScrollViews,
+ gtkComboMenus,
+/*
+#else
+ setDialogButtonOrder,
+*/
+#endif
+#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
+ mapKdeIcons,
+#endif
+#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ gtkButtonOrder,
+#endif
+ borderMenuitems,
+ colorMenubarMouseOver,
+ darkerBorders,
+ vArrows,
+ xCheck,
+ framelessGroupBoxes,
+ inactiveHighlight;
+ EStripe stripedProgress;
+ ESliderStyle sliderStyle;
+ EMouseOver coloredMouseOver;
+ ETBarBorder toolbarBorders;
+ EDefBtnIndicator defBtnIndicator;
+ ELine sliderThumbs,
+ handles,
+ toolbarSeparators,
+ splitters;
+ EAppearance appearance,
+ menubarAppearance,
+ menuitemAppearance,
+ toolbarAppearance,
+ lvAppearance,
+ tabAppearance,
+ sliderAppearance,
+ progressAppearance;
+ EShade shadeSliders,
+ shadeMenubars,
+ shadeCheckRadio;
+ EEffect buttonEffect;
+ EScrollbar scrollbarType;
+ color customMenubarsColor,
+ customSlidersColor,
+ customMenuNormTextColor,
+ customMenuSelTextColor,
+ customCheckRadioColor;
+ #ifdef QTC_CONFIG_DIALOG
+ EShading shading;
+ #endif
+#ifndef __cplusplus
+} Options;
+#else
+};
+#endif
+
+#if defined QTC_COMMON_FUNCTIONS && !defined QTC_CONFIG_DIALOG
+static EAppearance widgetApp(EWidget w, const Options *opts)
+{
+ switch(w)
+ {
+ case WIDGET_LISTVIEW_HEADER:
+ return opts->lvAppearance;
+ case WIDGET_SB_BUTTON:
+ case WIDGET_SLIDER:
+ case WIDGET_SB_SLIDER:
+ return opts->sliderAppearance;
+ case WIDGET_TAB_TOP:
+ case WIDGET_TAB_BOT:
+ return opts->tabAppearance;
+ case WIDGET_MENU_ITEM:
+ return opts->menuitemAppearance;
+ case WIDGET_PROGRESSBAR:
+ return opts->progressAppearance;
+ case WIDGET_SLIDER_TROUGH:
+ return APPEARANCE_FLAT==opts->appearance || APPEARANCE_RAISED==opts->appearance
+ ? APPEARANCE_FLAT : APPEARANCE_GRADIENT;
+ default:
+ break;
+ }
+
+ return opts->appearance;
+};
+#endif
+
+#endif
diff --git a/common/config_file.c b/common/config_file.c
new file mode 100644
index 0000000..930ce21
--- /dev/null
+++ b/common/config_file.c
@@ -0,0 +1,1238 @@
+/*
+ QtCurve (C) Craig Drummond, 2003 - 2007 [email protected]
+
+ ----
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <pwd.h>
+#include <sys/types.h>
+
+#define QTC_MAX_FILENAME_LEN 1024
+#define QTC_MAX_INPUT_LINE_LEN 256
+#define QTC_FILE "qtcurvestylerc"
+
+#ifdef CONFIG_READ
+static int c2h(char ch)
+{
+ return (ch>='0' && ch<='9') ? ch-'0' :
+ (ch>='a' && ch<='f') ? 10+(ch-'a') :
+ (ch>='A' && ch<='F') ? 10+(ch-'A') :
+ 0;
+}
+
+#define ATOH(str) ((c2h(*str)<<4)+c2h(*(str+1)))
+
+static void setRgb(color *col, const char *str)
+{
+ if(str && strlen(str)>6)
+ {
+ int offset='#'==str[0] ? 1 : 0;
+#ifdef __cplusplus
+ col->setRgb(ATOH(&str[offset]), ATOH(&str[offset+2]), ATOH(&str[offset+4]));
+#else
+ col->red=ATOH(&str[offset])<<8;
+ col->green=ATOH(&str[offset+2])<<8;
+ col->blue=ATOH(&str[offset+4])<<8;
+ col->pixel=0;
+#endif
+ }
+ else
+#ifdef __cplusplus
+ col->setRgb(0, 0, 0);
+#else
+ col->red=col->green=col->blue=col->pixel=0;
+#endif
+}
+
+static EDefBtnIndicator toInd(const char *str, EDefBtnIndicator def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "fontcolor", 9) || 0==memcmp(str, "border", 6))
+ return IND_FONT_COLOR;
+ if(0==memcmp(str, "none", 4))
+ return IND_NONE;
+ if(0==memcmp(str, "corner", 6))
+ return IND_CORNER;
+ if(0==memcmp(str, "colored", 7))
+ return IND_COLORED;
+ }
+
+ return def;
+}
+
+static ELine toLine(const char *str, ELine def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "dashes", 6))
+ return LINE_DASHES;
+ if(0==memcmp(str, "none", 4))
+ return LINE_NONE;
+ if(0==memcmp(str, "sunken", 6))
+ return LINE_SUNKEN;
+ if(0==memcmp(str, "dots", 4))
+ return LINE_DOTS;
+ if(0==memcmp(str, "flat", 4))
+ return LINE_FLAT;
+ }
+ return def;
+}
+
+static ETBarBorder toTBarBorder(const char *str, ETBarBorder def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "dark", 4))
+ return 0==memcmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK;
+ if(0==memcmp(str, "none", 4))
+ return TB_NONE;
+ if(0==memcmp(str, "light", 5))
+ return 0==memcmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT;
+ }
+ return def;
+}
+
+static EMouseOver toMouseOver(const char *str, EMouseOver def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7))
+ return MO_COLORED;
+ if(0==memcmp(str, "plastik", 7))
+ return MO_PLASTIK;
+ if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4))
+ return MO_NONE;
+ }
+ return def;
+}
+
+static EAppearance toAppearance(const char *str, EAppearance def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "flat", 4))
+ return APPEARANCE_FLAT;
+ if(0==memcmp(str, "raised", 6))
+ return APPEARANCE_RAISED;
+ if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13))
+ return APPEARANCE_GRADIENT;
+ if(0==memcmp(str, "splitgradient", 13))
+ return APPEARANCE_SPLIT_GRADIENT;
+ if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10))
+ return APPEARANCE_SHINY_GLASS;
+ if(0==memcmp(str, "dullglass", 9))
+ return APPEARANCE_DULL_GLASS;
+ if(0==memcmp(str, "inverted", 8))
+ return APPEARANCE_INVERTED;
+ if(0==memcmp(str, "bevelled", 8))
+ return APPEARANCE_BEVELLED;
+ }
+ return def;
+}
+
+static EShade toShade(const char *str, bool allowDarken, EShade def)
+{
+ if(str)
+ {
+ /* true/false is from 0.25... */
+ if(0==memcmp(str, "true", 4) || 0==memcmp(str, "selected", 8))
+ return SHADE_BLEND_SELECTED;
+ if(0==memcmp(str, "origselected", 12))
+ return SHADE_SELECTED;
+ if(allowDarken && 0==memcmp(str, "darken", 6))
+ return SHADE_DARKEN;
+ if(0==memcmp(str, "custom", 6))
+ return SHADE_CUSTOM;
+ if(0==memcmp(str, "none", 4))
+ return SHADE_NONE;
+ }
+
+ return def;
+}
+
+/* Prior to 0.42 round was a bool - so need to read 'false' as 'none' */
+static ERound toRound(const char *str, ERound def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5))
+ return ROUND_NONE;
+ if(0==memcmp(str, "slight", 6))
+ return ROUND_SLIGHT;
+ if(0==memcmp(str, "full", 4))
+ return ROUND_FULL;
+ }
+
+ return def;
+}
+
+static EScrollbar toScrollbar(const char *str, EScrollbar def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "kde", 3))
+ return SCROLLBAR_KDE;
+ if(0==memcmp(str, "windows", 7))
+ return SCROLLBAR_WINDOWS;
+ if(0==memcmp(str, "platinum", 8))
+ return SCROLLBAR_PLATINUM;
+ if(0==memcmp(str, "next", 4))
+ return SCROLLBAR_NEXT;
+ if(0==memcmp(str, "none", 4))
+ return SCROLLBAR_NONE;
+ }
+
+ return def;
+}
+
+static EEffect toEffect(const char *str, EEffect def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "none", 4))
+ return EFFECT_NONE;
+ if(0==memcmp(str, "shadow", 6))
+ return EFFECT_SHADOW;
+ if(0==memcmp(str, "etch", 4))
+ return EFFECT_ETCH;
+ }
+
+ return def;
+}
+
+static EShading toShading(const char * str, EShading def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "simple", 6))
+ return SHADING_SIMPLE;
+ if(0==memcmp(str, "hsl", 3))
+ return SHADING_HSL;
+ if(0==memcmp(str, "hsv", 3))
+ return SHADING_HSV;
+ }
+
+ return def;
+}
+
+static EStripe toStripe(const char * str, EStripe def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "plain", 5) || 0==memcmp(str, "true", 4))
+ return STRIPE_PLAIN;
+ if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5))
+ return STRIPE_NONE;
+ if(0==memcmp(str, "diagonal", 8))
+ return STRIPE_DIAGONAL;
+ }
+
+ return def;
+}
+
+static ESliderStyle toSlider(const char * str, ESliderStyle def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "round", 5))
+ return SLIDER_ROUND;
+ if(0==memcmp(str, "plain", 5))
+ return SLIDER_PLAIN;
+ if(0==memcmp(str, "triangular", 10))
+ return SLIDER_TRIANGULAR;
+ }
+
+ return def;
+}
+
+#endif
+
+#ifdef CONFIG_WRITE
+#include <kstandarddirs.h>
+#endif
+
+static const char * getHome()
+{
+ static const char *home=NULL;
+
+ if(!home)
+ {
+ struct passwd *p=getpwuid(getuid());
+
+ if(p)
+ home=p->pw_dir;
+ else
+ {
+ char *env=getenv("HOME");
+
+ if(env)
+ home=env;
+ }
+
+ if(!home)
+ home="/tmp";
+ }
+
+ return home;
+}
+
+static const char *xdgConfigFolder()
+{
+ static char xdgDir[QTC_MAX_FILENAME_LEN]={'\0'};
+
+ if(!xdgDir[0])
+ {
+ static const char *home=NULL;
+
+#if 0
+ char *env=getenv("XDG_CONFIG_HOME");
+
+ /*
+ Check the setting of XDG_CONFIG_HOME
+ For some reason, sudo leaves the env vars set to those of the
+ caller - so XDG_CONFIG_HOME would point to the users setting, and
+ not roots.
+
+ Therefore, check that home is first part of XDG_CONFIG_HOME
+ */
+
+ if(env && 0==getuid())
+ {
+ if(!home)
+ home=getHome();
+ if(home && home!=strstr(env, home))
+ env=NULL;
+ }
+#else
+ /*
+ Hmm... for 'root' dont bother to check env var, just set to ~/.config
+ - as problems would arise if "sudo kcmshell style", and then
+ "sudo su" / "kcmshell style". The 1st would write to ~/.config, but
+ if root has a XDG_ set then that would be used on the second :-(
+ */
+ char *env=0==getuid() ? NULL : getenv("XDG_CONFIG_HOME");
+#endif
+
+ if(!env)
+ {
+ if(!home)
+ home=getHome();
+
+ sprintf(xdgDir, "%s/.config", home);
+ }
+ else
+ strcpy(xdgDir, env);
+
+#if defined CONFIG_WRITE || !defined __cplusplus
+ {
+ struct stat info;
+
+ if(0!=lstat(xdgDir, &info))
+ {
+#ifdef __cplusplus
+ KStandardDirs::makeDir(xdgDir, 0755);
+#else
+ g_mkdir_with_parents(xdgDir, 0755);
+#endif
+ }
+ }
+#endif
+ }
+
+ return xdgDir;
+}
+
+#ifdef CONFIG_READ
+
+#ifdef __cplusplus
+#define QTC_IS_BLACK(A) (0==(A).red() && 0==(A).green() && 0==(A).blue())
+#else
+#define QTC_IS_BLACK(A) (0==(A).red && 0==(A).green && 0==(A).blue)
+#endif
+
+static void checkColor(EShade *s, color *c)
+{
+ if(SHADE_CUSTOM==*s && QTC_IS_BLACK(*c))
+ *s=SHADE_NONE;
+}
+
+#ifdef __cplusplus
+
+#if QT_VERSION >= 0x040000
+#include <QMap>
+#include <QFile>
+#include <QTextStream>
+#define QTC_LATIN1(A) A.toLatin1()
+#else
+#define QTC_LATIN1(A) A.latin1()
+
+#include <qmap.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#endif
+
+class QtCConfig
+{
+ public:
+
+ QtCConfig(const QString &filename);
+
+ bool ok() const { return values.count()>0; }
+ const QString & readEntry(const char *key, const QString &def=QString::null);
+
+ private:
+
+ QMap<QString, QString> values;
+};
+
+QtCConfig::QtCConfig(const QString &filename)
+{
+ QFile f(filename);
+
+#if QT_VERSION >= 0x040000
+ if(f.open(QIODevice::ReadOnly))
+#else
+ if(f.open(IO_ReadOnly))
+#endif
+ {
+ QTextStream stream(&f);
+ QString line;
+
+ while(!stream.atEnd())
+ {
+ line = stream.readLine();
+#if QT_VERSION >= 0x040000
+ int pos=line.indexOf('=');
+#else
+ int pos=line.find('=');
+#endif
+ if(-1!=pos)
+ values[line.left(pos)]=line.mid(pos+1);
+ }
+ f.close();
+ }
+}
+
+inline const QString & QtCConfig::readEntry(const char *key, const QString &def)
+{
+ return values.contains(key) ? values[key] : def;
+}
+
+inline QString readStringEntry(QtCConfig &cfg, const char *key)
+{
+ return cfg.readEntry(key);
+}
+
+static int readNumEntry(QtCConfig &cfg, const char *key, int def)
+{
+ const QString &val(readStringEntry(cfg, key));
+
+ return val.isEmpty() ? def : val.toInt();
+}
+
+static bool readBoolEntry(QtCConfig &cfg, const char *key, bool def)
+{
+ const QString &val(readStringEntry(cfg, key));
+
+ return val.isEmpty() ? def : (val=="true" ? true : false);
+}
+
+#if QT_VERSION >= 0x040000
+#define QTC_LATIN1(A) A.toLatin1()
+#else
+#define QTC_LATIN1(A) A.latin1()
+#endif
+
+#define QTC_CFG_READ_COLOR(ENTRY) \
+ { \
+ QString sVal(cfg.readEntry(#ENTRY)); \
+ if(sVal.isEmpty()) \
+ opts->ENTRY=def->ENTRY; \
+ else \
+ setRgb(&(opts->ENTRY), QTC_LATIN1(sVal)); \
+ }
+
+#else
+
+static char * lookupCfgHash(GHashTable **cfg, char *key, char *val)
+{
+ char *rv=NULL;
+
+ if(!*cfg)
+ *cfg=g_hash_table_new(g_str_hash, g_str_equal);
+ else
+ rv=(char *)g_hash_table_lookup(*cfg, key);
+
+ if(!rv && val)
+ {
+ g_hash_table_insert(*cfg, g_strdup(key), g_strdup(val));
+ rv=(char *)g_hash_table_lookup(*cfg, key);
+ }
+
+ return rv;
+}
+
+static GHashTable * loadConfig(const char *filename)
+{
+ FILE *f=fopen(filename, "r");
+ GHashTable *cfg=NULL;
+
+ if(f)
+ {
+ char line[QTC_MAX_INPUT_LINE_LEN];
+
+ while(NULL!=fgets(line, QTC_MAX_INPUT_LINE_LEN-1, f))
+ {
+ char *eq=strchr(line, '=');
+ int pos=eq ? eq-line : -1;
+
+ if(pos>0)
+ {
+ char *endl=strchr(line, '\n');
+
+ if(endl)
+ *endl='\0';
+
+ line[pos]='\0';
+
+ lookupCfgHash(&cfg, line, &line[pos+1]);
+ }
+ }
+
+ fclose(f);
+ }
+
+ return cfg;
+}
+
+static void releaseConfig(GHashTable *cfg)
+{
+ g_hash_table_destroy(cfg);
+}
+
+static char * readStringEntry(GHashTable *cfg, char *key)
+{
+ return lookupCfgHash(&cfg, key, NULL);
+}
+
+static int readNumEntry(GHashTable *cfg, char *key, int def)
+{
+ char *str=readStringEntry(cfg, key);
+
+ return str ? atoi(str) : def;
+}
+
+static gboolean readBoolEntry(GHashTable *cfg, char *key, gboolean def)
+{
+ char *str=readStringEntry(cfg, key);
+
+ return str ? (0==memcmp(str, "true", 4) ? true : false) : def;
+}
+
+#define QTC_LATIN1(A) A
+
+#define QTC_CFG_READ_COLOR(ENTRY) \
+ { \
+ const char *str=readStringEntry(cfg, #ENTRY); \
+ \
+ if(str) \
+ setRgb(&(opts->ENTRY), str); \
+ else \
+ opts->ENTRY=def->ENTRY; \
+ }
+#endif
+
+#define QTC_CFG_READ_NUM(ENTRY) \
+ opts->ENTRY=readNumEntry(cfg, #ENTRY, def->ENTRY);
+
+#define QTC_CFG_READ_BOOL(ENTRY) \
+ opts->ENTRY=readBoolEntry(cfg, #ENTRY, def->ENTRY);
+
+#define QTC_CFG_READ_ROUND(ENTRY) \
+ opts->ENTRY=toRound(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_DI(ENTRY) \
+ opts->ENTRY=((double)(readNumEntry(cfg, #ENTRY, ((int)(def->ENTRY*100))-100)+100))/100.0;
+
+#define QTC_CFG_READ_TB_BORDER(ENTRY) \
+ opts->ENTRY=toTBarBorder(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_MOUSE_OVER(ENTRY) \
+ opts->ENTRY=toMouseOver(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_APPEARANCE(ENTRY, DEF) \
+ opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF);
+
+/*
+#define QTC_CFG_READ_APPEARANCE(ENTRY) \
+ opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+*/
+
+#define QTC_CFG_READ_STRIPE(ENTRY) \
+ opts->ENTRY=toStripe(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_SLIDER(ENTRY) \
+ opts->ENTRY=toSlider(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_DEF_BTN(ENTRY) \
+ opts->ENTRY=toInd(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_LINE(ENTRY) \
+ opts->ENTRY=toLine(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_SHADE(ENTRY, AD) \
+ opts->ENTRY=toShade(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), AD, def->ENTRY);
+
+#define QTC_CFG_READ_SCROLLBAR(ENTRY) \
+ opts->ENTRY=toScrollbar(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_EFFECT(ENTRY) \
+ opts->ENTRY=toEffect(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#ifdef QTC_CONFIG_DIALOG
+#define QTC_CFG_READ_SHADING(ENTRY, UNUSED) \
+ opts->ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#else
+#define QTC_CFG_READ_SHADING(ENTRY, DEF) \
+ ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF);
+#endif
+
+#ifdef __cplusplus
+static bool readConfig(const QString &file, Options *opts, Options *def)
+#else
+static bool readConfig(const char *file, Options *opts, Options *def)
+#endif
+{
+#ifdef __cplusplus
+ if(file.isEmpty())
+ {
+ const char *xdg=xdgConfigFolder();
+
+ if(xdg)
+ {
+ QString filename(xdg);
+
+ filename+="/"QTC_FILE;
+ return readConfig(filename, opts, def);
+ }
+ }
+#else
+ if(!file)
+ {
+ const char *xdg=xdgConfigFolder();
+
+ if(xdg)
+ {
+ char filename[QTC_MAX_FILENAME_LEN];
+
+ sprintf(filename, "%s/"QTC_FILE, xdg);
+ return readConfig(filename, opts, def);
+ }
+ }
+#endif
+ else
+ {
+#ifdef __cplusplus
+ QtCConfig cfg(file);
+
+ if(cfg.ok())
+ {
+#else
+ GHashTable *cfg=loadConfig(file);
+
+ if(cfg)
+ {
+#endif
+ QTC_CFG_READ_NUM(passwordChar)
+ QTC_CFG_READ_ROUND(round)
+ QTC_CFG_READ_DI(highlightFactor)
+ QTC_CFG_READ_TB_BORDER(toolbarBorders)
+ QTC_CFG_READ_APPEARANCE(appearance, def->appearance)
+ QTC_CFG_READ_BOOL(fixParentlessDialogs)
+ QTC_CFG_READ_STRIPE(stripedProgress)
+ QTC_CFG_READ_SLIDER(sliderStyle)
+ QTC_CFG_READ_BOOL(animatedProgress)
+ QTC_CFG_READ_BOOL(lighterPopupMenuBgnd)
+ QTC_CFG_READ_BOOL(embolden)
+ QTC_CFG_READ_DEF_BTN(defBtnIndicator)
+ QTC_CFG_READ_LINE(sliderThumbs)
+ QTC_CFG_READ_LINE(handles)
+ QTC_CFG_READ_BOOL(highlightTab)
+ QTC_CFG_READ_BOOL(colorSelTab)
+ QTC_CFG_READ_SHADE(shadeSliders, false)
+ QTC_CFG_READ_SHADE(shadeMenubars, true)
+ QTC_CFG_READ_SHADE(shadeCheckRadio, false)
+ QTC_CFG_READ_APPEARANCE(menubarAppearance, def->menubarAppearance)
+ QTC_CFG_READ_APPEARANCE(menuitemAppearance, opts->appearance)
+ QTC_CFG_READ_APPEARANCE(toolbarAppearance, def->toolbarAppearance)
+ QTC_CFG_READ_LINE(toolbarSeparators)
+ QTC_CFG_READ_LINE(splitters)
+ QTC_CFG_READ_BOOL(customMenuTextColor)
+ QTC_CFG_READ_MOUSE_OVER(coloredMouseOver)
+ QTC_CFG_READ_BOOL(menubarMouseOver)
+ QTC_CFG_READ_BOOL(shadeMenubarOnlyWhenActive)
+ QTC_CFG_READ_BOOL(thinnerMenuItems)
+ QTC_CFG_READ_COLOR(customSlidersColor)
+ QTC_CFG_READ_COLOR(customMenubarsColor)
+ QTC_CFG_READ_COLOR(customMenuSelTextColor)
+ QTC_CFG_READ_COLOR(customMenuNormTextColor)
+ QTC_CFG_READ_COLOR(customCheckRadioColor)
+ QTC_CFG_READ_SCROLLBAR(scrollbarType)
+ QTC_CFG_READ_EFFECT(buttonEffect)
+ QTC_CFG_READ_APPEARANCE(lvAppearance, opts->appearance)
+ QTC_CFG_READ_APPEARANCE(tabAppearance, opts->appearance)
+ QTC_CFG_READ_APPEARANCE(sliderAppearance, opts->appearance)
+ QTC_CFG_READ_APPEARANCE(progressAppearance, opts->appearance)
+#ifndef QTC_PLAIN_FOCUS_ONLY
+ QTC_CFG_READ_BOOL(stdFocus)
+#endif
+ QTC_CFG_READ_BOOL(lvLines)
+ QTC_CFG_READ_BOOL(drawStatusBarFrames)
+ QTC_CFG_READ_BOOL(fillSlider)
+ QTC_CFG_READ_BOOL(roundMbTopOnly)
+ QTC_CFG_READ_BOOL(borderMenuitems)
+ QTC_CFG_READ_BOOL(gradientPbGroove)
+ QTC_CFG_READ_BOOL(darkerBorders)
+ QTC_CFG_READ_BOOL(vArrows)
+ QTC_CFG_READ_BOOL(xCheck)
+ QTC_CFG_READ_BOOL(framelessGroupBoxes)
+ QTC_CFG_READ_BOOL(inactiveHighlight)
+ QTC_CFG_READ_BOOL(colorMenubarMouseOver)
+#ifdef __cplusplus
+ QTC_CFG_READ_BOOL(stdSidebarButtons)
+ QTC_CFG_READ_BOOL(gtkScrollViews)
+ QTC_CFG_READ_BOOL(gtkComboMenus)
+/*
+#else
+ QTC_CFG_READ_BOOL(setDialogButtonOrder)
+*/
+#endif
+#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
+ QTC_CFG_READ_BOOL(mapKdeIcons)
+#endif
+#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ QTC_CFG_READ_BOOL(gtkButtonOrder)
+#endif
+ QTC_CFG_READ_SHADING(shading, shading);
+
+#ifndef __cplusplus
+ releaseConfig(cfg);
+#endif
+ if(SHADE_SELECTED==opts->shadeCheckRadio)
+ opts->shadeCheckRadio=SHADE_BLEND_SELECTED;
+
+ checkColor(&opts->shadeMenubars, &opts->customMenubarsColor);
+ checkColor(&opts->shadeSliders, &opts->customSlidersColor);
+ checkColor(&opts->shadeCheckRadio, &opts->customCheckRadioColor);
+
+ if(APPEARANCE_BEVELLED==opts->toolbarAppearance)
+ opts->toolbarAppearance=APPEARANCE_GRADIENT;
+ else if(APPEARANCE_RAISED==opts->toolbarAppearance)
+ opts->toolbarAppearance=APPEARANCE_FLAT;
+
+ if(APPEARANCE_BEVELLED==opts->menubarAppearance)
+ opts->menubarAppearance=APPEARANCE_GRADIENT;
+ else if(APPEARANCE_RAISED==opts->menubarAppearance)
+ opts->menubarAppearance=APPEARANCE_FLAT;
+
+ if(APPEARANCE_BEVELLED==opts->sliderAppearance)
+ opts->sliderAppearance=APPEARANCE_GRADIENT;
+
+ if(APPEARANCE_BEVELLED==opts->tabAppearance)
+ opts->tabAppearance=APPEARANCE_GRADIENT;
+
+ if(opts->highlightFactor<((100.0+MIN_HIGHLIGHT_FACTOR)/100.0) ||
+ opts->highlightFactor>((100.0+MAX_HIGHLIGHT_FACTOR)/100.0))
+ opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR;
+
+ if(opts->animatedProgress && !opts->stripedProgress)
+ opts->animatedProgress=false;
+
+ if(opts->colorSelTab && APPEARANCE_GRADIENT!=opts->tabAppearance)
+ opts->colorSelTab=false;
+
+ if(SHADE_CUSTOM==opts->shadeMenubars || SHADE_BLEND_SELECTED==opts->shadeMenubars || !opts->borderMenuitems)
+ opts->colorMenubarMouseOver=true;
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool fileExists(const char *path)
+{
+ struct stat info;
+
+ return 0==lstat(path, &info) && (info.st_mode&S_IFMT)==S_IFREG;
+}
+
+static const char * getSystemConfigFile()
+{
+ static const char * constFiles[]={ "/etc/qt4/"QTC_FILE, "/etc/qt3/"QTC_FILE, "/etc/qt/"QTC_FILE, NULL };
+
+ int i;
+
+ for(i=0; constFiles[i]; ++i)
+ if(fileExists(constFiles[i]))
+ return constFiles[i];
+ return NULL;
+}
+
+static void defaultSettings(Options *opts)
+{
+ /* Set hard-coded defaults... */
+ opts->contrast=7;
+ opts->passwordChar=0x25CF;
+ opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR;
+ opts->round=ROUND_FULL;
+ opts->lighterPopupMenuBgnd=true;
+ opts->animatedProgress=true;
+ opts->stripedProgress=STRIPE_DIAGONAL;
+ opts->sliderStyle=SLIDER_TRIANGULAR;
+ opts->highlightTab=true;
+ opts->colorSelTab=false;
+ opts->embolden=false;
+ opts->appearance=APPEARANCE_DULL_GLASS;
+ opts->lvAppearance=APPEARANCE_BEVELLED;
+ opts->tabAppearance=APPEARANCE_GRADIENT;
+ opts->sliderAppearance=APPEARANCE_DULL_GLASS;
+ opts->menubarAppearance=APPEARANCE_GRADIENT;
+ opts->menuitemAppearance=APPEARANCE_DULL_GLASS;
+ opts->toolbarAppearance=APPEARANCE_FLAT;
+ opts->progressAppearance=APPEARANCE_DULL_GLASS;
+ opts->defBtnIndicator=IND_COLORED;
+ opts->sliderThumbs=LINE_FLAT;
+ opts->handles=LINE_SUNKEN;
+ opts->shadeSliders=SHADE_BLEND_SELECTED;
+ opts->shadeMenubars=SHADE_NONE;
+ opts->shadeCheckRadio=SHADE_NONE;
+ opts->toolbarBorders=TB_NONE;
+ opts->toolbarSeparators=LINE_NONE;
+ opts->splitters=LINE_FLAT;
+ opts->fixParentlessDialogs=false;
+ opts->customMenuTextColor=false;
+ opts->coloredMouseOver=MO_PLASTIK;
+ opts->menubarMouseOver=true;
+ opts->shadeMenubarOnlyWhenActive=true;
+ opts->thinnerMenuItems=false;
+ opts->scrollbarType=SCROLLBAR_KDE;
+ opts->buttonEffect=EFFECT_NONE;
+#ifndef QTC_PLAIN_FOCUS_ONLY
+ opts->stdFocus=true;
+#endif
+ opts->lvLines=false;
+ opts->drawStatusBarFrames=false;
+ opts->fillSlider=true;
+ opts->roundMbTopOnly=true;
+ opts->borderMenuitems=true;
+ opts->gradientPbGroove=true;
+ opts->darkerBorders=false;
+ opts->vArrows=false;
+ opts->xCheck=false;
+ opts->framelessGroupBoxes=false;
+ opts->colorMenubarMouseOver=false;
+ opts->inactiveHighlight=false;
+#ifdef QTC_CONFIG_DIALOG
+ opts->shading=SHADING_HSL;
+#endif
+#ifdef __cplusplus
+ opts->stdSidebarButtons=false;
+ opts->gtkScrollViews=false;
+ opts->gtkComboMenus=false;
+ opts->customMenubarsColor.setRgb(0, 0, 0);
+ opts->customSlidersColor.setRgb(0, 0, 0);
+ opts->customMenuNormTextColor.setRgb(0, 0, 0);
+ opts->customMenuSelTextColor.setRgb(0, 0, 0);
+ opts->customCheckRadioColor.setRgb(0, 0, 0);
+#else
+/*
+ opts->setDialogButtonOrder=false;
+*/
+ opts->customMenubarsColor.red=opts->customMenubarsColor.green=opts->customMenubarsColor.blue=0;
+ opts->customSlidersColor.red=opts->customSlidersColor.green=opts->customSlidersColor.blue=0;
+ opts->customMenuNormTextColor.red=opts->customMenuNormTextColor.green=opts->customMenuNormTextColor.blue=0;
+ opts->customMenuSelTextColor.red=opts->customMenuSelTextColor.green=opts->customMenuSelTextColor.blue=0;
+ opts->customCheckRadioColor.red=opts->customCheckRadioColor.green=opts->customCheckRadioColor.blue=0;
+#endif
+
+#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
+ opts->mapKdeIcons=true;
+#endif
+#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ opts->gtkButtonOrder=false;
+#endif
+
+ /* Read system config file... */
+ {
+ static const char * systemFilename=NULL;
+
+ if(!systemFilename)
+ systemFilename=getSystemConfigFile();
+
+ if(systemFilename)
+ readConfig(systemFilename, opts, opts);
+ }
+}
+
+#endif
+
+#ifdef CONFIG_WRITE
+static const char *toStr(EDefBtnIndicator ind)
+{
+ switch(ind)
+ {
+ case IND_NONE:
+ return "none";
+ case IND_FONT_COLOR:
+ return "fontcolor";
+ case IND_CORNER:
+ return "corner";
+ default:
+ return "colored";
+ }
+}
+
+static const char *toStr(ELine ind, bool none)
+{
+ switch(ind)
+ {
+ case LINE_DOTS:
+ return "dots";
+ case LINE_DASHES:
+ return none ? "none" : "dashes";
+ case LINE_FLAT:
+ return "flat";
+ default:
+ return "sunken";
+ }
+}
+
+static const char *toStr(ETBarBorder ind)
+{
+ switch(ind)
+ {
+ case TB_DARK:
+ return "dark";
+ case TB_DARK_ALL:
+ return "dark-all";
+ case TB_LIGHT_ALL:
+ return "light-all";
+ case TB_NONE:
+ return "none";
+ default:
+ return "light";
+ }
+}
+
+static const char *toStr(EMouseOver mo)
+{
+ switch(mo)
+ {
+ case MO_COLORED:
+ return "colored";
+ case MO_NONE:
+ return "none";
+ default:
+ return "plastik";
+ }
+}
+
+static const char *toStr(EAppearance exp)
+{
+ switch(exp)
+ {
+ case APPEARANCE_FLAT:
+ return "flat";
+ case APPEARANCE_RAISED:
+ return "raised";
+ case APPEARANCE_GRADIENT:
+ return "gradient";
+ case APPEARANCE_SPLIT_GRADIENT:
+ return "splitgradient";
+ case APPEARANCE_DULL_GLASS:
+ return "dullglass";
+ case APPEARANCE_BEVELLED:
+ return "bevelled";
+ case APPEARANCE_INVERTED:
+ return "inverted";
+ default:
+ return "shinyglass";
+ }
+}
+
+static const char *toStr(EShade exp, bool dark, bool convertBlendSelToSel)
+{
+ switch(exp)
+ {
+ default:
+ case SHADE_NONE:
+ return "none";
+ case SHADE_BLEND_SELECTED:
+ return dark || !convertBlendSelToSel ? "selected" : "origselected";
+ case SHADE_CUSTOM:
+ return "custom";
+ /* case SHADE_SELECTED */
+ case SHADE_DARKEN:
+ return dark ? "darken" : "origselected";
+ }
+}
+
+static const char *toStr(ERound exp)
+{
+ switch(exp)
+ {
+ case ROUND_NONE:
+ return "none";
+ case ROUND_SLIGHT:
+ return "slight";
+ default:
+ case ROUND_FULL:
+ return "full";
+ }
+}
+
+static const char *toStr(EScrollbar sb)
+{
+ switch(sb)
+ {
+ case SCROLLBAR_KDE:
+ return "kde";
+ default:
+ case SCROLLBAR_WINDOWS:
+ return "windows";
+ case SCROLLBAR_PLATINUM:
+ return "platinum";
+ case SCROLLBAR_NEXT:
+ return "next";
+ case SCROLLBAR_NONE:
+ return "none";
+ }
+}
+
+static const char *toStr(EEffect e)
+{
+ switch(e)
+ {
+ case EFFECT_NONE:
+ return "none";
+ default:
+ case EFFECT_SHADOW:
+ return "shadow";
+ case EFFECT_ETCH:
+ return "etch";
+ }
+}
+
+inline const char * toStr(bool b) { return b ? "true" : "false"; }
+
+static QString toStr(const QColor &col)
+{
+ QString colorStr;
+
+ colorStr.sprintf("#%02X%02X%02X", col.red(), col.green(), col.blue());
+ return colorStr;
+}
+
+static const char *toStr(EShading s)
+{
+ switch(s)
+ {
+ case SHADING_SIMPLE:
+ return "simple";
+ default:
+ case SHADING_HSL:
+ return "hsl";
+ case SHADING_HSV:
+ return "hsv";
+ }
+}
+
+static const char *toStr(EStripe s)
+{
+ switch(s)
+ {
+ default:
+ case STRIPE_PLAIN:
+ return "plain";
+ case STRIPE_NONE:
+ return "none";
+ case STRIPE_DIAGONAL:
+ return "diagonal";
+ }
+}
+
+static const char *toStr(ESliderStyle s)
+{
+ switch(s)
+ {
+ case SLIDER_PLAIN:
+ return "plain";
+ case SLIDER_TRIANGULAR:
+ return "triangular";
+ default:
+ case SLIDER_ROUND:
+ return "round";
+ }
+}
+
+#if QT_VERSION >= 0x040000
+#define CFG config
+#else
+#define CFG (*cfg)
+#endif
+
+#define CFG_WRITE_ENTRY(ENTRY) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY));
+
+#define CFG_WRITE_ENTRY_FORCE(ENTRY) \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY));
+
+#define CFG_WRITE_ENTRY_B(ENTRY, B) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, B));
+
+#define CFG_WRITE_ENTRY_SHADE(ENTRY, DARK, CONVERT_SHADE) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, DARK, CONVERT_SHADE));
+
+#define CFG_WRITE_ENTRY_D(ENTRY) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, ((int)(opts.ENTRY*100))-100);
+
+#define CFG_WRITE_ENTRY_NUM(ENTRY) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, opts.ENTRY);
+
+bool static writeConfig(KConfig *cfg, const Options &opts, const Options &def, bool exportingStyle=false)
+{
+ if(!cfg)
+ {
+ const char *xdg=xdgConfigFolder();
+
+ if(xdg)
+ {
+ char filename[QTC_MAX_FILENAME_LEN];
+
+ sprintf(filename, "%s/"QTC_FILE, xdg);
+
+#if QT_VERSION >= 0x040000
+ KConfig defCfg(filename, KConfig::SimpleConfig);
+#else
+ KConfig defCfg(filename, false, false);
+#endif
+
+ return writeConfig(&defCfg, opts, def, exportingStyle);
+ }
+ }
+ else
+ {
+#if QT_VERSION >= 0x040000
+ KConfigGroup config(cfg, QTC_GROUP);
+#else
+ cfg->setGroup(QTC_GROUP);
+#endif
+ CFG_WRITE_ENTRY_NUM(passwordChar)
+ CFG_WRITE_ENTRY(round)
+ CFG_WRITE_ENTRY_D(highlightFactor)
+ CFG_WRITE_ENTRY(toolbarBorders)
+ CFG_WRITE_ENTRY_FORCE(appearance)
+ CFG_WRITE_ENTRY(fixParentlessDialogs)
+ CFG_WRITE_ENTRY(stripedProgress)
+ CFG_WRITE_ENTRY(sliderStyle)
+ CFG_WRITE_ENTRY(animatedProgress)
+ CFG_WRITE_ENTRY(lighterPopupMenuBgnd)
+ CFG_WRITE_ENTRY(embolden)
+ CFG_WRITE_ENTRY(defBtnIndicator)
+ CFG_WRITE_ENTRY_B(sliderThumbs, true)
+ CFG_WRITE_ENTRY_B(handles, false)
+ CFG_WRITE_ENTRY(highlightTab)
+ CFG_WRITE_ENTRY(colorSelTab)
+ CFG_WRITE_ENTRY_SHADE(shadeSliders, false, false)
+ CFG_WRITE_ENTRY_SHADE(shadeMenubars, true, false)
+ CFG_WRITE_ENTRY_SHADE(shadeCheckRadio, false, true)
+ CFG_WRITE_ENTRY_FORCE(menubarAppearance)
+ CFG_WRITE_ENTRY_FORCE(menuitemAppearance)
+ CFG_WRITE_ENTRY_FORCE(toolbarAppearance)
+ CFG_WRITE_ENTRY_B(toolbarSeparators, true)
+ CFG_WRITE_ENTRY_B(splitters, false)
+ CFG_WRITE_ENTRY(customMenuTextColor)
+ CFG_WRITE_ENTRY(coloredMouseOver)
+ CFG_WRITE_ENTRY(menubarMouseOver)
+ CFG_WRITE_ENTRY(shadeMenubarOnlyWhenActive)
+ CFG_WRITE_ENTRY(thinnerMenuItems)
+ CFG_WRITE_ENTRY(customSlidersColor)
+ CFG_WRITE_ENTRY(customMenubarsColor)
+ CFG_WRITE_ENTRY(customMenuSelTextColor)
+ CFG_WRITE_ENTRY(customMenuNormTextColor)
+ CFG_WRITE_ENTRY(customCheckRadioColor)
+ CFG_WRITE_ENTRY(scrollbarType)
+ CFG_WRITE_ENTRY(buttonEffect)
+ CFG_WRITE_ENTRY_FORCE(lvAppearance)
+ CFG_WRITE_ENTRY_FORCE(tabAppearance)
+ CFG_WRITE_ENTRY_FORCE(sliderAppearance)
+ CFG_WRITE_ENTRY_FORCE(progressAppearance)
+#ifndef QTC_PLAIN_FOCUS_ONLY
+ CFG_WRITE_ENTRY(stdFocus)
+#endif
+ CFG_WRITE_ENTRY(lvLines)
+ CFG_WRITE_ENTRY(drawStatusBarFrames)
+ CFG_WRITE_ENTRY(fillSlider)
+ CFG_WRITE_ENTRY(roundMbTopOnly)
+ CFG_WRITE_ENTRY(borderMenuitems)
+ CFG_WRITE_ENTRY(gradientPbGroove)
+ CFG_WRITE_ENTRY(darkerBorders)
+ CFG_WRITE_ENTRY(vArrows)
+ CFG_WRITE_ENTRY(xCheck)
+ CFG_WRITE_ENTRY(framelessGroupBoxes)
+ CFG_WRITE_ENTRY(inactiveHighlight)
+#ifdef __cplusplus
+ CFG_WRITE_ENTRY(stdSidebarButtons)
+#endif
+
+ CFG_WRITE_ENTRY(gtkScrollViews)
+ CFG_WRITE_ENTRY(gtkComboMenus)
+ CFG_WRITE_ENTRY(gtkButtonOrder)
+ CFG_WRITE_ENTRY(mapKdeIcons)
+ CFG_WRITE_ENTRY(shading)
+ cfg->sync();
+ return true;
+ }
+ return false;
+}
+#endif
diff --git a/common/config_file.c-orig b/common/config_file.c-orig
new file mode 100644
index 0000000..fd51e01
--- /dev/null
+++ b/common/config_file.c-orig
@@ -0,0 +1,1238 @@
+/*
+ QtCurve (C) Craig Drummond, 2003 - 2007 [email protected]
+
+ ----
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License version 2 as published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include "common.h"
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <pwd.h>
+#include <sys/types.h>
+
+#define QTC_MAX_FILENAME_LEN 1024
+#define QTC_MAX_INPUT_LINE_LEN 256
+#define QTC_FILE "qtcurvestylerc"
+
+#ifdef CONFIG_READ
+static int c2h(char ch)
+{
+ return (ch>='0' && ch<='9') ? ch-'0' :
+ (ch>='a' && ch<='f') ? 10+(ch-'a') :
+ (ch>='A' && ch<='F') ? 10+(ch-'A') :
+ 0;
+}
+
+#define ATOH(str) ((c2h(*str)<<4)+c2h(*(str+1)))
+
+static void setRgb(color *col, const char *str)
+{
+ if(str && strlen(str)>6)
+ {
+ int offset='#'==str[0] ? 1 : 0;
+#ifdef __cplusplus
+ col->setRgb(ATOH(&str[offset]), ATOH(&str[offset+2]), ATOH(&str[offset+4]));
+#else
+ col->red=ATOH(&str[offset])<<8;
+ col->green=ATOH(&str[offset+2])<<8;
+ col->blue=ATOH(&str[offset+4])<<8;
+ col->pixel=0;
+#endif
+ }
+ else
+#ifdef __cplusplus
+ col->setRgb(0, 0, 0);
+#else
+ col->red=col->green=col->blue=col->pixel=0;
+#endif
+}
+
+static EDefBtnIndicator toInd(const char *str, EDefBtnIndicator def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "fontcolor", 9) || 0==memcmp(str, "border", 6))
+ return IND_FONT_COLOR;
+ if(0==memcmp(str, "none", 4))
+ return IND_NONE;
+ if(0==memcmp(str, "corner", 6))
+ return IND_CORNER;
+ if(0==memcmp(str, "colored", 7))
+ return IND_COLORED;
+ }
+
+ return def;
+}
+
+static ELine toLine(const char *str, ELine def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "dashes", 6))
+ return LINE_DASHES;
+ if(0==memcmp(str, "none", 4))
+ return LINE_NONE;
+ if(0==memcmp(str, "sunken", 6))
+ return LINE_SUNKEN;
+ if(0==memcmp(str, "dots", 4))
+ return LINE_DOTS;
+ if(0==memcmp(str, "flat", 4))
+ return LINE_FLAT;
+ }
+ return def;
+}
+
+static ETBarBorder toTBarBorder(const char *str, ETBarBorder def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "dark", 4))
+ return 0==memcmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK;
+ if(0==memcmp(str, "none", 4))
+ return TB_NONE;
+ if(0==memcmp(str, "light", 5))
+ return 0==memcmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT;
+ }
+ return def;
+}
+
+static EMouseOver toMouseOver(const char *str, EMouseOver def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7))
+ return MO_COLORED;
+ if(0==memcmp(str, "plastik", 7))
+ return MO_PLASTIK;
+ if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4))
+ return MO_NONE;
+ }
+ return def;
+}
+
+static EAppearance toAppearance(const char *str, EAppearance def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "flat", 4))
+ return APPEARANCE_FLAT;
+ if(0==memcmp(str, "raised", 6))
+ return APPEARANCE_RAISED;
+ if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13))
+ return APPEARANCE_GRADIENT;
+ if(0==memcmp(str, "splitgradient", 13))
+ return APPEARANCE_SPLIT_GRADIENT;
+ if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10))
+ return APPEARANCE_SHINY_GLASS;
+ if(0==memcmp(str, "dullglass", 9))
+ return APPEARANCE_DULL_GLASS;
+ if(0==memcmp(str, "inverted", 8))
+ return APPEARANCE_INVERTED;
+ if(0==memcmp(str, "bevelled", 8))
+ return APPEARANCE_BEVELLED;
+ }
+ return def;
+}
+
+static EShade toShade(const char *str, bool allowDarken, EShade def)
+{
+ if(str)
+ {
+ /* true/false is from 0.25... */
+ if(0==memcmp(str, "true", 4) || 0==memcmp(str, "selected", 8))
+ return SHADE_BLEND_SELECTED;
+ if(0==memcmp(str, "origselected", 12))
+ return SHADE_SELECTED;
+ if(allowDarken && 0==memcmp(str, "darken", 6))
+ return SHADE_DARKEN;
+ if(0==memcmp(str, "custom", 6))
+ return SHADE_CUSTOM;
+ if(0==memcmp(str, "none", 4))
+ return SHADE_NONE;
+ }
+
+ return def;
+}
+
+/* Prior to 0.42 round was a bool - so need to read 'false' as 'none' */
+static ERound toRound(const char *str, ERound def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5))
+ return ROUND_NONE;
+ if(0==memcmp(str, "slight", 6))
+ return ROUND_SLIGHT;
+ if(0==memcmp(str, "full", 4))
+ return ROUND_FULL;
+ }
+
+ return def;
+}
+
+static EScrollbar toScrollbar(const char *str, EScrollbar def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "kde", 3))
+ return SCROLLBAR_KDE;
+ if(0==memcmp(str, "windows", 7))
+ return SCROLLBAR_WINDOWS;
+ if(0==memcmp(str, "platinum", 8))
+ return SCROLLBAR_PLATINUM;
+ if(0==memcmp(str, "next", 4))
+ return SCROLLBAR_NEXT;
+ if(0==memcmp(str, "none", 4))
+ return SCROLLBAR_NONE;
+ }
+
+ return def;
+}
+
+static EEffect toEffect(const char *str, EEffect def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "none", 4))
+ return EFFECT_NONE;
+ if(0==memcmp(str, "shadow", 6))
+ return EFFECT_SHADOW;
+ if(0==memcmp(str, "etch", 4))
+ return EFFECT_ETCH;
+ }
+
+ return def;
+}
+
+static EShading toShading(const char * str, EShading def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "simple", 6))
+ return SHADING_SIMPLE;
+ if(0==memcmp(str, "hsl", 3))
+ return SHADING_HSL;
+ if(0==memcmp(str, "hsv", 3))
+ return SHADING_HSV;
+ }
+
+ return def;
+}
+
+static EStripe toStripe(const char * str, EStripe def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "plain", 5) || 0==memcmp(str, "true", 4))
+ return STRIPE_PLAIN;
+ if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5))
+ return STRIPE_NONE;
+ if(0==memcmp(str, "diagonal", 8))
+ return STRIPE_DIAGONAL;
+ }
+
+ return def;
+}
+
+static ESliderStyle toSlider(const char * str, ESliderStyle def)
+{
+ if(str)
+ {
+ if(0==memcmp(str, "round", 5))
+ return SLIDER_ROUND;
+ if(0==memcmp(str, "plain", 5))
+ return SLIDER_PLAIN;
+ if(0==memcmp(str, "triangular", 10))
+ return SLIDER_TRIANGULAR;
+ }
+
+ return def;
+}
+
+#endif
+
+#ifdef CONFIG_WRITE
+#include <kstandarddirs.h>
+#endif
+
+static const char * getHome()
+{
+ static const char *home=NULL;
+
+ if(!home)
+ {
+ struct passwd *p=getpwuid(getuid());
+
+ if(p)
+ home=p->pw_dir;
+ else
+ {
+ char *env=getenv("HOME");
+
+ if(env)
+ home=env;
+ }
+
+ if(!home)
+ home="/tmp";
+ }
+
+ return home;
+}
+
+static const char *xdgConfigFolder()
+{
+ static char xdgDir[QTC_MAX_FILENAME_LEN]={'\0'};
+
+ if(!xdgDir[0])
+ {
+ static const char *home=NULL;
+
+#if 0
+ char *env=getenv("XDG_CONFIG_HOME");
+
+ /*
+ Check the setting of XDG_CONFIG_HOME
+ For some reason, sudo leaves the env vars set to those of the
+ caller - so XDG_CONFIG_HOME would point to the users setting, and
+ not roots.
+
+ Therefore, check that home is first part of XDG_CONFIG_HOME
+ */
+
+ if(env && 0==getuid())
+ {
+ if(!home)
+ home=getHome();
+ if(home && home!=strstr(env, home))
+ env=NULL;
+ }
+#else
+ /*
+ Hmm... for 'root' dont bother to check env var, just set to ~/.config
+ - as problems would arise if "sudo kcmshell style", and then
+ "sudo su" / "kcmshell style". The 1st would write to ~/.config, but
+ if root has a XDG_ set then that would be used on the second :-(
+ */
+ char *env=0==getuid() ? NULL : getenv("XDG_CONFIG_HOME");
+#endif
+
+ if(!env)
+ {
+ if(!home)
+ home=getHome();
+
+ sprintf(xdgDir, "%s/.config", home);
+ }
+ else
+ strcpy(xdgDir, env);
+
+#if defined CONFIG_WRITE || !defined __cplusplus
+ {
+ struct stat info;
+
+ if(0!=lstat(xdgDir, &info))
+ {
+#ifdef __cplusplus
+ KStandardDirs::makeDir(xdgDir, 0755);
+#else
+ g_mkdir_with_parents(xdgDir, 0755);
+#endif
+ }
+ }
+#endif
+ }
+
+ return xdgDir;
+}
+
+#ifdef CONFIG_READ
+
+#ifdef __cplusplus
+#define QTC_IS_BLACK(A) (0==(A).red() && 0==(A).green() && 0==(A).blue())
+#else
+#define QTC_IS_BLACK(A) (0==(A).red && 0==(A).green && 0==(A).blue)
+#endif
+
+static void checkColor(EShade *s, color *c)
+{
+ if(SHADE_CUSTOM==*s && QTC_IS_BLACK(*c))
+ *s=SHADE_NONE;
+}
+
+#ifdef __cplusplus
+
+#if QT_VERSION >= 0x040000
+#include <QMap>
+#include <QFile>
+#include <QTextStream>
+#define QTC_LATIN1(A) A.toLatin1()
+#else
+#define QTC_LATIN1(A) A.latin1()
+
+#include <qmap.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#endif
+
+class QtCConfig
+{
+ public:
+
+ QtCConfig(const QString &filename);
+
+ bool ok() const { return values.count()>0; }
+ const QString & readEntry(const char *key, const QString &def=QString::null);
+
+ private:
+
+ QMap<QString, QString> values;
+};
+
+QtCConfig::QtCConfig(const QString &filename)
+{
+ QFile f(filename);
+
+#if QT_VERSION >= 0x040000
+ if(f.open(QIODevice::ReadOnly))
+#else
+ if(f.open(IO_ReadOnly))
+#endif
+ {
+ QTextStream stream(&f);
+ QString line;
+
+ while(!stream.atEnd())
+ {
+ line = stream.readLine();
+#if QT_VERSION >= 0x040000
+ int pos=line.indexOf('=');
+#else
+ int pos=line.find('=');
+#endif
+ if(-1!=pos)
+ values[line.left(pos)]=line.mid(pos+1);
+ }
+ f.close();
+ }
+}
+
+inline const QString & QtCConfig::readEntry(const char *key, const QString &def)
+{
+ return values.contains(key) ? values[key] : def;
+}
+
+inline QString readStringEntry(QtCConfig &cfg, const char *key)
+{
+ return cfg.readEntry(key);
+}
+
+static int readNumEntry(QtCConfig &cfg, const char *key, int def)
+{
+ const QString &val(readStringEntry(cfg, key));
+
+ return val.isEmpty() ? def : val.toInt();
+}
+
+static bool readBoolEntry(QtCConfig &cfg, const char *key, bool def)
+{
+ const QString &val(readStringEntry(cfg, key));
+
+ return val.isEmpty() ? def : (val=="true" ? true : false);
+}
+
+#if QT_VERSION >= 0x040000
+#define QTC_LATIN1(A) A.toLatin1()
+#else
+#define QTC_LATIN1(A) A.latin1()
+#endif
+
+#define QTC_CFG_READ_COLOR(ENTRY) \
+ { \
+ QString sVal(cfg.readEntry(#ENTRY)); \
+ if(sVal.isEmpty()) \
+ opts->ENTRY=def->ENTRY; \
+ else \
+ setRgb(&(opts->ENTRY), QTC_LATIN1(sVal)); \
+ }
+
+#else
+
+static char * lookupCfgHash(GHashTable **cfg, char *key, char *val)
+{
+ char *rv=NULL;
+
+ if(!*cfg)
+ *cfg=g_hash_table_new(g_str_hash, g_str_equal);
+ else
+ rv=(char *)g_hash_table_lookup(*cfg, key);
+
+ if(!rv && val)
+ {
+ g_hash_table_insert(*cfg, g_strdup(key), g_strdup(val));
+ rv=(char *)g_hash_table_lookup(*cfg, key);
+ }
+
+ return rv;
+}
+
+static GHashTable * loadConfig(const char *filename)
+{
+ FILE *f=fopen(filename, "r");
+ GHashTable *cfg=NULL;
+
+ if(f)
+ {
+ char line[QTC_MAX_INPUT_LINE_LEN];
+
+ while(NULL!=fgets(line, QTC_MAX_INPUT_LINE_LEN-1, f))
+ {
+ char *eq=strchr(line, '=');
+ int pos=eq ? eq-line : -1;
+
+ if(pos>0)
+ {
+ char *endl=strchr(line, '\n');
+
+ if(endl)
+ *endl='\0';
+
+ line[pos]='\0';
+
+ lookupCfgHash(&cfg, line, &line[pos+1]);
+ }
+ }
+
+ fclose(f);
+ }
+
+ return cfg;
+}
+
+static void releaseConfig(GHashTable *cfg)
+{
+ g_hash_table_destroy(cfg);
+}
+
+static char * readStringEntry(GHashTable *cfg, char *key)
+{
+ return lookupCfgHash(&cfg, key, NULL);
+}
+
+static int readNumEntry(GHashTable *cfg, char *key, int def)
+{
+ char *str=readStringEntry(cfg, key);
+
+ return str ? atoi(str) : def;
+}
+
+static gboolean readBoolEntry(GHashTable *cfg, char *key, gboolean def)
+{
+ char *str=readStringEntry(cfg, key);
+
+ return str ? (0==memcmp(str, "true", 4) ? true : false) : def;
+}
+
+#define QTC_LATIN1(A) A
+
+#define QTC_CFG_READ_COLOR(ENTRY) \
+ { \
+ const char *str=readStringEntry(cfg, #ENTRY); \
+ \
+ if(str) \
+ setRgb(&(opts->ENTRY), str); \
+ else \
+ opts->ENTRY=def->ENTRY; \
+ }
+#endif
+
+#define QTC_CFG_READ_NUM(ENTRY) \
+ opts->ENTRY=readNumEntry(cfg, #ENTRY, def->ENTRY);
+
+#define QTC_CFG_READ_BOOL(ENTRY) \
+ opts->ENTRY=readBoolEntry(cfg, #ENTRY, def->ENTRY);
+
+#define QTC_CFG_READ_ROUND(ENTRY) \
+ opts->ENTRY=toRound(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_DI(ENTRY) \
+ opts->ENTRY=((double)(readNumEntry(cfg, #ENTRY, ((int)(def->ENTRY*100))-100)+100))/100.0;
+
+#define QTC_CFG_READ_TB_BORDER(ENTRY) \
+ opts->ENTRY=toTBarBorder(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_MOUSE_OVER(ENTRY) \
+ opts->ENTRY=toMouseOver(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_APPEARANCE(ENTRY, DEF) \
+ opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF);
+
+/*
+#define QTC_CFG_READ_APPEARANCE(ENTRY) \
+ opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+*/
+
+#define QTC_CFG_READ_STRIPE(ENTRY) \
+ opts->ENTRY=toStripe(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_SLIDER(ENTRY) \
+ opts->ENTRY=toSlider(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_DEF_BTN(ENTRY) \
+ opts->ENTRY=toInd(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_LINE(ENTRY) \
+ opts->ENTRY=toLine(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_SHADE(ENTRY, AD) \
+ opts->ENTRY=toShade(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), AD, def->ENTRY);
+
+#define QTC_CFG_READ_SCROLLBAR(ENTRY) \
+ opts->ENTRY=toScrollbar(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#define QTC_CFG_READ_EFFECT(ENTRY) \
+ opts->ENTRY=toEffect(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+
+#ifdef QTC_CONFIG_DIALOG
+#define QTC_CFG_READ_SHADING(ENTRY, UNUSED) \
+ opts->ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY);
+#else
+#define QTC_CFG_READ_SHADING(ENTRY, DEF) \
+ ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF);
+#endif
+
+#ifdef __cplusplus
+static bool readConfig(const QString &file, Options *opts, Options *def)
+#else
+static bool readConfig(const char *file, Options *opts, Options *def)
+#endif
+{
+#ifdef __cplusplus
+ if(file.isEmpty())
+ {
+ const char *xdg=xdgConfigFolder();
+
+ if(xdg)
+ {
+ QString filename(xdg);
+
+ filename+="/"QTC_FILE;
+ return readConfig(filename, opts, def);
+ }
+ }
+#else
+ if(!file)
+ {
+ const char *xdg=xdgConfigFolder();
+
+ if(xdg)
+ {
+ char filename[QTC_MAX_FILENAME_LEN];
+
+ sprintf(filename, "%s/"QTC_FILE, xdg);
+ return readConfig(filename, opts, def);
+ }
+ }
+#endif
+ else
+ {
+#ifdef __cplusplus
+ QtCConfig cfg(file);
+
+ if(cfg.ok())
+ {
+#else
+ GHashTable *cfg=loadConfig(file);
+
+ if(cfg)
+ {
+#endif
+ QTC_CFG_READ_NUM(passwordChar)
+ QTC_CFG_READ_ROUND(round)
+ QTC_CFG_READ_DI(highlightFactor)
+ QTC_CFG_READ_TB_BORDER(toolbarBorders)
+ QTC_CFG_READ_APPEARANCE(appearance, def->appearance)
+ QTC_CFG_READ_BOOL(fixParentlessDialogs)
+ QTC_CFG_READ_STRIPE(stripedProgress)
+ QTC_CFG_READ_SLIDER(sliderStyle)
+ QTC_CFG_READ_BOOL(animatedProgress)
+ QTC_CFG_READ_BOOL(lighterPopupMenuBgnd)
+ QTC_CFG_READ_BOOL(embolden)
+ QTC_CFG_READ_DEF_BTN(defBtnIndicator)
+ QTC_CFG_READ_LINE(sliderThumbs)
+ QTC_CFG_READ_LINE(handles)
+ QTC_CFG_READ_BOOL(highlightTab)
+ QTC_CFG_READ_BOOL(colorSelTab)
+ QTC_CFG_READ_SHADE(shadeSliders, false)
+ QTC_CFG_READ_SHADE(shadeMenubars, true)
+ QTC_CFG_READ_SHADE(shadeCheckRadio, false)
+ QTC_CFG_READ_APPEARANCE(menubarAppearance, def->menubarAppearance)
+ QTC_CFG_READ_APPEARANCE(menuitemAppearance, opts->appearance)
+ QTC_CFG_READ_APPEARANCE(toolbarAppearance, def->toolbarAppearance)
+ QTC_CFG_READ_LINE(toolbarSeparators)
+ QTC_CFG_READ_LINE(splitters)
+ QTC_CFG_READ_BOOL(customMenuTextColor)
+ QTC_CFG_READ_MOUSE_OVER(coloredMouseOver)
+ QTC_CFG_READ_BOOL(menubarMouseOver)
+ QTC_CFG_READ_BOOL(shadeMenubarOnlyWhenActive)
+ QTC_CFG_READ_BOOL(thinnerMenuItems)
+ QTC_CFG_READ_COLOR(customSlidersColor)
+ QTC_CFG_READ_COLOR(customMenubarsColor)
+ QTC_CFG_READ_COLOR(customMenuSelTextColor)
+ QTC_CFG_READ_COLOR(customMenuNormTextColor)
+ QTC_CFG_READ_COLOR(customCheckRadioColor)
+ QTC_CFG_READ_SCROLLBAR(scrollbarType)
+ QTC_CFG_READ_EFFECT(buttonEffect)
+ QTC_CFG_READ_APPEARANCE(lvAppearance, opts->appearance)
+ QTC_CFG_READ_APPEARANCE(tabAppearance, opts->appearance)
+ QTC_CFG_READ_APPEARANCE(sliderAppearance, opts->appearance)
+ QTC_CFG_READ_APPEARANCE(progressAppearance, opts->appearance)
+#ifndef QTC_PLAIN_FOCUS_ONLY
+ QTC_CFG_READ_BOOL(stdFocus)
+#endif
+ QTC_CFG_READ_BOOL(lvLines)
+ QTC_CFG_READ_BOOL(drawStatusBarFrames)
+ QTC_CFG_READ_BOOL(fillSlider)
+ QTC_CFG_READ_BOOL(roundMbTopOnly)
+ QTC_CFG_READ_BOOL(borderMenuitems)
+ QTC_CFG_READ_BOOL(gradientPbGroove)
+ QTC_CFG_READ_BOOL(darkerBorders)
+ QTC_CFG_READ_BOOL(vArrows)
+ QTC_CFG_READ_BOOL(xCheck)
+ QTC_CFG_READ_BOOL(framelessGroupBoxes)
+ QTC_CFG_READ_BOOL(inactiveHighlight)
+ QTC_CFG_READ_BOOL(colorMenubarMouseOver)
+#ifdef __cplusplus
+ QTC_CFG_READ_BOOL(stdSidebarButtons)
+ QTC_CFG_READ_BOOL(gtkScrollViews)
+ QTC_CFG_READ_BOOL(gtkComboMenus)
+/*
+#else
+ QTC_CFG_READ_BOOL(setDialogButtonOrder)
+*/
+#endif
+#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
+ QTC_CFG_READ_BOOL(mapKdeIcons)
+#endif
+#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ QTC_CFG_READ_BOOL(gtkButtonOrder)
+#endif
+ QTC_CFG_READ_SHADING(shading, shading);
+
+#ifndef __cplusplus
+ releaseConfig(cfg);
+#endif
+ if(SHADE_SELECTED==opts->shadeCheckRadio)
+ opts->shadeCheckRadio=SHADE_BLEND_SELECTED;
+
+ checkColor(&opts->shadeMenubars, &opts->customMenubarsColor);
+ checkColor(&opts->shadeSliders, &opts->customSlidersColor);
+ checkColor(&opts->shadeCheckRadio, &opts->customCheckRadioColor);
+
+ if(APPEARANCE_BEVELLED==opts->toolbarAppearance)
+ opts->toolbarAppearance=APPEARANCE_GRADIENT;
+ else if(APPEARANCE_RAISED==opts->toolbarAppearance)
+ opts->toolbarAppearance=APPEARANCE_FLAT;
+
+ if(APPEARANCE_BEVELLED==opts->menubarAppearance)
+ opts->menubarAppearance=APPEARANCE_GRADIENT;
+ else if(APPEARANCE_RAISED==opts->menubarAppearance)
+ opts->menubarAppearance=APPEARANCE_FLAT;
+
+ if(APPEARANCE_BEVELLED==opts->sliderAppearance)
+ opts->sliderAppearance=APPEARANCE_GRADIENT;
+
+ if(APPEARANCE_BEVELLED==opts->tabAppearance)
+ opts->tabAppearance=APPEARANCE_GRADIENT;
+
+ if(opts->highlightFactor<((100.0+MIN_HIGHLIGHT_FACTOR)/100.0) ||
+ opts->highlightFactor>((100.0+MAX_HIGHLIGHT_FACTOR)/100.0))
+ opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR;
+
+ if(opts->animatedProgress && !opts->stripedProgress)
+ opts->animatedProgress=false;
+
+ if(opts->colorSelTab && APPEARANCE_GRADIENT!=opts->tabAppearance)
+ opts->colorSelTab=false;
+
+ if(SHADE_CUSTOM==opts->shadeMenubars || SHADE_BLEND_SELECTED==opts->shadeMenubars || !opts->borderMenuitems)
+ opts->colorMenubarMouseOver=true;
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool fileExists(const char *path)
+{
+ struct stat info;
+
+ return 0==lstat(path, &info) && (info.st_mode&S_IFMT)==S_IFREG;
+}
+
+static const char * getSystemConfigFile()
+{
+ static const char * constFiles[]={ "/etc/qt4/"QTC_FILE, "/etc/qt3/"QTC_FILE, "/etc/qt/"QTC_FILE, NULL };
+
+ int i;
+
+ for(i=0; constFiles[i]; ++i)
+ if(fileExists(constFiles[i]))
+ return constFiles[i];
+ return NULL;
+}
+
+static void defaultSettings(Options *opts)
+{
+ /* Set hard-coded defaults... */
+ opts->contrast=7;
+ opts->passwordChar=0x25CF;
+ opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR;
+ opts->round=ROUND_FULL;
+ opts->lighterPopupMenuBgnd=true;
+ opts->animatedProgress=true;
+ opts->stripedProgress=STRIPE_DIAGONAL;
+ opts->sliderStyle=SLIDER_TRIANGULAR;
+ opts->highlightTab=true;
+ opts->colorSelTab=false;
+ opts->embolden=false;
+ opts->appearance=APPEARANCE_DULL_GLASS;
+ opts->lvAppearance=APPEARANCE_BEVELLED;
+ opts->tabAppearance=APPEARANCE_GRADIENT;
+ opts->sliderAppearance=APPEARANCE_DULL_GLASS;
+ opts->menubarAppearance=APPEARANCE_GRADIENT;
+ opts->menuitemAppearance=APPEARANCE_DULL_GLASS;
+ opts->toolbarAppearance=APPEARANCE_GRADIENT;
+ opts->progressAppearance=APPEARANCE_DULL_GLASS;
+ opts->defBtnIndicator=IND_COLORED;
+ opts->sliderThumbs=LINE_FLAT;
+ opts->handles=LINE_DOTS;
+ opts->shadeSliders=SHADE_BLEND_SELECTED;
+ opts->shadeMenubars=SHADE_DARKEN;
+ opts->shadeCheckRadio=SHADE_NONE;
+ opts->toolbarBorders=TB_NONE;
+ opts->toolbarSeparators=LINE_NONE;
+ opts->splitters=LINE_FLAT;
+ opts->fixParentlessDialogs=false;
+ opts->customMenuTextColor=false;
+ opts->coloredMouseOver=MO_PLASTIK;
+ opts->menubarMouseOver=true;
+ opts->shadeMenubarOnlyWhenActive=true;
+ opts->thinnerMenuItems=false;
+ opts->scrollbarType=SCROLLBAR_KDE;
+ opts->buttonEffect=EFFECT_NONE;
+#ifndef QTC_PLAIN_FOCUS_ONLY
+ opts->stdFocus=true;
+#endif
+ opts->lvLines=false;
+ opts->drawStatusBarFrames=false;
+ opts->fillSlider=true;
+ opts->roundMbTopOnly=true;
+ opts->borderMenuitems=true;
+ opts->gradientPbGroove=true;
+ opts->darkerBorders=false;
+ opts->vArrows=false;
+ opts->xCheck=false;
+ opts->framelessGroupBoxes=false;
+ opts->colorMenubarMouseOver=false;
+ opts->inactiveHighlight=false;
+#ifdef QTC_CONFIG_DIALOG
+ opts->shading=SHADING_HSL;
+#endif
+#ifdef __cplusplus
+ opts->stdSidebarButtons=false;
+ opts->gtkScrollViews=false;
+ opts->gtkComboMenus=false;
+ opts->customMenubarsColor.setRgb(0, 0, 0);
+ opts->customSlidersColor.setRgb(0, 0, 0);
+ opts->customMenuNormTextColor.setRgb(0, 0, 0);
+ opts->customMenuSelTextColor.setRgb(0, 0, 0);
+ opts->customCheckRadioColor.setRgb(0, 0, 0);
+#else
+/*
+ opts->setDialogButtonOrder=false;
+*/
+ opts->customMenubarsColor.red=opts->customMenubarsColor.green=opts->customMenubarsColor.blue=0;
+ opts->customSlidersColor.red=opts->customSlidersColor.green=opts->customSlidersColor.blue=0;
+ opts->customMenuNormTextColor.red=opts->customMenuNormTextColor.green=opts->customMenuNormTextColor.blue=0;
+ opts->customMenuSelTextColor.red=opts->customMenuSelTextColor.green=opts->customMenuSelTextColor.blue=0;
+ opts->customCheckRadioColor.red=opts->customCheckRadioColor.green=opts->customCheckRadioColor.blue=0;
+#endif
+
+#if !defined __cplusplus || defined QTC_CONFIG_DIALOG
+ opts->mapKdeIcons=true;
+#endif
+#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus
+ opts->gtkButtonOrder=false;
+#endif
+
+ /* Read system config file... */
+ {
+ static const char * systemFilename=NULL;
+
+ if(!systemFilename)
+ systemFilename=getSystemConfigFile();
+
+ if(systemFilename)
+ readConfig(systemFilename, opts, opts);
+ }
+}
+
+#endif
+
+#ifdef CONFIG_WRITE
+static const char *toStr(EDefBtnIndicator ind)
+{
+ switch(ind)
+ {
+ case IND_NONE:
+ return "none";
+ case IND_FONT_COLOR:
+ return "fontcolor";
+ case IND_CORNER:
+ return "corner";
+ default:
+ return "colored";
+ }
+}
+
+static const char *toStr(ELine ind, bool none)
+{
+ switch(ind)
+ {
+ case LINE_DOTS:
+ return "dots";
+ case LINE_DASHES:
+ return none ? "none" : "dashes";
+ case LINE_FLAT:
+ return "flat";
+ default:
+ return "sunken";
+ }
+}
+
+static const char *toStr(ETBarBorder ind)
+{
+ switch(ind)
+ {
+ case TB_DARK:
+ return "dark";
+ case TB_DARK_ALL:
+ return "dark-all";
+ case TB_LIGHT_ALL:
+ return "light-all";
+ case TB_NONE:
+ return "none";
+ default:
+ return "light";
+ }
+}
+
+static const char *toStr(EMouseOver mo)
+{
+ switch(mo)
+ {
+ case MO_COLORED:
+ return "colored";
+ case MO_NONE:
+ return "none";
+ default:
+ return "plastik";
+ }
+}
+
+static const char *toStr(EAppearance exp)
+{
+ switch(exp)
+ {
+ case APPEARANCE_FLAT:
+ return "flat";
+ case APPEARANCE_RAISED:
+ return "raised";
+ case APPEARANCE_GRADIENT:
+ return "gradient";
+ case APPEARANCE_SPLIT_GRADIENT:
+ return "splitgradient";
+ case APPEARANCE_DULL_GLASS:
+ return "dullglass";
+ case APPEARANCE_BEVELLED:
+ return "bevelled";
+ case APPEARANCE_INVERTED:
+ return "inverted";
+ default:
+ return "shinyglass";
+ }
+}
+
+static const char *toStr(EShade exp, bool dark, bool convertBlendSelToSel)
+{
+ switch(exp)
+ {
+ default:
+ case SHADE_NONE:
+ return "none";
+ case SHADE_BLEND_SELECTED:
+ return dark || !convertBlendSelToSel ? "selected" : "origselected";
+ case SHADE_CUSTOM:
+ return "custom";
+ /* case SHADE_SELECTED */
+ case SHADE_DARKEN:
+ return dark ? "darken" : "origselected";
+ }
+}
+
+static const char *toStr(ERound exp)
+{
+ switch(exp)
+ {
+ case ROUND_NONE:
+ return "none";
+ case ROUND_SLIGHT:
+ return "slight";
+ default:
+ case ROUND_FULL:
+ return "full";
+ }
+}
+
+static const char *toStr(EScrollbar sb)
+{
+ switch(sb)
+ {
+ case SCROLLBAR_KDE:
+ return "kde";
+ default:
+ case SCROLLBAR_WINDOWS:
+ return "windows";
+ case SCROLLBAR_PLATINUM:
+ return "platinum";
+ case SCROLLBAR_NEXT:
+ return "next";
+ case SCROLLBAR_NONE:
+ return "none";
+ }
+}
+
+static const char *toStr(EEffect e)
+{
+ switch(e)
+ {
+ case EFFECT_NONE:
+ return "none";
+ default:
+ case EFFECT_SHADOW:
+ return "shadow";
+ case EFFECT_ETCH:
+ return "etch";
+ }
+}
+
+inline const char * toStr(bool b) { return b ? "true" : "false"; }
+
+static QString toStr(const QColor &col)
+{
+ QString colorStr;
+
+ colorStr.sprintf("#%02X%02X%02X", col.red(), col.green(), col.blue());
+ return colorStr;
+}
+
+static const char *toStr(EShading s)
+{
+ switch(s)
+ {
+ case SHADING_SIMPLE:
+ return "simple";
+ default:
+ case SHADING_HSL:
+ return "hsl";
+ case SHADING_HSV:
+ return "hsv";
+ }
+}
+
+static const char *toStr(EStripe s)
+{
+ switch(s)
+ {
+ default:
+ case STRIPE_PLAIN:
+ return "plain";
+ case STRIPE_NONE:
+ return "none";
+ case STRIPE_DIAGONAL:
+ return "diagonal";
+ }
+}
+
+static const char *toStr(ESliderStyle s)
+{
+ switch(s)
+ {
+ case SLIDER_PLAIN:
+ return "plain";
+ case SLIDER_TRIANGULAR:
+ return "triangular";
+ default:
+ case SLIDER_ROUND:
+ return "round";
+ }
+}
+
+#if QT_VERSION >= 0x040000
+#define CFG config
+#else
+#define CFG (*cfg)
+#endif
+
+#define CFG_WRITE_ENTRY(ENTRY) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY));
+
+#define CFG_WRITE_ENTRY_FORCE(ENTRY) \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY));
+
+#define CFG_WRITE_ENTRY_B(ENTRY, B) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, B));
+
+#define CFG_WRITE_ENTRY_SHADE(ENTRY, DARK, CONVERT_SHADE) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, DARK, CONVERT_SHADE));
+
+#define CFG_WRITE_ENTRY_D(ENTRY) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, ((int)(opts.ENTRY*100))-100);
+
+#define CFG_WRITE_ENTRY_NUM(ENTRY) \
+ if (!exportingStyle && def.ENTRY==opts.ENTRY) \
+ CFG.deleteEntry(#ENTRY); \
+ else \
+ CFG.writeEntry(#ENTRY, opts.ENTRY);
+
+bool static writeConfig(KConfig *cfg, const Options &opts, const Options &def, bool exportingStyle=false)
+{
+ if(!cfg)
+ {
+ const char *xdg=xdgConfigFolder();
+
+ if(xdg)
+ {
+ char filename[QTC_MAX_FILENAME_LEN];
+
+ sprintf(filename, "%s/"QTC_FILE, xdg);
+
+#if QT_VERSION >= 0x040000
+ KConfig defCfg(filename, KConfig::SimpleConfig);
+#else
+ KConfig defCfg(filename, false, false);
+#endif
+
+ return writeConfig(&defCfg, opts, def, exportingStyle);
+ }
+ }
+ else
+ {
+#if QT_VERSION >= 0x040000
+ KConfigGroup config(cfg, QTC_GROUP);
+#else
+ cfg->setGroup(QTC_GROUP);
+#endif
+ CFG_WRITE_ENTRY_NUM(passwordChar)
+ CFG_WRITE_ENTRY(round)
+ CFG_WRITE_ENTRY_D(highlightFactor)
+ CFG_WRITE_ENTRY(toolbarBorders)
+ CFG_WRITE_ENTRY_FORCE(appearance)
+ CFG_WRITE_ENTRY(fixParentlessDialogs)
+ CFG_WRITE_ENTRY(stripedProgress)
+ CFG_WRITE_ENTRY(sliderStyle)
+ CFG_WRITE_ENTRY(animatedProgress)
+ CFG_WRITE_ENTRY(lighterPopupMenuBgnd)
+ CFG_WRITE_ENTRY(embolden)
+ CFG_WRITE_ENTRY(defBtnIndicator)
+ CFG_WRITE_ENTRY_B(sliderThumbs, true)
+ CFG_WRITE_ENTRY_B(handles, false)
+ CFG_WRITE_ENTRY(highlightTab)
+ CFG_WRITE_ENTRY(colorSelTab)
+ CFG_WRITE_ENTRY_SHADE(shadeSliders, false, false)
+ CFG_WRITE_ENTRY_SHADE(shadeMenubars, true, false)
+ CFG_WRITE_ENTRY_SHADE(shadeCheckRadio, false, true)
+ CFG_WRITE_ENTRY_FORCE(menubarAppearance)
+ CFG_WRITE_ENTRY_FORCE(menuitemAppearance)
+ CFG_WRITE_ENTRY_FORCE(toolbarAppearance)
+ CFG_WRITE_ENTRY_B(toolbarSeparators, true)
+ CFG_WRITE_ENTRY_B(splitters, false)
+ CFG_WRITE_ENTRY(customMenuTextColor)
+ CFG_WRITE_ENTRY(coloredMouseOver)
+ CFG_WRITE_ENTRY(menubarMouseOver)
+ CFG_WRITE_ENTRY(shadeMenubarOnlyWhenActive)
+ CFG_WRITE_ENTRY(thinnerMenuItems)
+ CFG_WRITE_ENTRY(customSlidersColor)
+ CFG_WRITE_ENTRY(customMenubarsColor)
+ CFG_WRITE_ENTRY(customMenuSelTextColor)
+ CFG_WRITE_ENTRY(customMenuNormTextColor)
+ CFG_WRITE_ENTRY(customCheckRadioColor)
+ CFG_WRITE_ENTRY(scrollbarType)
+ CFG_WRITE_ENTRY(buttonEffect)
+ CFG_WRITE_ENTRY_FORCE(lvAppearance)
+ CFG_WRITE_ENTRY_FORCE(tabAppearance)
+ CFG_WRITE_ENTRY_FORCE(sliderAppearance)
+ CFG_WRITE_ENTRY_FORCE(progressAppearance)
+#ifndef QTC_PLAIN_FOCUS_ONLY
+ CFG_WRITE_ENTRY(stdFocus)
+#endif
+ CFG_WRITE_ENTRY(lvLines)
+ CFG_WRITE_ENTRY(drawStatusBarFrames)
+ CFG_WRITE_ENTRY(fillSlider)
+ CFG_WRITE_ENTRY(roundMbTopOnly)
+ CFG_WRITE_ENTRY(borderMenuitems)
+ CFG_WRITE_ENTRY(gradientPbGroove)
+ CFG_WRITE_ENTRY(darkerBorders)
+ CFG_WRITE_ENTRY(vArrows)
+ CFG_WRITE_ENTRY(xCheck)
+ CFG_WRITE_ENTRY(framelessGroupBoxes)
+ CFG_WRITE_ENTRY(inactiveHighlight)
+#ifdef __cplusplus
+ CFG_WRITE_ENTRY(stdSidebarButtons)
+#endif
+
+ CFG_WRITE_ENTRY(gtkScrollViews)
+ CFG_WRITE_ENTRY(gtkComboMenus)
+ CFG_WRITE_ENTRY(gtkButtonOrder)
+ CFG_WRITE_ENTRY(mapKdeIcons)
+ CFG_WRITE_ENTRY(shading)
+ cfg->sync();
+ return true;
+ }
+ return false;
+}
+#endif
diff --git a/common/mkpkg b/common/mkpkg
new file mode 100755
index 0000000..41cc3c6
--- /dev/null
+++ b/common/mkpkg
@@ -0,0 +1,7 @@
+version=`grep "#define VERSION" config.h | awk -F\" '{print $2}'`
+packageName=`grep CPACK_PACKAGE_NAME CPackSourceConfig.cmake | grep -v "Package project name" | awk -F\" '{print $2}' | sed y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/`
+maintainer=`grep $USER /etc/passwd | awk -F: '{print $5}'`
+
+checkinstall --nodoc --pkgname="$packageName" --pkgversion="$version" \
+ --pkgrelease="0" --exclude="/" --include=install_manifest.txt \
+ --pakdir="/tmp/checkinstall-$packageName" sleep 1
diff --git a/common/radio_frame.png b/common/radio_frame.png
new file mode 100644
index 0000000..2bf777a
--- /dev/null
+++ b/common/radio_frame.png
Binary files differ
diff --git a/common/radio_light.png b/common/radio_light.png
new file mode 100644
index 0000000..0c093d4
--- /dev/null
+++ b/common/radio_light.png
Binary files differ
diff --git a/common/radio_on.png b/common/radio_on.png
new file mode 100644
index 0000000..7d1557a
--- /dev/null
+++ b/common/radio_on.png
Binary files differ
diff --git a/common/slider.png b/common/slider.png
new file mode 100644
index 0000000..bdb7e67
--- /dev/null
+++ b/common/slider.png
Binary files differ
diff --git a/common/slider_light.png b/common/slider_light.png
new file mode 100644
index 0000000..a36d2ca
--- /dev/null
+++ b/common/slider_light.png
Binary files differ
diff --git a/common/slider_light_v.png b/common/slider_light_v.png
new file mode 100644
index 0000000..3a9cd92
--- /dev/null
+++ b/common/slider_light_v.png
Binary files differ
diff --git a/common/slider_v.png b/common/slider_v.png
new file mode 100644
index 0000000..e2becff
--- /dev/null
+++ b/common/slider_v.png
Binary files differ