From d04b1da1c2fe8a6aaff42512e0a8c424d0526786 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 13 Mar 2017 12:54:01 -0700 Subject: [PATCH 1/5] Merging from PAL_v2_Zach --- interface/resources/qml/hifi/NameCard.qml | 6 +- interface/resources/qml/hifi/Pal.qml | 137 ++++++++++++++++++++-- 2 files changed, 132 insertions(+), 11 deletions(-) diff --git a/interface/resources/qml/hifi/NameCard.qml b/interface/resources/qml/hifi/NameCard.qml index fcde5817fc..aa908c0039 100644 --- a/interface/resources/qml/hifi/NameCard.qml +++ b/interface/resources/qml/hifi/NameCard.qml @@ -91,10 +91,8 @@ Item { enabled: selected || isMyCard; hoverEnabled: enabled onClicked: { - /* - THIS WILL OPEN THE BROWSER TO THE USER'S INFO PAGE! - I've no idea how to do this yet.. - */ + userInfoViewer.url = "http://highfidelity.com/users/" + (pal.activeTab == "nearbyTab" ? userName : displayName); // Connections tab puts username in "displayname" field + userInfoViewer.visible = true; } } } diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 5fb11b4e2f..8bd6824246 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -934,15 +934,138 @@ Rectangle { } } // Keyboard - /* - THIS WILL BE THE BROWSER THAT OPENS THE USER'S INFO PAGE! - I've no idea how to do this yet.. + Item { + id: webViewContainer; + anchors.fill: parent; - HifiTablet.TabletAddressDialog { - id: userInfoViewer; - visible: false; + Rectangle { + id: navigationContainer; + visible: userInfoViewer.visible; + height: 75; + anchors { + top: parent.top; + left: parent.left; + right: parent.right; + } + color: hifi.colors.faintGray; + + Item { + id: backButton + anchors { + top: parent.top; + left: parent.left; + } + height: parent.height - urlBar.height; + width: parent.width/2; + + FiraSansSemiBold { + // Properties + text: "BACK"; + elide: Text.ElideRight; + // Anchors + anchors.fill: parent; + // Text Size + size: 16; + // Text Positioning + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter; + // Style + color: backButtonMouseArea.containsMouse || !userInfoViewer.canGoBack ? hifi.colors.lightGray : hifi.colors.darkGray; + MouseArea { + id: backButtonMouseArea; + anchors.fill: parent + hoverEnabled: enabled + onClicked: userInfoViewer.goBack(); + } + } + } + + Item { + id: closeButton + anchors { + top: parent.top; + right: parent.right; + } + height: parent.height - urlBar.height; + width: parent.width/2; + + FiraSansSemiBold { + // Properties + text: "CLOSE"; + elide: Text.ElideRight; + // Anchors + anchors.fill: parent; + // Text Size + size: 16; + // Text Positioning + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter; + // Style + color: closeButtonMouseArea.containsMouse ? hifi.colors.lightGray : hifi.colors.darkGray; + MouseArea { + id: closeButtonMouseArea; + anchors.fill: parent + hoverEnabled: enabled + onClicked: userInfoViewer.visible = false; + } + } + } + + Item { + id: urlBar + anchors { + top: closeButton.bottom; + left: parent.left; + right: parent.right; + } + height: 25; + width: parent.width; + + FiraSansRegular { + // Properties + text: userInfoViewer.url; + elide: Text.ElideRight; + // Anchors + anchors.fill: parent; + // Text Size + size: 14; + // Text Positioning + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter; + // Style + color: hifi.colors.lightGray; + MouseArea { + anchors.fill: parent + onClicked: userInfoViewer.visible = false; + } + } + } + } + + Rectangle { + id: webViewBackground; + color: "white"; + visible: userInfoViewer.visible; + anchors { + top: navigationContainer.bottom; + bottom: parent.bottom; + left: parent.left; + right: parent.right; + } + } + + HifiControls.WebView { + id: userInfoViewer; + anchors { + top: navigationContainer.bottom; + topMargin: 5; + bottom: parent.bottom; + left: parent.left; + right: parent.right; + } + visible: false; + } } - */ } // PAL container From 515e6fd34eb1e1487d44de1954cf0fcc9e0f279f Mon Sep 17 00:00:00 2001 From: David Kelly Date: Mon, 13 Mar 2017 13:10:05 -0700 Subject: [PATCH 2/5] map Controller.Standard.RB so xbox controller works. whee. --- scripts/system/makeUserConnection.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/system/makeUserConnection.js b/scripts/system/makeUserConnection.js index 50243aa7e4..1b49ed92cb 100644 --- a/scripts/system/makeUserConnection.js +++ b/scripts/system/makeUserConnection.js @@ -354,11 +354,18 @@ Messages.subscribe(MESSAGE_CHANNEL); Messages.messageReceived.connect(messageHandler); -function makeGripHandler(hand) { +function makeGripHandler(hand, animate) { // determine if we are gripping or un-gripping - return function (value) { - updateTriggers(value, false, hand); - }; + if (animate) { + return function(value) { + updateTriggers(value, true, hand); + }; + + } else { + return function (value) { + updateTriggers(value, false, hand); + }; + } } function keyPressEvent(event) { @@ -377,10 +384,12 @@ friendsMapping.from(Controller.Standard.LeftGrip).peek().to(makeGripHandler(Cont friendsMapping.from(Controller.Standard.RightGrip).peek().to(makeGripHandler(Controller.Standard.RightHand)); // setup keyboard initiation - Controller.keyPressEvent.connect(keyPressEvent); Controller.keyReleaseEvent.connect(keyReleaseEvent); +// xbox controller cuz that's important +friendsMapping.from(Controller.Standard.RB).peek().to(makeGripHandler(Controller.Standard.RightHand, true)); + // it is easy to forget this and waste a lot of time for nothing friendsMapping.enable(); From e3d0842ddcc8a9b4dc0d740016909ea2c5fe3f2e Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 13 Mar 2017 18:39:47 -0700 Subject: [PATCH 3/5] Implement browser in PAL --- interface/resources/qml/hifi/NameCard.qml | 21 ++++++++++----------- interface/resources/qml/hifi/Pal.qml | 6 +++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/interface/resources/qml/hifi/NameCard.qml b/interface/resources/qml/hifi/NameCard.qml index aa908c0039..88ecededd1 100644 --- a/interface/resources/qml/hifi/NameCard.qml +++ b/interface/resources/qml/hifi/NameCard.qml @@ -91,7 +91,7 @@ Item { enabled: selected || isMyCard; hoverEnabled: enabled onClicked: { - userInfoViewer.url = "http://highfidelity.com/users/" + (pal.activeTab == "nearbyTab" ? userName : displayName); // Connections tab puts username in "displayname" field + userInfoViewer.url = "http://highfidelity.com/users/" + userName; userInfoViewer.visible = true; } } @@ -202,13 +202,12 @@ Item { // DisplayName container for others' cards Item { id: displayNameContainer - visible: !isMyCard + visible: !isMyCard && pal.activeTab !== "connectionsTab" // Size width: parent.width - anchors.leftMargin - avatarImage.width - anchors.leftMargin; height: displayNameTextPixelSize + 4 // Anchors - anchors.top: pal.activeTab == "connectionsTab" ? undefined : avatarImage.top; - anchors.bottom: pal.activeTab == "connectionsTab" ? avatarImage.bottom : undefined; + anchors.top: avatarImage.top; anchors.left: avatarImage.right anchors.leftMargin: avatarImage.visible ? 5 : 0; // DisplayName Text for others' cards @@ -227,8 +226,7 @@ Item { // Text Positioning verticalAlignment: Text.AlignTop // Style - color: (pal.activeTab == "nearbyTab" && (displayNameTextMouseArea.containsMouse || userNameTextMouseArea.containsMouse)) - ? hifi.colors.blueHighlight : (pal.activeTab == "nearbyTab" ? hifi.colors.darkGray : hifi.colors.greenShadow); + color: (displayNameTextMouseArea.containsMouse || userNameTextMouseArea.containsMouse) ? hifi.colors.blueHighlight : hifi.colors.darkGray; MouseArea { id: displayNameTextMouseArea; anchors.fill: parent @@ -297,21 +295,22 @@ Item { // Properties text: thisNameCard.userName elide: Text.ElideRight - visible: thisNameCard.displayName + visible: thisNameCard.userName !== ""; // Size width: parent.width - height: usernameTextPixelSize + 4 + height: pal.activeTab == "nearbyTab" || isMyCard ? usernameTextPixelSize + 4 : displayNameTextPixelSize + 4 // Anchors anchors.top: isMyCard ? myDisplayName.bottom : undefined; - anchors.bottom: isMyCard ? undefined : avatarImage.bottom + anchors.bottom: !isMyCard ? avatarImage.bottom : undefined; anchors.left: avatarImage.right; anchors.leftMargin: avatarImage.visible ? 5 : 0; // Text Size - size: usernameTextPixelSize; + size: pal.activeTab == "nearbyTab" || isMyCard ? usernameTextPixelSize : displayNameTextPixelSize; // Text Positioning verticalAlignment: Text.AlignBottom // Style - color: (pal.activeTab == "nearbyTab" && (displayNameTextMouseArea.containsMouse || userNameTextMouseArea.containsMouse)) ? hifi.colors.blueHighlight : hifi.colors.greenShadow; + color: (pal.activeTab == "nearbyTab" && (displayNameTextMouseArea.containsMouse || userNameTextMouseArea.containsMouse)) + ? hifi.colors.blueHighlight : hifi.colors.greenShadow; MouseArea { id: userNameTextMouseArea; anchors.fill: parent diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 8bd6824246..43e874dc57 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -860,8 +860,8 @@ Rectangle { visible: styleData.role === "userName"; profileUrl: (model && model.profileUrl) || ""; imageMaskColor: rowColor(styleData.selected, styleData.row % 2); - displayName: model ? model.userName : ""; - userName: ""; + displayName: ""; + userName: model ? model.userName : ""; connectionStatus : model ? model.connection : ""; selected: styleData.selected; // Size @@ -1001,7 +1001,7 @@ Rectangle { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter; // Style - color: closeButtonMouseArea.containsMouse ? hifi.colors.lightGray : hifi.colors.darkGray; + color: closeButtonMouseArea.containsMouse ? hifi.colors.redAccent : hifi.colors.redHighlight; MouseArea { id: closeButtonMouseArea; anchors.fill: parent From 5da0dfc4acc3b387250a7b5be41ad6d3d29d5428 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 14 Mar 2017 14:05:50 -0700 Subject: [PATCH 4/5] Merging from Pal_v2_Zach --- interface/resources/qml/hifi/NameCard.qml | 8 ++++---- interface/resources/qml/hifi/Pal.qml | 5 +++-- scripts/system/pal.js | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/interface/resources/qml/hifi/NameCard.qml b/interface/resources/qml/hifi/NameCard.qml index 88ecededd1..f547975533 100644 --- a/interface/resources/qml/hifi/NameCard.qml +++ b/interface/resources/qml/hifi/NameCard.qml @@ -91,7 +91,7 @@ Item { enabled: selected || isMyCard; hoverEnabled: enabled onClicked: { - userInfoViewer.url = "http://highfidelity.com/users/" + userName; + userInfoViewer.url = defaultBaseUrl + "/users/" + userName; userInfoViewer.visible = true; } } @@ -116,12 +116,12 @@ Item { id: myDisplayName visible: isMyCard // Size - width: parent.width - avatarImage.width - anchors.leftMargin*2 - anchors.rightMargin; + width: parent.width - avatarImage.width - anchors.leftMargin - anchors.rightMargin*2; height: 40 // Anchors anchors.top: avatarImage.top anchors.left: avatarImage.right - anchors.leftMargin: 5; + anchors.leftMargin: avatarImage.visible ? 5 : 0; anchors.rightMargin: 5; // Style color: myDisplayNameMouseArea.containsMouse ? hifi.colors.lightGrayText : hifi.colors.textFieldLightBackground @@ -293,7 +293,7 @@ Item { FiraSansRegular { id: userNameText // Properties - text: thisNameCard.userName + text: thisNameCard.userName === "Unknown user" ? "not logged in" : thisNameCard.userName; elide: Text.ElideRight visible: thisNameCard.userName !== ""; // Size diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 43e874dc57..762a0a14c7 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -941,7 +941,7 @@ Rectangle { Rectangle { id: navigationContainer; visible: userInfoViewer.visible; - height: 75; + height: 70; anchors { top: parent.top; left: parent.left; @@ -1018,7 +1018,7 @@ Rectangle { left: parent.left; right: parent.right; } - height: 25; + height: 30; width: parent.width; FiraSansRegular { @@ -1125,6 +1125,7 @@ Rectangle { break; case 'connections': var data = message.params; + console.log('Got connection data: ', JSON.stringify(data)); connectionsUserModelData = data; sortConnectionsModel(); connectionsLoading.visible = false; diff --git a/scripts/system/pal.js b/scripts/system/pal.js index ff0fb80c4d..ec0d19962c 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -261,6 +261,7 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See UserActivityLogger.palAction("refresh_nearby", ""); break; case 'refreshConnections': + print('Refreshing Connections...'); getConnectionData(); UserActivityLogger.palAction("refresh_connections", ""); break; From 0a6bcd7fca5ecba8fd1256250a6fcd74606f6332 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 14 Mar 2017 16:22:16 -0700 Subject: [PATCH 5/5] Massive performance boost --- interface/resources/qml/hifi/NameCard.qml | 33 ++++++++++++++++------- interface/resources/qml/hifi/Pal.qml | 32 +++++++++++++--------- 2 files changed, 43 insertions(+), 22 deletions(-) diff --git a/interface/resources/qml/hifi/NameCard.qml b/interface/resources/qml/hifi/NameCard.qml index f547975533..2b44a72fe3 100644 --- a/interface/resources/qml/hifi/NameCard.qml +++ b/interface/resources/qml/hifi/NameCard.qml @@ -79,14 +79,13 @@ Item { } StateImage { id: infoHoverImage; - visible: avatarImageMouseArea.containsMouse ? true : false; + visible: false; imageURL: "../../images/info-icon-2-state.svg"; size: 32; buttonState: 1; anchors.centerIn: parent; } MouseArea { - id: avatarImageMouseArea; anchors.fill: parent enabled: selected || isMyCard; hoverEnabled: enabled @@ -94,6 +93,8 @@ Item { userInfoViewer.url = defaultBaseUrl + "/users/" + userName; userInfoViewer.visible = true; } + onEntered: infoHoverImage.visible = true; + onExited: infoHoverImage.visible = false; } } @@ -124,7 +125,7 @@ Item { anchors.leftMargin: avatarImage.visible ? 5 : 0; anchors.rightMargin: 5; // Style - color: myDisplayNameMouseArea.containsMouse ? hifi.colors.lightGrayText : hifi.colors.textFieldLightBackground + color: hifi.colors.textFieldLightBackground border.color: hifi.colors.blueHighlight border.width: 0 TextInput { @@ -165,7 +166,6 @@ Item { } } MouseArea { - id: myDisplayNameMouseArea; anchors.fill: parent hoverEnabled: true onClicked: { @@ -182,6 +182,8 @@ Item { pal.currentlyEditingDisplayName = true myDisplayNameText.autoScroll = true; } + onEntered: myDisplayName.color = hifi.colors.lightGrayText; + onExited: myDisplayName.color = hifi.colors.textFieldLightBackground; } // Edit pencil glyph HiFiGlyphs { @@ -226,13 +228,20 @@ Item { // Text Positioning verticalAlignment: Text.AlignTop // Style - color: (displayNameTextMouseArea.containsMouse || userNameTextMouseArea.containsMouse) ? hifi.colors.blueHighlight : hifi.colors.darkGray; + color: hifi.colors.darkGray; MouseArea { - id: displayNameTextMouseArea; anchors.fill: parent enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== ""; hoverEnabled: enabled onClicked: pal.sendToScript({method: 'goToUser', params: thisNameCard.userName}); + onEntered: { + displayNameText.color = hifi.colors.blueHighlight; + userNameText.color = hifi.colors.blueHighlight; + } + onExited: { + displayNameText.color = hifi.colors.darkGray + userNameText.color = hifi.colors.greenShadow; + } } } TextMetrics { @@ -309,14 +318,20 @@ Item { // Text Positioning verticalAlignment: Text.AlignBottom // Style - color: (pal.activeTab == "nearbyTab" && (displayNameTextMouseArea.containsMouse || userNameTextMouseArea.containsMouse)) - ? hifi.colors.blueHighlight : hifi.colors.greenShadow; + color: hifi.colors.greenShadow; MouseArea { - id: userNameTextMouseArea; anchors.fill: parent enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== ""; hoverEnabled: enabled onClicked: pal.sendToScript({method: 'goToUser', params: thisNameCard.userName}); + onEntered: { + displayNameText.color = hifi.colors.blueHighlight; + userNameText.color = hifi.colors.blueHighlight; + } + onExited: { + displayNameText.color = hifi.colors.darkGray; + userNameText.color = hifi.colors.greenShadow; + } } } // VU Meter diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 762a0a14c7..3099087bd4 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -346,13 +346,12 @@ Rectangle { text: "[?]"; size: connectionsTabSelectorText.size + 6; font.capitalization: Font.AllUppercase; - color: connectionsTabSelectorMouseArea.containsMouse ? hifi.colors.redAccent : hifi.colors.redHighlight; + color: hifi.colors.redHighlight; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; anchors.fill: parent; } MouseArea { - id: connectionsTabSelectorMouseArea; anchors.fill: parent; hoverEnabled: true; onClicked: letterbox(hifi.glyphs.question, @@ -361,6 +360,8 @@ Rectangle { "When your availability is set to Everyone, Connections can see your username and location.

" + "Green borders around profile pictures are Friends.
" + "When your availability is set to Friends, only Friends can see your username and location."); + onEntered: connectionsHelpText.color = hifi.colors.redAccent; + onExited: connectionsHelpText.color = hifi.colors.redHighlight; } } } @@ -703,7 +704,6 @@ Rectangle { } // This Rectangle refers to the [?] popup button next to "NAMES" Rectangle { - id: helpText; color: hifi.colors.tableBackgroundLight; width: 20; height: hifi.dimensions.tableHeaderHeight - 2; @@ -712,16 +712,16 @@ Rectangle { anchors.topMargin: 1; anchors.leftMargin: actionButtonWidth + nearbyNameCardWidth/2 + displayNameHeaderMetrics.width/2 + 6; RalewayRegular { + id: helpText; text: "[?]"; size: hifi.fontSizes.tableHeading + 2; font.capitalization: Font.AllUppercase; - color: helpTextMouseArea.containsMouse ? hifi.colors.baseGrayHighlight : hifi.colors.darkGray; + color: hifi.colors.darkGray; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; anchors.fill: parent; } MouseArea { - id: helpTextMouseArea; anchors.fill: parent; hoverEnabled: true; onClicked: letterbox(hifi.glyphs.question, @@ -733,6 +733,8 @@ Rectangle { "If you can see someone's username, you can GoTo them by selecting them in the PAL, then clicking their name.
" + "
If someone's display name isn't set, a unique session display name is assigned to them.
" + "
Administrators of this domain can also see the username or machine ID associated with each avatar present."); + onEntered: helpText.color = hifi.colors.baseGrayHighlight; + onExited: helpText.color = hifi.colors.darkGray; } } // This Rectangle refers to the [?] popup button next to "ADMIN" @@ -750,19 +752,20 @@ Rectangle { text: "[?]"; size: hifi.fontSizes.tableHeading + 2; font.capitalization: Font.AllUppercase; - color: adminHelpTextMouseArea.containsMouse ? "#94132e" : hifi.colors.redHighlight; + color: hifi.colors.redHighlight; horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter; anchors.fill: parent; } MouseArea { - id: adminHelpTextMouseArea; anchors.fill: parent; hoverEnabled: true; onClicked: letterbox(hifi.glyphs.question, "Admin Actions", "Silence mutes a user's microphone. Silenced users can unmute themselves by clicking "UNMUTE" on their toolbar.

" + "Ban removes a user from this domain and prevents them from returning. Admins can un-ban users from the Sandbox Domain Settings page."); + onEntered: adminHelpText.color = "#94132e"; + onExited: adminHelpText.color = hifi.colors.redHighlight; } } } // "Nearby" Tab @@ -887,13 +890,14 @@ Rectangle { // Text Positioning verticalAlignment: Text.AlignVCenter // Style - color: connectionsLocationDataMouseArea.containsMouse ? hifi.colors.blueHighlight : hifi.colors.darkGray; + color: hifi.colors.darkGray; MouseArea { - id: connectionsLocationDataMouseArea; anchors.fill: parent hoverEnabled: enabled enabled: connectionsNameCard.selected && pal.activeTab == "connectionsTab" onClicked: pal.sendToScript({method: 'goToUser', params: model.userName}); + onEntered: connectionsLocationData.color = hifi.colors.blueHighlight; + onExited: connectionsLocationData.color = hifi.colors.darkGray; } } @@ -981,7 +985,7 @@ Rectangle { } Item { - id: closeButton + id: closeButtonContainer anchors { top: parent.top; right: parent.right; @@ -990,6 +994,7 @@ Rectangle { width: parent.width/2; FiraSansSemiBold { + id: closeButton; // Properties text: "CLOSE"; elide: Text.ElideRight; @@ -1001,12 +1006,13 @@ Rectangle { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter; // Style - color: closeButtonMouseArea.containsMouse ? hifi.colors.redAccent : hifi.colors.redHighlight; + color: hifi.colors.redHighlight; MouseArea { - id: closeButtonMouseArea; anchors.fill: parent hoverEnabled: enabled onClicked: userInfoViewer.visible = false; + onEntered: closeButton.color = hifi.colors.redAccent; + onExited: closeButton.color = hifi.colors.redHighlight; } } } @@ -1014,7 +1020,7 @@ Rectangle { Item { id: urlBar anchors { - top: closeButton.bottom; + top: closeButtonContainer.bottom; left: parent.left; right: parent.right; }