diff --git a/src/apps/haikudepot/HaikuDepot.rdef b/src/apps/haikudepot/HaikuDepot.rdef index d8eb7dde38..7647dbe999 100644 --- a/src/apps/haikudepot/HaikuDepot.rdef +++ b/src/apps/haikudepot/HaikuDepot.rdef @@ -84,3 +84,9 @@ resource(503, "thumbs down") #'VICN' array { $"523C4C4248BFD5C45C44444C4048405040010A00010000" }; +resource(504, "installed") #'VICN' array { + $"6E636966030369D90504011704011F0202043E24C4AC24B93B24243E24B93B24" + $"C4AC3E58B93B58C4AC58583E58C4AC58B93B0A06333A3C42493051363E4F2D41" + $"010A0002000100" +}; + diff --git a/src/apps/haikudepot/ui/App.cpp b/src/apps/haikudepot/ui/App.cpp index 78898f2a14..b520fec65e 100644 --- a/src/apps/haikudepot/ui/App.cpp +++ b/src/apps/haikudepot/ui/App.cpp @@ -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(); } diff --git a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp index b7246578a0..4d8a94140d 100644 --- a/src/apps/haikudepot/ui/FeaturedPackagesView.cpp +++ b/src/apps/haikudepot/ui/FeaturedPackagesView.cpp @@ -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(); +} diff --git a/src/apps/haikudepot/ui/FeaturedPackagesView.h b/src/apps/haikudepot/ui/FeaturedPackagesView.h index b1fe7c5dbd..b046ea4659 100644 --- a/src/apps/haikudepot/ui/FeaturedPackagesView.h +++ b/src/apps/haikudepot/ui/FeaturedPackagesView.h @@ -25,9 +25,10 @@ public: void SelectPackage(const PackageInfoRef& package); + static void CleanupIcons(); + private: BGroupLayout* fPackageListLayout; - };