From b5feb1f13f33c2a470adb759b67e574e83caffd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 28 Sep 2005 22:50:52 +0000 Subject: [PATCH] total size is now working copied BPrivate::CopyLoopControl impl from libtracker.so because R5 loader doesn't seem able to find these symbols correctly in libtracker.so git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14271 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../installer/InstallerCopyLoopControl.cpp | 34 ++++++++++++++++--- src/apps/installer/InstallerCopyLoopControl.h | 2 +- src/apps/installer/InstallerWindow.cpp | 14 ++++++-- src/apps/installer/PackageViews.cpp | 9 ++++- src/apps/installer/PackageViews.h | 1 + 5 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/apps/installer/InstallerCopyLoopControl.cpp b/src/apps/installer/InstallerCopyLoopControl.cpp index 4aa6790ac4..572817a6a2 100644 --- a/src/apps/installer/InstallerCopyLoopControl.cpp +++ b/src/apps/installer/InstallerCopyLoopControl.cpp @@ -5,14 +5,40 @@ */ #include "InstallerCopyLoopControl.h" -InstallerCopyLoopControl::InstallerCopyLoopControl(InstallerWindow *window) - : CopyLoopControl(), - fWindow(window) +/* copied from libtracker, because beos loader doesn't seem to find them correctly in libtracker.so */ + +BPrivate::CopyLoopControl::~CopyLoopControl() +{ +} + +void +BPrivate::CopyLoopControl::ChecksumChunk(const char *, size_t) { } -InstallerCopyLoopControl::~InstallerCopyLoopControl(void) +bool +BPrivate::CopyLoopControl::ChecksumFile(const entry_ref *) +{ + return true; +} + + +bool +BPrivate::CopyLoopControl::SkipAttribute(const char*) +{ + return false; +} + + +bool +BPrivate::CopyLoopControl::PreserveAttribute(const char*) +{ + return false; +} + +InstallerCopyLoopControl::InstallerCopyLoopControl(InstallerWindow *window) + : fWindow(window) { } diff --git a/src/apps/installer/InstallerCopyLoopControl.h b/src/apps/installer/InstallerCopyLoopControl.h index f6640f5be8..52b80ee944 100644 --- a/src/apps/installer/InstallerCopyLoopControl.h +++ b/src/apps/installer/InstallerCopyLoopControl.h @@ -14,7 +14,7 @@ class InstallerCopyLoopControl : public CopyLoopControl { public: InstallerCopyLoopControl(InstallerWindow *window); - ~InstallerCopyLoopControl(void); + virtual ~InstallerCopyLoopControl() {}; virtual bool FileError(const char *message, const char *name, status_t error, bool allowContinue); diff --git a/src/apps/installer/InstallerWindow.cpp b/src/apps/installer/InstallerWindow.cpp index e55ac7a549..2db1287080 100644 --- a/src/apps/installer/InstallerWindow.cpp +++ b/src/apps/installer/InstallerWindow.cpp @@ -87,11 +87,14 @@ InstallerWindow::InstallerWindow(BRect frame_rect) fBackBox->AddChild(fDestMenuField); BRect sizeRect = fBackBox->Bounds(); - sizeRect.top = sizeRect.bottom - 15; - sizeRect.left = sizeRect.right - 100; - fSizeView = new BStringView(sizeRect, "size_view", "Disk space required : 0.0 KB"); + sizeRect.top = 105; + sizeRect.bottom = sizeRect.top + 15; + sizeRect.right -= 12; + sizeRect.left = sizeRect.right - 150; + fSizeView = new BStringView(sizeRect, "size_view", "Disk space required: 0.0 KB", B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); fSizeView->SetAlignment(B_ALIGN_RIGHT); fBackBox->AddChild(fSizeView); + fSizeView->Hide(); // finish creating window Show(); @@ -172,11 +175,15 @@ InstallerWindow::ShowBottom() fSetupButton->Show(); if (fPackagesScrollView->IsHidden()) fPackagesScrollView->Show(); + if (fSizeView->IsHidden()) + fSizeView->Show(); } else { if (!fSetupButton->IsHidden()) fSetupButton->Hide(); if (!fPackagesScrollView->IsHidden()) fPackagesScrollView->Hide(); + if (!fSizeView->IsHidden()) + fSizeView->Hide(); ResizeTo(332,160); } } @@ -253,6 +260,7 @@ InstallerWindow::PublishPackages() packages.SortItems(ComparePackages); fPackagesView->AddPackages(packages, new BMessage(PACKAGE_CHECKBOX)); + PostMessage(PACKAGE_CHECKBOX); } diff --git a/src/apps/installer/PackageViews.cpp b/src/apps/installer/PackageViews.cpp index e458b0dd1d..51867826c9 100644 --- a/src/apps/installer/PackageViews.cpp +++ b/src/apps/installer/PackageViews.cpp @@ -223,5 +223,12 @@ PackagesView::AddPackages(BList &packages, BMessage *msg) void PackagesView::GetTotalSizeAsString(char *string) { - SizeAsString(0, string); + int32 count = CountChildren(); + int32 size = 0; + for (int32 i=0; i(ChildAt(i)); + if (cb && cb->Value()) + size += cb->GetPackage()->Size(); + } + SizeAsString(size, string); } diff --git a/src/apps/installer/PackageViews.h b/src/apps/installer/PackageViews.h index ba6c401480..0ae4238971 100644 --- a/src/apps/installer/PackageViews.h +++ b/src/apps/installer/PackageViews.h @@ -57,6 +57,7 @@ class PackageCheckBox : public BCheckBox { PackageCheckBox(BRect rect, Package &item); virtual ~PackageCheckBox(); virtual void Draw(BRect update); + Package *GetPackage() { return &fPackage; }; private: Package &fPackage; };