Don't display the unit of the current size if it's the same as the unit of the
expected size in the download progress view. git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@382 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
parent
92e8b344ac
commit
cb0b497952
@ -110,7 +110,7 @@ public:
|
|||||||
Invalidate();
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsIconDimmed() const
|
bool IsIconDimmed() const
|
||||||
{
|
{
|
||||||
return fDimmedIcon;
|
return fDimmedIcon;
|
||||||
@ -307,7 +307,7 @@ DownloadProgressView::AttachedToWindow()
|
|||||||
fDownload->SetProgressListener(BMessenger(this));
|
fDownload->SetProgressListener(BMessenger(this));
|
||||||
fTopButton->SetTarget(this);
|
fTopButton->SetTarget(this);
|
||||||
fBottomButton->SetTarget(this);
|
fBottomButton->SetTarget(this);
|
||||||
|
|
||||||
BEntry entry(fPath.Path());
|
BEntry entry(fPath.Path());
|
||||||
if (entry.Exists())
|
if (entry.Exists())
|
||||||
_StartNodeMonitor(entry);
|
_StartNodeMonitor(entry);
|
||||||
@ -604,11 +604,23 @@ DownloadProgressView::_UpdateStatusText()
|
|||||||
// Draw speed info
|
// Draw speed info
|
||||||
char sizeBuffer[128];
|
char sizeBuffer[128];
|
||||||
buffer = "(";
|
buffer = "(";
|
||||||
buffer << string_for_size((double)fCurrentSize, sizeBuffer,
|
// Get strings for current and expected size and remove the unit
|
||||||
|
// from the current size string if it's the same as the expected
|
||||||
|
// size unit.
|
||||||
|
BString currentSize = string_for_size((double)fCurrentSize, sizeBuffer,
|
||||||
sizeof(sizeBuffer));
|
sizeof(sizeBuffer));
|
||||||
|
BString expectedSize = string_for_size((double)fExpectedSize, sizeBuffer,
|
||||||
|
sizeof(sizeBuffer));
|
||||||
|
int currentSizeUnitPos = currentSize.FindLast(' ');
|
||||||
|
int expectedSizeUnitPos = expectedSize.FindLast(' ');
|
||||||
|
if (currentSizeUnitPos >= 0 && expectedSizeUnitPos >= 0
|
||||||
|
&& strcmp(currentSize.String() + currentSizeUnitPos,
|
||||||
|
expectedSize.String() + expectedSizeUnitPos) == 0) {
|
||||||
|
currentSize.Truncate(currentSizeUnitPos);
|
||||||
|
}
|
||||||
|
buffer << currentSize;
|
||||||
buffer << " of ";
|
buffer << " of ";
|
||||||
buffer << string_for_size((double)fExpectedSize, sizeBuffer,
|
buffer << expectedSize;
|
||||||
sizeof(sizeBuffer));
|
|
||||||
buffer << ", ";
|
buffer << ", ";
|
||||||
buffer << string_for_size(fBytesPerSecond, sizeBuffer,
|
buffer << string_for_size(fBytesPerSecond, sizeBuffer,
|
||||||
sizeof(sizeBuffer));
|
sizeof(sizeBuffer));
|
||||||
|
Loading…
Reference in New Issue
Block a user