From f8597835a4644355d186b6fa8991980f9c72dee7 2012-03-23 14:46:57 From: Michal Klocek Date: 2012-03-23 14:46:57 Subject: [PATCH] Add build stamp and git head support for debug --- diff --git a/src/chartbackground.cpp b/src/chartbackground.cpp index 1b09a54..cf60cac 100644 --- a/src/chartbackground.cpp +++ b/src/chartbackground.cpp @@ -1,4 +1,5 @@ #include "chartbackground_p.h" +#include "qchartversion_p.h" #include #include #include @@ -8,7 +9,10 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE ChartBackground::ChartBackground(QGraphicsItem* parent):QGraphicsRectItem(parent), m_diameter(15) { - +#ifndef QT_NO_DEBUG + qDebug()<<"buildTime" <save(); painter->setPen(pen()); painter->setBrush(brush()); painter->drawRoundRect(rect(),roundness(rect().width()),roundness(rect().height())); +#ifndef QT_NO_DEBUG + painter->setPen(Qt::black); + QFont font; + QString build("build %1"); + font.setPointSize(6); + painter->setFont(font); + painter->drawText(rect().bottomLeft(),build.arg(buildTime)); +#endif + painter->restore(); } int ChartBackground::roundness(qreal size) const diff --git a/src/qchart.cpp b/src/qchart.cpp index e7800d6..82a1a56 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -6,7 +6,6 @@ #include "chartbackground_p.h" #include #include -#include QTCOMMERCIALCHART_BEGIN_NAMESPACE diff --git a/src/src.pro b/src/src.pro index 20425a0..7b67c2d 100644 --- a/src/src.pro +++ b/src/src.pro @@ -121,11 +121,21 @@ install_build_private_headers.CONFIG += target_predeps \ QMAKE_EXTRA_COMPILERS += install_build_public_headers \ install_build_private_headers \ + chartversion.target = qchartversion_p.h -chartversion.commands = @echo \ - "build_time" \ - > \ - $$chartversion.target; +unix:{ + chartversion.commands = @echo \ + "const char *buildTime = \\\"`date +'%y%m%d%H%M'`\\\" \\; \ + const char *gitHead = \\\"`git rev-parse HEAD`\\\" \\; " \ + > \ + $$chartversion.target; +}else{ + chartversion.commands = @echo \ + "const char *buildTime = \"%date%_%time%\" ; \ + const char *gitHead = \"unknown\" ; " \ + > \ + $$chartversion.target +} chartversion.depends = $$HEADERS \ $$SOURCES PRE_TARGETDEPS += qchartversion_p.h