From 0ea889939059694c588988e0b6d8fd92eb5b7539 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 14 Nov 2014 21:25:54 -0600 Subject: [PATCH] Fix a long-standing conflict between QtCurve's Gradient class and Libreoffice's Gradient class This largely resolves Bug 1489 --- common/common.h | 102 ++++++++++++++++++++++--------------- config/exportthemedialog.h | 4 ++ config/qtcurveconfig.h | 4 ++ style/qtcurve.h | 4 ++ 4 files changed, 73 insertions(+), 41 deletions(-) diff --git a/common/common.h b/common/common.h index f39022a..88dfb40 100644 --- a/common/common.h +++ b/common/common.h @@ -29,10 +29,45 @@ #include #include "config.h" -#if defined _WIN32 && (0x039999 >= 0x040000) +// #define QT4_OR_ABOVE 1 + +#if defined _WIN32 && defined QT4_OR_ABOVE #include #include #include +#endif + +#ifdef __cplusplus +#include +#ifdef CONFIG_DIALOG +#include +#endif +#include +#include +#if !defined CONFIG_DIALOG && defined QT4_OR_ABOVE +#include +#endif +#else +#include +#endif + +#ifdef __cplusplus +#include +#if defined QT4_OR_ABOVE +#include +#include +#endif +#endif + +#if defined QT4_OR_ABOVE && !defined TQTC_TQT_ONLY +#include +#endif + +#ifdef __cplusplus +namespace TDEQtCurveStyle { +#endif + +#if defined _WIN32 && defined QT4_OR_ABOVE static int isnan(double x) { @@ -66,25 +101,9 @@ typedef enum } EShading; #ifdef __cplusplus -#include -#ifdef CONFIG_DIALOG -#include -#endif -#include -#include -#if !defined CONFIG_DIALOG && (0x039999 >= 0x040000) -#include -#endif -#else -#include -#endif - -#ifdef __cplusplus -#include typedef TQColor color; -#if (0x039999 >= 0x040000) -#include +#if defined QT4_OR_ABOVE typedef TQSet Strings; #else typedef TQStringList Strings; @@ -372,19 +391,19 @@ enum #define FULLLY_ROUNDED (opts.round>=ROUND_FULL) #define DO_EFFECT (EFFECT_NONE!=opts.buttonEffect) -#if !defined __cplusplus || ( (0x039999 >= 0x040000)) +#if !defined __cplusplus || ( defined QT4_OR_ABOVE) #define SLIDER_GLOW (DO_EFFECT && MO_GLOW==opts.coloredMouseOver /*&& SLIDER_TRIANGULAR!=opts.sliderStyle*/ ? 2 : 0) #endif #define ENTRY_MO (opts.unifyCombo && opts.unifySpin) -#if !defined __cplusplus || ( (0x039999 >= 0x040000)) +#if !defined __cplusplus || ( defined QT4_OR_ABOVE) #define FOCUS_ALPHA 0.08 #define FOCUS_GLOW_LINE_ALPHA 0.5 #define BORDER_BLEND_ALPHA 0.7 #define ETCH_TOP_ALPHA 0.055 #define ETCH_BOTTOM_ALPHA 0.1 -// #if (0x039999 >= 0x040000) +// #if defined QT4_OR_ABOVE // #define ETCH_RADIO_TOP_ALPHA 0.055 // #define ETCH_RADIO_BOTTOM_ALPHA 0.80 // #else @@ -416,9 +435,7 @@ enum #endif -#if defined __cplusplus && (0x039999 >= 0x040000) - -#include +#if defined __cplusplus && defined QT4_OR_ABOVE typedef enum { TQtC_Round = TQStyle::PM_CustomBase, @@ -455,7 +472,7 @@ typedef enum #define WINDOW_SHADOW_COLOR(A) (EFFECT_SHADOW==(A) ? TQt::black : TQt::white) #endif -#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) +#if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE) #define QTCURVE_PREVIEW_CONFIG "QTCURVE_PREVIEW_CONFIG" #define QTCURVE_PREVIEW_CONFIG_FULL "QTCURVE_PREVIEW_CONFIG_FULL" @@ -1069,7 +1086,7 @@ typedef struct */ #endif mapKdeIcons, -#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) || !defined __cplusplus +#if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE) || !defined __cplusplus gtkButtonOrder, fadeLines, #endif @@ -1099,10 +1116,10 @@ typedef struct borderInactiveTab, doubleGtkComboArrow, menuIcons, -#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) +#if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE) stdBtnSizes, #endif -#if (0x039999 >= 0x040000) +#if defined QT4_OR_ABOVE xbar, #endif forceAlternateLvCols, @@ -1125,10 +1142,10 @@ typedef struct bgndOpacity, menuBgndOpacity, dlgOpacity; -#if (0x039999 >= 0x040000) +#if defined QT4_OR_ABOVE int dwtSettings; #endif -#if defined CONFIG_DIALOG || ( (0x039999 >= 0x040000)) +#if defined CONFIG_DIALOG || ( defined QT4_OR_ABOVE) int titlebarButtons; TBCols titlebarButtonColors; ETitleBarIcon titlebarIcon; @@ -1206,7 +1223,7 @@ typedef struct #endif TQtCImage bgndImage, menuBgndImage; -#if !defined __cplusplus || ( (0x039999 >= 0x040000)) +#if !defined __cplusplus || ( defined QT4_OR_ABOVE) /* NOTE: If add any more settings here, need to alter copyOpts/freeOpts/defaultSettings in config_file.c */ Strings noBgndGradientApps, noBgndOpacityApps, @@ -1217,7 +1234,7 @@ typedef struct Strings noDlgFixApps; #endif Strings noMenuStripeApps; -#if (0x039999 >= 0x040000) +#if defined QT4_OR_ABOVE Strings menubarApps, statusbarApps, useTQtFileDialogApps, @@ -1416,8 +1433,7 @@ inline int limit(double c) } #endif -#if (0x039999 >= 0x040000) && !defined TQTC_TQT_ONLY -#include +#if defined QT4_OR_ABOVE && !defined TQTC_TQT_ONLY #define tint(COLA, COLB, FACTOR) KColorUtils::tint((COLA), (COLB), (FACTOR)) #define midColor(COLA, COLB) KColorUtils::mix((COLA), (COLB), 0.5) #else @@ -1528,7 +1544,7 @@ static void shade(const Options *opts, const color *ca, color *cb, double k) case SHADING_HCY: { #define HCY_FACTOR 0.15 - #if (0x039999 >= 0x040000) && !defined TQTC_TQT_ONLY + #if defined QT4_OR_ABOVE && !defined TQTC_TQT_ONLY if(k>1.0) *cb=KColorUtils::lighten(ca, (k*(1+HCY_FACTOR))-1.0, 1.0); else @@ -1546,7 +1562,7 @@ static void shade(const Options *opts, const color *ca, color *cb, double k) #endif } } -#if defined __cplusplus && (0x039999 >= 0x040000) +#if defined __cplusplus && defined QT4_OR_ABOVE cb->setAlpha(ca.alpha()); #endif #ifndef __cplusplus @@ -1751,7 +1767,7 @@ static EAppearance widgetApp(EWidget w, const Options *opts) #define MIN_ROUND_MAX_HEIGHT 12 #define MIN_ROUND_MAX_WIDTH 24 -#if !defined __cplusplus || ( (0x039999 >= 0x040000)) +#if !defined __cplusplus || ( defined QT4_OR_ABOVE) #if defined __cplusplus #define EXTRA_INNER_RADIUS 3.5 @@ -1826,7 +1842,7 @@ ERound getWidgetRound(const Options *opts, int w, int h, EWidget widget) if((WIDGET_CHECKBOX==widget || WIDGET_FOCUS==widget) && ROUND_NONE!=r) r=ROUND_SLIGHT; -#if defined __cplusplus && ( (0x039999 >= 0x040000)) +#if defined __cplusplus && ( defined QT4_OR_ABOVE) if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) || WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget) return ROUND_MAX; @@ -1836,7 +1852,7 @@ ERound getWidgetRound(const Options *opts, int w, int h, EWidget widget) return ROUND_MAX; #endif -#if !defined __cplusplus || ( (0x039999 >= 0x040000)) +#if !defined __cplusplus || ( defined QT4_OR_ABOVE) if(WIDGET_SLIDER==widget && (SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle)) return ROUND_MAX; @@ -1874,7 +1890,7 @@ static double getRadius(const Options *opts, int w, int h, EWidget widget, ERadi (WIDGET_ENTRY==widget && (opts->square&SQUARE_ENTRY)) ) return 0.0; -#if defined __cplusplus && ( (0x039999 >= 0x040000)) +#if defined __cplusplus && ( defined QT4_OR_ABOVE) if((WIDGET_MDI_WINDOW_BUTTON==widget && (opts->titlebarButtons&TITLEBAR_BUTTON_ROUND)) || WIDGET_RADIO_BUTTON==widget || WIDGET_DIAL==widget) return (w>h ? h : w)/2.0; @@ -1884,7 +1900,7 @@ static double getRadius(const Options *opts, int w, int h, EWidget widget, ERadi return (w>h ? h : w)/2.0; #endif -#if !defined __cplusplus || ( (0x039999 >= 0x040000)) +#if !defined __cplusplus || ( defined QT4_OR_ABOVE) if(WIDGET_SLIDER==widget && (SLIDER_ROUND==opts->sliderStyle || SLIDER_ROUND_ROTATED==opts->sliderStyle || SLIDER_CIRCULAR==opts->sliderStyle)) return (w>h ? h : w)/2.0; @@ -2044,4 +2060,8 @@ static double shineAlpha(const color *bgnd) #endif +#ifdef __cplusplus +} +#endif + #endif // __COMMON_H__ diff --git a/config/exportthemedialog.h b/config/exportthemedialog.h index 2891037..cc8d022 100644 --- a/config/exportthemedialog.h +++ b/config/exportthemedialog.h @@ -25,6 +25,10 @@ #define CONFIG_DIALOG #include "common.h" +#ifdef __cplusplus +using namespace TDEQtCurveStyle; +#endif + class KURLRequester; class TQLineEdit; diff --git a/config/qtcurveconfig.h b/config/qtcurveconfig.h index 66bd61a..60cd63c 100644 --- a/config/qtcurveconfig.h +++ b/config/qtcurveconfig.h @@ -29,6 +29,10 @@ #include #include "common.h" +#ifdef __cplusplus +using namespace TDEQtCurveStyle; +#endif + class TQPopupMenu; class TQListViewItem; class KDoubleNumInput; diff --git a/style/qtcurve.h b/style/qtcurve.h index fc31dab..a060102 100644 --- a/style/qtcurve.h +++ b/style/qtcurve.h @@ -65,6 +65,10 @@ #include #include "common.h" +#ifdef __cplusplus +using namespace TDEQtCurveStyle; +#endif + class TQTimer; class TQSlider;