diff --git a/src/chartbackground.cpp b/src/chartbackground.cpp index cf60cac..6ec1886 100644 --- a/src/chartbackground.cpp +++ b/src/chartbackground.cpp @@ -1,5 +1,5 @@ #include "chartbackground_p.h" -#include "qchartversion_p.h" +#include "chartconfig_p.h" #include #include #include @@ -9,10 +9,6 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE ChartBackground::ChartBackground(QGraphicsItem* parent):QGraphicsRectItem(parent), m_diameter(15) { -#ifndef QT_NO_DEBUG - qDebug()<<"buildTime" <setFont(font); - painter->drawText(rect().bottomLeft(),build.arg(buildTime)); + painter->drawText(rect().bottomLeft(),build.arg(ChartConfig::instance()->compilationTime())); #endif painter->restore(); } diff --git a/src/chartconfig_p.h b/src/chartconfig_p.h new file mode 100644 index 0000000..41d5559 --- /dev/null +++ b/src/chartconfig_p.h @@ -0,0 +1,45 @@ +#ifndef CHARTCONFIG_H_ +#define CHARTCONFIG_H_ + +#include "qchartglobal.h" +#include "qchartversion_p.h" + + +QTCOMMERCIALCHART_BEGIN_NAMESPACE + +class ChartConfig { + +private: + ChartConfig(){ + #ifndef QT_NO_DEBUG + qDebug()<<"buildTime" << buildTime; + qDebug()<<"gitHead" << gitHead; + #endif + m_instance = this; + } +public: + static ChartConfig* instance(){ + if(!m_instance){ + m_instance= new ChartConfig(); + } + return m_instance; + } + + QString compilationTime(){ + return buildTime; + } + + QString compilationHead(){ + return gitHead; + } + +private: + static ChartConfig* m_instance; +}; + + +ChartConfig* ChartConfig::m_instance=0; + +#endif + +QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/src.pro b/src/src.pro index 8ce0561..85d8923 100644 --- a/src/src.pro +++ b/src/src.pro @@ -29,7 +29,8 @@ PRIVATE_HEADERS += \ $$PWD/legendmarker_p.h \ $$PWD/legendscrollbutton_p.h \ $$PWD/chartbackground_p.h \ - $$PWD/chart_p.h + $$PWD/chart_p.h \ + $$PWD/chartconfig_p.h PUBLIC_HEADERS += \ $$PWD/qchart.h \ $$PWD/qchartglobal.h \