@@ -0,0 +1,45 | |||
|
1 | #ifndef CHARTCONFIG_H_ | |
|
2 | #define CHARTCONFIG_H_ | |
|
3 | ||
|
4 | #include "qchartglobal.h" | |
|
5 | #include "qchartversion_p.h" | |
|
6 | ||
|
7 | ||
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
9 | ||
|
10 | class ChartConfig { | |
|
11 | ||
|
12 | private: | |
|
13 | ChartConfig(){ | |
|
14 | #ifndef QT_NO_DEBUG | |
|
15 | qDebug()<<"buildTime" << buildTime; | |
|
16 | qDebug()<<"gitHead" << gitHead; | |
|
17 | #endif | |
|
18 | m_instance = this; | |
|
19 | } | |
|
20 | public: | |
|
21 | static ChartConfig* instance(){ | |
|
22 | if(!m_instance){ | |
|
23 | m_instance= new ChartConfig(); | |
|
24 | } | |
|
25 | return m_instance; | |
|
26 | } | |
|
27 | ||
|
28 | QString compilationTime(){ | |
|
29 | return buildTime; | |
|
30 | } | |
|
31 | ||
|
32 | QString compilationHead(){ | |
|
33 | return gitHead; | |
|
34 | } | |
|
35 | ||
|
36 | private: | |
|
37 | static ChartConfig* m_instance; | |
|
38 | }; | |
|
39 | ||
|
40 | ||
|
41 | ChartConfig* ChartConfig::m_instance=0; | |
|
42 | ||
|
43 | #endif | |
|
44 | ||
|
45 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,57 +1,53 | |||
|
1 | 1 | #include "chartbackground_p.h" |
|
2 |
#include " |
|
|
2 | #include "chartconfig_p.h" | |
|
3 | 3 | #include <QPen> |
|
4 | 4 | #include <QBrush> |
|
5 | 5 | #include <QPainter> |
|
6 | 6 | |
|
7 | 7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | 8 | |
|
9 | 9 | ChartBackground::ChartBackground(QGraphicsItem* parent):QGraphicsRectItem(parent), |
|
10 | 10 | m_diameter(15) |
|
11 | 11 | { |
|
12 | #ifndef QT_NO_DEBUG | |
|
13 | qDebug()<<"buildTime" <<buildTime; | |
|
14 | qDebug()<<"gitHead" << gitHead; | |
|
15 | #endif | |
|
16 | 12 | } |
|
17 | 13 | |
|
18 | 14 | ChartBackground::~ChartBackground() |
|
19 | 15 | { |
|
20 | 16 | |
|
21 | 17 | } |
|
22 | 18 | |
|
23 | 19 | void ChartBackground::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) |
|
24 | 20 | { |
|
25 | 21 | Q_UNUSED(option); |
|
26 | 22 | Q_UNUSED(widget); |
|
27 | 23 | painter->save(); |
|
28 | 24 | painter->setPen(pen()); |
|
29 | 25 | painter->setBrush(brush()); |
|
30 | 26 | painter->drawRoundRect(rect(),roundness(rect().width()),roundness(rect().height())); |
|
31 | 27 | #ifndef QT_NO_DEBUG |
|
32 | 28 | painter->setPen(Qt::black); |
|
33 | 29 | QFont font; |
|
34 | 30 | QString build("build %1"); |
|
35 | 31 | font.setPointSize(6); |
|
36 | 32 | painter->setFont(font); |
|
37 |
painter->drawText(rect().bottomLeft(),build.arg( |
|
|
33 | painter->drawText(rect().bottomLeft(),build.arg(ChartConfig::instance()->compilationTime())); | |
|
38 | 34 | #endif |
|
39 | 35 | painter->restore(); |
|
40 | 36 | } |
|
41 | 37 | |
|
42 | 38 | int ChartBackground::roundness(qreal size) const |
|
43 | 39 | { |
|
44 | 40 | return 100*m_diameter/int(size); |
|
45 | 41 | } |
|
46 | 42 | |
|
47 | 43 | int ChartBackground::diameter() const |
|
48 | 44 | { |
|
49 | 45 | return m_diameter; |
|
50 | 46 | } |
|
51 | 47 | |
|
52 | 48 | void ChartBackground::setDimeter(int dimater) |
|
53 | 49 | { |
|
54 | 50 | m_diameter=dimater; |
|
55 | 51 | } |
|
56 | 52 | |
|
57 | 53 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,158 +1,159 | |||
|
1 | 1 | !include( ../common.pri ):error( Couldn't find the common.pri file! ) |
|
2 | 2 | TARGET = QtCommercialChart |
|
3 | 3 | DESTDIR = $$CHART_BUILD_LIB_DIR |
|
4 | 4 | TEMPLATE = lib |
|
5 | 5 | QT += core \ |
|
6 | 6 | gui |
|
7 | 7 | win32-msvc*: LIBS += User32.lib |
|
8 | 8 | CONFIG += debug_and_release |
|
9 | 9 | CONFIG(debug, debug|release):TARGET = QtCommercialChartd |
|
10 | 10 | SOURCES += \ |
|
11 | 11 | $$PWD/chartdataset.cpp \ |
|
12 | 12 | $$PWD/chartpresenter.cpp \ |
|
13 | 13 | $$PWD/charttheme.cpp \ |
|
14 | 14 | $$PWD/domain.cpp \ |
|
15 | 15 | $$PWD/qchart.cpp \ |
|
16 | 16 | $$PWD/qchartview.cpp \ |
|
17 | 17 | $$PWD/qseries.cpp \ |
|
18 | 18 | $$PWD/qlegend.cpp \ |
|
19 | 19 | $$PWD/legendmarker.cpp \ |
|
20 | 20 | $$PWD/legendscrollbutton.cpp \ |
|
21 | 21 | $$PWD/chartbackground.cpp \ |
|
22 | 22 | $$PWD/chart.cpp |
|
23 | 23 | PRIVATE_HEADERS += \ |
|
24 | 24 | $$PWD/chartdataset_p.h \ |
|
25 | 25 | $$PWD/chartitem_p.h \ |
|
26 | 26 | $$PWD/chartpresenter_p.h \ |
|
27 | 27 | $$PWD/charttheme_p.h \ |
|
28 | 28 | $$PWD/domain_p.h \ |
|
29 | 29 | $$PWD/legendmarker_p.h \ |
|
30 | 30 | $$PWD/legendscrollbutton_p.h \ |
|
31 | 31 | $$PWD/chartbackground_p.h \ |
|
32 | $$PWD/chart_p.h | |
|
32 | $$PWD/chart_p.h \ | |
|
33 | $$PWD/chartconfig_p.h | |
|
33 | 34 | PUBLIC_HEADERS += \ |
|
34 | 35 | $$PWD/qchart.h \ |
|
35 | 36 | $$PWD/qchartglobal.h \ |
|
36 | 37 | $$PWD/qseries.h \ |
|
37 | 38 | $$PWD/qchartview.h \ |
|
38 | 39 | $$PWD/qlegend.h |
|
39 | 40 | |
|
40 | 41 | include(animations/animations.pri) |
|
41 | 42 | include(axis/axis.pri) |
|
42 | 43 | include(xychart/xychart.pri) |
|
43 | 44 | include(linechart/linechart.pri) |
|
44 | 45 | include(areachart/areachart.pri) |
|
45 | 46 | include(barchart/barchart.pri) |
|
46 | 47 | include(piechart/piechart.pri) |
|
47 | 48 | include(scatterseries/scatter.pri) |
|
48 | 49 | include(splinechart/splinechart.pri) |
|
49 | 50 | include(themes/themes.pri) |
|
50 | 51 | |
|
51 | 52 | |
|
52 | 53 | HEADERS += $$PUBLIC_HEADERS |
|
53 | 54 | HEADERS += $$PRIVATE_HEADERS |
|
54 | 55 | HEADERS += $$THEMES |
|
55 | 56 | INCLUDEPATH += linechart \ |
|
56 | 57 | barchart \ |
|
57 | 58 | themes \ |
|
58 | 59 | . |
|
59 | 60 | OBJECTS_DIR = $$CHART_BUILD_DIR/lib |
|
60 | 61 | MOC_DIR = $$CHART_BUILD_DIR/lib |
|
61 | 62 | UI_DIR = $$CHART_BUILD_DIR/lib |
|
62 | 63 | RCC_DIR = $$CHART_BUILD_DIR/lib |
|
63 | 64 | DEFINES += QTCOMMERCIALCHART_LIBRARY |
|
64 | 65 | |
|
65 | 66 | #qt public headers |
|
66 | 67 | #this is very primitive and lame parser , TODO: make perl script insted |
|
67 | 68 | !exists($$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal) |
|
68 | 69 | { |
|
69 | 70 | system($$QMAKE_MKDIR $$CHART_BUILD_PUBLIC_HEADER_DIR) |
|
70 | 71 | win32:{ |
|
71 | 72 | command = "echo $${LITERAL_HASH}include \"qchartglobal.h\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal" |
|
72 | 73 | }else{ |
|
73 | 74 | command = "echo \"$${LITERAL_HASH}include \\\"qchartglobal.h\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal" |
|
74 | 75 | } |
|
75 | 76 | system($$command) |
|
76 | 77 | } |
|
77 | 78 | |
|
78 | 79 | for(file, PUBLIC_HEADERS) { |
|
79 | 80 | name = $$split(file,'/') |
|
80 | 81 | name = $$last(name) |
|
81 | 82 | class = "$$cat($$file)" |
|
82 | 83 | class = $$find(class,class) |
|
83 | 84 | !isEmpty(class){ |
|
84 | 85 | class = $$split(class,QTCOMMERCIALCHART_EXPORT) |
|
85 | 86 | class = $$member(class,1) |
|
86 | 87 | class = $$split(class,' ') |
|
87 | 88 | class = $$replace(class,' ','') |
|
88 | 89 | class = $$member(class,0) |
|
89 | 90 | win32:{ |
|
90 | 91 | command = "echo $${LITERAL_HASH}include \"$$name\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class" |
|
91 | 92 | }else{ |
|
92 | 93 | command = "echo \"$${LITERAL_HASH}include \\\"$$name\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class" |
|
93 | 94 | } |
|
94 | 95 | PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class |
|
95 | 96 | system($$command) |
|
96 | 97 | } |
|
97 | 98 | } |
|
98 | 99 | |
|
99 | 100 | public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart |
|
100 | 101 | public_headers.files = $$PUBLIC_HEADERS $$PUBLIC_QT_HEADERS |
|
101 | 102 | |
|
102 | 103 | target.path = $$[QT_INSTALL_LIBS] |
|
103 | 104 | INSTALLS += target public_headers |
|
104 | 105 | |
|
105 | 106 | install_build_public_headers.name = build_public_headers |
|
106 | 107 | install_build_public_headers.output = $$CHART_BUILD_PUBLIC_HEADER_DIR/${QMAKE_FILE_BASE}.h |
|
107 | 108 | install_build_public_headers.input = PUBLIC_HEADERS |
|
108 | 109 | install_build_public_headers.commands = $$QMAKE_COPY \ |
|
109 | 110 | ${QMAKE_FILE_NAME} \ |
|
110 | 111 | $$CHART_BUILD_PUBLIC_HEADER_DIR |
|
111 | 112 | install_build_public_headers.CONFIG += target_predeps \ |
|
112 | 113 | no_link |
|
113 | 114 | |
|
114 | 115 | install_build_private_headers.name = buld_private_headers |
|
115 | 116 | install_build_private_headers.output = $$CHART_BUILD_PRIVATE_HEADER_DIR/${QMAKE_FILE_BASE}.h |
|
116 | 117 | install_build_private_headers.input = PRIVATE_HEADERS |
|
117 | 118 | install_build_private_headers.commands = $$QMAKE_COPY \ |
|
118 | 119 | ${QMAKE_FILE_NAME} \ |
|
119 | 120 | $$CHART_BUILD_PRIVATE_HEADER_DIR |
|
120 | 121 | install_build_private_headers.CONFIG += target_predeps \ |
|
121 | 122 | no_link |
|
122 | 123 | |
|
123 | 124 | QMAKE_EXTRA_COMPILERS += install_build_public_headers \ |
|
124 | 125 | install_build_private_headers \ |
|
125 | 126 | |
|
126 | 127 | |
|
127 | 128 | chartversion.target = qchartversion_p.h |
|
128 | 129 | unix:{ |
|
129 | 130 | chartversion.commands = @echo \ |
|
130 | 131 | "const char *buildTime = \\\"`date +'%y%m%d%H%M'`\\\" \\; \ |
|
131 | 132 | const char *gitHead = \\\"`git rev-parse HEAD`\\\" \\; " \ |
|
132 | 133 | > \ |
|
133 | 134 | $$chartversion.target; |
|
134 | 135 | }else{ |
|
135 | 136 | chartversion.commands = @echo \ |
|
136 | 137 | "const char *buildTime = \"%date%_%time%\" ; \ |
|
137 | 138 | const char *gitHead = \"unknown\" ; " \ |
|
138 | 139 | > \ |
|
139 | 140 | $$chartversion.target |
|
140 | 141 | } |
|
141 | 142 | chartversion.depends = $$HEADERS \ |
|
142 | 143 | $$SOURCES |
|
143 | 144 | PRE_TARGETDEPS += qchartversion_p.h |
|
144 | 145 | QMAKE_CLEAN += qchartversion_p.h |
|
145 | 146 | QMAKE_EXTRA_TARGETS += chartversion |
|
146 | 147 | unix:QMAKE_DISTCLEAN += -r \ |
|
147 | 148 | $$CHART_BUILD_HEADER_DIR \ |
|
148 | 149 | $$CHART_BUILD_LIB_DIR |
|
149 | 150 | win32:QMAKE_DISTCLEAN += /Q \ |
|
150 | 151 | $$CHART_BUILD_HEADER_DIR \ |
|
151 | 152 | $$CHART_BUILD_LIB_DIR |
|
152 | 153 | |
|
153 | 154 | # treat warnings as errors |
|
154 | 155 | win32-msvc*: { |
|
155 | 156 | QMAKE_CXXFLAGS += /WX |
|
156 | 157 | } else { |
|
157 | 158 | QMAKE_CXXFLAGS += -Werror |
|
158 | 159 | } |
General Comments 0
You need to be logged in to leave comments.
Login now