From 5046f4c1acad0464da474de69ab128bea1fa5eb4 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Mon, 6 Jul 2015 13:19:42 -0700 Subject: [PATCH 01/18] Update upgrade dialog - Strip out "
"s - Show information for all new versions since current, not just latest - Display scrollbar if content too long to show all at once - "version" / "versions" behind depending on if one or more - Align buttons with heading and text - Darken text so that is more readable --- interface/resources/qml/UpdateDialog.qml | 31 ++++++++++++------------ interface/src/ui/UpdateDialog.cpp | 18 +++++++++++--- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index e5216ff619..5d901002f7 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -1,5 +1,6 @@ import Hifi 1.0 import QtQuick 2.3 +import QtQuick.Controls 1.3 import QtQuick.Controls.Styles 1.3 import QtGraphicalEffects 1.0 import "controls" @@ -85,33 +86,31 @@ DialogContainer { } } - Flickable { + ScrollView { id: scrollArea anchors { top: dialogTitle.bottom + topMargin: updateDialog.closeMargin + left: dialogTitle.left } - contentWidth: updateDialog.inputWidth - contentHeight: backgroundRectangle.height - (dialogTitle.height * 2.5) width: updateDialog.inputWidth - height: backgroundRectangle.height - (dialogTitle.height * 2.5) - flickableDirection: Flickable.VerticalFlick - clip: true - - TextEdit { + height: backgroundRectangle.height - (dialogTitle.height * 2.5) - updateDialog.closeMargin + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + verticalScrollBarPolicy: Qt.ScrollBarAsNeeded + + Text { id: releaseNotes - wrapMode: TextEdit.Wrap - width: parent.width - readOnly: true + wrapMode: Text.Wrap + width: parent.width - updateDialog.closeMargin text: updateDialog.releaseNotes font.pixelSize: 14 - color: hifi.colors.text + color: "#000000" anchors { left: parent.left - leftMargin: updateDialog.borderWidth } } } - + Rectangle { id: downloadButton width: updateDialog.buttonWidth @@ -122,7 +121,7 @@ DialogContainer { top: scrollArea.bottom topMargin: 10 right: backgroundRectangle.right - rightMargin: 15 + rightMargin: updateDialog.borderWidth } Text { text: "Upgrade" @@ -169,4 +168,4 @@ DialogContainer { } } } -} \ No newline at end of file +} diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index 69dfc343d9..12ac6dfd6c 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -24,9 +24,21 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) : int currentVersion = QCoreApplication::applicationVersion().toInt(); int latestVersion = applicationUpdater.data()->getBuildData().lastKey(); int versionsBehind = latestVersion - currentVersion; - _updateAvailableDetails = "v" + QString::number(latestVersion) + " released on " + applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"]; - _updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " versions behind"; - _releaseNotes = applicationUpdater.data()->getBuildData()[latestVersion]["releaseNotes"]; + _updateAvailableDetails = "v" + QString::number(latestVersion) + " released on " + + applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"]; + _updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " version" + + (versionsBehind > 1 ? "s" : "") + " behind"; + + _releaseNotes = ""; + for (int i = latestVersion; i > currentVersion; i--) { + QString releaseNotes = applicationUpdater.data()->getBuildData()[i]["releaseNotes"]; + releaseNotes.remove("
"); + releaseNotes.remove(QRegExp("^\n")); + _releaseNotes += releaseNotes; + if (i > currentVersion + 1) { + _releaseNotes += "\n\n"; + } + } } const QString& UpdateDialog::updateAvailableDetails() const { From 46e58cd1064b8fec3630a32782390e73bdcf378b Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Jul 2015 13:56:47 -0700 Subject: [PATCH 02/18] Rework dialog container and layout --- interface/resources/qml/UpdateDialog.qml | 171 +++++++++++------------ 1 file changed, 78 insertions(+), 93 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index 5d901002f7..f0188d5221 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -7,11 +7,14 @@ import "controls" import "styles" DialogContainer { - HifiConstants { id: hifi } id: root + HifiConstants { id: hifi } + objectName: "UpdateDialog" - implicitWidth: updateDialog.width - implicitHeight: updateDialog.height + + implicitWidth: updateDialog.implicitWidth + implicitHeight: updateDialog.implicitHeight + x: parent ? parent.width / 2 - width / 2 : 0 y: parent ? parent.height / 2 - height / 2 : 0 @@ -33,6 +36,16 @@ DialogContainer { signal triggerBuildDownload signal closeUpdateDialog + Rectangle { + id: backgroundRectangle + color: "#2c86b1" + opacity: 0.85 + radius: updateDialog.closeMargin * 2 + + width: updateDialog.inputWidth + updateDialog.borderWidth * 2 + height: updateDialog.inputHeight * 6 + updateDialog.closeMargin * 2 + } + Column { id: mainContent width: updateDialog.inputWidth @@ -43,72 +56,76 @@ DialogContainer { } Rectangle { - id: backgroundRectangle - color: "#2c86b1" - opacity: 0.85 - radius: updateDialog.closeMargin * 2 - - width: updateDialog.inputWidth + updateDialog.borderWidth * 2 - height: updateDialog.inputHeight * 6 + updateDialog.closeMargin * 2 - - Rectangle { - id: dialogTitle - width: updateDialog.inputWidth - height: updateDialog.inputHeight - radius: height / 2 - color: "#ebebeb" - + id: dialogTitle + width: updateDialog.inputWidth + height: updateDialog.inputHeight + radius: height / 2 + color: "#ebebeb" + + Text { + id: updateAvailableText + text: "Update Available" anchors { - top: parent.top - topMargin: updateDialog.inputSpacing - horizontalCenter: parent.horizontalCenter - } - - Text { - id: updateAvailableText - text: "Update Available" - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: updateDialog.inputSpacing - } - } - - Text { - text: updateDialog.updateAvailableDetails - font.pixelSize: 14 - color: hifi.colors.text - anchors { - verticalCenter: parent.verticalCenter - left: updateAvailableText.right - leftMargin: 13 - } + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: updateDialog.inputSpacing } } - - ScrollView { - id: scrollArea + + Text { + text: updateDialog.updateAvailableDetails + font.pixelSize: 14 + color: hifi.colors.text anchors { - top: dialogTitle.bottom - topMargin: updateDialog.closeMargin - left: dialogTitle.left + verticalCenter: parent.verticalCenter + left: updateAvailableText.right + leftMargin: 13 } - width: updateDialog.inputWidth - height: backgroundRectangle.height - (dialogTitle.height * 2.5) - updateDialog.closeMargin - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - verticalScrollBarPolicy: Qt.ScrollBarAsNeeded + } + } + + ScrollView { + id: scrollArea + width: updateDialog.inputWidth + height: backgroundRectangle.height - (dialogTitle.height * 2.5) - updateDialog.closeMargin + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + verticalScrollBarPolicy: Qt.ScrollBarAsNeeded + + Text { + id: releaseNotes + wrapMode: Text.Wrap + width: parent.width - updateDialog.closeMargin + text: updateDialog.releaseNotes + font.pixelSize: 14 + color: "#000000" + } + } + + Row { + anchors.right: parent.right + spacing: updateDialog.inputSpacing + + Rectangle { + id: cancelButton + width: updateDialog.buttonWidth + height: updateDialog.buttonHeight + radius: updateDialog.buttonRadius + color: "red" Text { - id: releaseNotes - wrapMode: Text.Wrap - width: parent.width - updateDialog.closeMargin - text: updateDialog.releaseNotes - font.pixelSize: 14 - color: "#000000" + text: "Cancel" anchors { - left: parent.left + verticalCenter: parent.verticalCenter + horizontalCenter: parent.horizontalCenter } } + + MouseArea { + id: cancelButtonAction + anchors.fill: parent + onClicked: updateDialog.closeDialog() + cursorShape: "PointingHandCursor" + } } Rectangle { @@ -117,12 +134,7 @@ DialogContainer { height: updateDialog.buttonHeight radius: updateDialog.buttonRadius color: "green" - anchors { - top: scrollArea.bottom - topMargin: 10 - right: backgroundRectangle.right - rightMargin: updateDialog.borderWidth - } + Text { text: "Upgrade" anchors { @@ -130,6 +142,7 @@ DialogContainer { horizontalCenter: parent.horizontalCenter } } + MouseArea { id: downloadButtonAction anchors.fill: parent @@ -137,34 +150,6 @@ DialogContainer { cursorShape: "PointingHandCursor" } } - - Rectangle { - id: cancelButton - width: updateDialog.buttonWidth - height: updateDialog.buttonHeight - radius: updateDialog.buttonRadius - color: "red" - anchors { - top: scrollArea.bottom - topMargin: 10 - right: downloadButton.left - rightMargin: 15 - } - - Text { - text: "Cancel" - anchors { - verticalCenter: parent.verticalCenter - horizontalCenter: parent.horizontalCenter - } - } - MouseArea { - id: cancelButtonAction - anchors.fill: parent - onClicked: updateDialog.closeDialog() - cursorShape: "PointingHandCursor" - } - } } } } From 085d87e0352ba10c23bb90d4f0e2bfc0fb124696 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Jul 2015 14:16:45 -0700 Subject: [PATCH 03/18] Make background squared, white, and dragable --- interface/resources/qml/UpdateDialog.qml | 28 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index f0188d5221..3f5036c6cc 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -17,7 +17,9 @@ DialogContainer { x: parent ? parent.width / 2 - width / 2 : 0 y: parent ? parent.height / 2 - height / 2 : 0 - + property int maximumX: parent ? parent.width - width : 0 + property int maximumY: parent ? parent.height - height : 0 + UpdateDialog { id: updateDialog @@ -32,18 +34,32 @@ DialogContainer { readonly property int buttonWidth: 150 readonly property int buttonHeight: 50 readonly property int buttonRadius: 15 - + signal triggerBuildDownload signal closeUpdateDialog Rectangle { id: backgroundRectangle - color: "#2c86b1" - opacity: 0.85 - radius: updateDialog.closeMargin * 2 + color: "#ffffff" width: updateDialog.inputWidth + updateDialog.borderWidth * 2 height: updateDialog.inputHeight * 6 + updateDialog.closeMargin * 2 + + MouseArea { + width: parent.width + height: parent.height + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + drag { + target: root + minimumX: 0 + minimumY: 0 + maximumX: root.parent ? root.maximumX : 0 + maximumY: root.parent ? root.maximumY : 0 + } + } } Column { @@ -59,8 +75,6 @@ DialogContainer { id: dialogTitle width: updateDialog.inputWidth height: updateDialog.inputHeight - radius: height / 2 - color: "#ebebeb" Text { id: updateAvailableText From 0994cd97dc5767c9f1a3cf8abe3abacb47cfe6ab Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Jul 2015 15:14:15 -0700 Subject: [PATCH 04/18] Rework header and add logo Use HiFi logo as placeholder for now until Interface SVG is available. --- interface/resources/qml/UpdateDialog.qml | 44 ++++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index 3f5036c6cc..2c5d1e74a9 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -26,14 +26,15 @@ DialogContainer { implicitWidth: backgroundRectangle.width implicitHeight: backgroundRectangle.height - readonly property int inputWidth: 500 - readonly property int inputHeight: 60 + readonly property int contentWidth: 500 + readonly property int logoSize: 60 readonly property int borderWidth: 30 readonly property int closeMargin: 16 readonly property int inputSpacing: 16 readonly property int buttonWidth: 150 readonly property int buttonHeight: 50 readonly property int buttonRadius: 15 + readonly property int noticeHeight: 15 * inputSpacing signal triggerBuildDownload signal closeUpdateDialog @@ -42,8 +43,8 @@ DialogContainer { id: backgroundRectangle color: "#ffffff" - width: updateDialog.inputWidth + updateDialog.borderWidth * 2 - height: updateDialog.inputHeight * 6 + updateDialog.closeMargin * 2 + width: updateDialog.contentWidth + updateDialog.borderWidth * 2 + height: mainContent.height + updateDialog.borderWidth * 2 MouseArea { width: parent.width @@ -62,9 +63,20 @@ DialogContainer { } } + Image { + id: logo + source: "../images/hifi-logo.svg" + width: updateDialog.logoSize + height: updateDialog.logoSize + anchors { + top: mainContent.top + right: mainContent.right + } + } + Column { id: mainContent - width: updateDialog.inputWidth + width: updateDialog.contentWidth spacing: updateDialog.inputSpacing anchors { horizontalCenter: parent.horizontalCenter @@ -72,36 +84,30 @@ DialogContainer { } Rectangle { - id: dialogTitle - width: updateDialog.inputWidth - height: updateDialog.inputHeight + id: header + width: parent.width - updateDialog.logoSize - updateDialog.inputSpacing + height: updateAvailable.height + versionDetails.height Text { - id: updateAvailableText + id: updateAvailable text: "Update Available" - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: updateDialog.inputSpacing - } } Text { + id: versionDetails text: updateDialog.updateAvailableDetails font.pixelSize: 14 color: hifi.colors.text anchors { - verticalCenter: parent.verticalCenter - left: updateAvailableText.right - leftMargin: 13 + top: updateAvailable.bottom } } } ScrollView { id: scrollArea - width: updateDialog.inputWidth - height: backgroundRectangle.height - (dialogTitle.height * 2.5) - updateDialog.closeMargin + width: parent.width + height: updateDialog.noticeHeight horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff verticalScrollBarPolicy: Qt.ScrollBarAsNeeded From 98cd706528aafac5372582fd8d1439fb4a16f529 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Jul 2015 15:48:39 -0700 Subject: [PATCH 05/18] Add border around update details --- interface/resources/qml/UpdateDialog.qml | 31 ++++++++++++++++-------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index 2c5d1e74a9..55468ff6ba 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -104,20 +104,31 @@ DialogContainer { } } - ScrollView { - id: scrollArea + Rectangle { width: parent.width height: updateDialog.noticeHeight - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - verticalScrollBarPolicy: Qt.ScrollBarAsNeeded - Text { - id: releaseNotes - wrapMode: Text.Wrap + border { + width: 1 + color: "#808080" + } + + ScrollView { + id: scrollArea width: parent.width - updateDialog.closeMargin - text: updateDialog.releaseNotes - font.pixelSize: 14 - color: "#000000" + height: parent.height + horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + verticalScrollBarPolicy: Qt.ScrollBarAsNeeded + anchors.right: parent.right + + Text { + id: releaseNotes + wrapMode: Text.Wrap + width: parent.width - updateDialog.closeMargin + text: updateDialog.releaseNotes + font.pixelSize: 14 + color: "#000000" + } } } From 1774ad9c534faf7e263876176a27713d0918327f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Jul 2015 15:59:34 -0700 Subject: [PATCH 06/18] Rework buttons --- interface/resources/qml/UpdateDialog.qml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index 55468ff6ba..c17cf5d5d9 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -31,9 +31,8 @@ DialogContainer { readonly property int borderWidth: 30 readonly property int closeMargin: 16 readonly property int inputSpacing: 16 - readonly property int buttonWidth: 150 - readonly property int buttonHeight: 50 - readonly property int buttonRadius: 15 + readonly property int buttonWidth: 100 + readonly property int buttonHeight: 30 readonly property int noticeHeight: 15 * inputSpacing signal triggerBuildDownload @@ -140,11 +139,10 @@ DialogContainer { id: cancelButton width: updateDialog.buttonWidth height: updateDialog.buttonHeight - radius: updateDialog.buttonRadius - color: "red" Text { text: "Cancel" + font.weight: Font.DemiBold anchors { verticalCenter: parent.verticalCenter horizontalCenter: parent.horizontalCenter @@ -160,14 +158,13 @@ DialogContainer { } Rectangle { - id: downloadButton + id: updateButton width: updateDialog.buttonWidth height: updateDialog.buttonHeight - radius: updateDialog.buttonRadius - color: "green" Text { - text: "Upgrade" + text: "Update" + font.weight: Font.DemiBold anchors { verticalCenter: parent.verticalCenter horizontalCenter: parent.horizontalCenter @@ -175,7 +172,7 @@ DialogContainer { } MouseArea { - id: downloadButtonAction + id: updateButtonAction anchors.fill: parent onClicked: updateDialog.triggerUpgrade() cursorShape: "PointingHandCursor" From cd258262d29a244dd0661cfbc0d07f9a9dade1f7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Jul 2015 16:21:24 -0700 Subject: [PATCH 07/18] Use proper Interface logo --- interface/resources/images/interface-logo.svg | 34 +++++++++++++++++++ interface/resources/qml/UpdateDialog.qml | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 interface/resources/images/interface-logo.svg diff --git a/interface/resources/images/interface-logo.svg b/interface/resources/images/interface-logo.svg new file mode 100644 index 0000000000..61fc9d9afb --- /dev/null +++ b/interface/resources/images/interface-logo.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index c17cf5d5d9..9ddc974ddd 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -64,7 +64,7 @@ DialogContainer { Image { id: logo - source: "../images/hifi-logo.svg" + source: "../images/interface-logo.svg" width: updateDialog.logoSize height: updateDialog.logoSize anchors { From b123e280d6a015e077c6fe048d91342d87d9acb9 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Jul 2015 16:22:01 -0700 Subject: [PATCH 08/18] Add release numbers to associated text --- interface/src/ui/UpdateDialog.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index 12ac6dfd6c..839553fa06 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -33,11 +33,8 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) : for (int i = latestVersion; i > currentVersion; i--) { QString releaseNotes = applicationUpdater.data()->getBuildData()[i]["releaseNotes"]; releaseNotes.remove("
"); - releaseNotes.remove(QRegExp("^\n")); - _releaseNotes += releaseNotes; - if (i > currentVersion + 1) { - _releaseNotes += "\n\n"; - } + releaseNotes.remove(QRegExp("^\n+")); + _releaseNotes += "\n" + QString().sprintf("%d", i) + "\n" + releaseNotes + "\n"; } } From abc54f2e3f7f74b5b94df5d05f1fad8ceaa2c9b3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Tue, 7 Jul 2015 17:08:02 -0700 Subject: [PATCH 09/18] Polished fonts, colors, etc. --- interface/resources/qml/LoginDialog.qml | 2 -- interface/resources/qml/UpdateDialog.qml | 36 ++++++++++++++++++++---- interface/src/ui/UpdateDialog.cpp | 4 +-- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/interface/resources/qml/LoginDialog.qml b/interface/resources/qml/LoginDialog.qml index 8d5267f7f8..29264fa608 100644 --- a/interface/resources/qml/LoginDialog.qml +++ b/interface/resources/qml/LoginDialog.qml @@ -41,8 +41,6 @@ DialogContainer { readonly property int closeMargin: 16 readonly property real tan30: 0.577 // tan(30°) readonly property int inputSpacing: 16 - property int maximumX: parent ? parent.width - width : 0 - property int maximumY: parent ? parent.height - height : 0 Rectangle { id: backgroundRectangle diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index 9ddc974ddd..948d2555a3 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -34,6 +34,7 @@ DialogContainer { readonly property int buttonWidth: 100 readonly property int buttonHeight: 30 readonly property int noticeHeight: 15 * inputSpacing + readonly property string fontFamily: "Futura" signal triggerBuildDownload signal closeUpdateDialog @@ -90,12 +91,22 @@ DialogContainer { Text { id: updateAvailable text: "Update Available" + font { + family: updateDialog.fontFamily + pixelSize: hifi.fonts.pixelSize * 1.5 + weight: Font.DemiBold + } + color: "#303030" } Text { id: versionDetails text: updateDialog.updateAvailableDetails - font.pixelSize: 14 + font { + family: updateDialog.fontFamily + pixelSize: hifi.fonts.pixelSize * 0.6 + letterSpacing: -0.5 + } color: hifi.colors.text anchors { top: updateAvailable.bottom @@ -109,7 +120,7 @@ DialogContainer { border { width: 1 - color: "#808080" + color: "#a0a0a0" } ScrollView { @@ -125,8 +136,11 @@ DialogContainer { wrapMode: Text.Wrap width: parent.width - updateDialog.closeMargin text: updateDialog.releaseNotes - font.pixelSize: 14 - color: "#000000" + color: hifi.colors.text + font { + family: updateDialog.fontFamily + pixelSize: hifi.fonts.pixelSize * 0.7 + } } } } @@ -142,7 +156,12 @@ DialogContainer { Text { text: "Cancel" - font.weight: Font.DemiBold + color: "#0c9ab4" // Same as logo + font { + family: updateDialog.fontFamily + pixelSize: hifi.fonts.pixelSize * 1.2 + weight: Font.DemiBold + } anchors { verticalCenter: parent.verticalCenter horizontalCenter: parent.horizontalCenter @@ -164,7 +183,12 @@ DialogContainer { Text { text: "Update" - font.weight: Font.DemiBold + color: "#0c9ab4" // Same as logo + font { + family: updateDialog.fontFamily + pixelSize: hifi.fonts.pixelSize * 1.2 + weight: Font.DemiBold + } anchors { verticalCenter: parent.verticalCenter horizontalCenter: parent.horizontalCenter diff --git a/interface/src/ui/UpdateDialog.cpp b/interface/src/ui/UpdateDialog.cpp index 839553fa06..6fa2d858fb 100644 --- a/interface/src/ui/UpdateDialog.cpp +++ b/interface/src/ui/UpdateDialog.cpp @@ -24,8 +24,8 @@ UpdateDialog::UpdateDialog(QQuickItem* parent) : int currentVersion = QCoreApplication::applicationVersion().toInt(); int latestVersion = applicationUpdater.data()->getBuildData().lastKey(); int versionsBehind = latestVersion - currentVersion; - _updateAvailableDetails = "v" + QString::number(latestVersion) + " released on " - + applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"]; + _updateAvailableDetails = "v" + QString::number(latestVersion) + " released on " + + QString(applicationUpdater.data()->getBuildData()[latestVersion]["releaseTime"]).replace(" ", " "); _updateAvailableDetails += "\nYou are " + QString::number(versionsBehind) + " version" + (versionsBehind > 1 ? "s" : "") + " behind"; From db7f1d6d273611c3017288694fb2a229ecafa7b9 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 9 Jul 2015 09:35:22 -0700 Subject: [PATCH 10/18] Change font to Trebuchet --- interface/resources/qml/UpdateDialog.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index 948d2555a3..b166bdfebb 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -34,7 +34,7 @@ DialogContainer { readonly property int buttonWidth: 100 readonly property int buttonHeight: 30 readonly property int noticeHeight: 15 * inputSpacing - readonly property string fontFamily: "Futura" + readonly property string fontFamily: Qt.platform.os === "windows" ? "Trebuchet MS" : "Trebuchet" signal triggerBuildDownload signal closeUpdateDialog @@ -139,7 +139,7 @@ DialogContainer { color: hifi.colors.text font { family: updateDialog.fontFamily - pixelSize: hifi.fonts.pixelSize * 0.7 + pixelSize: hifi.fonts.pixelSize * 0.65 } } } From daf34053a8ad044cac69b77f31f4e287adfa5be8 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 9 Jul 2015 10:15:28 -0700 Subject: [PATCH 11/18] Tweak button positions --- interface/resources/qml/UpdateDialog.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index b166bdfebb..8baf41cd75 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -44,7 +44,7 @@ DialogContainer { color: "#ffffff" width: updateDialog.contentWidth + updateDialog.borderWidth * 2 - height: mainContent.height + updateDialog.borderWidth * 2 + height: mainContent.height + updateDialog.borderWidth * 2 - updateDialog.closeMargin / 2 MouseArea { width: parent.width @@ -80,7 +80,8 @@ DialogContainer { spacing: updateDialog.inputSpacing anchors { horizontalCenter: parent.horizontalCenter - verticalCenter: parent.verticalCenter + topMargin: updateDialog.borderWidth + top: parent.top } Rectangle { @@ -148,11 +149,13 @@ DialogContainer { Row { anchors.right: parent.right spacing: updateDialog.inputSpacing + height: updateDialog.buttonHeight + updateDialog.closeMargin / 2 Rectangle { id: cancelButton width: updateDialog.buttonWidth height: updateDialog.buttonHeight + anchors.bottom: parent.bottom Text { text: "Cancel" @@ -180,6 +183,7 @@ DialogContainer { id: updateButton width: updateDialog.buttonWidth height: updateDialog.buttonHeight + anchors.bottom: parent.bottom Text { text: "Update" From c17c9f181880b33553201ae1ad9c3c287c11321b Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 12 Jul 2015 10:29:43 -0700 Subject: [PATCH 12/18] quiet compiler --- interface/src/ui/overlays/Rectangle3DOverlay.cpp | 5 ++--- libraries/gpu/src/gpu/GLBackend.cpp | 2 +- .../render-utils/src/DeferredLightingEffect.cpp | 9 +++++---- libraries/render/src/render/Scene.cpp | 2 +- libraries/shared/src/PropertyFlags.h | 2 +- tests/entities/src/main.cpp | 14 ++++++++++---- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/interface/src/ui/overlays/Rectangle3DOverlay.cpp b/interface/src/ui/overlays/Rectangle3DOverlay.cpp index ddab8040b1..dfe5a3ad74 100644 --- a/interface/src/ui/overlays/Rectangle3DOverlay.cpp +++ b/interface/src/ui/overlays/Rectangle3DOverlay.cpp @@ -35,14 +35,13 @@ void Rectangle3DOverlay::render(RenderArgs* args) { if (!_visible) { return; // do nothing if we're not visible } - + float alpha = getAlpha(); xColor color = getColor(); const float MAX_COLOR = 255.0f; glm::vec4 rectangleColor(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha); glm::vec3 position = getPosition(); - glm::vec3 center = getCenter(); glm::vec2 dimensions = getDimensions(); glm::vec2 halfDimensions = dimensions * 0.5f; glm::quat rotation = getRotation(); @@ -67,7 +66,7 @@ void Rectangle3DOverlay::render(RenderArgs* args) { glm::vec3 point2(halfDimensions.x, -halfDimensions.y, 0.0f); glm::vec3 point3(halfDimensions.x, halfDimensions.y, 0.0f); glm::vec3 point4(-halfDimensions.x, halfDimensions.y, 0.0f); - + geometryCache->renderDashedLine(*batch, point1, point2, rectangleColor); geometryCache->renderDashedLine(*batch, point2, point3, rectangleColor); geometryCache->renderDashedLine(*batch, point3, point4, rectangleColor); diff --git a/libraries/gpu/src/gpu/GLBackend.cpp b/libraries/gpu/src/gpu/GLBackend.cpp index d493978b88..a412c15514 100644 --- a/libraries/gpu/src/gpu/GLBackend.cpp +++ b/libraries/gpu/src/gpu/GLBackend.cpp @@ -238,7 +238,7 @@ void GLBackend::do_clearFramebuffer(Batch& batch, uint32 paramOffset) { std::vector drawBuffers; if (masks & Framebuffer::BUFFER_COLORS) { - for (int i = 0; i < Framebuffer::MAX_NUM_RENDER_BUFFERS; i++) { + for (unsigned int i = 0; i < Framebuffer::MAX_NUM_RENDER_BUFFERS; i++) { if (masks & (1 << i)) { drawBuffers.push_back(GL_COLOR_ATTACHMENT0 + i); } diff --git a/libraries/render-utils/src/DeferredLightingEffect.cpp b/libraries/render-utils/src/DeferredLightingEffect.cpp index 9bda5b8048..d46aa4d8d4 100644 --- a/libraries/render-utils/src/DeferredLightingEffect.cpp +++ b/libraries/render-utils/src/DeferredLightingEffect.cpp @@ -474,17 +474,18 @@ void DeferredLightingEffect::render(RenderArgs* args) { // IN DEBUG: light->setShowContour(true); batch.setUniformBuffer(_spotLightLocations.lightBufferUnit, light->getSchemaBuffer()); - + auto eyeLightPos = eyePoint - light->getPosition(); auto eyeHalfPlaneDistance = glm::dot(eyeLightPos, light->getDirection()); - + const float TANGENT_LENGTH_SCALE = 0.666f; - glm::vec4 coneParam(light->getSpotAngleCosSin(), TANGENT_LENGTH_SCALE * tan(0.5 * light->getSpotAngle()), 1.0f); + glm::vec4 coneParam(light->getSpotAngleCosSin(), TANGENT_LENGTH_SCALE * tanf(0.5f * light->getSpotAngle()), 1.0f); float expandedRadius = light->getMaximumRadius() * (1.0f + SCALE_EXPANSION); // TODO: We shouldn;t have to do that test and use a different volume geometry for when inside the vlight volume, // we should be able to draw thre same geometry use DepthClamp but for unknown reason it's s not working... - if ((eyeHalfPlaneDistance > -nearRadius) && (glm::distance(eyePoint, glm::vec3(light->getPosition())) < expandedRadius + nearRadius)) { + if ((eyeHalfPlaneDistance > -nearRadius) && + (glm::distance(eyePoint, glm::vec3(light->getPosition())) < expandedRadius + nearRadius)) { coneParam.w = 0.0f; batch._glUniform4fv(_spotLightLocations.coneParam, 1, reinterpret_cast< const GLfloat* >(&coneParam)); diff --git a/libraries/render/src/render/Scene.cpp b/libraries/render/src/render/Scene.cpp index 268f2b6841..1b52145a1c 100644 --- a/libraries/render/src/render/Scene.cpp +++ b/libraries/render/src/render/Scene.cpp @@ -76,7 +76,7 @@ void Item::Status::Value::setColor(float hue) { } void Item::Status::getPackedValues(glm::ivec4& values) const { - for (unsigned int i = 0; i < values.length(); i++) { + for (unsigned int i = 0; i < (unsigned int)values.length(); i++) { if (i < _values.size()) { values[i] = _values[i]().getPackedData(); } else { diff --git a/libraries/shared/src/PropertyFlags.h b/libraries/shared/src/PropertyFlags.h index b0ac9e76d8..0be7b3af93 100644 --- a/libraries/shared/src/PropertyFlags.h +++ b/libraries/shared/src/PropertyFlags.h @@ -208,7 +208,7 @@ inline size_t PropertyFlags::decode(const uint8_t* data, size_t size) { int bitAt = 0; int expectedBitCount; // unknown at this point int lastValueBit; - for (int byte = 0; byte < size; byte++) { + for (unsigned int byte = 0; byte < size; byte++) { char originalByte = data[byte]; bytesConsumed++; unsigned char maskBit = 0x80; // LEFT MOST BIT set diff --git a/tests/entities/src/main.cpp b/tests/entities/src/main.cpp index 8d16d98103..66daeb2607 100644 --- a/tests/entities/src/main.cpp +++ b/tests/entities/src/main.cpp @@ -73,14 +73,18 @@ template void testByteCountCodedStable(const T& value) { ByteCountCoded coder((T)value); auto encoded = coder.encode(); + #ifndef QT_NO_DEBUG auto originalEncodedSize = encoded.size(); + #endif for (int i = 0; i < 10; ++i) { encoded.append(qrand()); } ByteCountCoded decoder; decoder.decode(encoded); Q_ASSERT(decoder.data == coder.data); + #ifndef QT_NO_DEBUG auto consumed = decoder.decode(encoded.data(), encoded.size()); + #endif Q_ASSERT(consumed == originalEncodedSize); } @@ -100,12 +104,12 @@ void testPropertyFlags(uint32_t value) { EntityPropertyFlags original; original.clear(); auto enumSize = sizeof(EntityPropertyList); - for (size_t i = 0; i < sizeof(EntityPropertyList) * 8; ++i) { + for (size_t i = 0; i < enumSize * 8; ++i) { original.setHasProperty((EntityPropertyList)i); } QByteArray encoded = original.encode(); - auto originalSize = encoded.size(); - for (size_t i = 0; i < sizeof(EntityPropertyList); ++i) { + // auto originalSize = encoded.size(); + for (size_t i = 0; i < enumSize; ++i) { encoded.append(qrand()); } @@ -116,7 +120,9 @@ void testPropertyFlags(uint32_t value) { } { + #ifndef QT_NO_DEBUG auto decodeSize = decodeNew.decode((const uint8_t*)encoded.data(), encoded.size()); + #endif Q_ASSERT(originalSize == decodeSize); Q_ASSERT(decodeNew == original); } @@ -129,7 +135,7 @@ void testPropertyFlags() { testPropertyFlags(0xFFFF); } -int main(int argc, char** argv) { +int main(int argc, char** argv) { QCoreApplication app(argc, argv); { auto start = usecTimestampNow(); From f011d5c7f766616b731c73e080f1d960e34d1e58 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sun, 12 Jul 2015 20:42:17 -0700 Subject: [PATCH 13/18] remove commented code --- tests/entities/src/main.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/entities/src/main.cpp b/tests/entities/src/main.cpp index 66daeb2607..6aa021d1b2 100644 --- a/tests/entities/src/main.cpp +++ b/tests/entities/src/main.cpp @@ -108,7 +108,6 @@ void testPropertyFlags(uint32_t value) { original.setHasProperty((EntityPropertyList)i); } QByteArray encoded = original.encode(); - // auto originalSize = encoded.size(); for (size_t i = 0; i < enumSize; ++i) { encoded.append(qrand()); } From 5aca0c28ef15e7b6c7faf294cafa73659204e56a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 13 Jul 2015 07:37:59 -0700 Subject: [PATCH 14/18] quiet compiler --- libraries/entities/src/EntityItem.cpp | 24 ++++++++++++------------ libraries/gpu/src/gpu/GLBackend.cpp | 1 - tests/entities/src/main.cpp | 7 +++++-- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 794d0752a1..592382286a 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -385,7 +385,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef dataAt += encodedID.size(); bytesRead += encodedID.size(); Q_ASSERT(id == _id); - Q_ASSERT(parser.offset() == bytesRead); + Q_ASSERT(parser.offset() == (unsigned int) bytesRead); } #endif @@ -400,8 +400,8 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef quint32 type = typeCoder; EntityTypes::EntityType oldType = (EntityTypes::EntityType)type; Q_ASSERT(oldType == _type); - Q_ASSERT(parser.offset() == bytesRead); -#endif + Q_ASSERT(parser.offset() == (unsigned int) bytesRead); +#endif bool overwriteLocalData = true; // assume the new content overwrites our local data quint64 now = usecTimestampNow(); @@ -417,9 +417,9 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef dataAt += sizeof(createdFromBuffer2); bytesRead += sizeof(createdFromBuffer2); Q_ASSERT(createdFromBuffer2 == createdFromBuffer); - Q_ASSERT(parser.offset() == bytesRead); + Q_ASSERT(parser.offset() == (unsigned int) bytesRead); } -#endif +#endif if (_created == UNKNOWN_CREATED_TIME) { // we don't yet have a _created timestamp, so we accept this one createdFromBuffer -= clockSkew; @@ -458,9 +458,9 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef dataAt += sizeof(lastEditedFromBuffer2); bytesRead += sizeof(lastEditedFromBuffer2); Q_ASSERT(lastEditedFromBuffer2 == lastEditedFromBuffer); - Q_ASSERT(parser.offset() == bytesRead); + Q_ASSERT(parser.offset() == (unsigned int) bytesRead); } -#endif +#endif quint64 lastEditedFromBufferAdjusted = lastEditedFromBuffer - clockSkew; if (lastEditedFromBufferAdjusted > now) { lastEditedFromBufferAdjusted = now; @@ -534,10 +534,10 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef encodedUpdateDelta = updateDeltaCoder; // determine true length dataAt += encodedUpdateDelta.size(); bytesRead += encodedUpdateDelta.size(); - Q_ASSERT(parser.offset() == bytesRead); + Q_ASSERT(parser.offset() == (unsigned int) bytesRead); } -#endif - +#endif + if (overwriteLocalData) { _lastUpdated = lastEditedFromBufferAdjusted + updateDelta; // don't adjust for clock skew since we already did that #ifdef WANT_DEBUG @@ -562,7 +562,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef encodedSimulatedDelta = simulatedDeltaCoder; // determine true length dataAt += encodedSimulatedDelta.size(); bytesRead += encodedSimulatedDelta.size(); - Q_ASSERT(parser.offset() == bytesRead); + Q_ASSERT(parser.offset() == (unsigned int) bytesRead); } #endif @@ -599,7 +599,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef dataAt += propertyFlags.getEncodedLength(); bytesRead += propertyFlags.getEncodedLength(); Q_ASSERT(propertyFlags2 == propertyFlags); - Q_ASSERT(parser.offset() == bytesRead); + Q_ASSERT(parser.offset() == (unsigned int)bytesRead); } #endif diff --git a/libraries/gpu/src/gpu/GLBackend.cpp b/libraries/gpu/src/gpu/GLBackend.cpp index a412c15514..55aaa12e4e 100644 --- a/libraries/gpu/src/gpu/GLBackend.cpp +++ b/libraries/gpu/src/gpu/GLBackend.cpp @@ -204,7 +204,6 @@ void GLBackend::do_drawInstanced(Batch& batch, uint32 paramOffset) { GLenum mode = _primitiveToGLmode[primitiveType]; uint32 numVertices = batch._params[paramOffset + 2]._uint; uint32 startVertex = batch._params[paramOffset + 1]._uint; - uint32 startInstance = batch._params[paramOffset + 0]._uint; glDrawArraysInstancedARB(mode, startVertex, numVertices, numInstances); (void) CHECK_GL_ERROR(); diff --git a/tests/entities/src/main.cpp b/tests/entities/src/main.cpp index 6aa021d1b2..72dbf77dfa 100644 --- a/tests/entities/src/main.cpp +++ b/tests/entities/src/main.cpp @@ -85,7 +85,7 @@ void testByteCountCodedStable(const T& value) { #ifndef QT_NO_DEBUG auto consumed = decoder.decode(encoded.data(), encoded.size()); #endif - Q_ASSERT(consumed == originalEncodedSize); + Q_ASSERT(consumed == (unsigned int)originalEncodedSize); } @@ -108,6 +108,9 @@ void testPropertyFlags(uint32_t value) { original.setHasProperty((EntityPropertyList)i); } QByteArray encoded = original.encode(); + #ifndef QT_NO_DEBUG + auto originalSize = encoded.size(); + #endif for (size_t i = 0; i < enumSize; ++i) { encoded.append(qrand()); } @@ -123,7 +126,7 @@ void testPropertyFlags(uint32_t value) { auto decodeSize = decodeNew.decode((const uint8_t*)encoded.data(), encoded.size()); #endif Q_ASSERT(originalSize == decodeSize); - Q_ASSERT(decodeNew == original); + Q_ASSERT(decodeNew == (unsigned int) original); } } From 7a6cf40b546753ddaa1b54ae65b0f1464549fe24 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 13 Jul 2015 07:39:11 -0700 Subject: [PATCH 15/18] quiet compiler --- tests/entities/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/entities/src/main.cpp b/tests/entities/src/main.cpp index 72dbf77dfa..a255ffa995 100644 --- a/tests/entities/src/main.cpp +++ b/tests/entities/src/main.cpp @@ -126,7 +126,7 @@ void testPropertyFlags(uint32_t value) { auto decodeSize = decodeNew.decode((const uint8_t*)encoded.data(), encoded.size()); #endif Q_ASSERT(originalSize == decodeSize); - Q_ASSERT(decodeNew == (unsigned int) original); + Q_ASSERT(decodeNew == original); } } From d44bb1a0d8a580a960a95e4fe174748f52f47192 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 13 Jul 2015 11:42:29 -0700 Subject: [PATCH 16/18] update javascript to use relative-to-entity line-point ends --- examples/pointer.js | 97 +++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 56 deletions(-) diff --git a/examples/pointer.js b/examples/pointer.js index 83e2cbf776..2791e06466 100644 --- a/examples/pointer.js +++ b/examples/pointer.js @@ -65,70 +65,55 @@ function removeLine() { function createOrUpdateLine(event) { - var pickRay = Camera.computePickRay(event.x, event.y); - var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking - var props = Entities.getEntityProperties(intersection.entityID); + var pickRay = Camera.computePickRay(event.x, event.y); + var intersection = Entities.findRayIntersection(pickRay, true); // accurate picking + var props = Entities.getEntityProperties(intersection.entityID); - if (intersection.intersects && userCanPoint) { - var points = [nearLinePoint(intersection.intersection), intersection.intersection] - if (lineIsRezzed) { - Entities.editEntity(lineEntityID, { - position: nearLinePoint(intersection.intersection), - linePoints: points, - dimensions: { - x: 1, - y: 1, - z: 1 - }, - lifetime: 15 + props.lifespan // renew lifetime - }); + if (intersection.intersects && userCanPoint) { + var points = [Vec3.subtract(nearLinePoint(intersection.intersection), MyAvatar.position), + Vec3.subtract(intersection.intersection, MyAvatar.position)]; + if (lineIsRezzed) { + Entities.editEntity(lineEntityID, { + linePoints: points, + position: MyAvatar.position, + lifetime: 15 + props.lifespan // renew lifetime + }); + // Entities.setAllPoints(lineEntityID, points); + } else { + lineIsRezzed = true; + lineEntityID = Entities.addEntity({ + type: "Line", + position: MyAvatar.position, + linePoints: points, + dimensions: { x: 100, y: 100, z: 100 }, + color: { red: 255, green: 255, blue: 255 }, + lifetime: 15 // if someone crashes while pointing, don't leave the line there forever. + }); + } } else { - lineIsRezzed = true; - lineEntityID = Entities.addEntity({ - type: "Line", - position: nearLinePoint(intersection.intersection), - linePoints: points, - dimensions: { - x: 1, - y: 1, - z: 1 - }, - color: { - red: 255, - green: 255, - blue: 255 - }, - lifetime: 15 // if someone crashes while pointing, don't leave the line there forever. - }); + removeLine(); } - } else { - removeLine(); - } } function mousePressEvent(event) { - if (!event.isLeftButton) { - return; - } - - createOrUpdateLine(event); - var clickedOverlay = Overlays.getOverlayAtPoint({ - x: event.x, - y: event.y - }); - if (clickedOverlay == pointerButton) { - userCanPoint = !userCanPoint; - if (userCanPoint === true) { - Overlays.editOverlay(pointerButton, { - color: buttonOnColor - }); - } else { - Overlays.editOverlay(pointerButton, { - color: buttonOffColor - }); + if (!event.isLeftButton) { + return; + } + + var clickedOverlay = Overlays.getOverlayAtPoint({ + x: event.x, + y: event.y + }); + + if (clickedOverlay == pointerButton) { + userCanPoint = !userCanPoint; + if (userCanPoint === true) { + Overlays.editOverlay(pointerButton, { color: buttonOnColor }); + } else { + Overlays.editOverlay(pointerButton, { color: buttonOffColor }); + } } - } } From 59f456a2f2fcd4da47f4641052c9847b1a9cf9d6 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Mon, 13 Jul 2015 14:16:39 -0700 Subject: [PATCH 17/18] Add an "is looking at me" indicator above avatars' heads Menu item: Developer > Avatar > Show Who's Looking at Me --- interface/src/Menu.cpp | 1 + interface/src/Menu.h | 1 + interface/src/avatar/Avatar.cpp | 34 +++++++++++++++++++++++---------- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 9f49361f79..d22b80975d 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -458,6 +458,7 @@ Menu::Menu() { addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderBoundingCollisionShapes); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderLookAtVectors, 0, false); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderFocusIndicator, 0, false); + addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ShowWhosLookingAtMe, 0, false); MenuWrapper* handOptionsMenu = developerMenu->addMenu("Hands"); addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlignForearmsWithWrists, 0, false); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 043bb53a7f..3745f1e766 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -270,6 +270,7 @@ namespace MenuOption { const QString ShowBordersEntityNodes = "Show Entity Nodes"; const QString ShowIKConstraints = "Show IK Constraints"; const QString ShowRealtimeEntityStats = "Show Realtime Entity Stats"; + const QString ShowWhosLookingAtMe = "Show Who's Looking at Me"; const QString SimpleShadows = "Simple"; const QString SixenseEnabled = "Enable Hydra Support"; const QString SixenseMouseInput = "Enable Sixense Mouse Input"; diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 0dde96c7ce..d026457457 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -453,22 +453,36 @@ void Avatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition, boo } } + // Stack indicator spheres + float indicatorOffset = 0.0f; + if (!_displayName.isEmpty() && _displayNameAlpha != 0.0f) { + const float DISPLAY_NAME_INDICATOR_OFFSET = 0.22f; + indicatorOffset = DISPLAY_NAME_INDICATOR_OFFSET; + } + const float INDICATOR_RADIUS = 0.03f; + const float INDICATOR_INDICATOR_OFFSET = 3.0f * INDICATOR_RADIUS; + // If this is the avatar being looked at, render a little ball above their head if (_isLookAtTarget && Menu::getInstance()->isOptionChecked(MenuOption::RenderFocusIndicator)) { - const float LOOK_AT_INDICATOR_RADIUS = 0.03f; - const float LOOK_AT_INDICATOR_OFFSET = 0.22f; const glm::vec4 LOOK_AT_INDICATOR_COLOR = { 0.8f, 0.0f, 0.0f, 0.75f }; - glm::vec3 position; - if (_displayName.isEmpty() || _displayNameAlpha == 0.0f) { - position = glm::vec3(_position.x, getDisplayNamePosition().y, _position.z); - } else { - position = glm::vec3(_position.x, getDisplayNamePosition().y + LOOK_AT_INDICATOR_OFFSET, _position.z); - } + glm::vec3 position = glm::vec3(_position.x, getDisplayNamePosition().y + indicatorOffset, _position.z); Transform transform; transform.setTranslation(position); batch.setModelTransform(transform); - DependencyManager::get()->renderSolidSphere(batch, LOOK_AT_INDICATOR_RADIUS - , 15, 15, LOOK_AT_INDICATOR_COLOR); + DependencyManager::get()->renderSolidSphere(batch, INDICATOR_RADIUS, + 15, 15, LOOK_AT_INDICATOR_COLOR); + indicatorOffset += INDICATOR_INDICATOR_OFFSET; + } + + // If the avatar is looking at me, render an indication that they area + if (getHead()->getIsLookingAtMe() && Menu::getInstance()->isOptionChecked(MenuOption::ShowWhosLookingAtMe)) { + const glm::vec4 LOOKING_AT_ME_COLOR = { 0.8f, 0.65f, 0.0f, 0.1f }; + glm::vec3 position = glm::vec3(_position.x, getDisplayNamePosition().y + indicatorOffset, _position.z); + Transform transform; + transform.setTranslation(position); + batch.setModelTransform(transform); + DependencyManager::get()->renderSolidSphere(batch, INDICATOR_RADIUS, + 15, 15, LOOKING_AT_ME_COLOR); } // quick check before falling into the code below: From 5676246d751f2b1f5fe64e1ef91037b2e1acc86c Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 13 Jul 2015 15:26:52 -0700 Subject: [PATCH 18/18] fix the lingering model parts sometimes left behind when switching domains --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 7 +++++-- .../entities-renderer/src/RenderableModelEntityItem.cpp | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 11d24c6d9d..6be891e147 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -93,16 +93,18 @@ void EntityTreeRenderer::clear() { foreach (const EntityItemID& entityID, _entityScripts.keys()) { checkAndCallUnload(entityID); } - OctreeRenderer::clear(); _entityScripts.clear(); auto scene = _viewState->getMain3DScene(); render::PendingChanges pendingChanges; + foreach(auto entity, _entitiesInScene) { entity->removeFromScene(entity, scene, pendingChanges); } scene->enqueuePendingChanges(pendingChanges); _entitiesInScene.clear(); + + OctreeRenderer::clear(); } void EntityTreeRenderer::init() { @@ -1003,7 +1005,7 @@ void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) { checkAndCallUnload(entityID); } _entityScripts.remove(entityID); - + // here's where we remove the entity payload from the scene if (_entitiesInScene.contains(entityID)) { auto entity = _entitiesInScene.take(entityID); @@ -1164,6 +1166,7 @@ void EntityTreeRenderer::updateEntityRenderStatus(bool shouldRenderEntities) { } else { _entityIDsLastInScene = _entitiesInScene.keys(); for (auto entityID : _entityIDsLastInScene) { + // FIXME - is this really right? do we want to do the deletingEntity() code or just remove from the scene. deletingEntity(entityID); } } diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 85b7bafc78..2deb34d1f8 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -189,6 +189,7 @@ void makeEntityItemStatusGetters(RenderableModelEntityItem* entity, render::Item bool RenderableModelEntityItem::addToScene(EntityItemPointer self, std::shared_ptr scene, render::PendingChanges& pendingChanges) { + _myMetaItem = scene->allocateID(); auto renderData = RenderableModelEntityItemMeta::Pointer(new RenderableModelEntityItemMeta(self)); @@ -199,7 +200,10 @@ bool RenderableModelEntityItem::addToScene(EntityItemPointer self, std::shared_p if (_model) { render::Item::Status::Getters statusGetters; makeEntityItemStatusGetters(this, statusGetters); - return _model->addToScene(scene, pendingChanges, statusGetters); + + // note: we don't care if the model fails to add items, we always added our meta item and therefore we return + // true so that the system knows our meta item is in the scene! + _model->addToScene(scene, pendingChanges, statusGetters); } return true;