[haiku-commits] haiku: hrev45941 - src/apps/haiku-depot

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 1 Aug 2013 23:53:07 +0200 (CEST)

hrev45941 adds 1 changeset to branch 'master'
old head: ffc424b51aedad4bd479c54a0922a2ace1c4cafa
new head: b42e741f26c019febc7120a50fbb50f4c22ff752
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=b42e741+%5Effc424b

----------------------------------------------------------------------------

b42e741: HaikuDepot: ÜiPut psher info in its own class.

                                      [ Stephan Aßmus <superstippi@xxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45941
Commit:      b42e741f26c019febc7120a50fbb50f4c22ff752
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b42e741
Author:      Stephan Aßmus <superstippi@xxxxxx>
Date:        Thu Aug  1 21:52:14 2013 UTC

----------------------------------------------------------------------------

4 files changed, 116 insertions(+), 25 deletions(-)
src/apps/haiku-depot/MainWindow.cpp      | 12 +++-
src/apps/haiku-depot/PackageInfo.cpp     | 83 +++++++++++++++++++++++-----
src/apps/haiku-depot/PackageInfo.h       | 42 +++++++++++---
src/apps/haiku-depot/PackageInfoView.cpp |  4 +-

----------------------------------------------------------------------------

diff --git a/src/apps/haiku-depot/MainWindow.cpp 
b/src/apps/haiku-depot/MainWindow.cpp
index 225a24b..2862900 100644
--- a/src/apps/haiku-depot/MainWindow.cpp
+++ b/src/apps/haiku-depot/MainWindow.cpp
@@ -156,11 +156,15 @@ MainWindow::_InitDummyModel()
                BitmapRef(new SharedBitmap(601), true),
                "WonderBrush",
                "2.1.2",
+               PublisherInfo(
+                       BitmapRef(),
+                       "YellowBites",
+                       "superstippi@xxxxxx",
+                       "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@xxxxxx", "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@xxxxxxxxxxxxxxx",
+                       "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@xxxxxxxxxxxxxxx", "http://darkwyrm-haiku.blogspot.com";,
                "");
        paladin.AddUserRating(
                UserRating(UserInfo("stippi"), 3.5f,
diff --git a/src/apps/haiku-depot/PackageInfo.cpp 
b/src/apps/haiku-depot/PackageInfo.cpp
index cc3e020..b0fee98 100644
--- a/src/apps/haiku-depot/PackageInfo.cpp
+++ b/src/apps/haiku-depot/PackageInfo.cpp
@@ -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;
 }
diff --git a/src/apps/haiku-depot/PackageInfo.h 
b/src/apps/haiku-depot/PackageInfo.h
index 44aa33a..c50254e 100644
--- a/src/apps/haiku-depot/PackageInfo.h
+++ b/src/apps/haiku-depot/PackageInfo.h
@@ -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;
 };
diff --git a/src/apps/haiku-depot/PackageInfoView.cpp 
b/src/apps/haiku-depot/PackageInfoView.cpp
index f3d12ad..30f0de5 100644
--- a/src/apps/haiku-depot/PackageInfoView.cpp
+++ b/src/apps/haiku-depot/PackageInfoView.cpp
@@ -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()


Other related posts:

  • » [haiku-commits] haiku: hrev45941 - src/apps/haiku-depot - superstippi