HaikuDepot : User-Rating / Star Selection Fix
This commit resolves a problem where the user-rating is able to specify a rating (how many stars) or not. The behaviour was not properly honouring the checkbox to specify if the rating was to be used or not. Change-Id: I01067bf899e1d5beab1474a197c5698166b9f582 Reviewed-on: https://review.haiku-os.org/600 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
ebb4be2aef
commit
018d5927d5
@@ -33,6 +33,10 @@ typedef List<BString, false> StringList;
|
|||||||
#define ERROR_CODE_LIMITEXCEEDED -32805
|
#define ERROR_CODE_LIMITEXCEEDED -32805
|
||||||
#define ERROR_CODE_AUTHORIZATIONRULECONFLICT -32806
|
#define ERROR_CODE_AUTHORIZATIONRULECONFLICT -32806
|
||||||
|
|
||||||
|
/*! This constant can be used to indicate the lack of a rating. */
|
||||||
|
|
||||||
|
#define RATING_NONE -1
|
||||||
|
|
||||||
|
|
||||||
class WebAppInterface {
|
class WebAppInterface {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -202,7 +202,8 @@ RatePackageWindow::RatePackageWindow(BWindow* parent, BRect frame,
|
|||||||
fModel(model),
|
fModel(model),
|
||||||
fRatingText(),
|
fRatingText(),
|
||||||
fTextEditor(new TextEditor(), true),
|
fTextEditor(new TextEditor(), true),
|
||||||
fRating(-1.0f),
|
fRating(RATING_NONE),
|
||||||
|
fRatingDeterminate(false),
|
||||||
fCommentLanguage(fModel.PreferredLanguage()),
|
fCommentLanguage(fModel.PreferredLanguage()),
|
||||||
fWorkerThread(-1)
|
fWorkerThread(-1)
|
||||||
{
|
{
|
||||||
@@ -337,6 +338,7 @@ RatePackageWindow::MessageReceived(BMessage* message)
|
|||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case MSG_PACKAGE_RATED:
|
case MSG_PACKAGE_RATED:
|
||||||
message->FindFloat("rating", &fRating);
|
message->FindFloat("rating", &fRating);
|
||||||
|
fRatingDeterminate = true;
|
||||||
fSetRatingView->SetRatingDeterminate(true);
|
fSetRatingView->SetRatingDeterminate(true);
|
||||||
fRatingDeterminateCheckBox->SetValue(B_CONTROL_ON);
|
fRatingDeterminateCheckBox->SetValue(B_CONTROL_ON);
|
||||||
break;
|
break;
|
||||||
@@ -350,8 +352,9 @@ RatePackageWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MSG_RATING_DETERMINATE_CHANGED:
|
case MSG_RATING_DETERMINATE_CHANGED:
|
||||||
fSetRatingView->SetRatingDeterminate(
|
fRatingDeterminate = fRatingDeterminateCheckBox->Value()
|
||||||
fRatingDeterminateCheckBox->Value() == B_CONTROL_ON);
|
== B_CONTROL_ON;
|
||||||
|
fSetRatingView->SetRatingDeterminate(fRatingDeterminate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSG_RATING_ACTIVE_CHANGED:
|
case MSG_RATING_ACTIVE_CHANGED:
|
||||||
@@ -520,14 +523,15 @@ RatePackageWindow::_RelayServerDataToUI(BMessage& response)
|
|||||||
double rating;
|
double rating;
|
||||||
if (response.FindDouble("rating", &rating) == B_OK) {
|
if (response.FindDouble("rating", &rating) == B_OK) {
|
||||||
fRating = (float)rating;
|
fRating = (float)rating;
|
||||||
|
fRatingDeterminate = fRating >= 0.0f;
|
||||||
fSetRatingView->SetPermanentRating(fRating);
|
fSetRatingView->SetPermanentRating(fRating);
|
||||||
fSetRatingView->SetRatingDeterminate(true);
|
|
||||||
fRatingDeterminateCheckBox->SetValue(B_CONTROL_ON);
|
|
||||||
} else {
|
} else {
|
||||||
fSetRatingView->SetRatingDeterminate(false);
|
fRatingDeterminate = false;
|
||||||
fRatingDeterminateCheckBox->SetValue(B_CONTROL_OFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fSetRatingView->SetRatingDeterminate(fRatingDeterminate);
|
||||||
|
fRatingDeterminateCheckBox->SetValue(
|
||||||
|
fRatingDeterminate ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||||
fRatingActiveCheckBox->SetValue(fRatingActive);
|
fRatingActiveCheckBox->SetValue(fRatingActive);
|
||||||
fRatingActiveCheckBox->Show();
|
fRatingActiveCheckBox->Show();
|
||||||
|
|
||||||
@@ -649,6 +653,9 @@ RatePackageWindow::_SendRatingThread()
|
|||||||
BString ratingID = fRatingID;
|
BString ratingID = fRatingID;
|
||||||
bool active = fRatingActive;
|
bool active = fRatingActive;
|
||||||
|
|
||||||
|
if (!fRatingDeterminate)
|
||||||
|
rating = RATING_NONE;
|
||||||
|
|
||||||
const DepotInfo* depot = fModel.DepotForName(fPackage->DepotName());
|
const DepotInfo* depot = fModel.DepotForName(fPackage->DepotName());
|
||||||
|
|
||||||
if (depot != NULL)
|
if (depot != NULL)
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ private:
|
|||||||
TextDocumentRef fRatingText;
|
TextDocumentRef fRatingText;
|
||||||
TextEditorRef fTextEditor;
|
TextEditorRef fTextEditor;
|
||||||
float fRating;
|
float fRating;
|
||||||
|
bool fRatingDeterminate;
|
||||||
BString fStability;
|
BString fStability;
|
||||||
StabilityRatingList fStabilityCodes;
|
StabilityRatingList fStabilityCodes;
|
||||||
BString fCommentLanguage;
|
BString fCommentLanguage;
|
||||||
|
|||||||
Reference in New Issue
Block a user