* Change version string formatting to a cleaner format.

* Non-FINAL_RELEASE builds no longer show a version number, only SVN revision.
 * FINAL_RELEASE builds show SVN revision in About box only.
 * Also change FINAL_RELEASE version number to 2.1.7.

Originally committed to SVN as r3064.
This commit is contained in:
Niels Martin Hansen 2009-06-16 19:11:08 +00:00
parent 7097b3be3e
commit bab71db434

View file

@ -50,6 +50,8 @@
#endif #endif
#define _T_rec(X) _T(X) #define _T_rec(X) _T(X)
#define _T_stringize(X) _T(#X)
#define _T_int(X) _T_stringize(X)
#define BUILD_TIMESTAMP _T_rec(__DATE__) _T(" ") _T_rec(__TIME__) #define BUILD_TIMESTAMP _T_rec(__DATE__) _T(" ") _T_rec(__TIME__)
@ -71,55 +73,62 @@ struct VersionInfoStruct {
// Generate the above data // Generate the above data
VersionInfoStruct() { VersionInfoStruct() {
wxString SCMStr, VersionStr; wxString VersionStr;
// Update this whenever a new version is released
#ifdef _DEBUG
IsDebug = true;
#else
IsDebug = false;
#endif
SvnRev = BUILD_SVN_REVISION; SvnRev = BUILD_SVN_REVISION;
#ifdef BUILD_SVN_DATE #ifdef BUILD_SVN_DATE
BuildTime = _T_rec(BUILD_SVN_DATE); BuildTime = _T_rec(BUILD_SVN_DATE);
#else #else
BuildTime = BUILD_TIMESTAMP; BuildTime = BUILD_TIMESTAMP;
#endif #endif
#ifdef BUILD_CREDIT #ifdef BUILD_CREDIT
BuildCredit = _T_rec(BUILD_CREDIT); BuildCredit = _T(BUILD_CREDIT);
#else #else
BuildCredit = _T("(unknown)"); BuildCredit = _T("");
#endif #endif
if (SvnRev > 0) { #ifdef _DEBUG
SCMStr = wxString::Format(_T("SVN r%d"), SvnRev); IsDebug = true;
#ifdef BUILD_SVN_LOCALMODS #else
SCMStr += BUILD_SVN_LOCALMODS ? _T("M") : _T(""); IsDebug = false;
#endif #endif
#ifdef BUILD_DARCS
} else {
SCMStr = _T("darcs");
#endif
}
#ifdef FINAL_RELEASE #ifdef FINAL_RELEASE
VersionNumber = _T("v2.2.0");
IsRelease = true; IsRelease = true;
VersionNumber = _T("2.1.7");
#else #else
VersionNumber = _T("v2.1.6");
IsRelease = false; IsRelease = false;
VersionNumber = _T("r") _T_int(BUILD_SVN_REVISION)
# ifdef BUILD_SVN_LOCALMODS
_T("M")
# endif
;
#endif #endif
VersionStr = wxString::Format(_T("%s%s"), VersionNumber, IsRelease ? _T("") : _T(" RELEASE PREVIEW"));
if (IsRelease)
{
// Short is used in about box
ShortVersionString = wxString::Format(_T("%s (built from SVN revision %d)"), VersionNumber, SvnRev);
// Long is used in title bar
LongVersionString = VersionNumber;
}
else
{
wxString buildcred;
#ifdef BUILD_CREDIT #ifdef BUILD_CREDIT
LongVersionString = wxString::Format(_T("%s (%s%s, %s)"), VersionStr.c_str(), IsDebug ? _T("debug, ") : _T(""), SCMStr.c_str(), BuildCredit); buildcred += _T(", "); buildcred += BuildCredit;
#else
LongVersionString = wxString::Format(_T("%s (%s%s)"), VersionStr.c_str(), IsDebug ? _T("debug, ") : _T(""), SCMStr.c_str());
#endif #endif
ShortVersionString = wxString::Format(_T("%s %s%s"), VersionStr.c_str(), SCMStr.c_str(), IsDebug ? _T(" debug") : _T("")); ShortVersionString = wxString::Format(_T("%s (development version%s)"), VersionNumber, buildcred.c_str());
LongVersionString = ShortVersionString;
}
if (IsRelease && !IsDebug) if (IsDebug)
ShortVersionString = LongVersionString = VersionStr; {
ShortVersionString += _T(" [DEBUG VERSION]");
LongVersionString += _T(" [DEBUG VERSION]");
}
} }
}; };