Merge pull request #10108 from davidkelly/dk/PalImprovementsMostlyZach

Dk/pal improvements mostly zach
This commit is contained in:
Howard Stearns 2017-04-04 10:03:10 -07:00 committed by GitHub
commit b0fa784267
4 changed files with 75 additions and 68 deletions

View file

@ -19,12 +19,11 @@ Original.CheckBox {
property int colorScheme: hifi.colorSchemes.light property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
property bool isRedCheck: false
property int boxSize: 14 property int boxSize: 14
readonly property int boxRadius: 3 readonly property int boxRadius: 3
readonly property int checkSize: Math.max(boxSize - 8, 10) readonly property int checkSize: Math.max(boxSize - 8, 10)
readonly property int checkRadius: 2 readonly property int checkRadius: 2
activeFocusOnPress: true activeFocusOnPress: true
style: CheckBoxStyle { style: CheckBoxStyle {
@ -37,6 +36,7 @@ Original.CheckBox {
border.color: pressed || hovered border.color: pressed || hovered
? hifi.colors.checkboxCheckedBorder ? hifi.colors.checkboxCheckedBorder
: (checkBox.isLightColorScheme ? hifi.colors.checkboxLightFinish : hifi.colors.checkboxDarkFinish) : (checkBox.isLightColorScheme ? hifi.colors.checkboxLightFinish : hifi.colors.checkboxDarkFinish)
gradient: Gradient { gradient: Gradient {
GradientStop { GradientStop {
position: 0.2 position: 0.2
@ -68,9 +68,9 @@ Original.CheckBox {
height: checkSize height: checkSize
radius: checkRadius radius: checkRadius
anchors.centerIn: parent anchors.centerIn: parent
color: hifi.colors.checkboxChecked color: isRedCheck ? hifi.colors.checkboxCheckedRed : hifi.colors.checkboxChecked
border.width: 2 border.width: 2
border.color: hifi.colors.checkboxCheckedBorder border.color: isRedCheck? hifi.colors.checkboxCheckedBorderRed : hifi.colors.checkboxCheckedBorder
visible: checked && !pressed || !checked && pressed visible: checked && !pressed || !checked && pressed
} }

View file

@ -14,11 +14,12 @@ import QtQuick.Controls 1.4
import "../styles-uit" import "../styles-uit"
Item { Item {
property var dialogTitleText; property var dialogTitleText : "";
property var optionTitleText; property var optionTitleText: "";
property var optionBodyText; property var optionBodyText: "";
property var optionValues; property var optionValues: [];
property var selectedOptionIndex; property var selectedOptionIndex: 0;
property var callbackFunction;
property int dialogWidth; property int dialogWidth;
property int dialogHeight; property int dialogHeight;
property int comboOptionTextSize: 18; property int comboOptionTextSize: 18;
@ -31,6 +32,14 @@ Item {
populateComboListViewModel(); populateComboListViewModel();
} }
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
combo.visible = false;
}
}
Rectangle { Rectangle {
id: dialogBackground; id: dialogBackground;
anchors.fill: parent; anchors.fill: parent;
@ -42,12 +51,12 @@ Item {
id: dialogContainer; id: dialogContainer;
color: "white"; color: "white";
anchors.centerIn: dialogBackground; anchors.centerIn: dialogBackground;
width: dialogWidth; width: combo.dialogWidth;
height: dialogHeight; height: combo.dialogHeight;
RalewayRegular { RalewayRegular {
id: dialogTitle; id: dialogTitle;
text: dialogTitleText; text: combo.dialogTitleText;
anchors.top: parent.top; anchors.top: parent.top;
anchors.topMargin: 20; anchors.topMargin: 20;
anchors.left: parent.left; anchors.left: parent.left;
@ -69,6 +78,7 @@ Item {
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
anchors.left: parent.left; anchors.left: parent.left;
anchors.right: parent.right; anchors.right: parent.right;
clip: true;
model: comboListViewModel; model: comboListViewModel;
delegate: comboListViewDelegate; delegate: comboListViewDelegate;
@ -77,7 +87,7 @@ Item {
Rectangle { Rectangle {
id: comboListViewItemContainer; id: comboListViewItemContainer;
// Size // Size
height: childrenRect.height + 10; height: optionTitle.height + optionBody.height + 20;
width: dialogContainer.width; width: dialogContainer.width;
color: selectedOptionIndex === index ? '#cee6ff' : 'white'; color: selectedOptionIndex === index ? '#cee6ff' : 'white';
Rectangle { Rectangle {
@ -100,9 +110,11 @@ Item {
id: optionTitle; id: optionTitle;
text: titleText; text: titleText;
anchors.top: parent.top; anchors.top: parent.top;
anchors.topMargin: 7;
anchors.left: comboOptionSelected.right; anchors.left: comboOptionSelected.right;
anchors.leftMargin: 20; anchors.leftMargin: 10;
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: 10;
height: 30; height: 30;
size: comboOptionTextSize; size: comboOptionTextSize;
wrapMode: Text.WordWrap; wrapMode: Text.WordWrap;
@ -112,10 +124,10 @@ Item {
id: optionBody; id: optionBody;
text: bodyText; text: bodyText;
anchors.top: optionTitle.bottom; anchors.top: optionTitle.bottom;
anchors.bottom: parent.bottom;
anchors.left: comboOptionSelected.right; anchors.left: comboOptionSelected.right;
anchors.leftMargin: 25; anchors.leftMargin: 25;
anchors.right: parent.right; anchors.right: parent.right;
anchors.rightMargin: 10;
size: comboOptionTextSize; size: comboOptionTextSize;
wrapMode: Text.WordWrap; wrapMode: Text.WordWrap;
} }
@ -127,9 +139,8 @@ Item {
onEntered: comboListViewItemContainer.color = hifi.colors.blueHighlight onEntered: comboListViewItemContainer.color = hifi.colors.blueHighlight
onExited: comboListViewItemContainer.color = selectedOptionIndex === index ? '#cee6ff' : 'white'; onExited: comboListViewItemContainer.color = selectedOptionIndex === index ? '#cee6ff' : 'white';
onClicked: { onClicked: {
GlobalServices.findableBy = optionValue; callbackFunction(optionValue);
UserActivityLogger.palAction("set_availability", optionValue); combo.visible = false;
print('Setting availability:', optionValue);
} }
} }
} }
@ -137,18 +148,10 @@ Item {
} }
} }
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
combo.visible = false;
}
}
function populateComboListViewModel() { function populateComboListViewModel() {
comboListViewModel.clear(); comboListViewModel.clear();
optionTitleText.forEach(function(titleText, index) { optionTitleText.forEach(function(titleText, index) {
comboListViewModel.insert(index, {"titleText": titleText, "bodyText": optionBodyText[index], "optionValue": optionValues[index]}); comboListViewModel.insert(index, {"titleText": titleText, "bodyText": optionBodyText[index], "optionValue": optionValues[index]});
}); });
} }
} }

View file

@ -56,7 +56,7 @@ Rectangle {
ComboDialog { ComboDialog {
id: comboDialog; id: comboDialog;
z: 999; // Force the ComboDialog on top of everything else z: 999; // Force the ComboDialog on top of everything else
dialogWidth: parent.width - 100; dialogWidth: parent.width - 50;
dialogHeight: parent.height - 100; dialogHeight: parent.height - 100;
} }
function letterbox(headerGlyph, headerText, message) { function letterbox(headerGlyph, headerText, message) {
@ -66,7 +66,13 @@ Rectangle {
letterboxMessage.visible = true; letterboxMessage.visible = true;
letterboxMessage.popupRadius = 0; letterboxMessage.popupRadius = 0;
} }
function popupComboDialogCallback(availability) {
GlobalServices.findableBy = availability;
UserActivityLogger.palAction("set_availability", availability);
print('Setting availability:', JSON.stringify(GlobalServices.findableBy));
}
function popupComboDialog(dialogTitleText, optionTitleText, optionBodyText, optionValues) { function popupComboDialog(dialogTitleText, optionTitleText, optionBodyText, optionValues) {
comboDialog.callbackFunction = popupComboDialogCallback;
comboDialog.dialogTitleText = dialogTitleText; comboDialog.dialogTitleText = dialogTitleText;
comboDialog.optionTitleText = optionTitleText; comboDialog.optionTitleText = optionTitleText;
comboDialog.optionBodyText = optionBodyText; comboDialog.optionBodyText = optionBodyText;
@ -506,6 +512,7 @@ Rectangle {
// If this is an "Ignore" checkbox, disable the checkbox if user isn't present. // If this is an "Ignore" checkbox, disable the checkbox if user isn't present.
enabled: styleData.role === "ignore" ? (model ? model["isPresent"] : true) : true; enabled: styleData.role === "ignore" ? (model ? model["isPresent"] : true) : true;
boxSize: 24; boxSize: 24;
isRedCheck: true
onClicked: { onClicked: {
var newValue = !model[styleData.role]; var newValue = !model[styleData.role];
nearbyUserModel.setProperty(model.userIndex, styleData.role, newValue); nearbyUserModel.setProperty(model.userIndex, styleData.role, newValue);
@ -605,7 +612,7 @@ Rectangle {
"Bold names in the list are <b>avatar display names</b>.<br>" + "Bold names in the list are <b>avatar display names</b>.<br>" +
"<font color='purple'>Purple borders around profile pictures are <b>connections</b></font>.<br>" + "<font color='purple'>Purple borders around profile pictures are <b>connections</b></font>.<br>" +
"<font color='green'>Green borders around profile pictures are <b>friends</b>.</font><br>" + "<font color='green'>Green borders around profile pictures are <b>friends</b>.</font><br>" +
"(TEMPORARY LANGUAGE) In some situations, you can also see others' usernames.<br>" + "Others can find you and see your username according to your <b>availability</b> settings.<br>" +
"If you can see someone's username, you can GoTo them by selecting them in the PAL, then clicking their name.<br>" + "If you can see someone's username, you can GoTo them by selecting them in the PAL, then clicking their name.<br>" +
"<br>If someone's display name isn't set, a unique <b>session display name</b> is assigned to them.<br>" + "<br>If someone's display name isn't set, a unique <b>session display name</b> is assigned to them.<br>" +
"<br>Administrators of this domain can also see the <b>username</b> or <b>machine ID</b> associated with each avatar present."); "<br>Administrators of this domain can also see the <b>username</b> or <b>machine ID</b> associated with each avatar present.");
@ -942,7 +949,7 @@ Rectangle {
} }
Item { Item {
id: upperRightInfoContainer; id: upperRightInfoContainer;
width: 160; width: 200;
height: parent.height; height: parent.height;
anchors.top: parent.top; anchors.top: parent.top;
anchors.right: parent.right; anchors.right: parent.right;
@ -953,59 +960,53 @@ Rectangle {
// Text size // Text size
size: hifi.fontSizes.tabularData; size: hifi.fontSizes.tabularData;
// Anchors // Anchors
anchors.top: availabilityComboBox.bottom; anchors.top: myCard.top;
anchors.horizontalCenter: parent.horizontalCenter; anchors.left: parent.left;
// Style // Style
color: hifi.colors.baseGrayHighlight; color: hifi.colors.baseGrayHighlight;
// Alignment // Alignment
horizontalAlignment: Text.AlignHCenter; horizontalAlignment: Text.AlignLeft;
verticalAlignment: Text.AlignTop; verticalAlignment: Text.AlignTop;
} }
/*Rectangle { Rectangle {
property var availabilityStrings: ["Everyone", "Friends and Connections", "Friends Only", "Appear Offline"];
id: availabilityComboBox; id: availabilityComboBox;
color: hifi.colors.textFieldLightBackground
// Anchors // Anchors
anchors.top: parent.top; anchors.top: availabilityText.bottom;
anchors.horizontalCenter: parent.horizontalCenter; anchors.horizontalCenter: parent.horizontalCenter;
// Size // Size
width: parent.width; width: parent.width;
height: 40; height: 40;
function determineAvailabilityIndex() {
return ['all', 'connections', 'friends', 'none'].indexOf(GlobalServices.findableBy);
}
function determineAvailabilityString() {
return availabilityStrings[determineAvailabilityIndex()];
}
RalewayRegular {
text: myData.userName === "Unknown user" ? "Login to Set" : availabilityComboBox.determineAvailabilityString();
anchors.fill: parent;
anchors.leftMargin: 10;
horizontalAlignment: Text.AlignLeft;
size: 16;
}
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent;
enabled: myData.userName !== "Unknown user";
hoverEnabled: true;
onClicked: { onClicked: {
popupComboDialog("Set your list visibility", popupComboDialog("Set your availability:",
["Everyone", "Friends and Connections", "Friends Only", "Appear Offline"], availabilityComboBox.availabilityStrings,
["You will be invisible in everyone's 'People' list.\nAnyone will be able to jump to your location if the domain allows.", ["Your username will be visible in everyone's 'Nearby' list.\nAnyone will be able to jump to your location from within the 'Nearby' list.",
"You will be visible in the 'People' list only for those with whom you are connected or friends.\nThey will be able to jump to your location if the domain allows.", "Your location will be visible in the 'Connections' list only for those with whom you are connected or friends.\nThey will be able to jump to your location if the domain allows.",
"You will be visible in the 'People' list only for those with whom you are friends.\nThey will be able to jump to your location if the domain allows.", "Your location will be visible in the 'Connections' list only for those with whom you are friends.\nThey will be able to jump to your location if the domain allows.",
"You will not be visible in the 'People' list of any other users."], "Your location will not be visible in the 'Connections' list of any other users. Only domain admins will be able to see your username in the 'Nearby' list."],
["all", "connections", "friends", "none"]); ["all", "connections", "friends", "none"]);
} }
} onEntered: availabilityComboBox.color = hifi.colors.lightGrayText;
}*/ onExited: availabilityComboBox.color = hifi.colors.textFieldLightBackground;
HifiControlsUit.ComboBox {
function determineAvailabilityIndex() {
return ['all', 'connections', 'friends', 'none'].indexOf(GlobalServices.findableBy)
}
id: availabilityComboBox;
// Anchors
anchors.top: parent.top;
anchors.horizontalCenter: parent.horizontalCenter;
// Size
width: parent.width;
height: 40;
currentIndex: determineAvailabilityIndex();
model: ListModel {
id: availabilityComboBoxListItems
ListElement { text: "Everyone"; value: "all"; }
ListElement { text: "All Connections"; value: "connections"; }
ListElement { text: "Friends Only"; value: "friends"; }
ListElement { text: "Appear Offline"; value: "none" }
}
onCurrentIndexChanged: {
GlobalServices.findableBy = availabilityComboBoxListItems.get(currentIndex).value;
UserActivityLogger.palAction("set_availability", availabilityComboBoxListItems.get(currentIndex).value);
print('Setting availability:', JSON.stringify(GlobalServices.findableBy));
} }
} }
} }

View file

@ -70,6 +70,9 @@ Item {
readonly property color indigoAccent: "#9495FF" readonly property color indigoAccent: "#9495FF"
readonly property color magentaHighlight: "#EF93D1" readonly property color magentaHighlight: "#EF93D1"
readonly property color magentaAccent: "#A2277C" readonly property color magentaAccent: "#A2277C"
readonly property color checkboxCheckedRed: "#FF0000"
readonly property color checkboxCheckedBorderRed: "#D00000"
// Semitransparent // Semitransparent
readonly property color darkGray30: "#4d121212" readonly property color darkGray30: "#4d121212"
readonly property color darkGray0: "#00121212" readonly property color darkGray0: "#00121212"