##// END OF EJS Templates
Fixed build error on linux
Tero Ahola -
r593:1b84d5d9bed8
parent child
Show More
@@ -1,154 +1,154
1 #include "charttheme_p.h"
1 #include "charttheme_p.h"
2 #ifdef Q_OS_WIN
2 #ifdef Q_OS_WIN
3 #include <windows.h>
3 #include <windows.h>
4 #include <stdio.h>
4 #include <stdio.h>
5 #endif
5 #endif
6
6
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
9 class ChartThemeDefault: public ChartTheme
9 class ChartThemeDefault: public ChartTheme
10 {
10 {
11 public:
11 public:
12 ChartThemeDefault():ChartTheme(QChart::ChartThemeDefault)
12 ChartThemeDefault():ChartTheme(QChart::ChartThemeDefault)
13 {
13 {
14 #ifdef Q_OS_WIN
14 #ifdef Q_OS_WIN
15 // TODO: use theme specific window frame color as a series base color (it would give more
15 // TODO: use theme specific window frame color as a series base color (it would give more
16 // variation to the base colors in addition to the blue and black used now)
16 // variation to the base colors in addition to the blue and black used now)
17 // TODO: COLOR_WINDOWTEXT for text color?
17 // TODO: COLOR_WINDOWTEXT for text color?
18 // TODO: COLOR_INFOTEXT for tooltip text color?
18 // TODO: COLOR_INFOTEXT for tooltip text color?
19 // TODO: COLOR_INFOBK for tooltip background color?
19 // TODO: COLOR_INFOBK for tooltip background color?
20
20
21 // First series base color from COLOR_HIGHLIGHT
21 // First series base color from COLOR_HIGHLIGHT
22 DWORD colorHighlight;
22 DWORD colorHighlight;
23 colorHighlight = GetSysColor(COLOR_HIGHLIGHT);
23 colorHighlight = GetSysColor(COLOR_HIGHLIGHT);
24 m_seriesColors.append(QColor(GetRValue(colorHighlight),
24 m_seriesColors.append(QColor(GetRValue(colorHighlight),
25 GetGValue(colorHighlight),
25 GetGValue(colorHighlight),
26 GetBValue(colorHighlight)));
26 GetBValue(colorHighlight)));
27
27
28 // Second series base color from COLOR_WINDOWFRAME
28 // Second series base color from COLOR_WINDOWFRAME
29 DWORD colorWindowFrame;
29 DWORD colorWindowFrame;
30 colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME);
30 colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME);
31 m_seriesColors.append(QColor(GetRValue(colorWindowFrame),
31 m_seriesColors.append(QColor(GetRValue(colorWindowFrame),
32 GetGValue(colorWindowFrame),
32 GetGValue(colorWindowFrame),
33 GetBValue(colorWindowFrame)));
33 GetBValue(colorWindowFrame)));
34
34
35 // Third series base color from the middle of the COLOR_ACTIVECAPTION /
35 // Third series base color from the middle of the COLOR_ACTIVECAPTION /
36 // COLOR_GRADIENTACTIVECAPTION gradient
36 // COLOR_GRADIENTACTIVECAPTION gradient
37 DWORD colorGradientActiveCaptionLeft;
37 DWORD colorGradientActiveCaptionLeft;
38 colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION);
38 colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION);
39 DWORD colorGradientActiveCaptionRight;
39 DWORD colorGradientActiveCaptionRight;
40 colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION);
40 colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION);
41 QLinearGradient g;
41 QLinearGradient g;
42 QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft),
42 QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft),
43 GetGValue(colorGradientActiveCaptionLeft),
43 GetGValue(colorGradientActiveCaptionLeft),
44 GetBValue(colorGradientActiveCaptionLeft));
44 GetBValue(colorGradientActiveCaptionLeft));
45 g.setColorAt(0.0, start);
45 g.setColorAt(0.0, start);
46 QColor end = QColor(GetRValue(colorGradientActiveCaptionRight),
46 QColor end = QColor(GetRValue(colorGradientActiveCaptionRight),
47 GetGValue(colorGradientActiveCaptionRight),
47 GetGValue(colorGradientActiveCaptionRight),
48 GetBValue(colorGradientActiveCaptionRight));
48 GetBValue(colorGradientActiveCaptionRight));
49 g.setColorAt(1.0, end);
49 g.setColorAt(1.0, end);
50 m_seriesColors.append(colorAt(g, 0.5));
50 m_seriesColors.append(colorAt(g, 0.5));
51
51
52 // Generate gradients from the base colors
52 // Generate gradients from the base colors
53 generateSeriesGradients();
53 generateSeriesGradients();
54
54
55 // Background fill color from COLOR_WINDOW
55 // Background fill color from COLOR_WINDOW
56 QLinearGradient backgroundGradient;
56 QLinearGradient backgroundGradient;
57 DWORD colorWindow;
57 DWORD colorWindow;
58 colorWindow = GetSysColor(COLOR_WINDOW);
58 colorWindow = GetSysColor(COLOR_WINDOW);
59 backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow),
59 backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow),
60 GetGValue(colorWindow),
60 GetGValue(colorWindow),
61 GetBValue(colorWindow)));
61 GetBValue(colorWindow)));
62 backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow),
62 backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow),
63 GetGValue(colorWindow),
63 GetGValue(colorWindow),
64 GetBValue(colorWindow)));
64 GetBValue(colorWindow)));
65 // Axes and other
65 // Axes and other
66 m_masterFont = QFont();
66 m_masterFont = QFont();
67 m_masterFont.setPointSizeF(10.0);
67 m_masterFont.setPointSizeF(10.0);
68 m_axisLinePen = QPen(Qt::black);
68 m_axisLinePen = QPen(Qt::black);
69 m_axisLinePen.setWidth(2);
69 m_axisLinePen.setWidth(2);
70 m_axisLabelBrush = QBrush(Qt::black);
70 m_axisLabelBrush = QBrush(Qt::black);
71 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
71 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
72 m_backgroundShadesPen = Qt::NoPen;
72 m_backgroundShadesPen = Qt::NoPen;
73 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
73 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
74 m_backgroundShades = BackgroundShadesVertical;
74 m_backgroundShades = BackgroundShadesVertical;
75
75
76 #elif defined(Q_OS_LINUX)
76 #elif defined(Q_OS_LINUX)
77 // TODO: replace this dummy theme with linux specific theme
77 // TODO: replace this dummy theme with linux specific theme
78 m_seriesColors << QRgb(0x60a6e6);
78 m_seriesColors << QRgb(0x60a6e6);
79 m_seriesColors << QRgb(0x92ca66);
79 m_seriesColors << QRgb(0x92ca66);
80 m_seriesColors << QRgb(0xeba85f);
80 m_seriesColors << QRgb(0xeba85f);
81 m_seriesColors << QRgb(0xfc5751);
81 m_seriesColors << QRgb(0xfc5751);
82 generateSeriesGradients();
82 generateSeriesGradients();
83
83
84 QLinearGradient backgroundGradient;
84 QLinearGradient backgroundGradient;
85 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
85 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
86 backgroundGradient.setColorAt(1.0, QRgb(0xe9e9e9));
86 backgroundGradient.setColorAt(1.0, QRgb(0xe9e9e9));
87 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
87 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
88 m_backgroundGradient = backgroundGradient;
88 m_chartBackgroundGradient = backgroundGradient;
89
89
90 // Axes and other
90 // Axes and other
91 m_masterFont = QFont();
91 m_masterFont = QFont();
92 m_masterFont.setPointSizeF(10.0);
92 m_masterFont.setPointSizeF(10.0);
93 m_axisLinePen = QPen(Qt::black);
93 m_axisLinePen = QPen(Qt::black);
94 m_axisLinePen.setWidth(2);
94 m_axisLinePen.setWidth(2);
95 m_axisLabelBrush = QBrush(Qt::black);
95 m_axisLabelBrush = QBrush(Qt::black);
96 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
96 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
97 m_backgroundShadesPen = Qt::NoPen;
97 m_backgroundShadesPen = Qt::NoPen;
98 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
98 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
99 m_backgroundShades = BackgroundShadesVertical;
99 m_backgroundShades = BackgroundShadesVertical;
100
100
101 #elif defined(Q_OS_MAC)
101 #elif defined(Q_OS_MAC)
102 // TODO: replace this dummy theme with OSX specific theme
102 // TODO: replace this dummy theme with OSX specific theme
103 m_seriesColors << QRgb(0x60a6e6);
103 m_seriesColors << QRgb(0x60a6e6);
104 m_seriesColors << QRgb(0x92ca66);
104 m_seriesColors << QRgb(0x92ca66);
105 m_seriesColors << QRgb(0xeba85f);
105 m_seriesColors << QRgb(0xeba85f);
106 m_seriesColors << QRgb(0xfc5751);
106 m_seriesColors << QRgb(0xfc5751);
107 generateSeriesGradients();
107 generateSeriesGradients();
108
108
109 QLinearGradient backgroundGradient;
109 QLinearGradient backgroundGradient;
110 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
110 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
111 backgroundGradient.setColorAt(1.0, QRgb(0xe9e9e9));
111 backgroundGradient.setColorAt(1.0, QRgb(0xe9e9e9));
112 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
112 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
113 m_chartBackgroundGradient = backgroundGradient;
113 m_chartBackgroundGradient = backgroundGradient;
114
114
115 // Axes and other
115 // Axes and other
116 m_masterFont = QFont();
116 m_masterFont = QFont();
117 m_masterFont.setPointSizeF(10.0);
117 m_masterFont.setPointSizeF(10.0);
118 m_axisLinePen = QPen(Qt::black);
118 m_axisLinePen = QPen(Qt::black);
119 m_axisLinePen.setWidth(2);
119 m_axisLinePen.setWidth(2);
120 m_axisLabelBrush = QBrush(Qt::black);
120 m_axisLabelBrush = QBrush(Qt::black);
121 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
121 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
122 m_backgroundShadesPen = Qt::NoPen;
122 m_backgroundShadesPen = Qt::NoPen;
123 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
123 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
124 m_backgroundShades = BackgroundShadesVertical;
124 m_backgroundShades = BackgroundShadesVertical;
125
125
126 #else
126 #else
127 // TODO: replace this dummy theme with generic (not OS specific) theme
127 // TODO: replace this dummy theme with generic (not OS specific) theme
128 m_seriesColors << QRgb(0x60a6e6);
128 m_seriesColors << QRgb(0x60a6e6);
129 m_seriesColors << QRgb(0x92ca66);
129 m_seriesColors << QRgb(0x92ca66);
130 m_seriesColors << QRgb(0xeba85f);
130 m_seriesColors << QRgb(0xeba85f);
131 m_seriesColors << QRgb(0xfc5751);
131 m_seriesColors << QRgb(0xfc5751);
132 generateSeriesGradients();
132 generateSeriesGradients();
133
133
134 QLinearGradient backgroundGradient;
134 QLinearGradient backgroundGradient;
135 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
135 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
136 backgroundGradient.setColorAt(1.0, QRgb(0xafafaf));
136 backgroundGradient.setColorAt(1.0, QRgb(0xafafaf));
137 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
137 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
138 m_backgroundGradient = backgroundGradient;
138 m_backgroundGradient = backgroundGradient;
139
139
140 // Axes and other
140 // Axes and other
141 m_masterFont = QFont();
141 m_masterFont = QFont();
142 m_masterFont.setPointSizeF(10.0);
142 m_masterFont.setPointSizeF(10.0);
143 m_axisLinePen = QPen(Qt::black);
143 m_axisLinePen = QPen(Qt::black);
144 m_axisLinePen.setWidth(2);
144 m_axisLinePen.setWidth(2);
145 m_axisLabelBrush = QBrush(Qt::black);
145 m_axisLabelBrush = QBrush(Qt::black);
146 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
146 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
147 m_backgroundShadesPen = Qt::NoPen;
147 m_backgroundShadesPen = Qt::NoPen;
148 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
148 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
149 m_backgroundShades = BackgroundShadesVertical;
149 m_backgroundShades = BackgroundShadesVertical;
150 #endif
150 #endif
151 }
151 }
152 };
152 };
153
153
154 QTCOMMERCIALCHART_END_NAMESPACE
154 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now