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:
parent
9daa13637a
commit
38d8620261
@ -10,10 +10,12 @@
|
|||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <MessageRunner.h>
|
#include <MessageRunner.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
#include <Path.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
@ -150,20 +152,27 @@ AboutView::AboutView(const BRect &r)
|
|||||||
fInfoView->AddChild(stringView);
|
fInfoView->AddChild(stringView);
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
|
|
||||||
|
// we update "labelHeight" to the actual height of the string view
|
||||||
|
labelHeight = stringView->Bounds().Height();
|
||||||
|
|
||||||
r.OffsetBy(0, labelHeight);
|
r.OffsetBy(0, labelHeight);
|
||||||
r.bottom = r.top + textHeight;
|
r.bottom = r.top + textHeight;
|
||||||
|
|
||||||
|
strcpy(string, "Unknown");
|
||||||
|
|
||||||
// the version is stored in the BEOS:APP_VERSION attribute of libbe.so
|
// the version is stored in the BEOS:APP_VERSION attribute of libbe.so
|
||||||
BFile file("/boot/beos/system/lib/libbe.so", B_READ_ONLY);
|
BPath path;
|
||||||
if (file.InitCheck() == B_OK) {
|
if (find_directory(B_BEOS_LIB_DIRECTORY, &path) == B_OK) {
|
||||||
|
path.Append("libbe.so");
|
||||||
|
|
||||||
BAppFileInfo appFileInfo;
|
BAppFileInfo appFileInfo;
|
||||||
version_info versionInfo;
|
version_info versionInfo;
|
||||||
|
BFile file;
|
||||||
if (appFileInfo.SetTo(&file) == B_OK
|
if (file.SetTo(path.Path(), B_READ_ONLY) == B_OK
|
||||||
&& appFileInfo.GetVersionInfo(&versionInfo, B_APP_VERSION_KIND) == 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);
|
strcpy(string, versionInfo.short_info);
|
||||||
else
|
|
||||||
strcpy(string, "Unknown");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stringView = new BStringView(r, "ostext", string);
|
stringView = new BStringView(r, "ostext", string);
|
||||||
@ -251,10 +260,11 @@ AboutView::AboutView(const BRect &r)
|
|||||||
|
|
||||||
r.OffsetBy(0, labelHeight);
|
r.OffsetBy(0, labelHeight);
|
||||||
r.bottom = r.top + textHeight;
|
r.bottom = r.top + textHeight;
|
||||||
|
|
||||||
fUptimeView = new BStringView(r, "uptimetext", "");
|
fUptimeView = new BStringView(r, "uptimetext", "");
|
||||||
fInfoView->AddChild(fUptimeView);
|
fInfoView->AddChild(fUptimeView);
|
||||||
|
// string width changes, so we don't do ResizeToPreferred()
|
||||||
|
|
||||||
char uptimeString[255];
|
char uptimeString[255];
|
||||||
fUptimeView->SetText(UptimeToString(uptimeString, 255));
|
fUptimeView->SetText(UptimeToString(uptimeString, 255));
|
||||||
|
|
||||||
|
@ -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_SIG") #'MIMS' "application/x-vnd.haiku-AboutHaiku";
|
||||||
|
|
||||||
resource(1, "BEOS:APP_VERSION") #'APPV' array {
|
resource app_version {
|
||||||
$"0100000000000000000000000000000000000000000000000000000000000000"
|
major = 1,
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
middle = 0,
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
minor = 0,
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
variety = B_APPV_ALPHA,
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
internal = 3,
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
short_info = "AboutHaiku 1.0.0",
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
long_info = "AboutHaiku ©2005 Haiku, Inc."
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000000000000000000000000000000000000000000000000000"
|
|
||||||
$"0000000000000000"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
resource(1, "BEOS:APP_FLAGS") #'APPF' $"02000000";
|
resource(1, "BEOS:APP_FLAGS") #'APPF' $"02000000";
|
||||||
|
Loading…
Reference in New Issue
Block a user