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

View File

@ -156,11 +156,15 @@ MainWindow::_InitDummyModel()
BitmapRef(new SharedBitmap(601), true),
"WonderBrush",
"2.1.2",
PublisherInfo(
BitmapRef(),
"YellowBites",
"superstippi@gmx.de",
"http://www.yellowbites.com"),
"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.",
"superstippi@gmx.de", "http://www.yellowbites.com",
"2.1.2 - Initial Haiku release.");
wonderbrush.AddUserRating(
UserRating(UserInfo("humdinger"), 4.5f,
@ -176,12 +180,16 @@ MainWindow::_InitDummyModel()
BitmapRef(new SharedBitmap(602), true),
"Paladin",
"1.2.0",
PublisherInfo(
BitmapRef(),
"DarkWyrm",
"bpmagic@columbus.rr.com",
"http://darkwyrm-haiku.blogspot.com"),
"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.",
"bpmagic@columbus.rr.com", "http://darkwyrm-haiku.blogspot.com",
"");
paladin.AddUserRating(
UserRating(UserInfo("stippi"), 3.5f,

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
@ -283,10 +345,9 @@ PackageInfo::PackageInfo()
fIcon(),
fTitle(),
fVersion(),
fPublisher(),
fShortDescription(),
fFullDescription(),
fPublisherEmail(),
fPublisherWebsite(),
fChangelog(),
fUserRatings()
{
@ -294,17 +355,16 @@ PackageInfo::PackageInfo()
PackageInfo::PackageInfo(const BitmapRef& icon, const BString& title,
const BString& version, const BString& shortDescription,
const BString& fullDescription, const BString& publisherEmail,
const BString& publisherWebsite, const BString& changelog)
const BString& version, const PublisherInfo& publisher,
const BString& shortDescription, const BString& fullDescription,
const BString& changelog)
:
fIcon(icon),
fTitle(title),
fVersion(version),
fPublisher(publisher),
fShortDescription(shortDescription),
fFullDescription(fullDescription),
fPublisherEmail(publisherEmail),
fPublisherWebsite(publisherWebsite),
fChangelog(changelog),
fUserRatings()
{
@ -316,10 +376,9 @@ PackageInfo::PackageInfo(const PackageInfo& other)
fIcon(other.fIcon),
fTitle(other.fTitle),
fVersion(other.fVersion),
fPublisher(other.fPublisher),
fShortDescription(other.fShortDescription),
fFullDescription(other.fFullDescription),
fPublisherEmail(other.fPublisherEmail),
fPublisherWebsite(other.fPublisherWebsite),
fChangelog(other.fChangelog),
fUserRatings(other.fUserRatings)
{
@ -332,10 +391,9 @@ PackageInfo::operator=(const PackageInfo& other)
fIcon = other.fIcon;
fTitle = other.fTitle;
fVersion = other.fVersion;
fPublisher = other.fPublisher;
fShortDescription = other.fShortDescription;
fFullDescription = other.fFullDescription;
fPublisherEmail = other.fPublisherEmail;
fPublisherWebsite = other.fPublisherWebsite;
fChangelog = other.fChangelog;
fUserRatings = other.fUserRatings;
return *this;
@ -348,10 +406,9 @@ PackageInfo::operator==(const PackageInfo& other) const
return fIcon == other.fIcon
&& fTitle == other.fTitle
&& fVersion == other.fVersion
&& fPublisher == other.fPublisher
&& fShortDescription == other.fShortDescription
&& fFullDescription == other.fFullDescription
&& fPublisherEmail == other.fPublisherEmail
&& fPublisherWebsite == other.fPublisherWebsite
&& fChangelog == other.fChangelog
&& fUserRatings == other.fUserRatings;
}

View File

@ -104,16 +104,45 @@ private:
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 {
public:
PackageInfo();
PackageInfo(const BitmapRef& icon,
const BString& title,
const BString& version,
const PublisherInfo& publisher,
const BString& shortDescription,
const BString& fullDescription,
const BString& publisherEmail,
const BString& publisherWebsite,
const BString& changelog);
PackageInfo(const PackageInfo& other);
@ -131,10 +160,8 @@ public:
{ return fShortDescription; }
const BString& FullDescription() const
{ return fFullDescription; }
const BString& PublisherEmail() const
{ return fPublisherEmail; }
const BString& PublisherWebsite() const
{ return fPublisherWebsite; }
const PublisherInfo& Publisher() const
{ return fPublisher; }
const BString& Changelog() const
{ return fChangelog; }
@ -144,10 +171,9 @@ private:
BitmapRef fIcon;
BString fTitle;
BString fVersion;
PublisherInfo fPublisher;
BString fShortDescription;
BString fFullDescription;
BString fPublisherEmail;
BString fPublisherWebsite;
BString fChangelog;
UserRatingList fUserRatings;
};

View File

@ -203,9 +203,9 @@ public:
{
fDescriptionView->SetText(package.FullDescription());
fEmailIconView->SetBitmap(fEmailIcon.Bitmap(SharedBitmap::SIZE_16));
fEmailLinkView->SetText(package.PublisherEmail());
fEmailLinkView->SetText(package.Publisher().Email());
fWebsiteIconView->SetBitmap(fWebsiteIcon.Bitmap(SharedBitmap::SIZE_16));
fWebsiteLinkView->SetText(package.PublisherWebsite());
fWebsiteLinkView->SetText(package.Publisher().Website());
}
void Clear()