HaikuDepot: Display check box to deactivate rating
... if a rating already exists for the given package and version.
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <CheckBox.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
#include <MenuField.h>
|
#include <MenuField.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
@@ -30,10 +31,11 @@
|
|||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSG_SEND = 'send',
|
MSG_SEND = 'send',
|
||||||
MSG_PACKAGE_RATED = 'rpkg',
|
MSG_PACKAGE_RATED = 'rpkg',
|
||||||
MSG_STABILITY_SELECTED = 'stbl',
|
MSG_STABILITY_SELECTED = 'stbl',
|
||||||
MSG_LANGUAGE_SELECTED = 'lngs'
|
MSG_LANGUAGE_SELECTED = 'lngs',
|
||||||
|
MSG_RATING_ACTIVE_CHANGED = 'rtac'
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Layouts the scrollbar so it looks nice with no border and the document
|
//! Layouts the scrollbar so it looks nice with no border and the document
|
||||||
@@ -237,6 +239,13 @@ RatePackageWindow::RatePackageWindow(BWindow* parent, BRect frame,
|
|||||||
if (defaultItem != NULL)
|
if (defaultItem != NULL)
|
||||||
defaultItem->SetMarked(true);
|
defaultItem->SetMarked(true);
|
||||||
|
|
||||||
|
fRatingActiveCheckBox = new BCheckBox("rating active",
|
||||||
|
B_TRANSLATE("Other users can see this rating"),
|
||||||
|
new BMessage(MSG_RATING_ACTIVE_CHANGED));
|
||||||
|
// Hide the check mark by default, it will be made visible when
|
||||||
|
// the user already made a rating and it is loaded
|
||||||
|
fRatingActiveCheckBox->Hide();
|
||||||
|
|
||||||
// Construct buttons
|
// Construct buttons
|
||||||
fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
|
fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
|
||||||
new BMessage(B_QUIT_REQUESTED));
|
new BMessage(B_QUIT_REQUESTED));
|
||||||
@@ -254,11 +263,12 @@ RatePackageWindow::RatePackageWindow(BWindow* parent, BRect frame,
|
|||||||
.End()
|
.End()
|
||||||
.Add(textScrollView)
|
.Add(textScrollView)
|
||||||
.AddGroup(B_HORIZONTAL)
|
.AddGroup(B_HORIZONTAL)
|
||||||
|
.Add(fRatingActiveCheckBox)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(fCancelButton)
|
.Add(fCancelButton)
|
||||||
.Add(fSendButton)
|
.Add(fSendButton)
|
||||||
.End()
|
.End()
|
||||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
.SetInsets(B_USE_WINDOW_INSETS)
|
||||||
;
|
;
|
||||||
|
|
||||||
// NOTE: Do not make Send the default button. The user might want
|
// NOTE: Do not make Send the default button. The user might want
|
||||||
@@ -288,6 +298,14 @@ RatePackageWindow::MessageReceived(BMessage* message)
|
|||||||
case MSG_LANGUAGE_SELECTED:
|
case MSG_LANGUAGE_SELECTED:
|
||||||
message->FindString("code", &fCommentLanguage);
|
message->FindString("code", &fCommentLanguage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MSG_RATING_ACTIVE_CHANGED:
|
||||||
|
{
|
||||||
|
int32 value;
|
||||||
|
if (message->FindInt32("be:value", &value) == B_OK)
|
||||||
|
fRatingActive = value == B_CONTROL_ON;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MSG_SEND:
|
case MSG_SEND:
|
||||||
_SendRating();
|
_SendRating();
|
||||||
@@ -435,6 +453,9 @@ RatePackageWindow::_QueryRatingThread()
|
|||||||
fRating = (float)rating;
|
fRating = (float)rating;
|
||||||
fSetRatingView->SetPermanentRating(fRating);
|
fSetRatingView->SetPermanentRating(fRating);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fRatingActiveCheckBox->SetValue(fRatingActive);
|
||||||
|
fRatingActiveCheckBox->Show();
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class BButton;
|
class BButton;
|
||||||
|
class BCheckBox;
|
||||||
class BMenuField;
|
class BMenuField;
|
||||||
class SetRatingView;
|
class SetRatingView;
|
||||||
class TextDocumentView;
|
class TextDocumentView;
|
||||||
@@ -53,6 +54,7 @@ private:
|
|||||||
BMenuField* fStabilityField;
|
BMenuField* fStabilityField;
|
||||||
BMenuField* fCommentLanguageField;
|
BMenuField* fCommentLanguageField;
|
||||||
TextDocumentView* fTextView;
|
TextDocumentView* fTextView;
|
||||||
|
BCheckBox* fRatingActiveCheckBox;
|
||||||
BButton* fCancelButton;
|
BButton* fCancelButton;
|
||||||
BButton* fSendButton;
|
BButton* fSendButton;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user