[haiku-commits] haiku: hrev51189 - src/kits/tracker

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 29 May 2017 15:29:43 +0200 (CEST)

hrev51189 adds 2 changesets to branch 'master'
old head: 3ec770177938efc5a7fee54d03b45fa593a57988
new head: 756c36e7eec2933e768ddd15f37c73ecd4c1840b
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=756c36e7eec2+%5E3ec770177938

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

fd9afd8ac622: Missing localizations in tracker info window.
  
  Patches from Karvjorm in #6987 (but not directly related to that ticket)

756c36e7eec2: Rotate permission labels in Tracker InfoWindow
  
  This allows to fit a lot more text in the same horizontal space, so we
  can fit the label in various locales, without spreading the checkboxes
  further apart.
  
  Fixes #6987

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

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

3 files changed, 33 insertions(+), 19 deletions(-)
src/kits/tracker/FilePermissionsView.cpp | 42 ++++++++++++++++++----------
src/kits/tracker/InfoWindow.cpp          |  8 +++---
src/kits/tracker/NodeWalker.cpp          |  2 +-

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

Commit:      fd9afd8ac6227a310bcfa400199e5b2e68464677
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fd9afd8ac622
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Mon May 29 12:32:36 2017 UTC

Ticket:      https://dev.haiku-os.org/ticket/6987

Missing localizations in tracker info window.

Patches from Karvjorm in #6987 (but not directly related to that ticket)

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

