Sun, 19 May 2013 15:36:01 +0300
Show the version info in the about dialog properly
src/aboutDialog.cpp | file | annotate | diff | comparison | revisions | |
src/common.h | file | annotate | diff | comparison | revisions | |
src/gui.cpp | file | annotate | diff | comparison | revisions | |
src/main.cpp | file | annotate | diff | comparison | revisions |
--- 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 ("<b>" APPNAME " v%d.%d</b><br />" + QLabel* title = new QLabel (fmt ("<b>" APPNAME " %s</b><br />" "Copyright (C) 2013 Santeri Piippo", - VERSION_MAJOR, VERSION_MINOR)); + fullVersionString ().chars ())); // Body text QLabel* info = new QLabel (
--- 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)))
--- 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) {
--- 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