From 45de8176a5fa334304e2570a12a868c61c98eb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 3 Feb 2006 18:48:26 +0000 Subject: [PATCH] * Added the Subversion revision at build time to AboutHaiku - the revision is automatically updated everytime AboutHaiku is built (ie. also if nothing changed). * Added Oliver Tappe as contributor. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16219 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/abouthaiku/AboutHaiku.cpp | 17 ++++++++++++++--- src/apps/abouthaiku/Jamfile | 17 +++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/apps/abouthaiku/AboutHaiku.cpp b/src/apps/abouthaiku/AboutHaiku.cpp index 763775ebc1..46b723e38b 100644 --- a/src/apps/abouthaiku/AboutHaiku.cpp +++ b/src/apps/abouthaiku/AboutHaiku.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Haiku, Inc. + * Copyright (c) 2005-2006, Haiku, Inc. * Distributed under the terms of the MIT license. * * Author: DarkWyrm @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -122,7 +123,6 @@ AboutView::AboutView(const BRect &rect) font_height height; float labelHeight, textHeight; - char string[255]; system_info systemInfo; get_system_info(&systemInfo); @@ -158,6 +158,7 @@ AboutView::AboutView(const BRect &rect) r.OffsetBy(0, labelHeight); r.bottom = r.top + textHeight; + char string[256]; strcpy(string, "Unknown"); // the version is stored in the BEOS:APP_VERSION attribute of libbe.so @@ -175,6 +176,16 @@ AboutView::AboutView(const BRect &rect) strcpy(string, versionInfo.short_info); } + // Add revision from resources + BResources* resources = be_app->AppResources(); + const char* versionString = (const char *)resources->LoadResource( + B_STRING_TYPE, "SVN:REVISION", NULL); + if (versionString != NULL) { + strlcat(string, " (r", sizeof(string)); + strlcat(string, versionString, sizeof(string)); + strlcat(string, ")", sizeof(string)); + } + stringView = new BStringView(r, "ostext", string); fInfoView->AddChild(stringView); stringView->ResizeToPreferred(); @@ -285,7 +296,6 @@ AboutView::AboutView(const BRect &rect) fCreditsView, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, false, true, B_PLAIN_BORDER); AddChild(creditsScroller); - rgb_color darkgrey = { 100, 100, 100, 255 }; rgb_color haiku_green = { 42, 131, 36, 255 }; rgb_color haiku_orange = { 255, 69, 0, 255 }; @@ -376,6 +386,7 @@ AboutView::AboutView(const BRect &rect) "Jonas Sundström\n" "Daniel Switkin\n" "Atsushi Takamatsu\n" + "Oliver Tappe\n" "Jason Vandermark\n" "Sandor Vroemisse\n" "Nathan Whitehorn\n" diff --git a/src/apps/abouthaiku/Jamfile b/src/apps/abouthaiku/Jamfile index b7c2d7583b..8b9eaf444d 100644 --- a/src/apps/abouthaiku/Jamfile +++ b/src/apps/abouthaiku/Jamfile @@ -12,6 +12,23 @@ Application AboutHaiku : : AboutHaiku.rdef ; +rule AddRevisionToResources { + Depends $(1) ; + AddRevisionToResources1 $(1) : rc ; +} + +actions AddRevisionToResources1 { + VERSION=`svn info | grep Revision | cut -d\ -f2` + echo "resource(201, \"SVN:REVISION\") #'CSTR' \""$VERSION"\";" | $(2) -m -o $(1) - +} + +# This must come after the Application rule, so that the +# AboutHaiku.rsrc file is already created +AddRevisionToResources [ FGristFiles AboutHaiku.rsrc ] ; +ALWAYS [ FGristFiles AboutHaiku.rsrc ] ; + # we want to rebuild the resources everytime AboutHaiku + # is built to keep them up-to-date + Includes [ FGristFiles AboutHaiku.rdef ] : [ FGristFiles haikulogo.png ] ; SEARCH on [ FGristFiles haikulogo.png ] = [ FDirName $(HAIKU_TOP) src apps abouthaiku ] ;