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 <waddlesplash@gmail.com>
This commit is contained in:
parent
ebb4be2aef
commit
018d5927d5
@ -33,6 +33,10 @@ typedef List<BString, false> StringList;
|
||||
#define ERROR_CODE_LIMITEXCEEDED -32805
|
||||
#define ERROR_CODE_AUTHORIZATIONRULECONFLICT -32806
|
||||
|
||||
/*! This constant can be used to indicate the lack of a rating. */
|
||||
|
||||
#define RATING_NONE -1
|
||||
|
||||
|
||||
class WebAppInterface {
|
||||
public:
|
||||
|
@ -202,7 +202,8 @@ RatePackageWindow::RatePackageWindow(BWindow* parent, BRect frame,
|
||||
fModel(model),
|
||||
fRatingText(),
|
||||
fTextEditor(new TextEditor(), true),
|
||||
fRating(-1.0f),
|
||||
fRating(RATING_NONE),
|
||||
fRatingDeterminate(false),
|
||||
fCommentLanguage(fModel.PreferredLanguage()),
|
||||
fWorkerThread(-1)
|
||||
{
|
||||
@ -337,6 +338,7 @@ RatePackageWindow::MessageReceived(BMessage* message)
|
||||
switch (message->what) {
|
||||
case MSG_PACKAGE_RATED:
|
||||
message->FindFloat("rating", &fRating);
|
||||
fRatingDeterminate = true;
|
||||
fSetRatingView->SetRatingDeterminate(true);
|
||||
fRatingDeterminateCheckBox->SetValue(B_CONTROL_ON);
|
||||
break;
|
||||
@ -350,8 +352,9 @@ RatePackageWindow::MessageReceived(BMessage* message)
|
||||
break;
|
||||
|
||||
case MSG_RATING_DETERMINATE_CHANGED:
|
||||
fSetRatingView->SetRatingDeterminate(
|
||||
fRatingDeterminateCheckBox->Value() == B_CONTROL_ON);
|
||||
fRatingDeterminate = fRatingDeterminateCheckBox->Value()
|
||||
== B_CONTROL_ON;
|
||||
fSetRatingView->SetRatingDeterminate(fRatingDeterminate);
|
||||
break;
|
||||
|
||||
case MSG_RATING_ACTIVE_CHANGED:
|
||||
@ -520,14 +523,15 @@ RatePackageWindow::_RelayServerDataToUI(BMessage& response)
|
||||
double rating;
|
||||
if (response.FindDouble("rating", &rating) == B_OK) {
|
||||
fRating = (float)rating;
|
||||
fRatingDeterminate = fRating >= 0.0f;
|
||||
fSetRatingView->SetPermanentRating(fRating);
|
||||
fSetRatingView->SetRatingDeterminate(true);
|
||||
fRatingDeterminateCheckBox->SetValue(B_CONTROL_ON);
|
||||
} else {
|
||||
fSetRatingView->SetRatingDeterminate(false);
|
||||
fRatingDeterminateCheckBox->SetValue(B_CONTROL_OFF);
|
||||
fRatingDeterminate = false;
|
||||
}
|
||||
|
||||
fSetRatingView->SetRatingDeterminate(fRatingDeterminate);
|
||||
fRatingDeterminateCheckBox->SetValue(
|
||||
fRatingDeterminate ? B_CONTROL_ON : B_CONTROL_OFF);
|
||||
fRatingActiveCheckBox->SetValue(fRatingActive);
|
||||
fRatingActiveCheckBox->Show();
|
||||
|
||||
@ -649,6 +653,9 @@ RatePackageWindow::_SendRatingThread()
|
||||
BString ratingID = fRatingID;
|
||||
bool active = fRatingActive;
|
||||
|
||||
if (!fRatingDeterminate)
|
||||
rating = RATING_NONE;
|
||||
|
||||
const DepotInfo* depot = fModel.DepotForName(fPackage->DepotName());
|
||||
|
||||
if (depot != NULL)
|
||||
|
@ -53,6 +53,7 @@ private:
|
||||
TextDocumentRef fRatingText;
|
||||
TextEditorRef fTextEditor;
|
||||
float fRating;
|
||||
bool fRatingDeterminate;
|
||||
BString fStability;
|
||||
StabilityRatingList fStabilityCodes;
|
||||
BString fCommentLanguage;
|
||||
|
Loading…
x
Reference in New Issue
Block a user