split cVersionString into its three separate components (version, revision, hash) and apply the new values sensibly on the frontend (esp. title, info and feedback)
--- a/CMakeLists.txt Thu Feb 28 23:14:11 2013 +0100
+++ b/CMakeLists.txt Fri Mar 01 00:06:05 2013 +0100
@@ -44,8 +44,7 @@
#detect Mercurial revision (if present)
if(NOT NOREVISION)
set(default_build_type "DEBUG")
- set(version_suffix "-development_version")
- set(HW_DEV true)
+ set(HW_DEV true) #becomes isDevBuild
find_program(HGCOMMAND hg)
if(HGCOMMAND AND (EXISTS ${CMAKE_SOURCE_DIR}/.hg))
execute_process(COMMAND ${HGCOMMAND} identify -in
@@ -57,13 +56,12 @@
string(REGEX REPLACE "[^+]" "" HGCHANGED ${internal_version})
string(REGEX REPLACE "[0-9a-zA-Z]+(.*) ([0-9]+)(.*)" "\\2" revision_number ${internal_version})
- string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" revision_hash ${internal_version})
+ string(REGEX REPLACE "([0-9a-zA-Z]+)(.*) [0-9]+(.*)" "\\1" hash_number ${internal_version})
- message(STATUS "Building revision ${revision_number} from hash ${revision_hash} ${HGCHANGED}")
+ message(STATUS "Building revision ${revision_number} from hash ${hash_number}")
if(HGCHANGED)
- MESSAGE(${WARNING} "Notice: you have uncommitted changes in your repository")
+ MESSAGE(${WARNING} "You have uncommitted changes in your repository!")
endif()
- set(version_suffix "-${revision_number}${HGCHANGED}")
endif()
else(NOT NOREVISION)
set(default_build_type "RELEASE")
@@ -75,7 +73,7 @@
#versioning
set(CPACK_PACKAGE_VERSION_MAJOR 0)
set(CPACK_PACKAGE_VERSION_MINOR 9)
-set(CPACK_PACKAGE_VERSION_PATCH 19${version_suffix})
+set(CPACK_PACKAGE_VERSION_PATCH 19)
set(HEDGEWARS_PROTO_VER 44)
set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
--- a/QTfrontend/hwconsts.cpp.in Thu Feb 28 23:14:11 2013 +0100
+++ b/QTfrontend/hwconsts.cpp.in Fri Mar 01 00:06:05 2013 +0100
@@ -24,6 +24,9 @@
QString * cProtoVer = new QString("${HEDGEWARS_PROTO_VER}");
QString * cDataDir = new QString("${HEDGEWARS_DATADIR}");
QString * cVersionString = new QString("${HEDGEWARS_VERSION}");
+QString * cRevisionString = new QString("${revision_number}");
+QString * cHashString = new QString("${hash_number}");
+
QDir * bindir = new QDir();
QDir * cfgdir = new QDir();
--- a/QTfrontend/hwconsts.h Thu Feb 28 23:14:11 2013 +0100
+++ b/QTfrontend/hwconsts.h Fri Mar 01 00:06:05 2013 +0100
@@ -25,6 +25,8 @@
extern QString * cProtoVer;
extern QString * cVersionString;
+extern QString * cRevisionString;
+extern QString * cHashString;
extern QString * cDataDir;
extern QDir * bindir;
--- a/QTfrontend/hwform.cpp Thu Feb 28 23:14:11 2013 +0100
+++ b/QTfrontend/hwform.cpp Fri Mar 01 00:06:05 2013 +0100
@@ -1625,9 +1625,7 @@
QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm") :
"LastRound";
- QStringList versionParts = cVersionString->split('-');
- if ( (versionParts.size() == 2) && (!versionParts[1].isEmpty()) && (versionParts[1].contains(':')) )
- recordFileName = recordFileName + "_" + versionParts[1].replace(':','-');
+ recordFileName += "_" + *cRevisionString + "-" + *cHashString;
if (type == rtDemo)
{
--- a/QTfrontend/ui/widget/about.cpp Thu Feb 28 23:14:11 2013 +0100
+++ b/QTfrontend/ui/widget/about.cpp Fri Mar 01 00:06:05 2013 +0100
@@ -67,8 +67,8 @@
"a { color: #ffcc00; }"
// "a:hover { color: yellow; }"
"</style>"
- "<div align=\"center\"><h1>Hedgewars</h1>"
- "<h3>" + QLabel::tr("Version") + " " + *cVersionString + "</h3>"
+ "<div align=\"center\"><h1>Hedgewars " + *cVersionString + "</h1>"
+ "<h3>" + QLabel::tr("Revision") + " " + *cRevisionString + "|" + *cHashString + "</h3>"
"<p><a href=\"http://www.hedgewars.org/\">http://www.hedgewars.org/</a></p>" +
QLabel::tr("This program is distributed under the GNU General Public License v2") +
"</div>"
--- a/QTfrontend/ui/widget/feedbackdialog.cpp Thu Feb 28 23:14:11 2013 +0100
+++ b/QTfrontend/ui/widget/feedbackdialog.cpp Fri Mar 01 00:06:05 2013 +0100
@@ -447,7 +447,8 @@
QString email = this->email->text();
QString captchaCode = this->captcha_code->text();
QString captchaID = QString::number(this->captchaID);
- QString version = "HedgewarsFoundation-Hedgewars-" + (cVersionString?(*cVersionString):QString(""));
+ QString version = "HedgewarsFoundation-Hedgewars-v" + *cVersionString + "_r" +
+ *cRevisionString + "|" + *cHashString;
if (summary.isEmpty() || description.isEmpty())
{
--- a/QTfrontend/ui_hwform.cpp Thu Feb 28 23:14:11 2013 +0100
+++ b/QTfrontend/ui_hwform.cpp Fri Mar 01 00:06:05 2013 +0100
@@ -54,7 +54,10 @@
HWForm->setObjectName(QString::fromUtf8("HWForm"));
HWForm->resize(QSize(640, 480).expandedTo(HWForm->minimumSizeHint()));
HWForm->setMinimumSize(QSize(720, 450));
- HWForm->setWindowTitle(QMainWindow::tr("Hedgewars %1").arg(*cVersionString));
+ QString suffix = isDevBuild ?
+ QMainWindow::tr("-r%1 (%2)").arg(*cRevisionString, *cHashString) : QString("");
+ QString title = QMainWindow::tr("Hedgewars %1").arg(*cVersionString) + suffix;
+ HWForm->setWindowTitle(title);
centralWidget = new QWidget(HWForm);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));