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:
stippi
2012-07-03 15:38:52 +02:00
committed by Alexandre Deckner
parent 92e8b344ac
commit cb0b497952
+15 -3
View File
@@ -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));