From 9ecd9f029447d5070e43cf0067948cee414f2a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 4 Aug 2013 11:12:36 +0200 Subject: [PATCH] HaikuDepot: Added ability to store screenshots in PackageInfo. --- src/apps/haiku-depot/PackageInfo.cpp | 20 ++++++++++++++++---- src/apps/haiku-depot/PackageInfo.h | 7 +++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/apps/haiku-depot/PackageInfo.cpp b/src/apps/haiku-depot/PackageInfo.cpp index 2b2f5d8e89..cf12591961 100644 --- a/src/apps/haiku-depot/PackageInfo.cpp +++ b/src/apps/haiku-depot/PackageInfo.cpp @@ -373,7 +373,8 @@ PackageInfo::PackageInfo() fShortDescription(), fFullDescription(), fChangelog(), - fUserRatings() + fUserRatings(), + fScreenshots() { } @@ -390,7 +391,8 @@ PackageInfo::PackageInfo(const BitmapRef& icon, const BString& title, fShortDescription(shortDescription), fFullDescription(fullDescription), fChangelog(changelog), - fUserRatings() + fUserRatings(), + fScreenshots() { } @@ -404,7 +406,8 @@ PackageInfo::PackageInfo(const PackageInfo& other) fShortDescription(other.fShortDescription), fFullDescription(other.fFullDescription), fChangelog(other.fChangelog), - fUserRatings(other.fUserRatings) + fUserRatings(other.fUserRatings), + fScreenshots(other.fScreenshots) { } @@ -420,6 +423,7 @@ PackageInfo::operator=(const PackageInfo& other) fFullDescription = other.fFullDescription; fChangelog = other.fChangelog; fUserRatings = other.fUserRatings; + fScreenshots = other.fScreenshots; return *this; } @@ -434,7 +438,8 @@ PackageInfo::operator==(const PackageInfo& other) const && fShortDescription == other.fShortDescription && fFullDescription == other.fFullDescription && fChangelog == other.fChangelog - && fUserRatings == other.fUserRatings; + && fUserRatings == other.fUserRatings + && fScreenshots == other.fScreenshots; } @@ -494,6 +499,13 @@ PackageInfo::CalculateRatingSummary() const } +bool +PackageInfo::AddScreenshot(const BitmapRef& screenshot) +{ + return fScreenshots.Add(screenshot); +} + + // #pragma mark - diff --git a/src/apps/haiku-depot/PackageInfo.h b/src/apps/haiku-depot/PackageInfo.h index e4fe312963..d0dae7a2ce 100644 --- a/src/apps/haiku-depot/PackageInfo.h +++ b/src/apps/haiku-depot/PackageInfo.h @@ -42,6 +42,7 @@ private: typedef BReference BitmapRef; +typedef List BitmapList; class UserInfo { @@ -181,6 +182,11 @@ public: RatingSummary CalculateRatingSummary() const; + bool AddScreenshot(const BitmapRef& screenshot); + + const BitmapList& Screenshots() const + { return fScreenshots; } + private: BitmapRef fIcon; BString fTitle; @@ -190,6 +196,7 @@ private: BString fFullDescription; BString fChangelog; UserRatingList fUserRatings; + BitmapList fScreenshots; };