[haiku-commits] haiku: hrev47982 - in src: apps/magnify apps/diskusage preferences/locale preferences/time

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 8 Oct 2014 13:16:51 +0200 (CEST)

hrev47982 adds 3 changesets to branch 'master'
old head: 824cb460ac8ac243f8d0dd3c88e3d482df104599
new head: be93029899fb6fc32eabbaa0647f4716d03737f0
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=be93029+%5E824cb46

----------------------------------------------------------------------------

df8bc91: Locale preferences: use B_WIDTH_FROM_WIDEST tabs.
  
  The russian translation of "Formatting" does not fit in
  B_WIDTH_AS_USUAL with the default font size.

baf0ed6: Time preferences: Another too wide tab label

be93029: More uses of BMessageFormat.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 12 insertions(+), 11 deletions(-)
src/apps/diskusage/StatusView.cpp       |  9 +++++----
src/apps/magnify/Magnify.cpp            | 10 +++++-----
src/preferences/locale/LocaleWindow.cpp |  2 +-
src/preferences/time/TimeWindow.cpp     |  2 +-

############################################################################

Commit:      df8bc913d26e8b4968d3eaeb2085fe1fae1f4f04
URL:         http://cgit.haiku-os.org/haiku/commit/?id=df8bc91
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Wed Oct  8 09:54:34 2014 UTC

Locale preferences: use B_WIDTH_FROM_WIDEST tabs.

The russian translation of "Formatting" does not fit in
B_WIDTH_AS_USUAL with the default font size.

----------------------------------------------------------------------------

diff --git a/src/preferences/locale/LocaleWindow.cpp 
b/src/preferences/locale/LocaleWindow.cpp
index 2a6b4ef..5db6252 100644
--- a/src/preferences/locale/LocaleWindow.cpp
+++ b/src/preferences/locale/LocaleWindow.cpp
@@ -77,7 +77,7 @@ LocaleWindow::LocaleWindow()
 
        float spacing = be_control_look->DefaultItemSpacing();
 
-       BTabView* tabView = new BTabView("tabview");
+       BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_WIDEST);
        BGroupView* languageTab = new BGroupView(B_TRANSLATE("Language"),
                B_HORIZONTAL, spacing);
 

############################################################################

Commit:      baf0ed6a7bb05661492f282f446c37a7eee70d40
URL:         http://cgit.haiku-os.org/haiku/commit/?id=baf0ed6
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Wed Oct  8 11:02:06 2014 UTC

Time preferences: Another too wide tab label

----------------------------------------------------------------------------

diff --git a/src/preferences/time/TimeWindow.cpp 
b/src/preferences/time/TimeWindow.cpp
index 8d2e641..fe5821b 100644
--- a/src/preferences/time/TimeWindow.cpp
+++ b/src/preferences/time/TimeWindow.cpp
@@ -124,7 +124,7 @@ TTimeWindow::_InitWindow()
        fBaseView->StartWatchingAll(fDateTimeView);
        fBaseView->StartWatchingAll(fTimeZoneView);
 
-       fTabView = new BTabView("tabView");
+       fTabView = new BTabView("tabView", B_WIDTH_FROM_WIDEST);
        fTabView->AddTab(fDateTimeView);
        fTabView->AddTab(fTimeZoneView);
        fTabView->AddTab(fNetworkTimeView);

############################################################################

Revision:    hrev47982
Commit:      be93029899fb6fc32eabbaa0647f4716d03737f0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=be93029
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Wed Oct  8 10:04:06 2014 UTC

More uses of BMessageFormat.

----------------------------------------------------------------------------

diff --git a/src/apps/diskusage/StatusView.cpp 
b/src/apps/diskusage/StatusView.cpp
index 1c0c159..734d8b3 100644
--- a/src/apps/diskusage/StatusView.cpp
+++ b/src/apps/diskusage/StatusView.cpp
@@ -17,6 +17,7 @@
 #include <Catalog.h>
 #include <Box.h>
 #include <Button.h>
+#include <MessageFormat.h>
 #include <Node.h>
 #include <String.h>
 #include <StringForSize.h>
@@ -83,7 +84,7 @@ StatusView::StatusView()
                                .Add(fCountView)
                                .Add(divider2)
                                .Add(fSizeView)
-                               .End()                  
+                               .End()
                        .End()
                .AddStrut(kSmallHMargin)
                .Add(fRefreshBtn)
@@ -150,9 +151,9 @@ StatusView::ShowInfo(const FileInfo* info)
        fSizeView->SetText(label);
 
        if (info->count > 0) {
-               char label[256];
-               snprintf(label, sizeof(label), (info->count == 1) ?
-                       B_TRANSLATE("%d file") : B_TRANSLATE("%d files"), 
info->count);
+               BString label;
+               BMessageFormat().Format(label, B_TRANSLATE("{0, plural, one{# 
file}, "
+                       "other{# files}}"), info->count);
                fCountView->SetText(label);
        } else {
                fCountView->SetText(kEmptyStr);
diff --git a/src/apps/magnify/Magnify.cpp b/src/apps/magnify/Magnify.cpp
index 85184c9..9e9599d 100644
--- a/src/apps/magnify/Magnify.cpp
+++ b/src/apps/magnify/Magnify.cpp
@@ -21,6 +21,7 @@
 #include <Locale.h>
 #include <MenuItem.h>
 #include <MenuField.h>
+#include <MessageFormat.h>
 #include <Path.h>
 #include <PopUpMenu.h>
 #include <Screen.h>
@@ -828,17 +829,16 @@ TInfoView::Draw(BRect updateRect)
 
        MovePenTo(10, fFontHeight + 5);
 
-       BString dimensionsInfo(
-               B_TRANSLATE("%width x %height  @ %pixelSize pixels/pixel"));
+       BString dimensionsInfo;
+       BMessageFormat().Format(dimensionsInfo,
+               B_TRANSLATE("%width x %height  @ {0, plural, one{# pixel/pixel} 
"
+                       "other{# pixels/pixel}}"), pixelSize);
        BString rep;
        rep << hPixelCount;
        dimensionsInfo.ReplaceAll("%width", rep);
        rep = "";
        rep << vPixelCount;
        dimensionsInfo.ReplaceAll("%height", rep);
-       rep = "";
-       rep << pixelSize;
-       dimensionsInfo.ReplaceAll("%pixelSize", rep);
        invalRect.Set(10, 5, 10 + StringWidth(fInfoStr), fFontHeight+7);
        SetHighColor(ViewColor());
        FillRect(invalRect);


Other related posts:

  • » [haiku-commits] haiku: hrev47982 - in src: apps/magnify apps/diskusage preferences/locale preferences/time - pulkomandy