HaikuDepot: ÜiPut psher info in its own class.

This commit is contained in:
Stephan Aßmus
2013-08-01 23:52:14 +02:00
parent ffc424b51a
commit b42e741f26
4 changed files with 116 additions and 25 deletions
+10 -2
View File
@@ -156,11 +156,15 @@ MainWindow::_InitDummyModel()
BitmapRef(new SharedBitmap(601), true), BitmapRef(new SharedBitmap(601), true),
"WonderBrush", "WonderBrush",
"2.1.2", "2.1.2",
PublisherInfo(
BitmapRef(),
"YellowBites",
"[email protected]",
"http://www.yellowbites.com"),
"A vector based graphics editor.", "A vector based graphics editor.",
"WonderBrush is YellowBites' software for doing graphics design " "WonderBrush is YellowBites' software for doing graphics design "
"on Haiku. It combines many great under-the-hood features with " "on Haiku. It combines many great under-the-hood features with "
"powerful tools and an efficient and intuitive interface.", "powerful tools and an efficient and intuitive interface.",
"[email protected]", "http://www.yellowbites.com",
"2.1.2 - Initial Haiku release."); "2.1.2 - Initial Haiku release.");
wonderbrush.AddUserRating( wonderbrush.AddUserRating(
UserRating(UserInfo("humdinger"), 4.5f, UserRating(UserInfo("humdinger"), 4.5f,
@@ -176,12 +180,16 @@ MainWindow::_InitDummyModel()
BitmapRef(new SharedBitmap(602), true), BitmapRef(new SharedBitmap(602), true),
"Paladin", "Paladin",
"1.2.0", "1.2.0",
PublisherInfo(
BitmapRef(),
"DarkWyrm",
"[email protected]",
"http://darkwyrm-haiku.blogspot.com"),
"A C/C++ IDE based on Pe.", "A C/C++ IDE based on Pe.",
"If you like BeIDE, you'll like Paladin even better. " "If you like BeIDE, you'll like Paladin even better. "
"The interface is streamlined, it has some features sorely " "The interface is streamlined, it has some features sorely "
"missing from BeIDE, like running a project in the Terminal, " "missing from BeIDE, like running a project in the Terminal, "
"and has a bundled text editor based upon Pe.", "and has a bundled text editor based upon Pe.",
"[email protected]", "http://darkwyrm-haiku.blogspot.com",
""); "");
paladin.AddUserRating( paladin.AddUserRating(
UserRating(UserInfo("stippi"), 3.5f, UserRating(UserInfo("stippi"), 3.5f,
+70 -13
View File
@@ -275,6 +275,68 @@ UserRating::operator!=(const UserRating& other) const
} }
// #pragma mark - PublisherInfo
PublisherInfo::PublisherInfo()
:
fLogo(),
fName(),
fEmail(),
fWebsite()
{
}
PublisherInfo::PublisherInfo(const BitmapRef& logo, const BString& name,
const BString& email, const BString& website)
:
fLogo(logo),
fName(name),
fEmail(email),
fWebsite(website)
{
}
PublisherInfo::PublisherInfo(const PublisherInfo& other)
:
fLogo(other.fLogo),
fName(other.fName),
fEmail(other.fEmail),
fWebsite(other.fWebsite)
{
}
PublisherInfo&
PublisherInfo::operator=(const PublisherInfo& other)
{
fLogo = other.fLogo;
fName = other.fName;
fEmail = other.fEmail;
fWebsite = other.fWebsite;
return *this;
}
bool
PublisherInfo::operator==(const PublisherInfo& other) const
{
return fLogo == other.fLogo
&& fName == other.fName
&& fEmail == other.fEmail
&& fWebsite == other.fWebsite;
}
bool
PublisherInfo::operator!=(const PublisherInfo& other) const
{
return !(*this == other);
}
// #pragma mark - PackageInfo // #pragma mark - PackageInfo
@@ -283,10 +345,9 @@ PackageInfo::PackageInfo()
fIcon(), fIcon(),
fTitle(), fTitle(),
fVersion(), fVersion(),
fPublisher(),
fShortDescription(), fShortDescription(),
fFullDescription(), fFullDescription(),
fPublisherEmail(),
fPublisherWebsite(),
fChangelog(), fChangelog(),
fUserRatings() fUserRatings()
{ {
@@ -294,17 +355,16 @@ PackageInfo::PackageInfo()
PackageInfo::PackageInfo(const BitmapRef& icon, const BString& title, PackageInfo::PackageInfo(const BitmapRef& icon, const BString& title,
const BString& version, const BString& shortDescription, const BString& version, const PublisherInfo& publisher,
const BString& fullDescription, const BString& publisherEmail, const BString& shortDescription, const BString& fullDescription,
const BString& publisherWebsite, const BString& changelog) const BString& changelog)
: :
fIcon(icon), fIcon(icon),
fTitle(title), fTitle(title),
fVersion(version), fVersion(version),
fPublisher(publisher),
fShortDescription(shortDescription), fShortDescription(shortDescription),
fFullDescription(fullDescription), fFullDescription(fullDescription),
fPublisherEmail(publisherEmail),
fPublisherWebsite(publisherWebsite),
fChangelog(changelog), fChangelog(changelog),
fUserRatings() fUserRatings()
{ {
@@ -316,10 +376,9 @@ PackageInfo::PackageInfo(const PackageInfo& other)
fIcon(other.fIcon), fIcon(other.fIcon),
fTitle(other.fTitle), fTitle(other.fTitle),
fVersion(other.fVersion), fVersion(other.fVersion),
fPublisher(other.fPublisher),
fShortDescription(other.fShortDescription), fShortDescription(other.fShortDescription),
fFullDescription(other.fFullDescription), fFullDescription(other.fFullDescription),
fPublisherEmail(other.fPublisherEmail),
fPublisherWebsite(other.fPublisherWebsite),
fChangelog(other.fChangelog), fChangelog(other.fChangelog),
fUserRatings(other.fUserRatings) fUserRatings(other.fUserRatings)
{ {
@@ -332,10 +391,9 @@ PackageInfo::operator=(const PackageInfo& other)
fIcon = other.fIcon; fIcon = other.fIcon;
fTitle = other.fTitle; fTitle = other.fTitle;
fVersion = other.fVersion; fVersion = other.fVersion;
fPublisher = other.fPublisher;
fShortDescription = other.fShortDescription; fShortDescription = other.fShortDescription;
fFullDescription = other.fFullDescription; fFullDescription = other.fFullDescription;
fPublisherEmail = other.fPublisherEmail;
fPublisherWebsite = other.fPublisherWebsite;
fChangelog = other.fChangelog; fChangelog = other.fChangelog;
fUserRatings = other.fUserRatings; fUserRatings = other.fUserRatings;
return *this; return *this;
@@ -348,10 +406,9 @@ PackageInfo::operator==(const PackageInfo& other) const
return fIcon == other.fIcon return fIcon == other.fIcon
&& fTitle == other.fTitle && fTitle == other.fTitle
&& fVersion == other.fVersion && fVersion == other.fVersion
&& fPublisher == other.fPublisher
&& fShortDescription == other.fShortDescription && fShortDescription == other.fShortDescription
&& fFullDescription == other.fFullDescription && fFullDescription == other.fFullDescription
&& fPublisherEmail == other.fPublisherEmail
&& fPublisherWebsite == other.fPublisherWebsite
&& fChangelog == other.fChangelog && fChangelog == other.fChangelog
&& fUserRatings == other.fUserRatings; && fUserRatings == other.fUserRatings;
} }
+34 -8
View File
@@ -104,16 +104,45 @@ private:
typedef List<UserRating, false> UserRatingList; typedef List<UserRating, false> UserRatingList;
class PublisherInfo {
public:
PublisherInfo();
PublisherInfo(const BitmapRef& logo,
const BString& name,
const BString& email,
const BString& website);
PublisherInfo(const PublisherInfo& other);
PublisherInfo& operator=(const PublisherInfo& other);
bool operator==(const PublisherInfo& other) const;
bool operator!=(const PublisherInfo& other) const;
const BitmapRef& Logo() const
{ return fLogo; }
const BString& Name() const
{ return fName; }
const BString& Email() const
{ return fEmail; }
const BString& Website() const
{ return fWebsite; }
private:
BitmapRef fLogo;
BString fName;
BString fEmail;
BString fWebsite;
};
class PackageInfo { class PackageInfo {
public: public:
PackageInfo(); PackageInfo();
PackageInfo(const BitmapRef& icon, PackageInfo(const BitmapRef& icon,
const BString& title, const BString& title,
const BString& version, const BString& version,
const PublisherInfo& publisher,
const BString& shortDescription, const BString& shortDescription,
const BString& fullDescription, const BString& fullDescription,
const BString& publisherEmail,
const BString& publisherWebsite,
const BString& changelog); const BString& changelog);
PackageInfo(const PackageInfo& other); PackageInfo(const PackageInfo& other);
@@ -131,10 +160,8 @@ public:
{ return fShortDescription; } { return fShortDescription; }
const BString& FullDescription() const const BString& FullDescription() const
{ return fFullDescription; } { return fFullDescription; }
const BString& PublisherEmail() const const PublisherInfo& Publisher() const
{ return fPublisherEmail; } { return fPublisher; }
const BString& PublisherWebsite() const
{ return fPublisherWebsite; }
const BString& Changelog() const const BString& Changelog() const
{ return fChangelog; } { return fChangelog; }
@@ -144,10 +171,9 @@ private:
BitmapRef fIcon; BitmapRef fIcon;
BString fTitle; BString fTitle;
BString fVersion; BString fVersion;
PublisherInfo fPublisher;
BString fShortDescription; BString fShortDescription;
BString fFullDescription; BString fFullDescription;
BString fPublisherEmail;
BString fPublisherWebsite;
BString fChangelog; BString fChangelog;
UserRatingList fUserRatings; UserRatingList fUserRatings;
}; };
+2 -2
View File
@@ -203,9 +203,9 @@ public:
{ {
fDescriptionView->SetText(package.FullDescription()); fDescriptionView->SetText(package.FullDescription());
fEmailIconView->SetBitmap(fEmailIcon.Bitmap(SharedBitmap::SIZE_16)); fEmailIconView->SetBitmap(fEmailIcon.Bitmap(SharedBitmap::SIZE_16));
fEmailLinkView->SetText(package.PublisherEmail()); fEmailLinkView->SetText(package.Publisher().Email());
fWebsiteIconView->SetBitmap(fWebsiteIcon.Bitmap(SharedBitmap::SIZE_16)); fWebsiteIconView->SetBitmap(fWebsiteIcon.Bitmap(SharedBitmap::SIZE_16));
fWebsiteLinkView->SetText(package.PublisherWebsite()); fWebsiteLinkView->SetText(package.Publisher().Website());
} }
void Clear() void Clear()