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:
@@ -14,6 +14,7 @@
|
|||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
#include <NumberFormat.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <PopUpMenu.h>
|
#include <PopUpMenu.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
@@ -178,7 +179,13 @@ ShowImageStatusView::_SetFrameText(const BString& text)
|
|||||||
void
|
void
|
||||||
ShowImageStatusView::_SetZoomText(float zoom)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user