From 7f8618292df7e850a61df1d1728d2da236af037f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sundstr=C3=B6m?= Date: Fri, 14 Aug 2009 19:35:02 +0000 Subject: [PATCH] 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 --- .../tracker/zipomatic/ZipOMaticWindow.cpp | 44 +++++++++++++++---- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/src/add-ons/tracker/zipomatic/ZipOMaticWindow.cpp b/src/add-ons/tracker/zipomatic/ZipOMaticWindow.cpp index e843359162..882ad344fe 100644 --- a/src/add-ons/tracker/zipomatic/ZipOMaticWindow.cpp +++ b/src/add-ons/tracker/zipomatic/ZipOMaticWindow.cpp @@ -61,20 +61,16 @@ ZippoWindow::ZippoWindow(BRect frame, BMessage* refs) BSeparatorView* separator = new BSeparatorView(B_HORIZONTAL); SetLayout(new BGroupLayout(B_VERTICAL)); - BLayoutBuilder::Group<> group = BLayoutBuilder::Group<>(); - group.AddGroup(B_VERTICAL, 10) + BLayoutBuilder::Group<>(this, B_VERTICAL, 10) .Add(fActivityView) .Add(fArchiveNameView) .Add(fZipOutputView) .Add(separator) .Add(fStopButton) .SetInsets(14, 14, 14, 14) - .End() - .End(); - AddChild(group.View()); + .End(); - if (refs != NULL) - { + if (refs != NULL) { fWindowGotRefs = true; _StartZipping(refs); } @@ -136,9 +132,39 @@ ZippoWindow::MessageReceived(BMessage* message) case ZIPPO_LINE_OF_STDOUT: { + static int32 fileCount = 0; BString string; - if (message->FindString("zip_output", &string) == B_OK) - fZipOutputView->SetText(string.String()); + if (message->FindString("zip_output", &string) == B_OK) { + 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; }