# HG changeset patch # User Santeri Piippo # Date 1368966961 -10800 # Node ID b9e101b76eb3db44d34c7ab0a6a4070b3ea45ba1 # Parent 8cddb57489a7d879c6d6feb223e3066213df3711 Show the version info in the about dialog properly diff -r 8cddb57489a7 -r b9e101b76eb3 src/aboutDialog.cpp --- a/src/aboutDialog.cpp Sun May 19 14:34:15 2013 +0300 +++ b/src/aboutDialog.cpp Sun May 19 15:36:01 2013 +0300 @@ -32,9 +32,9 @@ icon->setPixmap (getIcon ("ldforge")); // Heading - application label and copyright information - QLabel* title = new QLabel (fmt ("" APPNAME " v%d.%d
" + QLabel* title = new QLabel (fmt ("" APPNAME " %s
" "Copyright (C) 2013 Santeri Piippo", - VERSION_MAJOR, VERSION_MINOR)); + fullVersionString ().chars ())); // Body text QLabel* info = new QLabel ( diff -r 8cddb57489a7 -r b9e101b76eb3 src/common.h --- a/src/common.h Sun May 19 14:34:15 2013 +0300 +++ b/src/common.h Sun May 19 15:36:01 2013 +0300 @@ -57,11 +57,9 @@ void doDevf (const char* func, const char* fmtstr, ...); // Version string identifier -#if VERSION_PATCH > 0 -static const str versionString = fmt ("%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); -#else -static const str versionString = fmt ("%d.%d", VERSION_MAJOR, VERSION_MINOR); -#endif // VERSION_PATCH +str versionString (); +const char* versionMoniker (); +str fullVersionString (); #ifdef __GNUC__ # define FORMAT_PRINTF(M,N) __attribute__ ((format (printf, M, N))) diff -r 8cddb57489a7 -r b9e101b76eb3 src/gui.cpp --- a/src/gui.cpp Sun May 19 14:34:15 2013 +0300 +++ b/src/gui.cpp Sun May 19 15:36:01 2013 +0300 @@ -492,18 +492,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // ============================================================================= void ForgeWindow::updateTitle () { - str title = APPNAME " v"; - title += versionString; - -#if BUILD_ID == BUILD_INTERNAL - title += " Internal"; -#elif BUILD_ID == BUILD_ALPHA - title += " Alpha"; -#elif BUILD_ID == BUILD_BETA - title += " Beta"; -#elif BUILD_ID == BUILD_RC - title += " RC"; -#endif // BUILD_ID + str title = fmt (APPNAME " %s", fullVersionString().chars ()); // Append our current file if we have one if (g_curfile) { diff -r 8cddb57489a7 -r b9e101b76eb3 src/main.cpp --- a/src/main.cpp Sun May 19 14:34:15 2013 +0300 +++ b/src/main.cpp Sun May 19 15:36:01 2013 +0300 @@ -88,4 +88,30 @@ va_start (va, fmtstr); vprintf (fmtstr, va); va_end (va); +} + +str versionString () { +#if VERSION_PATCH == 0 + return fmt ("%d.%d", VERSION_MAJOR, VERSION_MINOR); +#else + return fmt ("%d.%d.%d", VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH); +#endif // VERSION_PATCH +} + +const char* versionMoniker () { +#if BUILD_ID == BUILD_INTERNAL + return " Internal"; +#elif BUILD_ID == BUILD_ALPHA + return " Alpha"; +#elif BUILD_ID == BUILD_BETA + return " Beta"; +#elif BUILD_ID == BUILD_RC + return " RC"; +#else + return ""; +#endif // BUILD_ID +} + +str fullVersionString () { + return fmt ("v%s%s", versionString ().chars (), versionMoniker ()); } \ No newline at end of file