Merge branch 'PAL_v2_Zach_new' of https://github.com/zfox23/hifi

This commit is contained in:
David Kelly 2017-04-03 10:55:55 -07:00
commit 2f1b6be24d
2 changed files with 46 additions and 24 deletions

View file

@ -19,6 +19,7 @@ Item {
property var optionBodyText; property var optionBodyText;
property var optionValues; property var optionValues;
property var selectedOptionIndex; property var selectedOptionIndex;
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;
@ -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,14 +148,6 @@ 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) {

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;
@ -961,29 +967,42 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter; horizontalAlignment: Text.AlignHCenter;
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: parent.top;
anchors.horizontalCenter: parent.horizontalCenter; anchors.horizontalCenter: parent.horizontalCenter;
// Size // Size
width: parent.width; width: parent.width;
height: 40; height: 40;
RalewayRegular {
text: myData.userName === "Unknown user" ? "Login to Set" : availabilityStrings[GlobalServices.findableBy];
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.", "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.",
"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.", "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.",
"You will not be visible in the 'People' list of any other users."], "You will not be visible in the 'People' 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 { /*HifiControlsUit.ComboBox {
function determineAvailabilityIndex() { function determineAvailabilityIndex() {
return ['all', 'connections', 'friends', 'none'].indexOf(GlobalServices.findableBy) return ['all', 'connections', 'friends', 'none'].indexOf(GlobalServices.findableBy)
} }
@ -1007,7 +1026,7 @@ Rectangle {
UserActivityLogger.palAction("set_availability", availabilityComboBoxListItems.get(currentIndex).value); UserActivityLogger.palAction("set_availability", availabilityComboBoxListItems.get(currentIndex).value);
print('Setting availability:', JSON.stringify(GlobalServices.findableBy)); print('Setting availability:', JSON.stringify(GlobalServices.findableBy));
} }
} }*/
} }
} }