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
This commit is contained in:
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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<count; i++) {
|
||||
PackageCheckBox *cb = dynamic_cast<PackageCheckBox*>(ChildAt(i));
|
||||
if (cb && cb->Value())
|
||||
size += cb->GetPackage()->Size();
|
||||
}
|
||||
SizeAsString(size, string);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user