ShowImage: Apply i18n to number values

Also use multiplication sign for a nicer look

Change-Id: I526204832d4826f44a326f44037173418d8e2885
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7556
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: Niels Sascha Reedijk <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Emir SARI
2024-04-01 07:45:33 +00:00
committed by Adrien Destugues
parent 48cd211d71
commit dae087ed53
3 changed files with 16 additions and 10 deletions
+1 -3
View File
@@ -177,9 +177,7 @@ ShowImageStatusView::_SetZoomText(float zoom)
{ {
BNumberFormat numberFormat; BNumberFormat numberFormat;
BString data; BString data;
numberFormat.FormatPercent(data, zoom);
if (numberFormat.FormatPercent(data, zoom) != B_OK)
data.SetToFormat("%.0f%%", zoom * 100);
fCellText[kZoomCell] = data; fCellText[kZoomCell] = data;
} }
+13 -7
View File
@@ -407,7 +407,7 @@ ShowImageWindow::_BuildRatingMenu()
for (int32 i = 1; i <= 10; i++) { for (int32 i = 1; i <= 10; i++) {
BMessage* message = new BMessage(MSG_SET_RATING); BMessage* message = new BMessage(MSG_SET_RATING);
BString label; BString label;
label << i; fNumberFormat.Format(label, i);
message->AddInt32("rating", i); message->AddInt32("rating", i);
fRatingMenu->AddItem(new BMenuItem(label.String(), message)); fRatingMenu->AddItem(new BMenuItem(label.String(), message));
} }
@@ -1149,15 +1149,21 @@ ShowImageWindow::_GetFileInfo(const entry_ref& ref)
void void
ShowImageWindow::_UpdateStatusText(const BMessage* message) ShowImageWindow::_UpdateStatusText(const BMessage* message)
{ {
BString frameText; BString frameText, height, width;
if (fImageView->Bitmap() != NULL) { if (fImageView->Bitmap() != NULL) {
BRect bounds = fImageView->Bitmap()->Bounds(); BRect bounds = fImageView->Bitmap()->Bounds();
frameText << bounds.IntegerWidth() + 1 fNumberFormat.Format(width, bounds.IntegerWidth() + 1);
<< "x" << bounds.IntegerHeight() + 1; fNumberFormat.Format(height, bounds.IntegerHeight() + 1);
frameText.SetToFormat("%s × %s", width.String(), height.String());
} }
BString pages;
if (fNavigator.PageCount() > 1) BString currentPage, pageCount, pages;
pages << fNavigator.CurrentPage() << "/" << fNavigator.PageCount(); if (fNavigator.PageCount() > 1) {
fNumberFormat.Format(currentPage, fNavigator.CurrentPage());
fNumberFormat.Format(pageCount, fNavigator.PageCount());
pages.SetToFormat("%s / %s", currentPage.String(), pageCount.String());
}
fStatusView->Update(fNavigator.CurrentRef(), frameText, pages, fImageType, fStatusView->Update(fNavigator.CurrentRef(), frameText, pages, fImageType,
fImageView->Zoom()); fImageView->Zoom());
} }
+2
View File
@@ -11,6 +11,7 @@
#define SHOW_IMAGE_WINDOW_H #define SHOW_IMAGE_WINDOW_H
#include <NumberFormat.h>
#include <ToolBar.h> #include <ToolBar.h>
#include <Window.h> #include <Window.h>
@@ -127,6 +128,7 @@ private:
BMenu* fRatingMenu; BMenu* fRatingMenu;
BMenu* fOpenWithMenu; BMenu* fOpenWithMenu;
BMenuItem* fResetRatingItem; BMenuItem* fResetRatingItem;
BNumberFormat fNumberFormat;
BToolBar* fToolBar; BToolBar* fToolBar;
bool fToolBarVisible; bool fToolBarVisible;
BView* fScrollArea; BView* fScrollArea;