diff --git a/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml b/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml index a659ff4e0c..57bec2250f 100644 --- a/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml +++ b/interface/resources/qml/hifi/simplifiedUI/avatarApp/AvatarApp.qml @@ -92,7 +92,7 @@ Rectangle { AvatarAppComponents.DisplayNameHeader { id: displayNameHeader - previewUrl: avatarPreviewUrl + previewUrl: root.avatarPreviewUrl loading: !inventoryContentsList.visible anchors.top: parent.top anchors.topMargin: 30 @@ -210,7 +210,10 @@ Rectangle { downloadUrl = avatarAppInventoryModel.get(i).download_url; previewUrl = avatarAppInventoryModel.get(i).preview; if (MyAvatar.skeletonModelURL === downloadUrl) { - avatarPreviewUrl = previewUrl; + if (previewUrl.indexOf("missing.png") > -1) { + previewUrl = "../../images/defaultAvatar.svg"; // Extra `../` because the image is stored 2 levels up from `DisplayNameHeader.qml` + } + root.avatarPreviewUrl = previewUrl; return; } } diff --git a/interface/resources/qml/hifi/simplifiedUI/avatarApp/components/AvatarAppListDelegate.qml b/interface/resources/qml/hifi/simplifiedUI/avatarApp/components/AvatarAppListDelegate.qml index 7c6ad1b09c..cdfa06190c 100644 --- a/interface/resources/qml/hifi/simplifiedUI/avatarApp/components/AvatarAppListDelegate.qml +++ b/interface/resources/qml/hifi/simplifiedUI/avatarApp/components/AvatarAppListDelegate.qml @@ -51,12 +51,14 @@ Rectangle { Image { id: itemPreviewImage - source: root.itemPreviewImageUrl + source: root.itemPreviewImageUrl.indexOf("missing.png") > -1 ? "../../images/defaultAvatar.svg" : root.itemPreviewImageUrl anchors.left: parent.left anchors.leftMargin: 20 anchors.verticalCenter: parent.verticalCenter - height: 60 - width: height + width: 60 + height: width + sourceSize.width: width + sourceSize.height: height fillMode: Image.PreserveAspectCrop mipmap: true layer.enabled: true diff --git a/interface/resources/qml/hifi/simplifiedUI/avatarApp/components/DisplayNameHeader.qml b/interface/resources/qml/hifi/simplifiedUI/avatarApp/components/DisplayNameHeader.qml index 6bf3d34d6f..a6be398e53 100644 --- a/interface/resources/qml/hifi/simplifiedUI/avatarApp/components/DisplayNameHeader.qml +++ b/interface/resources/qml/hifi/simplifiedUI/avatarApp/components/DisplayNameHeader.qml @@ -43,6 +43,8 @@ Item { anchors.verticalCenter: parent.verticalCenter height: 100 width: height + sourceSize.width: width + sourceSize.height: height fillMode: Image.PreserveAspectCrop layer.enabled: true layer.effect: OpacityMask { diff --git a/interface/resources/qml/hifi/simplifiedUI/images/defaultAvatar.svg b/interface/resources/qml/hifi/simplifiedUI/images/defaultAvatar.svg new file mode 100644 index 0000000000..05779e7d40 --- /dev/null +++ b/interface/resources/qml/hifi/simplifiedUI/images/defaultAvatar.svg @@ -0,0 +1,14 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/InputDeviceButton.qml b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/InputDeviceButton.qml index 506c2a72bc..cb10cc5eef 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/InputDeviceButton.qml +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/InputDeviceButton.qml @@ -48,9 +48,6 @@ Rectangle { } } - height: 30 - width: 34 - opacity: 0.7 onLevelChanged: { @@ -67,13 +64,8 @@ Rectangle { MouseArea { id: mouseArea - - anchors { - left: icon.left - right: bar.right - top: icon.top - bottom: icon.bottom - } + + anchors.fill: parent hoverEnabled: true scrollGestureEnabled: false @@ -109,9 +101,10 @@ Rectangle { Item { id: icon anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - width: parent.width - bar.width - bar.anchors.leftMargin - height: parent.height + anchors.right: parent.horizontalCenter + anchors.rightMargin: 2 + width: 13 + height: 21 Item { anchors.fill: parent @@ -136,14 +129,12 @@ Rectangle { Item { id: bar - anchors { - left: icon.right - leftMargin: 0 - verticalCenter: icon.verticalCenter - } + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.horizontalCenter + anchors.leftMargin: 2 width: 4 - height: parent.height + height: 21 Rectangle { // base id: baseBar diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-clip-i.svg b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-clip-i.svg index f912c1e744..8b694c7f3d 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-clip-i.svg +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-clip-i.svg @@ -1,10 +1,20 @@ - - - - - - - - - - + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-gate-i.svg b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-gate-i.svg index 8255174532..ac70ce66cb 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-gate-i.svg +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-gate-i.svg @@ -1,3 +1,13 @@ - - - + + + + + + image/svg+xml + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-mute-a.svg b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-mute-a.svg index 67eafc27c8..eb36c2dd55 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-mute-a.svg +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-mute-a.svg @@ -1,3 +1,13 @@ - - - + + + + + + image/svg+xml + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-mute-i.svg b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-mute-i.svg index 63af1b0da8..ebca81f370 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-mute-i.svg +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-mute-i.svg @@ -1,3 +1,13 @@ - - - + + + + + + image/svg+xml + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-ptt-a.svg b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-ptt-a.svg index e6df3c69d7..3ce7c0ca51 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-ptt-a.svg +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-ptt-a.svg @@ -1 +1,17 @@ -mic-ptt-a \ No newline at end of file + + + + + + image/svg+xml + + mic-ptt-a + + + + + + + mic-ptt-a + + diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-ptt-i.svg b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-ptt-i.svg index 2141ea5229..3bf1f1bf9e 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-ptt-i.svg +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-ptt-i.svg @@ -1,24 +1,8 @@ - + - +image/svg+xml - + diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-unmute-a.svg b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-unmute-a.svg index 0bf7677017..0bd0b0c238 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-unmute-a.svg +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-unmute-a.svg @@ -1,3 +1,57 @@ - - + + + + + + image/svg+xml + + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-unmute-i.svg b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-unmute-i.svg index 0bf7677017..121873dd1b 100644 --- a/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-unmute-i.svg +++ b/interface/resources/qml/hifi/simplifiedUI/inputDeviceButton/images/mic-unmute-i.svg @@ -1,3 +1,13 @@ - - - + + + + + + image/svg+xml + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml b/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml index 2c1e632cff..6622da33d9 100644 --- a/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/SimplifiedTopBar.qml @@ -122,21 +122,14 @@ Rectangle { width: 48 height: width - AnimatedImage { - visible: avatarButtonImage.source === "" - anchors.centerIn: parent - width: parent.width - 10 - height: width - source: "../images/loading.gif" - } - Image { id: avatarButtonImage - visible: source !== "" - source: "" + source: "./images/defaultAvatar.svg" anchors.centerIn: parent - width: parent.width - 10 + width: 32 height: width + sourceSize.width: width + sourceSize.height: height mipmap: true fillMode: Image.PreserveAspectCrop layer.enabled: true @@ -194,7 +187,9 @@ Rectangle { id: inputDeviceButton anchors.verticalCenter: parent.verticalCenter anchors.left: avatarButtonContainer.right - anchors.leftMargin: 8 + anchors.leftMargin: 6 + width: 32 + height: width } @@ -202,40 +197,46 @@ Rectangle { id: outputDeviceButtonContainer anchors.verticalCenter: parent.verticalCenter anchors.left: inputDeviceButton.right - anchors.leftMargin: 24 - width: 20 + anchors.leftMargin: 2 + width: 32 height: width - HifiStylesUit.HiFiGlyphs { - property bool outputMuted: false + Image { id: outputDeviceButton - text: (outputDeviceButton.outputMuted ? simplifiedUI.glyphs.vol_0 : simplifiedUI.glyphs.vol_3) - color: (outputDeviceButton.outputMuted ? simplifiedUI.colors.controls.outputVolumeButton.text.muted : simplifiedUI.colors.controls.outputVolumeButton.text.noisy) - opacity: outputDeviceButtonMouseArea.containsMouse ? 1.0 : 0.7 - size: 32 + property bool outputMuted: false + source: outputDeviceButton.outputMuted ? "./images/outputDeviceMuted.svg" : "./images/outputDeviceLoud.svg" anchors.centerIn: parent - width: parent.width - height: parent.height - horizontalAlignment: Text.AlignHCenter - MouseArea { - id: outputDeviceButtonMouseArea - anchors.fill: parent - hoverEnabled: true - onEntered: { - Tablet.playSound(TabletEnums.ButtonHover); - } - onClicked: { - Tablet.playSound(TabletEnums.ButtonClick); - outputDeviceButton.outputMuted = !outputDeviceButton.outputMuted; + width: 20 + height: 20 + fillMode: Image.PreserveAspectFit + visible: false + } - sendToScript({ - "source": "SimplifiedTopBar.qml", - "method": "setOutputMuted", - "data": { - "outputMuted": outputDeviceButton.outputMuted - } - }); - } + ColorOverlay { + anchors.fill: outputDeviceButton + opacity: outputDeviceButtonMouseArea.containsMouse ? 1.0 : 0.7 + source: outputDeviceButton + color: (outputDeviceButton.outputMuted ? simplifiedUI.colors.controls.outputVolumeButton.text.muted : simplifiedUI.colors.controls.outputVolumeButton.text.noisy) + } + + MouseArea { + id: outputDeviceButtonMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: { + Tablet.playSound(TabletEnums.ButtonHover); + } + onClicked: { + Tablet.playSound(TabletEnums.ButtonClick); + outputDeviceButton.outputMuted = !outputDeviceButton.outputMuted; + + sendToScript({ + "source": "SimplifiedTopBar.qml", + "method": "setOutputMuted", + "data": { + "outputMuted": outputDeviceButton.outputMuted + } + }); } } } @@ -244,34 +245,40 @@ Rectangle { Item { id: hmdButtonContainer - anchors.top: parent.top - anchors.bottom: parent.bottom + anchors.verticalCenter: parent.verticalCenter anchors.right: settingsButtonContainer.left - anchors.rightMargin: 8 - width: height + anchors.rightMargin: 14 + width: 32 + height: width - HifiStylesUit.HiFiGlyphs { - id: hmdGlyph - text: HMD.active ? simplifiedUI.glyphs.hmd : simplifiedUI.glyphs.screen - color: simplifiedUI.colors.text.white - opacity: hmdGlyphMouseArea.containsMouse ? 1.0 : 0.7 - size: 40 + Image { + id: displayModeImage + source: HMD.active ? "./images/desktopMode.svg" : "./images/vrMode.svg" anchors.centerIn: parent - width: 35 - height: parent.height - horizontalAlignment: Text.AlignHCenter - MouseArea { - id: hmdGlyphMouseArea - anchors.fill: parent - hoverEnabled: true - onEntered: { - Tablet.playSound(TabletEnums.ButtonHover); - } - onClicked: { - Tablet.playSound(TabletEnums.ButtonClick); - // TODO: actually do this right and change the display plugin - HMD.active = !HMD.active; - } + width: 29 + height: 16 + fillMode: Image.PreserveAspectFit + visible: false + } + + ColorOverlay { + anchors.fill: displayModeImage + opacity: displayModeMouseArea.containsMouse ? 1.0 : 0.7 + source: displayModeImage + color: simplifiedUI.colors.text.white + } + + MouseArea { + id: displayModeMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: { + Tablet.playSound(TabletEnums.ButtonHover); + } + onClicked: { + Tablet.playSound(TabletEnums.ButtonClick); + // TODO: actually do this right and change the display plugin + HMD.active = !HMD.active; } } } @@ -280,36 +287,42 @@ Rectangle { Item { id: settingsButtonContainer - anchors.top: parent.top - anchors.bottom: parent.bottom + anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right anchors.rightMargin: 16 - width: height + width: 32 + height: width - HifiStylesUit.HiFiGlyphs { - id: settingsGlyph - text: simplifiedUI.glyphs.gear - color: simplifiedUI.colors.text.white - opacity: settingsGlyphMouseArea.containsMouse ? 1.0 : 0.7 - size: 40 + Image { + id: settingsButtonImage + source: "./images/settings.svg" anchors.centerIn: parent - width: 35 - height: parent.height - horizontalAlignment: Text.AlignHCenter - MouseArea { - id: settingsGlyphMouseArea - anchors.fill: parent - hoverEnabled: true - onEntered: { - Tablet.playSound(TabletEnums.ButtonHover); - } - onClicked: { - Tablet.playSound(TabletEnums.ButtonClick); - sendToScript({ - "source": "SimplifiedTopBar.qml", - "method": "toggleSettingsApp" - }); - } + width: 20 + height: 20 + fillMode: Image.PreserveAspectFit + visible: false + } + + ColorOverlay { + opacity: settingsButtonMouseArea.containsMouse ? 1.0 : 0.7 + anchors.fill: settingsButtonImage + source: settingsButtonImage + color: simplifiedUI.colors.text.white + } + + MouseArea { + id: settingsButtonMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: { + Tablet.playSound(TabletEnums.ButtonHover); + } + onClicked: { + Tablet.playSound(TabletEnums.ButtonClick); + sendToScript({ + "source": "SimplifiedTopBar.qml", + "method": "toggleSettingsApp" + }); } } } @@ -322,6 +335,9 @@ Rectangle { downloadUrl = topBarInventoryModel.get(i).download_url; previewUrl = topBarInventoryModel.get(i).preview; if (MyAvatar.skeletonModelURL === downloadUrl) { + if (previewUrl.indexOf("missing.png") > -1) { + previewUrl = "../images/defaultAvatar.svg"; + } avatarButtonImage.source = previewUrl; return; } @@ -336,7 +352,11 @@ Rectangle { switch (message.method) { case "updateAvatarThumbnailURL": - avatarButtonImage.source = message.data.avatarThumbnailURL; + if (message.data.avatarThumbnailURL.indexOf("defaultAvatar.svg") > -1) { + avatarButtonImage.source = "../images/defaultAvatar.svg"; + } else { + avatarButtonImage.source = message.data.avatarThumbnailURL; + } break; case "updateOutputMuted": diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/images/defaultAvatar.jpg b/interface/resources/qml/hifi/simplifiedUI/topBar/images/defaultAvatar.jpg deleted file mode 100644 index 821be6c584..0000000000 Binary files a/interface/resources/qml/hifi/simplifiedUI/topBar/images/defaultAvatar.jpg and /dev/null differ diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/images/desktopMode.svg b/interface/resources/qml/hifi/simplifiedUI/topBar/images/desktopMode.svg new file mode 100644 index 0000000000..8b04caca88 --- /dev/null +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/images/desktopMode.svg @@ -0,0 +1,13 @@ + + + + + + image/svg+xml + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/images/outputDeviceLoud.svg b/interface/resources/qml/hifi/simplifiedUI/topBar/images/outputDeviceLoud.svg new file mode 100644 index 0000000000..ebd844c471 --- /dev/null +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/images/outputDeviceLoud.svg @@ -0,0 +1,3 @@ + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/images/outputDeviceMuted.svg b/interface/resources/qml/hifi/simplifiedUI/topBar/images/outputDeviceMuted.svg new file mode 100644 index 0000000000..4188175c31 --- /dev/null +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/images/outputDeviceMuted.svg @@ -0,0 +1,14 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/images/settings.svg b/interface/resources/qml/hifi/simplifiedUI/topBar/images/settings.svg new file mode 100644 index 0000000000..04a031d498 --- /dev/null +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/images/settings.svg @@ -0,0 +1,13 @@ + + + + + + image/svg+xml + + + + + + + diff --git a/interface/resources/qml/hifi/simplifiedUI/topBar/images/vrMode.svg b/interface/resources/qml/hifi/simplifiedUI/topBar/images/vrMode.svg new file mode 100644 index 0000000000..57b564813d --- /dev/null +++ b/interface/resources/qml/hifi/simplifiedUI/topBar/images/vrMode.svg @@ -0,0 +1,13 @@ + + + + + + image/svg+xml + + + + + + + diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 7978cd39da..be8fb1cdad 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -192,7 +192,7 @@ #include "scripting/WalletScriptingInterface.h" #include "scripting/TTSScriptingInterface.h" #include "scripting/KeyboardScriptingInterface.h" -#include "scripting/RefreshRateScriptingInterface.h" +#include "scripting/PerformanceScriptingInterface.h" #include "scripting/RenderScriptingInterface.h" #if defined(Q_OS_MAC) || defined(Q_OS_WIN) @@ -3273,7 +3273,7 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { surfaceContext->setContextProperty("Controller", DependencyManager::get().data()); surfaceContext->setContextProperty("Entities", DependencyManager::get().data()); - surfaceContext->setContextProperty("RefreshRate", new RefreshRateScriptingInterface()); + surfaceContext->setContextProperty("Performance", new PerformanceScriptingInterface()); _fileDownload = new FileScriptingInterface(engine); surfaceContext->setContextProperty("File", _fileDownload); connect(_fileDownload, &FileScriptingInterface::unzipResult, this, &Application::handleUnzip); @@ -3423,7 +3423,7 @@ void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditiona surfaceContext->setContextProperty("Settings", SettingsScriptingInterface::getInstance()); surfaceContext->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance()); - surfaceContext->setContextProperty("RefreshRate", new RefreshRateScriptingInterface()); + surfaceContext->setContextProperty("Performance", new PerformanceScriptingInterface()); surfaceContext->setContextProperty("Account", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED surfaceContext->setContextProperty("GlobalServices", AccountServicesScriptingInterface::getInstance()); // DEPRECATED - TO BE REMOVED @@ -7391,7 +7391,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe scriptEngine->registerGlobalObject("LODManager", DependencyManager::get().data()); scriptEngine->registerGlobalObject("Keyboard", DependencyManager::get().data()); - scriptEngine->registerGlobalObject("RefreshRate", new RefreshRateScriptingInterface); + scriptEngine->registerGlobalObject("Performance", new PerformanceScriptingInterface()); scriptEngine->registerGlobalObject("Paths", DependencyManager::get().data()); diff --git a/interface/src/RefreshRateManager.cpp b/interface/src/RefreshRateManager.cpp index 0c5bcd405e..f2033b9491 100644 --- a/interface/src/RefreshRateManager.cpp +++ b/interface/src/RefreshRateManager.cpp @@ -13,13 +13,8 @@ #include "RefreshRateManager.h" #include -#include -#include - -#include - static const int VR_TARGET_RATE = 90; static const std::array REFRESH_RATE_PROFILE_TO_STRING = diff --git a/interface/src/RefreshRateManager.h b/interface/src/RefreshRateManager.h index 6ded8c8869..6316de3bfb 100644 --- a/interface/src/RefreshRateManager.h +++ b/interface/src/RefreshRateManager.h @@ -14,6 +14,7 @@ #include #include +#include #include diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index 127bca9eba..aa50b42075 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -879,35 +879,40 @@ void Wallet::sendChallengeOwnershipResponses() { textByteArraySize = textByteArray.size(); int idSize = id.size(); // setup the packet - Node& sendingNode = *nodeList->nodeWithLocalID(packet->getSourceID()); - if (challengeOriginatedFromClient) { - auto textPacket = NLPacket::create(PacketType::ChallengeOwnershipReply, - idSize + textByteArraySize + challengingNodeUUIDByteArraySize + 3 * sizeof(int), - true); + const SharedNodePointer sendingNode = nodeList->nodeWithLocalID(packet->getSourceID()); + if (!sendingNode.isNull()) { + if (challengeOriginatedFromClient) { + auto textPacket = NLPacket::create(PacketType::ChallengeOwnershipReply, + idSize + textByteArraySize + challengingNodeUUIDByteArraySize + 3 * sizeof(int), + true); - textPacket->writePrimitive(idSize); - textPacket->writePrimitive(textByteArraySize); - textPacket->writePrimitive(challengingNodeUUIDByteArraySize); - textPacket->write(id); - textPacket->write(textByteArray); - textPacket->write(challengingNodeUUID); + textPacket->writePrimitive(idSize); + textPacket->writePrimitive(textByteArraySize); + textPacket->writePrimitive(challengingNodeUUIDByteArraySize); + textPacket->write(id); + textPacket->write(textByteArray); + textPacket->write(challengingNodeUUID); - qCDebug(commerce) << "Sending ChallengeOwnershipReply Packet containing signed text" << textByteArray << "for id" << id; + qCDebug(commerce) << "Sending ChallengeOwnershipReply Packet containing signed text" << textByteArray << "for id" << id; - nodeList->sendPacket(std::move(textPacket), sendingNode); + nodeList->sendPacket(std::move(textPacket), *sendingNode); + } else { + auto textPacket = NLPacket::create(PacketType::ChallengeOwnership, idSize + textByteArraySize + 2 * sizeof(int), true); + + textPacket->writePrimitive(idSize); + textPacket->writePrimitive(textByteArraySize); + textPacket->write(id); + textPacket->write(textByteArray); + + qCDebug(commerce) << "Sending ChallengeOwnership Packet containing signed text" << textByteArray << "for id" << id; + + nodeList->sendPacket(std::move(textPacket), *sendingNode); + } } else { - auto textPacket = NLPacket::create(PacketType::ChallengeOwnership, idSize + textByteArraySize + 2 * sizeof(int), true); - - textPacket->writePrimitive(idSize); - textPacket->writePrimitive(textByteArraySize); - textPacket->write(id); - textPacket->write(textByteArray); - - qCDebug(commerce) << "Sending ChallengeOwnership Packet containing signed text" << textByteArray << "for id" << id; - - nodeList->sendPacket(std::move(textPacket), sendingNode); + qCDebug(commerce) << "Challenging Node Local ID" << packet->getSourceID() << "disconnected before response"; } + if (status == -1) { qCDebug(commerce) << "During entity ownership challenge, signing the text failed."; long error = ERR_get_error(); diff --git a/interface/src/scripting/PerformanceScriptingInterface.cpp b/interface/src/scripting/PerformanceScriptingInterface.cpp new file mode 100644 index 0000000000..b1b4e62dca --- /dev/null +++ b/interface/src/scripting/PerformanceScriptingInterface.cpp @@ -0,0 +1,40 @@ +// +// Created by Bradley Austin Davis on 2019/05/14 +// Copyright 2013-2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + + +#include "PerformanceScriptingInterface.h" + +#include "../Application.h" + +std::once_flag PerformanceScriptingInterface::registry_flag; + +PerformanceScriptingInterface::PerformanceScriptingInterface() { + std::call_once(registry_flag, [] { + qmlRegisterType("PerformanceEnums", 1, 0, "RefreshRate"); + }); +} + +void PerformanceScriptingInterface::setRefreshRateProfile(RefreshRateProfile refreshRateProfile) { + qApp->getRefreshRateManager().setRefreshRateProfile((RefreshRateManager::RefreshRateProfile)refreshRateProfile); +} + +PerformanceScriptingInterface::RefreshRateProfile PerformanceScriptingInterface::getRefreshRateProfile() const { + return (PerformanceScriptingInterface::RefreshRateProfile)qApp->getRefreshRateManager().getRefreshRateProfile(); +} + +int PerformanceScriptingInterface::getActiveRefreshRate() const { + return qApp->getRefreshRateManager().getActiveRefreshRate(); +} + +RefreshRateManager::UXMode PerformanceScriptingInterface::getUXMode() const { + return qApp->getRefreshRateManager().getUXMode(); +} + +RefreshRateManager::RefreshRateRegime PerformanceScriptingInterface::getRefreshRateRegime() const { + return qApp->getRefreshRateManager().getRefreshRateRegime(); +} diff --git a/interface/src/scripting/PerformanceScriptingInterface.h b/interface/src/scripting/PerformanceScriptingInterface.h new file mode 100644 index 0000000000..90b51d173c --- /dev/null +++ b/interface/src/scripting/PerformanceScriptingInterface.h @@ -0,0 +1,48 @@ +// +// Created by Bradley Austin Davis on 2019/05/14 +// Copyright 2013-2019 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#pragma once +#ifndef hifi_PerformanceScriptingInterface_h +#define hifi_PerformanceScriptingInterface_h + +#include + +#include + +#include "../RefreshRateManager.h" + + +class PerformanceScriptingInterface : public QObject { + Q_OBJECT +public: + // Must match RefreshRateManager enums + enum RefreshRateProfile { + ECO = RefreshRateManager::RefreshRateProfile::ECO, + INTERACTIVE = RefreshRateManager::RefreshRateProfile::INTERACTIVE, + REALTIME = RefreshRateManager::RefreshRateProfile::REALTIME, + }; + Q_ENUM(RefreshRateProfile) + + + PerformanceScriptingInterface(); + ~PerformanceScriptingInterface() = default; + +public slots: + void setRefreshRateProfile(RefreshRateProfile refreshRateProfile); + RefreshRateProfile getRefreshRateProfile() const; + + int getActiveRefreshRate() const; + RefreshRateManager::UXMode getUXMode() const; + RefreshRateManager::RefreshRateRegime getRefreshRateRegime() const; + + +private: + static std::once_flag registry_flag; +}; + +#endif // header guard diff --git a/interface/src/scripting/RefreshRateScriptingInterface.h b/interface/src/scripting/RefreshRateScriptingInterface.h deleted file mode 100644 index 697141583f..0000000000 --- a/interface/src/scripting/RefreshRateScriptingInterface.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// RefreshRateScriptingInterface.h -// interface/src/scrfipting -// -// Created by Dante Ruiz on 2019-04-15. -// Copyright 2019 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_RefreshRateScriptingInterface_h -#define hifi_RefreshRateScriptingInterface_h - -#include - -#include - -class RefreshRateScriptingInterface : public QObject { - Q_OBJECT -public: - RefreshRateScriptingInterface() = default; - ~RefreshRateScriptingInterface() = default; - -public: - Q_INVOKABLE QString getRefreshRateProfile() { - RefreshRateManager& refreshRateManager = qApp->getRefreshRateManager(); - return QString::fromStdString(RefreshRateManager::refreshRateProfileToString(refreshRateManager.getRefreshRateProfile())); - } - - Q_INVOKABLE QString getRefreshRateRegime() { - RefreshRateManager& refreshRateManager = qApp->getRefreshRateManager(); - return QString::fromStdString(RefreshRateManager::refreshRateRegimeToString(refreshRateManager.getRefreshRateRegime())); - } - - Q_INVOKABLE QString getUXMode() { - RefreshRateManager& refreshRateManager = qApp->getRefreshRateManager(); - return QString::fromStdString(RefreshRateManager::uxModeToString(refreshRateManager.getUXMode())); - } - - Q_INVOKABLE int getActiveRefreshRate() { - return qApp->getRefreshRateManager().getActiveRefreshRate(); - } -}; - -#endif diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index 954c3e4590..eb967dde89 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include "AndroidHelper.h" @@ -609,3 +610,31 @@ void WindowScriptingInterface::onMessageBoxSelected(int button) { float WindowScriptingInterface::domainLoadingProgress() { return qApp->getOctreePacketProcessor().domainLoadingProgress(); } + +int WindowScriptingInterface::getDisplayPluginCount() { + return (int)PluginManager::getInstance()->getDisplayPlugins().size(); +} + +QString WindowScriptingInterface::getDisplayPluginName(int index) { + return PluginManager::getInstance()->getDisplayPlugins().at(index)->getName(); +} + +bool WindowScriptingInterface::isDisplayPluginHmd(int index) { + return PluginManager::getInstance()->getDisplayPlugins().at(index)->isHmd(); +} + +int WindowScriptingInterface::getActiveDisplayPlugin() { + auto active = qApp->getActiveDisplayPlugin(); + auto size = getDisplayPluginCount(); + for (int i = 0; i < size; ++i) { + if (PluginManager::getInstance()->getDisplayPlugins().at(i) == active) { + return i; + } + } + return -1; +} + +void WindowScriptingInterface::setActiveDisplayPlugin(int index) { + auto name = PluginManager::getInstance()->getDisplayPlugins().at(index)->getName(); + qApp->setActiveDisplayPlugin(name); +} diff --git a/interface/src/scripting/WindowScriptingInterface.h b/interface/src/scripting/WindowScriptingInterface.h index 9a314cad6a..dd3f01dd17 100644 --- a/interface/src/scripting/WindowScriptingInterface.h +++ b/interface/src/scripting/WindowScriptingInterface.h @@ -558,6 +558,44 @@ public slots: */ float domainLoadingProgress(); + /**jsdoc + * Return the number of display plugins currently available + * @function Window.getDisplayPluginCount + * @returns {int} The number of currently available display plugins + */ + int getDisplayPluginCount(); + + /**jsdoc + * Return the human readable name of a display plugin + * @function Window.getDisplayPluginName + * @param {int} index - The index of the display plugin. Must be less than the value returned by {@link Window.getDisplayPluginCount|getDisplayPluginCount}. + * @returns {string} The name of the specified display plugin + */ + QString getDisplayPluginName(int index); + + /**jsdoc + * Return whether a given display plugin is an HMD + * @function Window.isDisplayPluginHmd + * @param {int} index - The index of the display plugin. Must be less than the value returned by {@link Window.getDisplayPluginCount|getDisplayPluginCount}. + * @returns {bool} True if the specified display plugin is a HMD + */ + bool isDisplayPluginHmd(int index); + + /**jsdoc + * Return the currently active display plugin + * @function Window.getActiveDisplayPlugin + * @returns {int} The index of the currently active display plugin + */ + int getActiveDisplayPlugin(); + + /**jsdoc + * Return the currently active display plugin + * @function Window.setActiveDisplayPlugin + * @param {int} index - The index of the display plugin. Must be less than the value returned by {@link Window.getDisplayPluginCount|getDisplayPluginCount}. + */ + void setActiveDisplayPlugin(int index); + + private slots: void onWindowGeometryChanged(const QRect& geometry); void onMessageBoxSelected(int button); diff --git a/scripts/system/simplifiedUI/simplifiedUI.js b/scripts/system/simplifiedUI/simplifiedUI.js index 3f22f376cf..c6181d2ad9 100644 --- a/scripts/system/simplifiedUI/simplifiedUI.js +++ b/scripts/system/simplifiedUI/simplifiedUI.js @@ -15,7 +15,6 @@ // START CONFIG OPTIONS var DOCKED_QML_SUPPORTED = true; -var REMOVE_EXISTING_UI = true; var TOOLBAR_NAME = "com.highfidelity.interface.toolbar.system"; var DEFAULT_SCRIPTS_PATH_PREFIX = ScriptDiscoveryService.defaultScriptsPath + "/"; // END CONFIG OPTIONS @@ -24,7 +23,7 @@ var DEFAULT_SCRIPTS_PATH_PREFIX = ScriptDiscoveryService.defaultScriptsPath + "/ var DEFAULT_SCRIPTS_SEPARATE = [ DEFAULT_SCRIPTS_PATH_PREFIX + "system/controllers/controllerScripts.js" ]; -function loadSeparateDefaults() { +function loadNewSeparateDefaults() { for (var i in DEFAULT_SCRIPTS_SEPARATE) { Script.load(DEFAULT_SCRIPTS_SEPARATE[i]); } @@ -36,7 +35,7 @@ var DEFAULT_SCRIPTS_COMBINED = [ DEFAULT_SCRIPTS_PATH_PREFIX + "system/progress.js", DEFAULT_SCRIPTS_PATH_PREFIX + "system/away.js" ]; -function runDefaultsTogether() { +function runNewDefaultsTogether() { for (var i in DEFAULT_SCRIPTS_COMBINED) { Script.include(DEFAULT_SCRIPTS_COMBINED[i]); } @@ -47,10 +46,13 @@ function runDefaultsTogether() { // Until then, users are required to access some functionality from the top menu bar. //var MENU_NAMES = ["File", "Edit", "Display", "View", "Navigate", "Settings", "Developer", "Help"]; var MENU_NAMES = ["File", "Edit", "View", "Navigate", "Help"]; -function removeDesktopMenu() { - MENU_NAMES.forEach(function(menu) { - Menu.removeMenu(menu); - }); +var keepMenusSetting = Settings.getValue("simplifiedUI/keepMenus", false); +function maybeRemoveDesktopMenu() { + if (!keepMenusSetting) { + MENU_NAMES.forEach(function(menu) { + Menu.removeMenu(menu); + }); + } } @@ -436,18 +438,21 @@ function ensureFirstPersonCameraInHMD(isHMDMode) { var simplifiedNametag = Script.require("../simplifiedNametag/simplifiedNametag.js"); var oldShowAudioTools; var oldShowBubbleTools; +var keepExistingUIAndScriptsSetting = Settings.getValue("simplifiedUI/keepExistingUIAndScripts", false); function startup() { - if (REMOVE_EXISTING_UI) { + maybeRemoveDesktopMenu(); + + if (!keepExistingUIAndScriptsSetting) { pauseCurrentScripts(); - removeDesktopMenu(); - runDefaultsTogether(); - loadSeparateDefaults(); + runNewDefaultsTogether(); + loadNewSeparateDefaults(); if (!HMD.active) { var toolbar = Toolbars.getToolbar(TOOLBAR_NAME); toolbar.writeProperty("visible", false); } } + loadSimplifiedTopBar(); simplifiedNametag.create(); @@ -476,7 +481,7 @@ function restoreScripts() { function shutdown() { restoreScripts(); - if (REMOVE_EXISTING_UI) { + if (!keepExistingUIAndScriptsSetting) { Window.confirm("You'll have to restart Interface to get full functionality back. Clicking yes or no will dismiss this dialog."); if (!HMD.active) {