Branch: master

0ea88993 2014-11-14 21:25:54 Timothy Pearson
Fix a long-standing conflict between QtCurve's Gradient class and Libreoffice's Gradient class
This largely resolves Bug 1489
M common/common.h
M config/exportthemedialog.h
M config/qtcurveconfig.h
M style/qtcurve.h
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 <math.h>
 #include "config.h"
 
-#if defined _WIN32 &&  (0x039999 >= 0x040000)
+// #define QT4_OR_ABOVE 1
+
+#if defined _WIN32 &&  defined QT4_OR_ABOVE
 #include <sys/stat.h>
 #include <float.h>
 #include <direct.h>
+#endif
+
+#ifdef __cplusplus
+#include <tqconfig.h>
+#ifdef CONFIG_DIALOG
+#include <tqapplication.h>
+#endif
+#include <map>
+#include <set>
+#if !defined CONFIG_DIALOG &&  defined QT4_OR_ABOVE
+#include <TQtCore/TQString>
+#endif
+#else
+#include <glib.h>
+#endif
+
+#ifdef __cplusplus
+#include <tqpixmap.h>
+#if  defined QT4_OR_ABOVE
+#include <TQtCore/TQSet>
+#include <tqstyle.h>
+#endif
+#endif
+
+#if  defined QT4_OR_ABOVE && !defined TQTC_TQT_ONLY
+#include <KDE/KColorUtils>
+#endif
+
+#ifdef __cplusplus
+namespace TDEQtCurveStyle {
+#endif
+
+#if defined _WIN32 &&  defined QT4_OR_ABOVE
 
 static int isnan(double x)
 {
@@ -66,25 +101,9 @@
 } EShading;
 
 #ifdef __cplusplus
-#include <tqconfig.h>
-#ifdef CONFIG_DIALOG
-#include <tqapplication.h>
-#endif
-#include <map>
-#include <set>
-#if !defined CONFIG_DIALOG &&  (0x039999 >= 0x040000)
-#include <TQtCore/TQString>
-#endif
-#else
-#include <glib.h>
-#endif
-
-#ifdef __cplusplus
-#include <tqpixmap.h>
 typedef TQColor color;
 
-#if  (0x039999 >= 0x040000)
-#include <TQtCore/TQSet>
+#if  defined QT4_OR_ABOVE
 typedef TQSet<TQString> Strings;
 #else
 typedef TQStringList Strings;
@@ -372,19 +391,19 @@
 
 #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 @@
 
 #endif
 
-#if defined __cplusplus &&  (0x039999 >= 0x040000)
-
-#include <tqstyle.h>
+#if defined __cplusplus &&  defined QT4_OR_ABOVE
 typedef enum
 {
     TQtC_Round = TQStyle::PM_CustomBase,
@@ -455,7 +472,7 @@
 #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 @@
 */
 #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 @@
                      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 @@
                      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 @@
 #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 @@
     Strings          noDlgFixApps;
 #endif
     Strings          noMenuStripeApps;
-#if  (0x039999 >= 0x040000)
+#if  defined QT4_OR_ABOVE
     Strings          menubarApps,
                      statusbarApps,
                      useTQtFileDialogApps,
@@ -1416,8 +1433,7 @@
 }
 #endif
 
-#if  (0x039999 >= 0x040000) && !defined TQTC_TQT_ONLY
-#include <KDE/KColorUtils>
+#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 @@
             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 @@
     #endif
             }
         }
-#if defined __cplusplus &&  (0x039999 >= 0x040000)
+#if defined __cplusplus &&  defined QT4_OR_ABOVE
     cb->setAlpha(ca.alpha());
 #endif
 #ifndef __cplusplus
@@ -1751,7 +1767,7 @@
 #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 @@
     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 @@
        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 @@
         (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 @@
         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 @@
 
 #endif
 ** Diff limit reached (max: 250 lines) **