Now has real app version information.

"labelHeight" was not the actual label height, just the font height; as a
result, it could overwrite the label (and did so with "Time Running:").
Now uses find_directory() to locate the system lib directory.
Does not use version_info::short_info if it's empty.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13567 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-07-09 20:50:44 +00:00
parent 9daa13637a
commit 38d8620261
2 changed files with 30 additions and 32 deletions

View File

@ -10,10 +10,12 @@
#include <Application.h>
#include <Bitmap.h>
#include <File.h>
#include <FindDirectory.h>
#include <Font.h>
#include <MessageRunner.h>
#include <Messenger.h>
#include <OS.h>
#include <Path.h>
#include <Screen.h>
#include <ScrollView.h>
#include <String.h>
@ -150,20 +152,27 @@ AboutView::AboutView(const BRect &r)
fInfoView->AddChild(stringView);
stringView->ResizeToPreferred();
// we update "labelHeight" to the actual height of the string view
labelHeight = stringView->Bounds().Height();
r.OffsetBy(0, labelHeight);
r.bottom = r.top + textHeight;
strcpy(string, "Unknown");
// the version is stored in the BEOS:APP_VERSION attribute of libbe.so
BFile file("/boot/beos/system/lib/libbe.so", B_READ_ONLY);
if (file.InitCheck() == B_OK) {
BPath path;
if (find_directory(B_BEOS_LIB_DIRECTORY, &path) == B_OK) {
path.Append("libbe.so");
BAppFileInfo appFileInfo;
version_info versionInfo;
if (appFileInfo.SetTo(&file) == B_OK
&& appFileInfo.GetVersionInfo(&versionInfo, B_APP_VERSION_KIND) == B_OK)
BFile file;
if (file.SetTo(path.Path(), B_READ_ONLY) == B_OK
&& appFileInfo.SetTo(&file) == B_OK
&& appFileInfo.GetVersionInfo(&versionInfo, B_APP_VERSION_KIND) == B_OK
&& versionInfo.short_info[0] != '\0')
strcpy(string, versionInfo.short_info);
else
strcpy(string, "Unknown");
}
stringView = new BStringView(r, "ostext", string);
@ -254,6 +263,7 @@ AboutView::AboutView(const BRect &r)
fUptimeView = new BStringView(r, "uptimetext", "");
fInfoView->AddChild(fUptimeView);
// string width changes, so we don't do ResizeToPreferred()
char uptimeString[255];
fUptimeView->SetText(UptimeToString(uptimeString, 255));

View File

@ -104,29 +104,17 @@ resource(101, "BEOS:M:STD_ICON") #'MICN' array {
resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.haiku-AboutHaiku";
resource(1, "BEOS:APP_VERSION") #'APPV' array {
$"0100000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000000000000000000000000000000000000000000000000000"
$"0000000000000000"
resource app_version {
major = 1,
middle = 0,
minor = 0,
variety = B_APPV_ALPHA,
internal = 3,
short_info = "AboutHaiku 1.0.0",
long_info = "AboutHaiku ©2005 Haiku, Inc."
};
resource(1, "BEOS:APP_FLAGS") #'APPF' $"02000000";