diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index 8b6afcbc77..a433cbfb7a 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -48,7 +48,7 @@ InstallerWindow::InstallerWindow(BRect frame_rect) BScrollView *scroll = new BScrollView("statusScroll", fStatusView, B_FOLLOW_LEFT|B_FOLLOW_TOP, B_WILL_DRAW|B_FRAME_EVENTS); fBackBox->AddChild(scroll); - fBeginButton = new BButton(BRect(bounds.right-90, bounds.bottom-35, bounds.right-10, bounds.bottom-11), + fBeginButton = new BButton(BRect(bounds.right-90, bounds.bottom-35, bounds.right-11, bounds.bottom-11), "begin_button", "Begin", new BMessage(BEGIN_MESSAGE), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); fBeginButton->MakeDefault(true); fBackBox->AddChild(fBeginButton); diff --git a/src/apps/installer/PackageViews.cpp b/src/apps/installer/PackageViews.cpp index 8bb8f34e9a..a6928fdd33 100644 --- a/src/apps/installer/PackageViews.cpp +++ b/src/apps/installer/PackageViews.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "PackageViews.h" @@ -66,6 +67,24 @@ err: } +void +Package::GetSizeAsString(char *string) +{ + float kb = fSize / 1024.0; + if (kb < 1.0) { + sprintf(string, "%ld B", fSize); + return; + } + float mb = kb / 1024.0; + if (mb < 1.0) { + sprintf(string, "%3.1f KB", kb); + return; + } + sprintf(string, "%3.1f MB", mb); + +} + + Group::Group() : fGroup(NULL) { @@ -94,9 +113,12 @@ void PackageCheckBox::Draw(BRect update) { BCheckBox::Draw(update); + char string[255]; + fPackage.GetSizeAsString(string); + float width = StringWidth(string); + DrawString(string, BPoint(Bounds().right - width - 8, 11)); } - GroupView::GroupView(BRect rect, Group &group) : BStringView(rect, "group", group.GroupName()), fGroup(group) diff --git a/src/apps/installer/PackageViews.h b/src/apps/installer/PackageViews.h index 192a704dec..2c2e80428e 100644 --- a/src/apps/installer/PackageViews.h +++ b/src/apps/installer/PackageViews.h @@ -36,6 +36,7 @@ public: const char * Name() const { return fName; }; const char * Description() const { return fDescription; }; const int32 Size() const { return fSize; }; + void GetSizeAsString(char *string); const BBitmap * Icon() const { return fIcon; }; bool OnByDefault() const { return fOnByDefault; }; bool AlwaysOn() const { return fAlwaysOn; };