Make fileCount a data member and reset it between zip runs. Trim double space in output.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32391 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jonas Sundström
2009-08-14 20:18:12 +00:00
parent 7f8618292d
commit 4dc6088201
2 changed files with 8 additions and 6 deletions
@@ -37,6 +37,7 @@ ZippoWindow::ZippoWindow(BRect frame, BMessage* refs)
fThread(NULL), fThread(NULL),
fWindowGotRefs(false), fWindowGotRefs(false),
fZippingWasStopped(false), fZippingWasStopped(false),
fFileCount(0),
fWindowInvoker(new BInvoker(new BMessage(ZIPPO_QUIT_OR_CONTINUE), NULL, fWindowInvoker(new BInvoker(new BMessage(ZIPPO_QUIT_OR_CONTINUE), NULL,
this)) this))
{ {
@@ -132,7 +133,6 @@ 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) {
if (string.FindFirst("Adding: ") == 0 if (string.FindFirst("Adding: ") == 0
@@ -145,14 +145,14 @@ ZippoWindow::MessageReceived(BMessage* message)
// being created (added to) or if we're updating an // being created (added to) or if we're updating an
// already existing archive. // already existing archive.
fileCount++; fFileCount++;
BString countString; BString countString;
countString << fileCount; countString << fFileCount;
if (fileCount == 1) if (fFileCount == 1)
countString << " file "; countString << " file";
else else
countString << " files "; countString << " files";
if (string.FindFirst("Adding: ") == 0) if (string.FindFirst("Adding: ") == 0)
countString << " added."; countString << " added.";
@@ -218,6 +218,7 @@ ZippoWindow::_StartZipping(BMessage* message)
{ {
fStopButton->SetEnabled(true); fStopButton->SetEnabled(true);
fActivityView->Start(); fActivityView->Start();
fFileCount = 0;
fThread = new ZipperThread(message, this); fThread = new ZipperThread(message, this);
fThread->Start(); fThread->Start();
@@ -37,6 +37,7 @@ private:
bool fWindowGotRefs; bool fWindowGotRefs;
bool fZippingWasStopped; bool fZippingWasStopped;
int32 fFileCount;
BInvoker* fWindowInvoker; BInvoker* fWindowInvoker;
}; };