hrev45931 adds 3 changesets to branch 'master' old head: 28538208de049660cac02826cca7dffd5e1ea13d new head: cdbf478fbf2aa409e060bfb273e239b07389ccbe overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=cdbf478+%5E2853820 ---------------------------------------------------------------------------- 46d5f6b: HaikuDepot: PackageInfo: Split description into short and full 3a98600: HaikuDepot: Tweak default, min and max column widths cdbf478: HaikuDepot: PackageInfo, added SharedBitmap and BitmapRef classes * Use in UserInfo for avatar field. * Use in PackageInfo for icon. * Use in PackageListView. [ Stephan Aßmus <superstippi@xxxxxx> ] ---------------------------------------------------------------------------- 5 files changed, 123 insertions(+), 36 deletions(-) src/apps/haiku-depot/MainWindow.cpp | 9 ++++ src/apps/haiku-depot/PackageInfo.cpp | 64 +++++++++++++++++++++++----- src/apps/haiku-depot/PackageInfo.h | 48 ++++++++++++++++++--- src/apps/haiku-depot/PackageInfoView.cpp | 3 +- src/apps/haiku-depot/PackageListView.cpp | 35 ++++++++------- ############################################################################ Commit: 46d5f6b433249beb03341ca707c50d7e189776f6 URL: http://cgit.haiku-os.org/haiku/commit/?id=46d5f6b Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Jul 30 20:27:31 2013 UTC HaikuDepot: PackageInfo: Split description into short and full ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/MainWindow.cpp b/src/apps/haiku-depot/MainWindow.cpp index cfec1a6..1a140cb 100644 --- a/src/apps/haiku-depot/MainWindow.cpp +++ b/src/apps/haiku-depot/MainWindow.cpp @@ -156,6 +156,9 @@ MainWindow::_InitDummyModel() "WonderBrush", "2.1.2", "A vector based graphics editor.", + "WonderBrush is YellowBites' software for doing graphics design " + "on Haiku. It combines many great under-the-hood features with " + "powerful tools and an efficient and intuitive interface.", "2.1.2 - Initial Haiku release."); wonderbrush.AddUserRating( UserRating(UserInfo("humdinger"), 4.5f, @@ -171,6 +174,10 @@ MainWindow::_InitDummyModel() "Paladin", "1.2.0", "A C/C++ IDE based on Pe.", + "If you like BeIDE, you'll like Paladin even better. " + "The interface is streamlined, it has some features sorely " + "missing from BeIDE, like running a project in the Terminal, " + "and has a bundled text editor based upon Pe.", ""); paladin.AddUserRating( UserRating(UserInfo("stippi"), 3.5f, diff --git a/src/apps/haiku-depot/PackageInfo.cpp b/src/apps/haiku-depot/PackageInfo.cpp index 10a6724..a90c471 100644 --- a/src/apps/haiku-depot/PackageInfo.cpp +++ b/src/apps/haiku-depot/PackageInfo.cpp @@ -130,7 +130,8 @@ PackageInfo::PackageInfo() : fTitle(), fVersion(), - fDescription(), + fShortDescription(), + fFullDescription(), fChangelog(), fUserRatings() { @@ -138,11 +139,13 @@ PackageInfo::PackageInfo() PackageInfo::PackageInfo(const BString& title, const BString& version, - const BString& description, const BString& changelog) + const BString& shortDescription, const BString& fullDescription, + const BString& changelog) : fTitle(title), fVersion(version), - fDescription(description), + fShortDescription(shortDescription), + fFullDescription(fullDescription), fChangelog(changelog), fUserRatings() { @@ -153,7 +156,8 @@ PackageInfo::PackageInfo(const PackageInfo& other) : fTitle(other.fTitle), fVersion(other.fVersion), - fDescription(other.fDescription), + fShortDescription(other.fShortDescription), + fFullDescription(other.fFullDescription), fChangelog(other.fChangelog), fUserRatings(other.fUserRatings) { @@ -165,7 +169,8 @@ PackageInfo::operator=(const PackageInfo& other) { fTitle = other.fTitle; fVersion = other.fVersion; - fDescription = other.fDescription; + fShortDescription = other.fShortDescription; + fFullDescription = other.fFullDescription; fChangelog = other.fChangelog; fUserRatings = other.fUserRatings; return *this; @@ -177,7 +182,8 @@ PackageInfo::operator==(const PackageInfo& other) const { return fTitle == other.fTitle && fVersion == other.fVersion - && fDescription == other.fDescription + && fShortDescription == other.fShortDescription + && fFullDescription == other.fFullDescription && fChangelog == other.fChangelog && fUserRatings == other.fUserRatings; } diff --git a/src/apps/haiku-depot/PackageInfo.h b/src/apps/haiku-depot/PackageInfo.h index 10e3419..d0a4b31 100644 --- a/src/apps/haiku-depot/PackageInfo.h +++ b/src/apps/haiku-depot/PackageInfo.h @@ -46,6 +46,8 @@ public: { return fUserInfo; } const BString& Comment() const { return fComment; } + const BString& Language() const + { return fLanguage; } const float Rating() const { return fRating; } const BString& PackageVersion() const @@ -68,7 +70,8 @@ public: PackageInfo(); PackageInfo(const BString& title, const BString& version, - const BString& description, + const BString& shortDescription, + const BString& fullDescription, const BString& changelog); PackageInfo(const PackageInfo& other); @@ -80,8 +83,10 @@ public: { return fTitle; } const BString& Version() const { return fVersion; } - const BString& Description() const - { return fDescription; } + const BString& ShortDescription() const + { return fShortDescription; } + const BString& FullDescription() const + { return fFullDescription; } const BString& Changelog() const { return fChangelog; } @@ -90,7 +95,8 @@ public: private: BString fTitle; BString fVersion; - BString fDescription; + BString fShortDescription; + BString fFullDescription; BString fChangelog; UserRatingList fUserRatings; }; diff --git a/src/apps/haiku-depot/PackageInfoView.cpp b/src/apps/haiku-depot/PackageInfoView.cpp index a753a2d..9b60ec1 100644 --- a/src/apps/haiku-depot/PackageInfoView.cpp +++ b/src/apps/haiku-depot/PackageInfoView.cpp @@ -155,6 +155,7 @@ public: fDescriptionView = new BTextView("description view"); fDescriptionView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fDescriptionView->MakeEditable(false); BLayoutBuilder::Group<>(fLayout) .Add(fDescriptionView) @@ -172,7 +173,7 @@ public: void SetPackage(const PackageInfo& package) { - fDescriptionView->SetText(package.Description()); + fDescriptionView->SetText(package.FullDescription()); } void Clear() ############################################################################ Commit: 3a98600e80781cc2df1906c1bf5eaefb23e17240 URL: http://cgit.haiku-os.org/haiku/commit/?id=3a98600 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Jul 30 20:28:09 2013 UTC HaikuDepot: Tweak default, min and max column widths ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/PackageListView.cpp b/src/apps/haiku-depot/PackageListView.cpp index 27e3298..5588f4d 100644 --- a/src/apps/haiku-depot/PackageListView.cpp +++ b/src/apps/haiku-depot/PackageListView.cpp @@ -260,7 +260,7 @@ PackageRow::PackageRow(const PackageInfo& package) SetField(new BStringField("n/a"), kRatingColumn); // Description - SetField(new BStringField(package.Description()), kDescriptionColumn); + SetField(new BStringField(package.ShortDescription()), kDescriptionColumn); // Size // TODO: Store package size @@ -279,15 +279,15 @@ PackageListView::PackageListView() : BColumnListView("package list view", 0, B_FANCY_BORDER, true) { - AddColumn(new PackageColumn(B_TRANSLATE("Name"), 150, 50, 500, + AddColumn(new PackageColumn(B_TRANSLATE("Name"), 150, 50, 300, B_TRUNCATE_MIDDLE), kTitleColumn); - AddColumn(new PackageColumn(B_TRANSLATE("Rating"), 100, 50, 500, + AddColumn(new PackageColumn(B_TRANSLATE("Rating"), 80, 50, 100, B_TRUNCATE_MIDDLE), kRatingColumn); - AddColumn(new PackageColumn(B_TRANSLATE("Description"), 130, 50, 500, + AddColumn(new PackageColumn(B_TRANSLATE("Description"), 300, 80, 1000, B_TRUNCATE_MIDDLE), kDescriptionColumn); - AddColumn(new PackageColumn(B_TRANSLATE("Size"), 100, 50, 500, + AddColumn(new PackageColumn(B_TRANSLATE("Size"), 60, 50, 100, B_TRUNCATE_END), kSizeColumn); - AddColumn(new PackageColumn(B_TRANSLATE("Status"), 100, 50, 500, + AddColumn(new PackageColumn(B_TRANSLATE("Status"), 60, 60, 100, B_TRUNCATE_END), kStatusColumn); SetSortingEnabled(true); ############################################################################ Revision: hrev45931 Commit: cdbf478fbf2aa409e060bfb273e239b07389ccbe URL: http://cgit.haiku-os.org/haiku/commit/?id=cdbf478 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Tue Jul 30 20:57:30 2013 UTC HaikuDepot: PackageInfo, added SharedBitmap and BitmapRef classes * Use in UserInfo for avatar field. * Use in PackageInfo for icon. * Use in PackageListView. ---------------------------------------------------------------------------- diff --git a/src/apps/haiku-depot/MainWindow.cpp b/src/apps/haiku-depot/MainWindow.cpp index 1a140cb..768b566 100644 --- a/src/apps/haiku-depot/MainWindow.cpp +++ b/src/apps/haiku-depot/MainWindow.cpp @@ -153,6 +153,7 @@ MainWindow::_InitDummyModel() DepotInfo depot(B_TRANSLATE("Default")); PackageInfo wonderbrush( + BitmapRef(), "WonderBrush", "2.1.2", "A vector based graphics editor.", @@ -171,6 +172,7 @@ MainWindow::_InitDummyModel() depot.AddPackage(wonderbrush); PackageInfo paladin( + BitmapRef(), "Paladin", "1.2.0", "A C/C++ IDE based on Pe.", diff --git a/src/apps/haiku-depot/PackageInfo.cpp b/src/apps/haiku-depot/PackageInfo.cpp index a90c471..dc718da 100644 --- a/src/apps/haiku-depot/PackageInfo.cpp +++ b/src/apps/haiku-depot/PackageInfo.cpp @@ -7,26 +7,55 @@ #include <stdio.h> +#include <Bitmap.h> + + +// #pragma mark - SharedBitmap + + +SharedBitmap::SharedBitmap(BBitmap* bitmap) + : + fBitmap(bitmap) +{ +} + + +SharedBitmap::~SharedBitmap() +{ + delete fBitmap; +} + // #pragma mark - UserInfo UserInfo::UserInfo() : + fAvatar(), fNickName() { } -UserInfo::UserInfo(const BString& fNickName) +UserInfo::UserInfo(const BString& nickName) : - fNickName(fNickName) + fAvatar(), + fNickName(nickName) +{ +} + + +UserInfo::UserInfo(const BitmapRef& avatar, const BString& nickName) + : + fAvatar(avatar), + fNickName(nickName) { } UserInfo::UserInfo(const UserInfo& other) : + fAvatar(other.fAvatar), fNickName(other.fNickName) { } @@ -35,6 +64,7 @@ UserInfo::UserInfo(const UserInfo& other) UserInfo& UserInfo::operator=(const UserInfo& other) { + fAvatar = other.fAvatar; fNickName = other.fNickName; return *this; } @@ -43,7 +73,8 @@ UserInfo::operator=(const UserInfo& other) bool UserInfo::operator==(const UserInfo& other) const { - return fNickName == other.fNickName; + return fAvatar == other.fAvatar + && fNickName == other.fNickName; } @@ -128,6 +159,7 @@ UserRating::operator!=(const UserRating& other) const PackageInfo::PackageInfo() : + fIcon(), fTitle(), fVersion(), fShortDescription(), @@ -138,10 +170,11 @@ PackageInfo::PackageInfo() } -PackageInfo::PackageInfo(const BString& title, const BString& version, - const BString& shortDescription, const BString& fullDescription, - const BString& changelog) +PackageInfo::PackageInfo(const BitmapRef& icon, const BString& title, + const BString& version, const BString& shortDescription, + const BString& fullDescription, const BString& changelog) : + fIcon(icon), fTitle(title), fVersion(version), fShortDescription(shortDescription), @@ -154,6 +187,7 @@ PackageInfo::PackageInfo(const BString& title, const BString& version, PackageInfo::PackageInfo(const PackageInfo& other) : + fIcon(other.fIcon), fTitle(other.fTitle), fVersion(other.fVersion), fShortDescription(other.fShortDescription), @@ -167,6 +201,7 @@ PackageInfo::PackageInfo(const PackageInfo& other) PackageInfo& PackageInfo::operator=(const PackageInfo& other) { + fIcon = other.fIcon; fTitle = other.fTitle; fVersion = other.fVersion; fShortDescription = other.fShortDescription; @@ -180,7 +215,8 @@ PackageInfo::operator=(const PackageInfo& other) bool PackageInfo::operator==(const PackageInfo& other) const { - return fTitle == other.fTitle + return fIcon == other.fIcon + && fTitle == other.fTitle && fVersion == other.fVersion && fShortDescription == other.fShortDescription && fFullDescription == other.fFullDescription diff --git a/src/apps/haiku-depot/PackageInfo.h b/src/apps/haiku-depot/PackageInfo.h index d0a4b31..aa86e72 100644 --- a/src/apps/haiku-depot/PackageInfo.h +++ b/src/apps/haiku-depot/PackageInfo.h @@ -6,24 +6,50 @@ #define PACKAGE_INFO_H +#include <Referenceable.h> #include <String.h> #include "List.h" +class BBitmap; + + +class SharedBitmap : public BReferenceable { +public: + SharedBitmap(BBitmap* bitmap); + ~SharedBitmap(); + + const BBitmap* Bitmap() const + { return fBitmap; } + +private: + BBitmap* fBitmap; +}; + + +typedef BReference<SharedBitmap> BitmapRef; + + class UserInfo { public: UserInfo(); UserInfo(const BString& nickName); + UserInfo(const BitmapRef& avatar, + const BString& nickName); UserInfo(const UserInfo& other); UserInfo& operator=(const UserInfo& other); bool operator==(const UserInfo& other) const; bool operator!=(const UserInfo& other) const; - const BString& NickName() const; + const BitmapRef& Avatar() const + { return fAvatar; } + const BString& NickName() const + { return fNickName; } private: + BitmapRef fAvatar; BString fNickName; }; @@ -68,7 +94,8 @@ typedef List<UserRating, false> UserRatingList; class PackageInfo { public: PackageInfo(); - PackageInfo(const BString& title, + PackageInfo(const BitmapRef& icon, + const BString& title, const BString& version, const BString& shortDescription, const BString& fullDescription, @@ -79,6 +106,8 @@ public: bool operator==(const PackageInfo& other) const; bool operator!=(const PackageInfo& other) const; + const BitmapRef& Icon() const + { return fIcon; } const BString& Title() const { return fTitle; } const BString& Version() const @@ -93,6 +122,7 @@ public: bool AddUserRating(const UserRating& rating); private: + BitmapRef fIcon; BString fTitle; BString fVersion; BString fShortDescription; diff --git a/src/apps/haiku-depot/PackageListView.cpp b/src/apps/haiku-depot/PackageListView.cpp index 5588f4d..961f7c5 100644 --- a/src/apps/haiku-depot/PackageListView.cpp +++ b/src/apps/haiku-depot/PackageListView.cpp @@ -22,16 +22,16 @@ class BBitmapStringField : public BStringField { typedef BStringField Inherited; public: - BBitmapStringField(BBitmap* bitmap, + BBitmapStringField(const BBitmap* bitmap, const char* string); virtual ~BBitmapStringField(); - void SetBitmap(BBitmap* bitmap); + void SetBitmap(const BBitmap* bitmap); const BBitmap* Bitmap() const { return fBitmap; } private: - BBitmap* fBitmap; + const BBitmap* fBitmap; }; @@ -79,7 +79,8 @@ private: // TODO: Code-duplication with DriveSetup PartitionList.cpp -BBitmapStringField::BBitmapStringField(BBitmap* bitmap, const char* string) +BBitmapStringField::BBitmapStringField(const BBitmap* bitmap, + const char* string) : Inherited(string), fBitmap(bitmap) @@ -89,14 +90,12 @@ BBitmapStringField::BBitmapStringField(BBitmap* bitmap, const char* string) BBitmapStringField::~BBitmapStringField() { - delete fBitmap; } void -BBitmapStringField::SetBitmap(BBitmap* bitmap) +BBitmapStringField::SetBitmap(const BBitmap* bitmap) { - delete fBitmap; fBitmap = bitmap; // TODO: cause a redraw? } @@ -248,11 +247,11 @@ PackageRow::PackageRow(const PackageInfo& package) Inherited(), fPackage(package) { - // Package icon - - BBitmap* icon = NULL; - // TODO: Fetch package icon - + // Package icon and title + // NOTE: The icon BBitmap is referenced by the fPackage member. + const BBitmap* icon = NULL; + if (package.Icon().Get() != NULL) + icon = package.Icon()->Bitmap(); SetField(new BBitmapStringField(icon, package.Title()), kTitleColumn); // Rating