HaikuDepot: Added up and down vote count to UserRating

This commit is contained in:
Stephan Aßmus
2013-08-17 13:33:56 +02:00
parent 74577830da
commit 4f434bc67a
3 changed files with 30 additions and 14 deletions
+7 -7
View File
@@ -199,11 +199,11 @@ MainWindow::_InitDummyModel()
"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,
"Awesome!", "en", "2.1.2") "Awesome!", "en", "2.1.2", 0, 0)
); );
wonderbrush.AddUserRating( wonderbrush.AddUserRating(
UserRating(UserInfo("bonefish"), 5.0f, UserRating(UserInfo("bonefish"), 5.0f,
"The best!", "en", "2.1.2") "The best!", "en", "2.1.2", 3, 1)
); );
wonderbrush.AddScreenshot( wonderbrush.AddScreenshot(
BitmapRef(new SharedBitmap(603), true)); BitmapRef(new SharedBitmap(603), true));
@@ -231,17 +231,17 @@ MainWindow::_InitDummyModel()
paladin.AddUserRating( paladin.AddUserRating(
UserRating(UserInfo("stippi"), 3.5f, UserRating(UserInfo("stippi"), 3.5f,
"Could be more integrated from the sounds of it.", "Could be more integrated from the sounds of it.",
"en", "1.2.0") "en", "1.2.0", 0, 1)
); );
paladin.AddUserRating( paladin.AddUserRating(
UserRating(UserInfo("mmadia"), 5.0f, UserRating(UserInfo("mmadia"), 5.0f,
"It rocks! Give a try", "It rocks! Give a try",
"en", "1.1.0") "en", "1.1.0", 1, 0)
); );
paladin.AddUserRating( paladin.AddUserRating(
UserRating(UserInfo("bonefish"), 2.0f, UserRating(UserInfo("bonefish"), 2.0f,
"It just needs to use my jam-rewrite 'ham' and it will be great.", "It just needs to use my jam-rewrite 'ham' and it will be great.",
"en", "1.1.0") "en", "1.1.0", 3, 1)
); );
paladin.AddScreenshot( paladin.AddScreenshot(
BitmapRef(new SharedBitmap(605), true)); BitmapRef(new SharedBitmap(605), true));
@@ -321,14 +321,14 @@ MainWindow::_InitDummyModel()
"custom installed sound fonts? Reading through this comment I find " "custom installed sound fonts? Reading through this comment I find "
"that I did not until now. Hopefully there are enough lines now to " "that I did not until now. Hopefully there are enough lines now to "
"please the programmer with the text layouting and scrolling of " "please the programmer with the text layouting and scrolling of "
"long ratings!", "en", "2.1.0") "long ratings!", "en", "2.1.0", 4, 1)
); );
sequitur.AddUserRating( sequitur.AddUserRating(
UserRating(UserInfo("stippi"), 3.5f, UserRating(UserInfo("stippi"), 3.5f,
"It seems very capable. Still runs fine on Haiku. The interface " "It seems very capable. Still runs fine on Haiku. The interface "
"is composed of many small, hard to click items. But you can " "is composed of many small, hard to click items. But you can "
"configure a tool for each mouse button, which is great for the " "configure a tool for each mouse button, which is great for the "
"work flow.", "en", "2.1.0") "work flow.", "en", "2.1.0", 2, 1)
); );
sequitur.AddCategory(fModel.CategoryAudio()); sequitur.AddCategory(fModel.CategoryAudio());
+15 -6
View File
@@ -242,21 +242,24 @@ UserRating::UserRating()
fRating(0.0f), fRating(0.0f),
fComment(), fComment(),
fLanguage(), fLanguage(),
fPackageVersion() fPackageVersion(),
fUpVotes(0),
fDownVotes(0)
{ {
} }
UserRating::UserRating(const UserInfo& userInfo, float rating, UserRating::UserRating(const UserInfo& userInfo, float rating,
const BString& comment, const BString& language, const BString& comment, const BString& language,
const BString& packageVersion) const BString& packageVersion, int32 upVotes, int32 downVotes)
: :
fUserInfo(userInfo), fUserInfo(userInfo),
fRating(rating), fRating(rating),
fComment(comment), fComment(comment),
fLanguage(language), fLanguage(language),
fPackageVersion(packageVersion) fPackageVersion(packageVersion),
fUpVotes(upVotes),
fDownVotes(downVotes)
{ {
} }
@@ -267,7 +270,9 @@ UserRating::UserRating(const UserRating& other)
fRating(other.fRating), fRating(other.fRating),
fComment(other.fComment), fComment(other.fComment),
fLanguage(other.fLanguage), fLanguage(other.fLanguage),
fPackageVersion(other.fPackageVersion) fPackageVersion(other.fPackageVersion),
fUpVotes(other.fUpVotes),
fDownVotes(other.fDownVotes)
{ {
} }
@@ -280,6 +285,8 @@ UserRating::operator=(const UserRating& other)
fComment = other.fComment; fComment = other.fComment;
fLanguage = other.fLanguage; fLanguage = other.fLanguage;
fPackageVersion = other.fPackageVersion; fPackageVersion = other.fPackageVersion;
fUpVotes = other.fUpVotes;
fDownVotes = other.fDownVotes;
return *this; return *this;
} }
@@ -291,7 +298,9 @@ UserRating::operator==(const UserRating& other) const
&& fRating == other.fRating && fRating == other.fRating
&& fComment == other.fComment && fComment == other.fComment
&& fLanguage == other.fLanguage && fLanguage == other.fLanguage
&& fPackageVersion == other.fPackageVersion; && fPackageVersion == other.fPackageVersion
&& fUpVotes == other.fUpVotes
&& fDownVotes == other.fDownVotes;
} }
+8 -1
View File
@@ -76,7 +76,8 @@ public:
float rating, float rating,
const BString& comment, const BString& comment,
const BString& language, const BString& language,
const BString& packageVersion); const BString& packageVersion,
int32 upVotes, int32 downVotes);
UserRating(const UserRating& other); UserRating(const UserRating& other);
UserRating& operator=(const UserRating& other); UserRating& operator=(const UserRating& other);
@@ -94,12 +95,18 @@ public:
const BString& PackageVersion() const const BString& PackageVersion() const
{ return fPackageVersion; } { return fPackageVersion; }
int32 UpVotes() const
{ return fUpVotes; }
int32 DownVotes() const
{ return fDownVotes; }
private: private:
UserInfo fUserInfo; UserInfo fUserInfo;
float fRating; float fRating;
BString fComment; BString fComment;
BString fLanguage; BString fLanguage;
BString fPackageVersion; BString fPackageVersion;
int32 fUpVotes;
int32 fDownVotes;
}; };