[haiku-commits] haiku: hrev45955 - src/apps/haiku-depot

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 8 Aug 2013 09:22:29 +0200 (CEST)

hrev45955 adds 2 changesets to branch 'master'
old head: b939c391670d1327defbd89a5668a0ae4497d337
new head: 0c82a69de48e3a80d4651999ebdef4ee5521d6a9
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=0c82a69+%5Eb939c39

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

b928a72: HaikuDepot: Layout and labeling tweaks
  
   * Swap rating and version in title view so it matches the
     order in the Ratings tab (rating XX for version YY).
   * Give a chance to decorate the version in translations.
   * Drop the p�arenthesis around version in Ratings tab.

0c82a69: HaikuDepot: Make string and icon+string columns sortable.

                                      [ Stephan Aßmus <superstippi@xxxxxx> ]

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

2 files changed, 22 insertions(+), 12 deletions(-)
src/apps/haiku-depot/PackageInfoView.cpp | 10 ++++++----
src/apps/haiku-depot/PackageListView.cpp | 24 ++++++++++++++++--------

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

Commit:      b928a72b883d1bfac0979a3d4af0900bbc6100d1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b928a72
Author:      Stephan Aßmus <superstippi@xxxxxx>
Date:        Thu Aug  8 07:18:30 2013 UTC

HaikuDepot: Layout and labeling tweaks

 * Swap rating and version in title view so it matches the
   order in the Ratings tab (rating XX for version YY).
 * Give a chance to decorate the version in translations.
 * Drop the p�arenthesis around version in Ratings tab.

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

diff --git a/src/apps/haiku-depot/PackageInfoView.cpp 
b/src/apps/haiku-depot/PackageInfoView.cpp
index 0f2bc7f..d91589e 100644
--- a/src/apps/haiku-depot/PackageInfoView.cpp
+++ b/src/apps/haiku-depot/PackageInfoView.cpp
@@ -394,13 +394,13 @@ public:
                                .Add(fPublisherView)
                        .End()
                        .AddGlue(0.1f)
-                       .Add(fVersionInfo)
-                       .AddGlue(0.2f)
                        .AddGroup(B_HORIZONTAL, B_USE_SMALL_SPACING)
                                .Add(fRatingView)
                                .Add(fAvgRating)
                                .Add(fVoteInfo)
                        .End()
+                       .AddGlue(0.2f)
+                       .Add(fVersionInfo)
                        .AddGlue(3.0f)
                ;
        
@@ -424,7 +424,9 @@ public:
                publisher.ReplaceAll("%Publisher%", package.Publisher().Name());
                fPublisherView->SetText(publisher);
 
-               fVersionInfo->SetText(package.Version());
+               BString version = B_TRANSLATE("%Version%");
+               version.ReplaceAll("%Version%", package.Version());
+               fVersionInfo->SetText(version);
 
                RatingSummary ratingSummary = package.CalculateRatingSummary();
 
@@ -722,7 +724,7 @@ public:
                ratingLabel.SetToFormat("%.1f", rating.Rating());
                fRatingLabelView = new BStringView("rating label", ratingLabel);
 
-               BString versionLabel(B_TRANSLATE("(for %Version%)"));
+               BString versionLabel(B_TRANSLATE("for %Version%"));
                versionLabel.ReplaceAll("%Version%", rating.PackageVersion());
                fPackageVersionView = new BStringView("package version",
                        versionLabel);

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

Revision:    hrev45955
Commit:      0c82a69de48e3a80d4651999ebdef4ee5521d6a9
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0c82a69
Author:      Stephan Aßmus <superstippi@xxxxxx>
Date:        Thu Aug  8 07:20:21 2013 UTC

HaikuDepot: Make string and icon+string columns sortable.

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

diff --git a/src/apps/haiku-depot/PackageListView.cpp 
b/src/apps/haiku-depot/PackageListView.cpp
index 669da32..f1a2050 100644
--- a/src/apps/haiku-depot/PackageListView.cpp
+++ b/src/apps/haiku-depot/PackageListView.cpp
@@ -293,17 +293,25 @@ PackageColumn::DrawField(BField* field, BRect rect, 
BView* parent)
 int
 PackageColumn::CompareFields(BField* field1, BField* field2)
 {
+       BStringField* stringField1 = dynamic_cast<BStringField*>(field1);
+       BStringField* stringField2 = dynamic_cast<BStringField*>(field2);
+       if (stringField1 != NULL && stringField2 != NULL) {
+               // TODO: Locale aware string compare... not too important if
+               // package names are not translated.
+               return strcmp(stringField1->String(), stringField2->String());
+       }
+
        RatingField* ratingField1 = dynamic_cast<RatingField*>(field1);
        RatingField* ratingField2 = dynamic_cast<RatingField*>(field2);
-       if (ratingField1 == NULL || ratingField2 == NULL)
-               return Inherited::CompareFields(field1, field2);
-
-       if (ratingField1->Rating() > ratingField2->Rating())
-               return -1;
-       else if (ratingField1->Rating() < ratingField2->Rating())
-               return 1;
+       if (ratingField1 != NULL && ratingField2 != NULL) {
+               if (ratingField1->Rating() > ratingField2->Rating())
+                       return -1;
+               else if (ratingField1->Rating() < ratingField2->Rating())
+                       return 1;
+               return 0;
+       }
 
-       return 0;
+       return Inherited::CompareFields(field1, field2);
 }
 
 


Other related posts:

  • » [haiku-commits] haiku: hrev45955 - src/apps/haiku-depot - superstippi