HaikuDepot: Add a version column.

Makes it easier to find the latest version of a app.

Fixes #15668.

Change-Id: I26e939cd7ac4c590d856a2b093cc52098fa14301
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2488
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Paradoxon 2020-04-17 17:32:39 +02:00 committed by waddlesplash
parent dc0bc42494
commit a688d43f35
2 changed files with 23 additions and 2 deletions

View File

@ -21,7 +21,8 @@ enum {
PKG_CHANGED_CATEGORIES = 1 << 8,
PKG_CHANGED_PROMINENCE = 1 << 9,
PKG_CHANGED_SIZE = 1 << 10,
PKG_CHANGED_DEPOT = 1 << 11
PKG_CHANGED_DEPOT = 1 << 11,
PKG_CHANGED_VERSION = 1 << 12
// ...
};

View File

@ -154,6 +154,7 @@ public:
void UpdateRating();
void UpdateSize();
void UpdateRepository();
void UpdateVersion();
PackageRow*& NextInHash()
{ return fNextInHash; }
@ -537,7 +538,8 @@ enum {
kDescriptionColumn,
kSizeColumn,
kStatusColumn,
kRepositoryColumn
kRepositoryColumn,
kVersionColumn,
};
@ -573,6 +575,9 @@ PackageRow::PackageRow(const PackageInfoRef& packageRef,
// Repository
UpdateRepository();
// Version
UpdateVersion();
package.AddListener(fPackageListener);
}
@ -647,6 +652,16 @@ PackageRow::UpdateRepository()
}
void
PackageRow::UpdateVersion()
{
if (fPackage.Get() == NULL)
return;
SetField(new BStringField(fPackage->Version().ToString()), kVersionColumn);
}
// #pragma mark - ItemCountView
@ -802,6 +817,9 @@ PackageListView::PackageListView(BLocker* modelLock)
SetColumnVisible(kRepositoryColumn, false);
// invisible by default
AddColumn(new PackageColumn(B_TRANSLATE("Version"), 50 * scale,
50 * scale, 200 * scale, B_TRUNCATE_MIDDLE), kVersionColumn);
fItemCountView = new ItemCountView();
AddStatusView(fItemCountView);
}
@ -863,6 +881,8 @@ PackageListView::MessageReceived(BMessage* message)
row->UpdateTitle();
if ((changes & PKG_CHANGED_DEPOT) != 0)
row->UpdateRepository();
if ((changes & PKG_CHANGED_VERSION) != 0)
row->UpdateVersion();
}
break;
}