Changing the layout code as suggested. Something's not right. White background not intended. Presenting zip output as a file count instead, to work around excessive window resizing.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32390 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström
2009-08-14 19:35:02 +00:00
parent 6fc8f3cdc9
commit 7f8618292d
@@ -61,20 +61,16 @@ ZippoWindow::ZippoWindow(BRect frame, BMessage* refs)
BSeparatorView* separator = new BSeparatorView(B_HORIZONTAL); BSeparatorView* separator = new BSeparatorView(B_HORIZONTAL);
SetLayout(new BGroupLayout(B_VERTICAL)); SetLayout(new BGroupLayout(B_VERTICAL));
BLayoutBuilder::Group<> group = BLayoutBuilder::Group<>(); BLayoutBuilder::Group<>(this, B_VERTICAL, 10)
group.AddGroup(B_VERTICAL, 10)
.Add(fActivityView) .Add(fActivityView)
.Add(fArchiveNameView) .Add(fArchiveNameView)
.Add(fZipOutputView) .Add(fZipOutputView)
.Add(separator) .Add(separator)
.Add(fStopButton) .Add(fStopButton)
.SetInsets(14, 14, 14, 14) .SetInsets(14, 14, 14, 14)
.End() .End();
.End();
AddChild(group.View());
if (refs != NULL) if (refs != NULL) {
{
fWindowGotRefs = true; fWindowGotRefs = true;
_StartZipping(refs); _StartZipping(refs);
} }
@@ -136,9 +132,39 @@ ZippoWindow::MessageReceived(BMessage* message)
case ZIPPO_LINE_OF_STDOUT: case ZIPPO_LINE_OF_STDOUT:
{ {
static int32 fileCount = 0;
BString string; BString string;
if (message->FindString("zip_output", &string) == B_OK) if (message->FindString("zip_output", &string) == B_OK) {
fZipOutputView->SetText(string.String()); if (string.FindFirst("Adding: ") == 0
|| string.FindFirst("Updating: ") == 0) {
// This is a workaround for the current window resizing
// behavior as the window resizes for each line of output.
// Instead of showing the true output of /bin/zip
// we display a file count and whether the archive is
// being created (added to) or if we're updating an
// already existing archive.
fileCount++;
BString countString;
countString << fileCount;
if (fileCount == 1)
countString << " file ";
else
countString << " files ";
if (string.FindFirst("Adding: ") == 0)
countString << " added.";
if (string.FindFirst("Updating: ") == 0)
countString << " updated.";
fZipOutputView->SetText(countString.String());
} else {
fZipOutputView->SetText(string.String());
}
}
break; break;
} }