[haiku-commits] haiku: hrev50550 - in src/kits/tracker: . src

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 25 Sep 2016 15:16:25 +0200 (CEST)

hrev50550 adds 3 changesets to branch 'master'
old head: 43caca9680e8c72ee2f3b47cde31b30f6d6e278f
new head: 09bb8269ac18ccf92315ff2a8b785fd06f021499
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=09bb8269ac18+%5E43caca9680e8

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

29089fe2e849: Workspaces: style fixes
  
  As pointed out by Axel.

ccb55f969c54: Tracker: localize query templates.
  
  Tracker can create query templates when they don't exist yet. This was
  done with an hardcoded archive of BColumns for the pose view, which did
  not allow for an easy way to replace the strings. Now the archive is
  created on the fly when the function is run, which makes it possible to
  build it with localized strings (and in the system's endianness, which
  will make it load faster).
  
  Based on patch by mt, but with a lot of rework.
  
  Fixes part of #6374.

09bb8269ac18: Tracker: localize RegExp errors.
  
  These were left out because the same RegExp.cpp file is also used by
  collectcatkeys. This needed some jam file changes to get collectcatkeys
  to build on both the host and target.
  
  Fixes the last remaining part of #6374.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

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

5 files changed, 294 insertions(+), 195 deletions(-)
src/apps/workspaces/Workspaces.cpp       |   9 +-
src/bin/locale/Jamfile                   |   2 +-
src/kits/tracker/RegExp.cpp              |  38 ++-
src/kits/tracker/TrackerInitialState.cpp | 437 ++++++++++++++++-----------
src/tools/locale/Jamfile                 |   3 +

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

Commit:      29089fe2e849dc7d246f1bc36b1e28705281dfce
URL:         http://cgit.haiku-os.org/haiku/commit/?id=29089fe2e849
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Sep 25 09:20:32 2016 UTC

Workspaces: style fixes

As pointed out by Axel.

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

diff --git a/src/apps/workspaces/Workspaces.cpp 
b/src/apps/workspaces/Workspaces.cpp
index 34b7155..c171409 100644
--- a/src/apps/workspaces/Workspaces.cpp
+++ b/src/apps/workspaces/Workspaces.cpp
@@ -694,7 +694,8 @@ WorkspacesWindow::WorkspacesWindow(WorkspacesSettings 
*settings)
                float width = floor(workspaceWidth * columns);
                float height = floor(workspaceHeight * rows);
 
