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),
fWindowGotRefs(false),
fZippingWasStopped(false),
fFileCount(0),
fWindowInvoker(new BInvoker(new BMessage(ZIPPO_QUIT_OR_CONTINUE), NULL,
this))
{
@@ -132,7 +133,6 @@ ZippoWindow::MessageReceived(BMessage* message)
case ZIPPO_LINE_OF_STDOUT:
{
static int32 fileCount = 0;
BString string;
if (message->FindString("zip_output", &string) == B_OK) {
if (string.FindFirst("Adding: ") == 0
@@ -145,14 +145,14 @@ ZippoWindow::MessageReceived(BMessage* message)
// being created (added to) or if we're updating an
// already existing archive.
fileCount++;
fFileCount++;
BString countString;
countString << fileCount;
countString << fFileCount;
if (fileCount == 1)
countString << " file ";
if (fFileCount == 1)
countString << " file";
else
countString << " files ";
countString << " files";
if (string.FindFirst("Adding: ") == 0)
countString << " added.";
@@ -218,6 +218,7 @@ ZippoWindow::_StartZipping(BMessage* message)
{
fStopButton->SetEnabled(true);
fActivityView->Start();
fFileCount = 0;
fThread = new ZipperThread(message, this);
fThread->Start();
@@ -37,6 +37,7 @@ private:
bool fWindowGotRefs;
bool fZippingWasStopped;
int32 fFileCount;
BInvoker* fWindowInvoker;
};