HaikuDepot: Mark installed featured packages...

... with a checkmark icon.
This commit is contained in:
Stephan Aßmus 2014-12-28 23:34:15 +01:00
parent 0f45a48087
commit 056d423c39
4 changed files with 37 additions and 2 deletions

View File

@ -84,3 +84,9 @@ resource(503, "thumbs down") #'VICN' array {
$"523C4C4248BFD5C45C44444C4048405040010A00010000"
};
resource(504, "installed") #'VICN' array {
$"6E636966030369D90504011704011F0202043E24C4AC24B93B24243E24B93B24"
$"C4AC3E58B93B58C4AC58583E58C4AC58B93B0A06333A3C42493051363E4F2D41"
$"010A0002000100"
};

View File

@ -18,6 +18,7 @@
#include "support.h"
#include "FeaturedPackagesView.h"
#include "MainWindow.h"
@ -38,7 +39,11 @@ App::App()
App::~App()
{
// We cannot let global destructors cleanup static BitmapRef objects,
// since calling BBitmap destructors needs a valid BApplication still
// around. That's why we do it here.
PackageInfo::CleanupDefaultIcon();
FeaturedPackagesView::CleanupIcons();
}

View File

@ -29,6 +29,8 @@
static const rgb_color kLightBlack = (rgb_color){ 60, 60, 60, 255 };
static BitmapRef sInstalledIcon(new(std::nothrow) SharedBitmap(504), true);
// #pragma mark - PackageView
@ -46,6 +48,7 @@ public:
SetEventMask(B_POINTER_EVENTS);
fIconView = new BitmapView("package icon view");
fInstalledIconView = new BitmapView("installed icon view");
fTitleView = new BStringView("package title view", "");
fPublisherView = new BStringView("package publisher view", "");
@ -87,7 +90,11 @@ public:
BLayoutBuilder::Group<>(this)
.Add(fIconView)
.AddGroup(B_VERTICAL, 1.0f, 2.2f)
.Add(fTitleView)
.AddGroup(B_HORIZONTAL)
.Add(fTitleView)
.Add(fInstalledIconView)
.AddGlue()
.End()
.Add(fPublisherView)
.SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET))
.End()
@ -149,6 +156,12 @@ public:
} else
fIconView->SetBitmap(NULL);
if (package->State() == ACTIVATED) {
fInstalledIconView->SetBitmap(
sInstalledIcon->Bitmap(SharedBitmap::SIZE_16));
} else
fInstalledIconView->SetBitmap(NULL);
fTitleView->SetText(package->Title());
BString publisher = package->Publisher().Name();
@ -187,6 +200,7 @@ public:
fPackageListener->SetPackage(PackageInfoRef(NULL));
fIconView->SetBitmap(NULL);
fInstalledIconView->SetBitmap(NULL);
fTitleView->SetText("");
fPublisherView->SetText("");
fSummaryView->SetText("");
@ -216,6 +230,7 @@ public:
views.Add(this);
views.Add(fIconView);
views.Add(fInstalledIconView);
views.Add(fTitleView);
views.Add(fPublisherView);
views.Add(fSummaryView);
@ -236,6 +251,7 @@ private:
OnePackageMessagePackageListener* fPackageListener;
BitmapView* fIconView;
BitmapView* fInstalledIconView;
BStringView* fTitleView;
BStringView* fPublisherView;
@ -247,6 +263,7 @@ private:
BStringView* fVoteInfo;
bool fSelected;
};
@ -341,3 +358,9 @@ FeaturedPackagesView::SelectPackage(const PackageInfoRef& package)
}
}
void
FeaturedPackagesView::CleanupIcons()
{
sInstalledIcon.Unset();
}

View File

@ -25,9 +25,10 @@ public:
void SelectPackage(const PackageInfoRef& package);
static void CleanupIcons();
private:
BGroupLayout* fPackageListLayout;
};