-               // If you have too many workspaces to fit on the screen, shrink 
until they fit.
+               // If you have too many workspaces to fit on the screen, shrink 
until
+               // they fit.
                while (width + 2 * borderWidth > screenWidth
                                || height + 2 * borderWidth + GetTabHeight() > 
screenHeight) {
                        width = floor(0.95 * width);
@@ -796,15 +797,15 @@ WorkspacesWindow::Zoom(BPoint origin, float width, float 
height)
        height = floor(workspaceHeight * rows);
 
        while (width + 2 * GetScreenBorderOffset() > screenWidth
-               || height + 2 * GetScreenBorderOffset() + GetTabHeight() > 
screenHeight) {
+               || height + 2 * GetScreenBorderOffset() + GetTabHeight()
+                       > screenHeight) {
                width = floor(0.95 * width);
                height = floor(0.95 * height);
        }
 
        ResizeTo(width, height);
 
-       if (fSettings->AutoRaising())
-       {
+       if (fSettings->AutoRaising()) {
                // The auto-raising mode makes sense only if the window is 
positionned
                // exactly in the bottom-right corner. If the setting is 
enabled, move
                // the window there.

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

Commit:      ccb55f969c54124af1727c80799ba9ba10b894d8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ccb55f969c54
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Sep 25 11:20:18 2016 UTC

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

Tracker: localize query templates.

Tracker can create query templates when they don't exist yet. This was
done with an hardcoded archive of BColumns for the pose view, which did
not allow for an easy way to replace the strings. Now the archive is
created on the fly when the function is run, which makes it possible to
build it with localized strings (and in the system's endianness, which
will make it load faster).

Based on patch by mt, but with a lot of rework.

Fixes part of #6374.

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

diff --git a/src/kits/tracker/TrackerInitialState.cpp 
b/src/kits/tracker/TrackerInitialState.cpp
index a7c0065..0a84c32 100644
--- a/src/kits/tracker/TrackerInitialState.cpp
+++ b/src/kits/tracker/TrackerInitialState.cpp
@@ -62,6 +62,7 @@ All rights reserved.
 #include "FSUtils.h"
 #include "QueryContainerWindow.h"
 #include "Tracker.h"
+#include "ViewState.h"
 
 
 enum {
@@ -73,181 +74,38 @@ enum {
 };
 
 
-const char* kAttrName = "META:name";
-const char* kAttrCompany = "META:company";
-const char* kAttrAddress = "META:address";
-const char* kAttrCity = "META:city";
-const char* kAttrState = "META:state";
-const char* kAttrZip = "META:zip";
-const char* kAttrCountry = "META:country";
-const char* kAttrHomePhone = "META:hphone";
-const char* kAttrWorkPhone = "META:wphone";
-const char* kAttrFax = "META:fax";
-const char* kAttrEmail = "META:email";
-const char* kAttrURL = "META:url";
-const char* kAttrGroup = "META:group";
-const char* kAttrNickname = "META:nickname";
-
-const char* kNetPositiveSignature = "application/x-vnd.Be-NPOS";
-const char* kPeopleSignature = "application/x-vnd.Be-PEPL";
-
-// the following templates are in big endian and we rely on the Tracker
-// translation support to swap them on little endian machines
-//
-// in case there is an attribute (B_RECT_TYPE) that gets swapped by the media
-// (unzip, file system endianness swapping, etc., the correct endianness for
-// the correct machine has to be used here
-
-const BRect kDefaultFrame(40, 40, 695, 350);
-const int32 kDefaultQueryTemplateCount = 3;
-
-const AttributeTemplate kDefaultQueryTemplate[] =
-       /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
-               application_octet-stream */
-{
-       {
-               // default frame
-               kAttrWindowFrame,
-               B_RECT_TYPE,
-               16,
-               (const char*)&kDefaultFrame
-       },
-       {
-               // attr: _trk/viewstate
-               kAttrViewState_be,
-               B_RAW_TYPE,
-               49,
-               
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
-               
"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000"
-               "\000\000\000\000\000\000\000"
-       },
-       {
-               // attr: _trk/columns
-               kAttrColumns_be,
-               B_RAW_TYPE,
-               223,
-               "O\362VR\000\000\000\025\000\000\000\004Name\000B 
\000\000C\021\000"
-               
"\000\000\000\000\000\000\000\000\012_stat/name\000\357\323\335RCST"
-               
"R\001\001O\362VR\000\000\000\025\000\000\000\004Path\000CH\000\000"
-               
"Ca\000\000\000\000\000\000\000\000\000\011_trk/path\000\357_\174RC"
-               
"STR\000\000O\362VR\000\000\000\025\000\000\000\004Size\000C\334\000"
-               
"\000B$\000\000\000\000\000\001\000\000\000\012_stat/size\000\317\317"
-               
"\306TOFFT\001\000O\362VR\000\000\000\025\000\000\000\010Modified\000"
-               
"C\370\000\000C\012\000\000\000\000\000\000\000\000\000\016_stat/mo"
-               "dified\000]KmETIME\001\000"
-       }
-};
+static const char* kAttrName = "META:name";
+static const char* kAttrCompany = "META:company";
+static const char* kAttrAddress = "META:address";
+static const char* kAttrCity = "META:city";
+static const char* kAttrState = "META:state";
+static const char* kAttrZip = "META:zip";
+static const char* kAttrCountry = "META:country";
+static const char* kAttrHomePhone = "META:hphone";
+static const char* kAttrWorkPhone = "META:wphone";
+static const char* kAttrFax = "META:fax";
+static const char* kAttrEmail = "META:email";
+static const char* kAttrURL = "META:url";
+static const char* kAttrGroup = "META:group";
+static const char* kAttrNickname = "META:nickname";
 
+static const char* kNetPositiveSignature = "application/x-vnd.Be-NPOS";
+static const char* kPeopleSignature = "application/x-vnd.Be-PEPL";
 
-const AttributeTemplate kBookmarkQueryTemplate[] =
-       /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
-               application_x-vnd.Be-bookmark */
-{
-       {
-               // default frame
-               kAttrWindowFrame,
-               B_RECT_TYPE,
-               16,
-               (const char*)&kDefaultFrame
-       },
-       {
-               // attr: _trk/viewstate
-               kAttrViewState_be,
-               B_RAW_TYPE,
-               49,
-               
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
-               
"\000\000\000\000\000\000\000\000\000\000w\373\175RCSTR\000\000\000"
-               "\000\000\000\000\000\000"
-       },
-       {
-               // attr: _trk/columns
-               kAttrColumns_be,
-               B_RAW_TYPE,
-               163,
-               "O\362VR\000\000\000\025\000\000\000\005Title\000B 
\000\000C+\000\000"
-               
"\000\000\000\000\000\000\000\012META:title\000w\373\175RCSTR\000\001"
-               
"O\362VR\000\000\000\025\000\000\000\003URL\000Cb\000\000C\217\200"
-               
"\000\000\000\000\000\000\000\000\010META:url\000\343[TRCSTR\000\001O"
-               
"\362VR\000\000\000\025\000\000\000\010Keywords\000D\004\000\000C\002"
-               
"\000\000\000\000\000\000\000\000\000\011META:keyw\000\333\363\334"
-               "RCSTR\000\001"
-       }
-};
+static const BRect kDefaultFrame(40, 40, 695, 350);
+static const int32 sDefaultQueryTemplateCount = 3;
 
 
-const AttributeTemplate kPersonQueryTemplate[] =
-       /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
-               application_x-vnd.Be-bookmark */
+struct ColumnData
 {
-       {
-               // default frame
-               kAttrWindowFrame,
-               B_RECT_TYPE,
-               16,
-               (const char*)&kDefaultFrame
-       },
-       {
-               // attr: _trk/viewstate
-               kAttrViewState_be,
-               B_RAW_TYPE,
-               49,
-               
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
-               
"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000"
-               "\000\000\000\000\000\000\000"
-       },
-       {
-               // attr: _trk/columns
-               kAttrColumns_be,
-               B_RAW_TYPE,
-               230,
-               "O\362VR\000\000\000\025\000\000\000\004Name\000B 
\000\000B\346\000"
-               
"\000\000\000\000\000\000\000\000\012_stat/name\000\357\323\335RCST"
-               "R\001\001O\362VR\000\000\000\025\000\000\000\012Work 
Phone\000C*\000"
-               
"\000B\264\000\000\000\000\000\000\000\000\000\013META:wphone\000C_"
-               
"uRCSTR\000\001O\362VR\000\000\000\025\000\000\000\006E-mail\000C\211"
-               
"\200\000B\272\000\000\000\000\000\000\000\000\000\012META:email\000"
-               
"sW\337RCSTR\000\001O\362VR\000\000\000\025\000\000\000\007Company"
-               "\000C\277\200\000B\360\000\000\000\000\000\000\000\000\000\014"
-               "META:company\000CS\174RCSTR\000\001"
-       },
-};
-
-
-const AttributeTemplate kEmailQueryTemplate[] =
-       /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
-               text_x-email */
-{
-       {
-               // default frame
-               kAttrWindowFrame,
-               B_RECT_TYPE,
-               16,
-               (const char*)&kDefaultFrame
-       },
-       {
-               // attr: _trk/viewstate
-               kAttrViewState_be,
-               B_RAW_TYPE,
-               49,
-               
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
-               
"\000\000\000\000\000\000\000\000\000\000\366_\377ETIME\000\000\000"
-               "\000\000\000\000\000\000"
-       },
-       {
-               // attr: _trk/columns
-               kAttrColumns_be,
-               B_RAW_TYPE,
-               222,
-               "O\362VR\000\000\000\025\000\000\000\007Subject\000B 
\000\000B\334"
-               
"\000\000\000\000\000\000\000\000\000\014MAIL:subject\000\343\173\337"
-               
"RCSTR\000\000O\362VR\000\000\000\025\000\000\000\004From\000C%\000"
-               
"\000C\031\000\000\000\000\000\000\000\000\000\011MAIL:from\000\317"
-               
"s_RCSTR\000\000O\362VR\000\000\000\025\000\000\000\004When\000C\246"
-               
"\200\000B\360\000\000\000\000\000\000\000\000\000\011MAIL:when\000"
-               
"\366_\377ETIME\000\000O\362VR\000\000\000\025\000\000\000\006Status"
-               "\000C\352\000\000BH\000\000\000\000\000\001\000\000\000\013"
-               "MAIL:status\000G\363\134RCSTR\000\001"
-       },
+       const char*     title;
+       float           offset;
+       float           width;
+       alignment       align;
+       const char*     attributeName;
+       uint32          attrType;
+       bool            statField;
+       bool            editable;
 };
 
 
@@ -361,6 +219,22 @@ AddTemporaryBackgroundImages(BMessage* message, const 
char* imagePath,
 }
 
 
+static size_t
+mkColumnsBits(BMallocIO& stream, const ColumnData* src, int32 nelm,
+       const char* context)
+{
+       for (int32 i = 0; i < nelm; i++) {
+               BColumn c(
+                       B_TRANSLATE_CONTEXT(src[i].title, context),
+                       src[i].offset, src[i].width, src[i].align, 
src[i].attributeName,
+                       src[i].attrType, src[i].statField, src[i].editable);
+               c.ArchiveToStream(&stream);
+       }
+
+       return stream.Position();
+}
+
+
 // #pragma mark - TrackerInitialState
 
 
@@ -592,6 +466,197 @@ TTracker::InstallIndices(dev_t device)
 void
 TTracker::InstallDefaultTemplates()
 {
+       // the following templates are in big endian and we rely on the Tracker
+       // translation support to swap them on little endian machines
+       //
+       // in case there is an attribute (B_RECT_TYPE) that gets swapped by the 
media
+       // (unzip, file system endianness swapping, etc., the correct 
endianness for
+       // the correct machine has to be used here
+
+       static AttributeTemplate sDefaultQueryTemplate[] =
+               /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
+                  application_octet-stream */
+       {
+               {
+                       // default frame
+                       kAttrWindowFrame,
+                       B_RECT_TYPE,
+                       16,
+                       (const char*)&kDefaultFrame
+               },
+               {
+                       // attr: _trk/viewstate
+                       kAttrViewState_be,
+                       B_RAW_TYPE,
+                       49,
+                       
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
+                               
"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000"
+                               "\000\000\000\000\000\000\000"
+               },
+               {
+                       // attr: _trk/columns
+                       kAttrColumns_be,
+                       B_RAW_TYPE,
+                       0,
+                       NULL
+               }
+       };
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Default Query Columns"
+
+       static const ColumnData defaultQueryColumns[] =
+       {
+               { B_TRANSLATE_MARK("Name"), 40, 145, B_ALIGN_LEFT, "_stat/name",
+                       B_STRING_TYPE, true, true },
+               { B_TRANSLATE_MARK("Path"), 200, 225, B_ALIGN_LEFT, "_trk/path",
+                       B_STRING_TYPE, false, false },
+               { B_TRANSLATE_MARK("Size"), 440, 41, B_ALIGN_LEFT, "_stat/size",
+                       B_OFF_T_TYPE, true, false },
+               { B_TRANSLATE_MARK("Modified"), 496, 138, B_ALIGN_LEFT, 
"_stat/modified",
+                       B_TIME_TYPE, true, false }
+       };
+
+
+       static AttributeTemplate sBookmarkQueryTemplate[] =
+               /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
+                  application_x-vnd.Be-bookmark */
+       {
+               {
+                       // default frame
+                       kAttrWindowFrame,
+                       B_RECT_TYPE,
+                       16,
+                       (const char*)&kDefaultFrame
+               },
+               {
+                       // attr: _trk/viewstate
+                       kAttrViewState_be,
+                       B_RAW_TYPE,
+                       49,
+                       
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
+                               
"\000\000\000\000\000\000\000\000\000\000w\373\175RCSTR\000\000\000"
+                               "\000\000\000\000\000\000"
+               },
+               {
+                       // attr: _trk/columns
+                       kAttrColumns_be,
+                       B_RAW_TYPE,
+                       0,
+                       NULL
+               }
+       };
+
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Bookmark Query Columns"
+
+
+       static const ColumnData bookmarkQueryColumns[] =
+       {
+               { B_TRANSLATE_MARK("Title"), 40, 171, B_ALIGN_LEFT, 
"META:title",
+                       B_STRING_TYPE, false, true },
+               { B_TRANSLATE_MARK("URL"), 226, 287, B_ALIGN_LEFT, kAttrURL,
+                       B_STRING_TYPE, false, true },
+               { B_TRANSLATE_MARK("Keywords"), 528, 130, B_ALIGN_LEFT, 
"META:keyw",
+                       B_STRING_TYPE, false, true }
+       };
+
+
+       static AttributeTemplate sPersonQueryTemplate[] =
+               /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
+                  application_x-vnd.Be-bookmark */
+       {
+               {
+                       // default frame
+                       kAttrWindowFrame,
+                       B_RECT_TYPE,
+                       16,
+                       (const char*)&kDefaultFrame
+               },
+               {
+                       // attr: _trk/viewstate
+                       kAttrViewState_be,
+                       B_RAW_TYPE,
+                       49,
+                       
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
+                               
"\000\000\000\000\000\000\000\000\000\000\357\323\335RCSTR\000\000"
+                               "\000\000\000\000\000\000\000"
+               },
+               {
+                       // attr: _trk/columns
+                       kAttrColumns_be,
+                       B_RAW_TYPE,
+                       0,
+                       NULL
+               },
+       };
+
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Person Query Columns"
+
+
+       static const ColumnData personQueryColumns[] =
+       {
+               { B_TRANSLATE_MARK("Name"), 40, 115, B_ALIGN_LEFT, "_stat/name",
+                       B_STRING_TYPE, true, true },
+               { B_TRANSLATE_MARK("Work Phone"), 170, 90, B_ALIGN_LEFT, 
kAttrWorkPhone,
+                       B_STRING_TYPE, false, true },
+               { B_TRANSLATE_MARK("E-mail"), 275, 93, B_ALIGN_LEFT, kAttrEmail,
+                       B_STRING_TYPE, false, true },
+               { B_TRANSLATE_MARK("Company"), 383, 120, B_ALIGN_LEFT, 
kAttrCompany,
+                       B_STRING_TYPE, false, true }
+       };
+
+
+       static AttributeTemplate sEmailQueryTemplate[] =
+               /* /boot/home/config/settings/Tracker/DefaultQueryTemplates/
+                  text_x-email */
+       {
+               {
+                       // default frame
+                       kAttrWindowFrame,
+                       B_RECT_TYPE,
+                       16,
+                       (const char*)&kDefaultFrame
+               },
+               {
+                       // attr: _trk/viewstate
+                       kAttrViewState_be,
+                       B_RAW_TYPE,
+                       49,
+                       
"o^\365R\000\000\000\012Tlst\000\000\000\000\000\000\000\000\000\000"
+                               
"\000\000\000\000\000\000\000\000\000\000\366_\377ETIME\000\000\000"
+                               "\000\000\000\000\000\000"
+               },
+               {
+                       // attr: _trk/columns
+                       kAttrColumns_be,
+                       B_RAW_TYPE,
+                       0,
+                       NULL
+               },
+       };
+
+
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "Email Query Columns"
+
+
+       static const ColumnData emailQueryColumns[] =
+       {
+               { B_TRANSLATE_MARK("Subject"), 40, 110, B_ALIGN_LEFT, 
"MAIL:subject",
+                       B_STRING_TYPE, false, false },
+               { B_TRANSLATE_MARK("From"), 165, 153, B_ALIGN_LEFT, "MAIL:from",
+                       B_STRING_TYPE, false, false },
+               { B_TRANSLATE_MARK("When"), 333, 120, B_ALIGN_LEFT, "MAIL:when",
+                       B_STRING_TYPE, false, false },
+               { B_TRANSLATE_MARK("Status"), 468, 50, B_ALIGN_RIGHT, 
"MAIL:status",
+                       B_STRING_TYPE, false, true }
+       };
+
+
        BNode node;
        BString query(kQueryTemplates);
        query += "/application_octet-stream";
@@ -600,8 +665,14 @@ TTracker::InstallDefaultTemplates()
                        &node, false)) {
                if (BContainerWindow::DefaultStateSourceNode(query.String(),
                                &node, true)) {
+                       BMallocIO stream;
+                       size_t n = mkColumnsBits(stream,
+                                       defaultQueryColumns, 4, "Default Query 
Columns");
+                       sDefaultQueryTemplate[2].fSize = n;
+                       sDefaultQueryTemplate[2].fBits = (const 
char*)stream.Buffer();
+
                        AttributeStreamFileNode fileNode(&node);
-                       AttributeStreamTemplateNode tmp(kDefaultQueryTemplate, 
3);
+                       AttributeStreamTemplateNode tmp(sDefaultQueryTemplate, 
3);
                        fileNode << tmp;
                }
        }
@@ -611,8 +682,14 @@ TTracker::InstallDefaultTemplates()
                        &node, false)) {
                if (BContainerWindow::DefaultStateSourceNode(query.String(),
                                &node, true)) {
+                       BMallocIO stream;
+                       size_t n = mkColumnsBits(stream,
+                               bookmarkQueryColumns, 3, "Bookmark Query 
Columns");
+                       sBookmarkQueryTemplate[2].fSize = n;
+                       sBookmarkQueryTemplate[2].fBits = (const 
char*)stream.Buffer();
+
                        AttributeStreamFileNode fileNode(&node);
-                       AttributeStreamTemplateNode tmp(kBookmarkQueryTemplate, 
3);
+                       AttributeStreamTemplateNode tmp(sBookmarkQueryTemplate, 
3);
                        fileNode << tmp;
                }
        }
@@ -622,8 +699,14 @@ TTracker::InstallDefaultTemplates()
                        &node, false)) {
                if (BContainerWindow::DefaultStateSourceNode(query.String(),
                                &node, true)) {
+                       BMallocIO stream;
+                       size_t n = mkColumnsBits(stream,
+                               personQueryColumns, 4, "Person Query Columns");
+                       sPersonQueryTemplate[2].fSize = n;
+                       sPersonQueryTemplate[2].fBits = (const 
char*)stream.Buffer();
+
                        AttributeStreamFileNode fileNode(&node);
-                       AttributeStreamTemplateNode tmp(kPersonQueryTemplate, 
3);
+                       AttributeStreamTemplateNode tmp(sPersonQueryTemplate, 
3);
                        fileNode << tmp;
                }
        }
@@ -633,8 +716,14 @@ TTracker::InstallDefaultTemplates()
                        &node, false)) {
                if (BContainerWindow::DefaultStateSourceNode(query.String(),
                                &node, true)) {
+                       BMallocIO stream;
+                       size_t n = mkColumnsBits(stream,
+                               emailQueryColumns, 4, "Email Query Columns");
+                       sEmailQueryTemplate[2].fSize = n;
+                       sEmailQueryTemplate[2].fBits = (const 
char*)stream.Buffer();
+
                        AttributeStreamFileNode fileNode(&node);
-                       AttributeStreamTemplateNode tmp(kEmailQueryTemplate, 3);
+                       AttributeStreamTemplateNode tmp(sEmailQueryTemplate, 3);
                        fileNode << tmp;
                }
        }

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

