ShowImage: Use BNumberFormat for percentage value

This provides automatic percentage formatting according to the locale
setting.

Change-Id: I9a833fdc4056ac5479d8e4b4feddd0fce06d1fcd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6210
Tested-by: Automation <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Emir SARI
2023-03-16 21:22:36 +00:00
committed by waddlesplash
parent f6fad5e8c2
commit 174b7ef6cc
+8 -1
View File
@@ -14,6 +14,7 @@
#include <ControlLook.h>
#include <Entry.h>
#include <MenuItem.h>
#include <NumberFormat.h>
#include <Path.h>
#include <PopUpMenu.h>
#include <ScrollView.h>
@@ -178,7 +179,13 @@ ShowImageStatusView::_SetFrameText(const BString& text)
void
ShowImageStatusView::_SetZoomText(float zoom)
{
fCellText[kZoomCell].SetToFormat("%.0f%%", zoom * 100);
BNumberFormat numberFormat;
BString data;
if (numberFormat.FormatPercent(data, zoom) != B_OK)
fCellText[kZoomCell].SetToFormat("%.0f%%", zoom * 100);
fCellText[kZoomCell] = data;
}