diff --git a/src/kits/tracker/InfoWindow.cpp b/src/kits/tracker/InfoWindow.cpp
index f7a4372..d4bc2ff 100644
--- a/src/kits/tracker/InfoWindow.cpp
+++ b/src/kits/tracker/InfoWindow.cpp
@@ -1043,7 +1043,7 @@ AttributeView::InitStrings(const Model* model)
                fLinkToStr = linkToPath;
                if (!linked) {
                        // link points to missing object
-                       fLinkToStr += " (broken)";
+                       fLinkToStr += B_TRANSLATE(" (broken)");
                }
        } else if (model->IsExecutable()) {
                if (((Model*)model)->GetLongVersionString(fDescStr,
@@ -1120,7 +1120,7 @@ AttributeView::ModelChanged(Model* model, BMessage* 
message)
                                        && itemNode.node == 
model->NodeRef()->node)) {
                                model->UpdateEntryRef(&dirNode, name);
                                BString title;
-                               title << name << " info";
+                               title << name << B_TRANSLATE(" info");
                                Window()->SetTitle(title.String());
                                WidgetAttributeText::AttrAsString(model, 
&fPathStr, kAttrPath,
                                        B_STRING_TYPE, 0, this);
diff --git a/src/kits/tracker/NodeWalker.cpp b/src/kits/tracker/NodeWalker.cpp
index 949d142..87184b0 100644
--- a/src/kits/tracker/NodeWalker.cpp
+++ b/src/kits/tracker/NodeWalker.cpp
@@ -49,7 +49,7 @@ TWalker::~TWalker()
 }
 
 
-// all the following calls are pure viruals, should not get called
+// all the following calls are pure virtuals, should not get called
 status_t
 TWalker::GetNextEntry(BEntry*, bool )
 {

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

Revision:    hrev51189
Commit:      756c36e7eec2933e768ddd15f37c73ecd4c1840b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=756c36e7eec2
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Mon May 29 13:27:49 2017 UTC

Ticket:      https://dev.haiku-os.org/ticket/6987

Rotate permission labels in Tracker InfoWindow

This allows to fit a lot more text in the same horizontal space, so we
can fit the label in various locales, without spreading the checkboxes
further apart.

Fixes #6987

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

diff --git a/src/kits/tracker/FilePermissionsView.cpp 
b/src/kits/tracker/FilePermissionsView.cpp
index 788aa4c..c0028f5 100644
--- a/src/kits/tracker/FilePermissionsView.cpp
+++ b/src/kits/tracker/FilePermissionsView.cpp
@@ -52,6 +52,23 @@ const uint32 kNewOwnerEntered = 'nwow';
 const uint32 kNewGroupEntered = 'nwgr';
 
 
+class RotatedStringView: public BStringView
+{
+public:
+       RotatedStringView(BRect r, const char* name, const char* label)
+               : BStringView(r, name, label)
+       {
+       }
+
+       void Draw(BRect invalidate)
+       {
+               RotateBy(-M_PI / 5);
+               TranslateBy(0, Bounds().Height() / 1.5);
+               BStringView::Draw(invalidate);
+       }
+};
+
+
 //     #pragma mark - FilePermissionsView
 
 
@@ -63,23 +80,22 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model* 
model)
        SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
 
        // Constants for the column labels: "User", "Group" and "Other".
-       const float kColumnLabelMiddle = 77, kColumnLabelTop = 6,
-               kColumnLabelSpacing = 37, kColumnLabelBottom = 20,
-               kColumnLabelWidth = 35, kAttribFontHeight = 10;
+       const float kColumnLabelMiddle = 77, kColumnLabelTop = 0,
+               kColumnLabelSpacing = 37, kColumnLabelBottom = 39,
+               kColumnLabelWidth = 80, kAttribFontHeight = 10;
 
        BStringView* strView;
 
-       strView = new BStringView(
+       strView = new RotatedStringView(
                BRect(kColumnLabelMiddle - kColumnLabelWidth / 2,
                        kColumnLabelTop,
                        kColumnLabelMiddle + kColumnLabelWidth / 2,
                        kColumnLabelBottom),
                "", B_TRANSLATE("Owner"));
        AddChild(strView);
-       strView->SetAlignment(B_ALIGN_CENTER);
        strView->SetFontSize(kAttribFontHeight);
 
-       strView = new BStringView(
+       strView = new RotatedStringView(
                BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
                                + kColumnLabelSpacing,
                        kColumnLabelTop,
@@ -87,10 +103,9 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model* 
model)
                        kColumnLabelBottom),
                "", B_TRANSLATE("Group"));
        AddChild(strView);
-       strView->SetAlignment(B_ALIGN_CENTER);
        strView->SetFontSize(kAttribFontHeight);
 
-       strView = new BStringView(
+       strView = new RotatedStringView(
                BRect(kColumnLabelMiddle - kColumnLabelWidth / 2
                                + 2 * kColumnLabelSpacing,
                        kColumnLabelTop,
@@ -99,13 +114,12 @@ FilePermissionsView::FilePermissionsView(BRect rect, 
Model* model)
                        kColumnLabelBottom),
                "", B_TRANSLATE("Other"));
        AddChild(strView);
-       strView->SetAlignment(B_ALIGN_CENTER);
        strView->SetFontSize(kAttribFontHeight);
 
        // Constants for the row labels: "Read", "Write" and "Execute".
-       const float kRowLabelLeft = 10, kRowLabelTop = kColumnLabelTop + 15,
+       const float kRowLabelLeft = 10, kRowLabelTop = kColumnLabelBottom + 5,
                kRowLabelVerticalSpacing = 18, kRowLabelRight = 
kColumnLabelMiddle
-               - kColumnLabelWidth / 2 - 5, kRowLabelHeight = 14;
+               - kColumnLabelSpacing / 2 - 5, kRowLabelHeight = 14;
 
        strView = new BStringView(BRect(kRowLabelLeft, kRowLabelTop,
                        kRowLabelRight, kRowLabelTop + kRowLabelHeight),
@@ -131,7 +145,7 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model* 
model)
        strView->SetFontSize(kAttribFontHeight);
 
        // Constants for the 3x3 check box array.
-       const float kLeftMargin = kRowLabelRight + 15,
+       const float kLeftMargin = kRowLabelRight + 5,
                kTopMargin = kRowLabelTop - 2,
                kHorizontalSpacing = kColumnLabelSpacing,
                kVerticalSpacing = kRowLabelVerticalSpacing,
@@ -168,8 +182,8 @@ FilePermissionsView::FilePermissionsView(BRect rect, Model* 
model)
        }
 
        const float kTextControlLeft = 170, kTextControlRight = 270,
-               kTextControlTop = kColumnLabelTop, kTextControlHeight = 14,
-               kTextControlSpacing = 16;
+               kTextControlTop = kRowLabelTop - 19,
+               kTextControlHeight = 14, kTextControlSpacing = 16;
 
        strView = new BStringView(BRect(kTextControlLeft, kTextControlTop,
                kTextControlRight, kTextControlTop + kTextControlHeight), "",
diff --git a/src/kits/tracker/InfoWindow.cpp b/src/kits/tracker/InfoWindow.cpp
index d4bc2ff..ce5e92f 100644
--- a/src/kits/tracker/InfoWindow.cpp
+++ b/src/kits/tracker/InfoWindow.cpp
@@ -369,7 +369,7 @@ BInfoWindow::Show()
                "will use to find the window width");
 
        // window height depends on file type
-       int lines = 8;
+       int lines = 9;
        if (fModel->IsExecutable())
                lines++;
        float height = font->Size() * (lines * 2 + 1);
@@ -643,7 +643,7 @@ BInfoWindow::MessageReceived(BMessage* message)
                        BRect permissionsBounds(kBorderWidth + 1,
                                                fAttributeView->Bounds().bottom,
                                                fAttributeView->Bounds().right,
-                                               fAttributeView->Bounds().bottom 
+ 80);
+                                               fAttributeView->Bounds().bottom 
+ 103);
 
                        if (fPermissionsView == NULL) {
                                // Only true on first call.


Other related posts:

  • » [haiku-commits] haiku: hrev51189 - src/kits/tracker - pulkomandy