Revision:    hrev50550
Commit:      09bb8269ac18ccf92315ff2a8b785fd06f021499
URL:         http://cgit.haiku-os.org/haiku/commit/?id=09bb8269ac18
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Sep 25 13:10:12 2016 UTC

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

Tracker: localize RegExp errors.

These were left out because the same RegExp.cpp file is also used by
collectcatkeys. This needed some jam file changes to get collectcatkeys
to build on both the host and target.

Fixes the last remaining part of #6374.

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

diff --git a/src/bin/locale/Jamfile b/src/bin/locale/Jamfile
index 0a5ce38..2b3dc95 100644
--- a/src/bin/locale/Jamfile
+++ b/src/bin/locale/Jamfile
@@ -6,7 +6,7 @@ UsePublicHeaders locale ;
 UsePrivateHeaders locale shared ;
 
 BinCommand collectcatkeys : collectcatkeys.cpp RegExp.cpp 
-       : be [ TargetLibsupc++ ] ;
+       : be localestub [ TargetLibsupc++ ] ;
 
 BinCommand linkcatkeys : linkcatkeys.cpp : be  [ TargetLibstdc++ ] ;
 
diff --git a/src/kits/tracker/RegExp.cpp b/src/kits/tracker/RegExp.cpp
index 7e98f40..fcf980b 100644
--- a/src/kits/tracker/RegExp.cpp
+++ b/src/kits/tracker/RegExp.cpp
@@ -66,11 +66,16 @@ All rights reserved.
 #include <stdio.h>
 #include <string.h>
 
