From 5490dddbbf6fdb64fb4c2ca5096b23a195ed3865 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 23 Dec 2016 12:22:33 -0800 Subject: [PATCH] Cool style changes! --- interface/resources/qml/hifi/Pal.qml | 42 +++++++++++++++++++++++++++- scripts/system/pal.js | 10 +++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index af99d9a2e1..69e4b1d3e7 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -47,7 +47,7 @@ Item { id: myInfo // Size width: pal.width - height: myCardHeight + height: myCardHeight + 20 // Anchors anchors.top: pal.top // Properties @@ -215,6 +215,46 @@ Item { } } } + // Refresh button + Rectangle { + // Size + width: hifi.dimensions.tableHeaderHeight-1 + height: hifi.dimensions.tableHeaderHeight-1 + // Anchors + anchors.left: table.left + anchors.leftMargin: 4 + anchors.top: table.top + // Style + color: hifi.colors.tableBackgroundLight + // Actual refresh icon + HiFiGlyphs { + id: reloadButton + text: hifi.glyphs.reloadSmall + // Size + size: parent.width*1.5 + // Anchors + anchors.fill: parent + // Style + horizontalAlignment: Text.AlignHCenter + color: hifi.colors.darkGray + } + MouseArea { + id: reloadButtonArea + // Anchors + anchors.fill: parent + hoverEnabled: true + // Everyone likes a responsive refresh button! + // So use onPressed instead of onClicked + onPressed: { + reloadButton.color = hifi.colors.lightGrayText + pal.sendToScript({method: 'refresh'}) + } + onReleased: reloadButton.color = (containsMouse ? hifi.colors.baseGrayHighlight : hifi.colors.darkGray) + onEntered: reloadButton.color = hifi.colors.baseGrayHighlight + onExited: reloadButton.color = (pressed ? hifi.colors.lightGrayText: hifi.colors.darkGray) + } + } + // Separator between user and admin functions Rectangle { // Size diff --git a/scripts/system/pal.js b/scripts/system/pal.js index 9d419e5a0f..be87069b54 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -94,6 +94,10 @@ pal.fromQml.connect(function (message) { // messages are {method, params}, like overlay.select(selected); }); break; + case 'refresh': + removeOverlays(); + populateUserList(); + break; default: print('Unrecognized message from Pal.qml:', JSON.stringify(message)); } @@ -265,13 +269,13 @@ function onClicked() { // // Button state. // -function onVisibileChanged() { +function onVisibleChanged() { button.writeProperty('buttonState', pal.visible ? 0 : 1); button.writeProperty('defaultState', pal.visible ? 0 : 1); button.writeProperty('hoverState', pal.visible ? 2 : 3); } button.clicked.connect(onClicked); -pal.visibleChanged.connect(onVisibileChanged); +pal.visibleChanged.connect(onVisibleChanged); pal.closed.connect(off); Users.usernameFromIDReply.connect(usernameFromIDReply); @@ -281,7 +285,7 @@ Users.usernameFromIDReply.connect(usernameFromIDReply); Script.scriptEnding.connect(function () { button.clicked.disconnect(onClicked); toolBar.removeButton(buttonName); - pal.visibleChanged.disconnect(onVisibileChanged); + pal.visibleChanged.disconnect(onVisibleChanged); pal.closed.disconnect(off); Users.usernameFromIDReply.disconnect(usernameFromIDReply); off();