Skip to content

Commit

Permalink
HaikuDepot: ÜiPut psher info in its own class.
Browse files Browse the repository at this point in the history
  • Loading branch information
stippi committed Aug 1, 2013
1 parent ffc424b commit b42e741
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 25 deletions.
12 changes: 10 additions & 2 deletions src/apps/haiku-depot/MainWindow.cpp
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
83 changes: 70 additions & 13 deletions src/apps/haiku-depot/PackageInfo.cpp
Expand Up @@ -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


Expand All @@ -283,28 +345,26 @@ PackageInfo::PackageInfo()
fIcon(),
fTitle(),
fVersion(),
fPublisher(),
fShortDescription(),
fFullDescription(),
fPublisherEmail(),
fPublisherWebsite(),
fChangelog(),
fUserRatings()
{
}


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()
{
Expand All @@ -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)
{
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down
42 changes: 34 additions & 8 deletions src/apps/haiku-depot/PackageInfo.h
Expand Up @@ -104,16 +104,45 @@ class UserRating {
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);

Expand All @@ -131,10 +160,8 @@ class PackageInfo {
{ 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; }

Expand All @@ -144,10 +171,9 @@ class PackageInfo {
BitmapRef fIcon;
BString fTitle;
BString fVersion;
PublisherInfo fPublisher;
BString fShortDescription;
BString fFullDescription;
BString fPublisherEmail;
BString fPublisherWebsite;
BString fChangelog;
UserRatingList fUserRatings;
};
Expand Down
4 changes: 2 additions & 2 deletions src/apps/haiku-depot/PackageInfoView.cpp
Expand Up @@ -203,9 +203,9 @@ class AboutView : public BView {
{
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()
Expand Down

0 comments on commit b42e741

Please sign in to comment.