+#include <Catalog.h>
 #include <Errors.h>
 
 #include "RegExp.h"
 
 
+#undef B_TRANSLATION_CONTEXT
+#define B_TRANSLATION_CONTEXT "libtracker"
+
+
 // The first byte of the regexp internal "program" is actually this magic
 // number; the start node begins in the second byte.
 
@@ -179,21 +184,21 @@ enum {
 
 
 const char* kRegExpErrorStringArray[] = {
-       "Unmatched parenthesis.",
-       "Expression too long.",
-       "Too many parenthesis.",
-       "Junk on end.",
-       "*+? operand may be empty.",
-       "Nested *?+.",
-       "Invalid bracket range.",
-       "Unmatched brackets.",
-       "Internal error.",
-       "?+* follows nothing.",
-       "Trailing \\.",
-       "Corrupted expression.",
-       "Memory corruption.",
-       "Corrupted pointers.",
-       "Corrupted opcode."
+       B_TRANSLATE_MARK("Unmatched parenthesis."),
+       B_TRANSLATE_MARK("Expression too long."),
+       B_TRANSLATE_MARK("Too many parenthesis."),
+       B_TRANSLATE_MARK("Junk on end."),
+       B_TRANSLATE_MARK("*+? operand may be empty."),
+       B_TRANSLATE_MARK("Nested *?+."),
+       B_TRANSLATE_MARK("Invalid bracket range."),
+       B_TRANSLATE_MARK("Unmatched brackets."),
+       B_TRANSLATE_MARK("Internal error."),
+       B_TRANSLATE_MARK("?+* follows nothing."),
+       B_TRANSLATE_MARK("Trailing \\."),
+       B_TRANSLATE_MARK("Corrupted expression."),
+       B_TRANSLATE_MARK("Memory corruption."),
+       B_TRANSLATE_MARK("Corrupted pointers."),
+       B_TRANSLATE_MARK("Corrupted opcode.")
 };
 
 
@@ -409,7 +414,8 @@ RegExp::ErrorString() const
 {
        if (fError >= REGEXP_UNMATCHED_PARENTHESIS
                && fError <= REGEXP_CORRUPTED_OPCODE) {
-               return kRegExpErrorStringArray[fError - B_ERRORS_END];
+               return B_TRANSLATE_NOCOLLECT(
+                       kRegExpErrorStringArray[fError - B_ERRORS_END]);
        }
 
        return strerror(fError);
diff --git a/src/tools/locale/Jamfile b/src/tools/locale/Jamfile
index f1564b2..a06d60d 100644
--- a/src/tools/locale/Jamfile
+++ b/src/tools/locale/Jamfile
@@ -15,6 +15,9 @@ local localetools =
 # Due to the use of STL fstream open() mapping the function names via macro
 # name doesn't work.
 DEFINES += _HAIKU_BUILD_DONT_REMAP_FD_FUNCTIONS ;
+# Use empty translation macros to avoid a dependency on the locale kit
+DEFINES += B_AVOID_TRANSLATION_MACROS 'B_TRANSLATE_NOCOLLECT(x)=x'
+       'B_TRANSLATE_MARK(x)=x' ;
 # We link against the host libbe.so which could also contain this class, so
 # rename it for locale tools
 DEFINES += DefaultCatalog=ToolsDefaultCatalog ;


Other related posts:

  • » [haiku-commits] haiku: hrev50550 - in src/kits/tracker: . src - pulkomandy