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 <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
Emir SARI 2024-03-28 14:28:24 +03:00 committed by Adrien Destugues
parent 48cd211d71
commit dae087ed53
3 changed files with 16 additions and 10 deletions

View File

@ -177,9 +177,7 @@ ShowImageStatusView::_SetZoomText(float zoom)
{
BNumberFormat numberFormat;
BString data;
if (numberFormat.FormatPercent(data, zoom) != B_OK)
data.SetToFormat("%.0f%%", zoom * 100);
numberFormat.FormatPercent(data, zoom);
fCellText[kZoomCell] = data;
}

View File

@ -407,7 +407,7 @@ ShowImageWindow::_BuildRatingMenu()
for (int32 i = 1; i <= 10; i++) {
BMessage* message = new BMessage(MSG_SET_RATING);
BString label;
label << i;
fNumberFormat.Format(label, i);
message->AddInt32("rating", i);
fRatingMenu->AddItem(new BMenuItem(label.String(), message));
}
@ -1149,15 +1149,21 @@ ShowImageWindow::_GetFileInfo(const entry_ref& ref)
void
ShowImageWindow::_UpdateStatusText(const BMessage* message)
{
BString frameText;
BString frameText, height, width;
if (fImageView->Bitmap() != NULL) {
BRect bounds = fImageView->Bitmap()->Bounds();
frameText << bounds.IntegerWidth() + 1
<< "x" << bounds.IntegerHeight() + 1;
fNumberFormat.Format(width, bounds.IntegerWidth() + 1);
fNumberFormat.Format(height, bounds.IntegerHeight() + 1);
frameText.SetToFormat("%s × %s", width.String(), height.String());
}
BString pages;
if (fNavigator.PageCount() > 1)
pages << fNavigator.CurrentPage() << "/" << fNavigator.PageCount();
BString currentPage, pageCount, pages;
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,
fImageView->Zoom());
}

View File

@ -11,6 +11,7 @@
#define SHOW_IMAGE_WINDOW_H
#include <NumberFormat.h>
#include <ToolBar.h>
#include <Window.h>
@ -127,6 +128,7 @@ private:
BMenu* fRatingMenu;
BMenu* fOpenWithMenu;
BMenuItem* fResetRatingItem;
BNumberFormat fNumberFormat;
BToolBar* fToolBar;
bool fToolBarVisible;
BView* fScrollArea;