From d9dc8ebc41b9810a09555029348d2e407be0568c Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 13 Apr 2017 15:48:51 -0700 Subject: [PATCH 1/9] More improvements --- .../qml/hifi/tablet/TabletAddressDialog.qml | 162 ++++++------------ interface/src/Menu.cpp | 2 +- .../DialogsManagerScriptingInterface.cpp | 16 ++ .../DialogsManagerScriptingInterface.h | 3 + interface/src/ui/DialogsManager.cpp | 21 ++- interface/src/ui/DialogsManager.h | 1 + interface/src/ui/overlays/Web3DOverlay.cpp | 1 + 7 files changed, 95 insertions(+), 111 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 356ff92664..b84e1ae9d4 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -21,7 +21,7 @@ import "../../styles-uit" as HifiStyles import "../../controls-uit" as HifiControls StackView { - id: root + id: root; HifiConstants { id: hifi } HifiStyles.HifiConstants { id: hifiStyleConstants } initialItem: addressBarDialog @@ -34,24 +34,16 @@ StackView { property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/"; property var tablet: null; - property bool isDesktop: false; Component { id: tabletStoryCard; TabletStoryCard {} } Component.onCompleted: { - root.currentItem.focus = true; - root.currentItem.forceActiveFocus(); - addressLine.focus = true; - addressLine.forceActiveFocus(); fillDestinations(); updateLocationText(false); + fillDestinations(); + addressLine.focus = true; root.parentChanged.connect(center); center(); - isDesktop = (typeof desktop !== "undefined"); tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - - if (desktop) { - root.title = "GOTO"; - } } Component.onDestruction: { root.parentChanged.disconnect(center); @@ -78,8 +70,6 @@ StackView { toggleOrGo(true, targetString); clearAddressLineTimer.start(); } - - property bool isCursorVisible: false // Override default cursor visibility. AddressBarDialog { @@ -102,16 +92,11 @@ StackView { onMetaverseServerUrlChanged: updateLocationTextTimer.start(); Rectangle { id: navBar - width: 480 - height: 70 + width: parent.width + height: 50; color: hifiStyleConstants.colors.white - anchors { - top: parent.top - right: parent.right - rightMargin: 0 - left: parent.left - leftMargin: 0 - } + anchors.top: parent.top; + anchors.left: parent.left; ToolbarButton { id: homeButton @@ -149,85 +134,77 @@ StackView { Rectangle { id: addressBar - width: 480 + width: parent.width height: 70 color: hifiStyleConstants.colors.white anchors { - top: navBar.bottom - right: parent.right - rightMargin: 16 - left: parent.left - leftMargin: 16 + top: navBar.bottom; + left: parent.left; } - property int inputAreaHeight: 70 - property int inputAreaStep: (height - inputAreaHeight) / 2 - HifiStyles.RalewayLight { id: notice; - font.pixelSize: hifi.fonts.pixelSize * 0.50; + font.pixelSize: hifi.fonts.pixelSize * 0.7; anchors { - top: parent.top - topMargin: parent.inputAreaStep + 12 - left: addressLine.left - right: addressLine.right + top: parent.top; + left: addressLineContainer.left; + right: addressLineContainer.right; } } + HifiStyles.FiraSansRegular { id: location; + anchors { + left: addressLineContainer.left; + leftMargin: 8; + verticalCenter: addressLineContainer.verticalCenter; + } font.pixelSize: addressLine.font.pixelSize; color: "gray"; clip: true; - anchors.fill: addressLine; visible: addressLine.text.length === 0 } TextInput { id: addressLine - focus: true + width: addressLineContainer.width - addressLineContainer.anchors.leftMargin - addressLineContainer.anchors.rightMargin; anchors { - bottom: parent.bottom - left: parent.left - right: parent.right - leftMargin: 16 - rightMargin: 16 - topMargin: parent.inputAreaStep + (2 * hifi.layout.spacing) - bottomMargin: parent.inputAreaStep + left: addressLineContainer.left; + leftMargin: 8; + verticalCenter: addressLineContainer.verticalCenter; } font.pixelSize: hifi.fonts.pixelSize * 0.75 - cursorVisible: false onTextChanged: { filterChoicesByText(); updateLocationText(text.length > 0); - if (!isCursorVisible && text.length > 0) { - isCursorVisible = true; - cursorVisible = true; - } } onAccepted: { addressBarDialog.keyboardEnabled = false; - } - onActiveFocusChanged: { - cursorVisible = isCursorVisible && focus; - } - MouseArea { - // If user clicks in address bar show cursor to indicate ability to enter address. - anchors.fill: parent - onClicked: { - isCursorVisible = true; - parent.cursorVisible = true; - parent.focus = true; - parent.forceActiveFocus(); - addressBarDialog.keyboardEnabled = HMD.active - tabletRoot.playButtonClickSound(); - } + toggleOrGo(); } } Rectangle { - anchors.fill: addressLine + id: addressLineContainer; + height: 40; + anchors { + top: notice.bottom; + topMargin: 2; + left: parent.left; + leftMargin: 16; + right: parent.right; + rightMargin: 16; + } color: hifiStyleConstants.colors.lightGray opacity: 0.1 + MouseArea { + anchors.fill: parent + onClicked: { + addressLine.focus = true; + addressBarDialog.keyboardEnabled = HMD.active; + tabletRoot.playButtonClickSound(); + } + } } } Rectangle { @@ -347,13 +324,12 @@ StackView { Timer { // Delay clearing address line so as to avoid flicker of "not connected" being displayed after entering an address. - id: clearAddressLineTimer - running: false - interval: 100 // ms - repeat: false + id: clearAddressLineTimer; + running: false; + interval: 100; // ms + repeat: false; onTriggered: { addressLine.text = ""; - isCursorVisible = false; } } @@ -545,46 +521,14 @@ StackView { } } - onVisibleChanged: { - updateLocationText(false); - if (visible) { - addressLine.forceActiveFocus(); - fillDestinations(); - } - } - function toggleOrGo(fromSuggestions, address) { if (address !== undefined && address !== "") { - addressBarDialog.loadAddress(address, fromSuggestions) - } - - if (addressLine.text !== "") { - addressBarDialog.loadAddress(addressLine.text, fromSuggestions) - } - - if (isDesktop) { - tablet.gotoHomeScreen(); - } else { - HMD.closeTablet(); - } - - tabletRoot.shown = false; - } - - Keys.onPressed: { - switch (event.key) { - case Qt.Key_Escape: - case Qt.Key_Back: - tabletRoot.shown = false - clearAddressLineTimer.start(); - event.accepted = true - break - case Qt.Key_Enter: - case Qt.Key_Return: - toggleOrGo() - clearAddressLineTimer.start(); - event.accepted = true - break + addressBarDialog.loadAddress(address, fromSuggestions); + clearAddressLineTimer.start(); + } else if (addressLine.text !== "") { + addressBarDialog.loadAddress(addressLine.text, fromSuggestions); + clearAddressLineTimer.start(); } + DialogsManager.hideAddressBar(); } } diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 23d689e339..2451f42bca 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -254,7 +254,7 @@ Menu::Menu() { // Navigate > Show Address Bar addActionToQMenuAndActionHash(navigateMenu, MenuOption::AddressBar, Qt::CTRL | Qt::Key_L, - dialogsManager.data(), SLOT(toggleAddressBar())); + dialogsManager.data(), SLOT(showAddressBar())); // Navigate > Bookmark related menus -- Note: the Bookmark class adds its own submenus here. qApp->getBookmarks()->setupMenus(this, navigateMenu); diff --git a/interface/src/scripting/DialogsManagerScriptingInterface.cpp b/interface/src/scripting/DialogsManagerScriptingInterface.cpp index 1604c45593..f1c96b4309 100644 --- a/interface/src/scripting/DialogsManagerScriptingInterface.cpp +++ b/interface/src/scripting/DialogsManagerScriptingInterface.cpp @@ -22,11 +22,27 @@ DialogsManagerScriptingInterface::DialogsManagerScriptingInterface() { this, &DialogsManagerScriptingInterface::addressBarShown); } + +DialogsManagerScriptingInterface* DialogsManagerScriptingInterface::getInstance() { + static DialogsManagerScriptingInterface sharedInstance; + return &sharedInstance; +} + void DialogsManagerScriptingInterface::toggleAddressBar() { QMetaObject::invokeMethod(DependencyManager::get().data(), "toggleAddressBar", Qt::QueuedConnection); } +void DialogsManagerScriptingInterface::showAddressBar() { + QMetaObject::invokeMethod(DependencyManager::get().data(), + "showAddressBar", Qt::QueuedConnection); +} + +void DialogsManagerScriptingInterface::hideAddressBar() { + QMetaObject::invokeMethod(DependencyManager::get().data(), + "hideAddressBar", Qt::QueuedConnection); +} + void DialogsManagerScriptingInterface::showFeed() { QMetaObject::invokeMethod(DependencyManager::get().data(), "showFeed", Qt::QueuedConnection); diff --git a/interface/src/scripting/DialogsManagerScriptingInterface.h b/interface/src/scripting/DialogsManagerScriptingInterface.h index 86cd22af1c..aa231afb4a 100644 --- a/interface/src/scripting/DialogsManagerScriptingInterface.h +++ b/interface/src/scripting/DialogsManagerScriptingInterface.h @@ -18,10 +18,13 @@ class DialogsManagerScriptingInterface : public QObject { Q_OBJECT public: DialogsManagerScriptingInterface(); + static DialogsManagerScriptingInterface* getInstance(); Q_INVOKABLE void showFeed(); public slots: void toggleAddressBar(); + void showAddressBar(); + void hideAddressBar(); signals: void addressBarToggled(); diff --git a/interface/src/ui/DialogsManager.cpp b/interface/src/ui/DialogsManager.cpp index a95ac8d91f..c5932aae07 100644 --- a/interface/src/ui/DialogsManager.cpp +++ b/interface/src/ui/DialogsManager.cpp @@ -67,12 +67,14 @@ void DialogsManager::toggleAddressBar() { emit addressBarToggled(); } else { tablet->loadQMLSource(TABLET_ADDRESS_DIALOG); + qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID()); _closeAddressBar = true; emit addressBarToggled(); } } else { tablet->loadQMLSource(TABLET_ADDRESS_DIALOG); hmd->openTablet(); + qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID()); _closeAddressBar = true; emit addressBarToggled(); } @@ -84,11 +86,28 @@ void DialogsManager::showAddressBar() { auto hmd = DependencyManager::get(); auto tabletScriptingInterface = DependencyManager::get(); auto tablet = dynamic_cast(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); - tablet->loadQMLSource(TABLET_ADDRESS_DIALOG); + if (!tablet->isPathLoaded(TABLET_ADDRESS_DIALOG)) { + tablet->loadQMLSource(TABLET_ADDRESS_DIALOG); + } if (!hmd->getShouldShowTablet()) { hmd->openTablet(); } + qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID()); + emit addressBarShown(true); +} + +void DialogsManager::hideAddressBar() { + auto hmd = DependencyManager::get(); + auto tabletScriptingInterface = DependencyManager::get(); + auto tablet = dynamic_cast(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); + + if (tablet->isPathLoaded(TABLET_ADDRESS_DIALOG)) { + tablet->gotoHomeScreen(); + hmd->closeTablet(); + } + qApp->setKeyboardFocusOverlay(UNKNOWN_OVERLAY_ID); + emit addressBarShown(false); } void DialogsManager::showFeed() { diff --git a/interface/src/ui/DialogsManager.h b/interface/src/ui/DialogsManager.h index 24b9078baf..76c4f083d2 100644 --- a/interface/src/ui/DialogsManager.h +++ b/interface/src/ui/DialogsManager.h @@ -43,6 +43,7 @@ public: public slots: void toggleAddressBar(); void showAddressBar(); + void hideAddressBar(); void showFeed(); void setDomainConnectionFailureVisibility(bool visible); void toggleLoginDialog(); diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 502006c862..f80589e5a1 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -198,6 +198,7 @@ void Web3DOverlay::loadSourceURL() { _webSurface->getRootContext()->setContextProperty("AvatarInputs", AvatarInputs::getInstance()); _webSurface->getRootContext()->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance()); _webSurface->getRootContext()->setContextProperty("AvatarList", DependencyManager::get().data()); + _webSurface->getRootContext()->setContextProperty("DialogsManager", DialogsManagerScriptingInterface::getInstance()); _webSurface->getRootContext()->setContextProperty("pathToFonts", "../../"); tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data()); From 520ceebf5b9622befe6739aa7379c1ddf7a61249 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 13 Apr 2017 15:52:59 -0700 Subject: [PATCH 2/9] Small HMD tweaks --- .../resources/qml/hifi/tablet/TabletAddressDialog.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index b84e1ae9d4..620b1ace1c 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -40,7 +40,7 @@ StackView { fillDestinations(); updateLocationText(false); fillDestinations(); - addressLine.focus = true; + addressLine.focus = !HMD.active; root.parentChanged.connect(center); center(); tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); @@ -200,8 +200,13 @@ StackView { MouseArea { anchors.fill: parent onClicked: { - addressLine.focus = true; - addressBarDialog.keyboardEnabled = HMD.active; + if (!addressLine.focus || !HMD.active) { + addressLine.focus = true; + addressBarDialog.keyboardEnabled = HMD.active; + } else { + addressLine.focus = false; + addressBarDialog.keyboardEnabled = false; + } tabletRoot.playButtonClickSound(); } } From 054370908130562edd617978fdf71a7338da0f3d Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 13 Apr 2017 16:10:36 -0700 Subject: [PATCH 3/9] Focus fix --- interface/resources/qml/hifi/tablet/TabletAddressDialog.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 620b1ace1c..801b279591 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -198,10 +198,11 @@ StackView { color: hifiStyleConstants.colors.lightGray opacity: 0.1 MouseArea { - anchors.fill: parent + anchors.fill: parent; onClicked: { if (!addressLine.focus || !HMD.active) { addressLine.focus = true; + addressLine.forceActiveFocus(); addressBarDialog.keyboardEnabled = HMD.active; } else { addressLine.focus = false; @@ -516,7 +517,7 @@ StackView { function updateLocationText(enteringAddress) { if (enteringAddress) { - notice.text = "Go to a place, @user, path or network address"; + notice.text = "Go To a place, @user, path, or network address:"; notice.color = hifiStyleConstants.colors.baseGrayHighlight; } else { notice.text = AddressManager.isConnected ? "Your location:" : "Not Connected"; From a623ced64ea8f76dbde1465bdd2e2f8bdbbec271 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 14 Apr 2017 12:43:07 -0700 Subject: [PATCH 4/9] Fix hover states on back/forward buttons --- .../qml/hifi/tablet/TabletAddressDialog.qml | 18 +++++++++++-- .../qml/hifi/toolbars/ToolbarButton.qml | 27 ++++++++++++------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 801b279591..fec55d0594 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -20,6 +20,8 @@ import "../toolbars" import "../../styles-uit" as HifiStyles import "../../controls-uit" as HifiControls +// references HMD, AddressManager, AddressBarDialog from root context + StackView { id: root; HifiConstants { id: hifi } @@ -114,8 +116,14 @@ StackView { } ToolbarButton { id: backArrow; + buttonState: addressBarDialog.backEnabled; imageURL: "../../../images/backward.svg"; - onClicked: addressBarDialog.loadBack(); + buttonEnabled: addressBarDialog.backEnabled; + onClicked: { + if (buttonEnabled) { + addressBarDialog.loadBack(); + } + } anchors { left: homeButton.right verticalCenter: parent.verticalCenter @@ -123,8 +131,14 @@ StackView { } ToolbarButton { id: forwardArrow; + buttonState: addressBarDialog.forwardEnabled; imageURL: "../../../images/forward.svg"; - onClicked: addressBarDialog.loadForward(); + buttonEnabled: addressBarDialog.forwardEnabled; + onClicked: { + if (buttonEnabled) { + addressBarDialog.loadForward(); + } + } anchors { left: backArrow.right verticalCenter: parent.verticalCenter diff --git a/interface/resources/qml/hifi/toolbars/ToolbarButton.qml b/interface/resources/qml/hifi/toolbars/ToolbarButton.qml index cab5b14d5c..3d4231ced7 100644 --- a/interface/resources/qml/hifi/toolbars/ToolbarButton.qml +++ b/interface/resources/qml/hifi/toolbars/ToolbarButton.qml @@ -3,6 +3,8 @@ import QtQuick.Controls 1.4 StateImage { id: button + + property bool buttonEnabled: true property bool isActive: false property bool isEntered: false @@ -39,30 +41,37 @@ StateImage { } function updateState() { - if (!button.isEntered && !button.isActive) { - buttonState = imageOffOut; - } else if (!button.isEntered && button.isActive) { - buttonState = imageOnOut; - } else if (button.isEntered && !button.isActive) { - buttonState = imageOffIn; + if (buttonEnabled) { + if (!button.isEntered && !button.isActive) { + buttonState = imageOffOut; + } else if (!button.isEntered && button.isActive) { + buttonState = imageOnOut; + } else if (button.isEntered && !button.isActive) { + buttonState = imageOffIn; + } else { + buttonState = imageOnIn; + } } else { - buttonState = imageOnIn; + buttonState = 0; } } onIsActiveChanged: updateState(); + onButtonEnabledChanged: updateState(); Timer { id: asyncClickSender interval: 10 repeat: false running: false - onTriggered: button.clicked(); + onTriggered: { + button.clicked(); + } } MouseArea { id: mouseArea - hoverEnabled: true + hoverEnabled: buttonEnabled anchors.fill: parent onClicked: asyncClickSender.start(); onEntered: { From a4587e33f331d9fa2112acba0b860efae85f8a83 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 14 Apr 2017 13:19:33 -0700 Subject: [PATCH 5/9] Tiny forward/backward icon updates --- interface/resources/images/backward.svg | 27 ++++++++++--------------- interface/resources/images/forward.svg | 27 ++++++++++--------------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/interface/resources/images/backward.svg b/interface/resources/images/backward.svg index e4502fa80e..a913ad9cd0 100644 --- a/interface/resources/images/backward.svg +++ b/interface/resources/images/backward.svg @@ -1,6 +1,6 @@ - - - - - - - + + + + diff --git a/interface/resources/images/forward.svg b/interface/resources/images/forward.svg index 0c5cbe3d0c..dde9322b9e 100644 --- a/interface/resources/images/forward.svg +++ b/interface/resources/images/forward.svg @@ -1,6 +1,6 @@ - - - - - - - + + + + From 3e268fbf68f1e0a5d3eb9ebadd7ba9faa01d8113 Mon Sep 17 00:00:00 2001 From: David Kelly Date: Mon, 17 Apr 2017 07:38:24 -0700 Subject: [PATCH 6/9] put shareable_url in UserStory details when creating --- interface/src/ui/SnapshotUploader.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/interface/src/ui/SnapshotUploader.cpp b/interface/src/ui/SnapshotUploader.cpp index 5826c8bd38..411e892de5 100644 --- a/interface/src/ui/SnapshotUploader.cpp +++ b/interface/src/ui/SnapshotUploader.cpp @@ -40,6 +40,9 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) { QJsonObject userStoryObject; QJsonObject detailsObject; detailsObject.insert("image_url", imageUrl); + if (dataObject.contains("shareable_url")) { + detailsObject.insert("shareable_url", dataObject.value("shareable_url").toString()); + } QString pickledDetails = QJsonDocument(detailsObject).toJson(); userStoryObject.insert("details", pickledDetails); userStoryObject.insert("thumbnail_url", thumbnailUrl); From 7a7cfb84e57e6d364a38f3502b879592d84e2ab0 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 17 Apr 2017 10:08:40 -0700 Subject: [PATCH 7/9] Remove HMD keyboard focus toggle on AddressBar input --- interface/resources/qml/hifi/tablet/TabletAddressDialog.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index fec55d0594..d164100654 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -218,9 +218,6 @@ StackView { addressLine.focus = true; addressLine.forceActiveFocus(); addressBarDialog.keyboardEnabled = HMD.active; - } else { - addressLine.focus = false; - addressBarDialog.keyboardEnabled = false; } tabletRoot.playButtonClickSound(); } From e13000410e064494589210499abfc4d301302be4 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 17 Apr 2017 11:02:27 -0700 Subject: [PATCH 8/9] Whoops --- libraries/avatars/src/AvatarHashMap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/avatars/src/AvatarHashMap.h b/libraries/avatars/src/AvatarHashMap.h index 87bedf8d51..e944c7c887 100644 --- a/libraries/avatars/src/AvatarHashMap.h +++ b/libraries/avatars/src/AvatarHashMap.h @@ -41,7 +41,7 @@ public: Q_INVOKABLE QVector getAvatarIdentifiers(); // Null/Default-constructed QUuids will return MyAvatar - virtual ScriptAvatarData* getAvatar(QUuid avatarID) { return new ScriptAvatarData(getAvatarBySessionID(avatarID)); } + Q_INVOKABLE virtual ScriptAvatarData* getAvatar(QUuid avatarID) { return new ScriptAvatarData(getAvatarBySessionID(avatarID)); } virtual AvatarSharedPointer getAvatarBySessionID(const QUuid& sessionID) const { return findAvatar(sessionID); } int numberOfAvatarsInRange(const glm::vec3& position, float rangeMeters); From e6edce53524577b9e89cf972684eabcef7b3d8ac Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 17 Apr 2017 12:13:01 -0700 Subject: [PATCH 9/9] Entirely remove addressBarToggle() --- interface/src/Application.cpp | 4 +-- .../DialogsManagerScriptingInterface.cpp | 7 ---- .../DialogsManagerScriptingInterface.h | 2 -- interface/src/ui/DialogsManager.cpp | 36 ------------------- interface/src/ui/DialogsManager.h | 2 -- 5 files changed, 2 insertions(+), 49 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 9c523f53e8..441db9b7b3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1418,11 +1418,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo connect(DependencyManager::get().data(), &AudioClient::mutedByMixer, this, onMutedByMixer); // Track when the address bar is opened - auto onAddressBarToggled = [this]() { + auto onAddressBarShown = [this]() { // Record time UserActivityLogger::getInstance().logAction("opened_address_bar", { { "uptime_ms", _sessionRunTimer.elapsed() } }); }; - connect(DependencyManager::get().data(), &DialogsManager::addressBarToggled, this, onAddressBarToggled); + connect(DependencyManager::get().data(), &DialogsManager::addressBarShown, this, onAddressBarShown); // Make sure we don't time out during slow operations at startup updateHeartbeat(); diff --git a/interface/src/scripting/DialogsManagerScriptingInterface.cpp b/interface/src/scripting/DialogsManagerScriptingInterface.cpp index f1c96b4309..0fb6078290 100644 --- a/interface/src/scripting/DialogsManagerScriptingInterface.cpp +++ b/interface/src/scripting/DialogsManagerScriptingInterface.cpp @@ -16,8 +16,6 @@ #include "ui/DialogsManager.h" DialogsManagerScriptingInterface::DialogsManagerScriptingInterface() { - connect(DependencyManager::get().data(), &DialogsManager::addressBarToggled, - this, &DialogsManagerScriptingInterface::addressBarToggled); connect(DependencyManager::get().data(), &DialogsManager::addressBarShown, this, &DialogsManagerScriptingInterface::addressBarShown); } @@ -28,11 +26,6 @@ DialogsManagerScriptingInterface* DialogsManagerScriptingInterface::getInstance( return &sharedInstance; } -void DialogsManagerScriptingInterface::toggleAddressBar() { - QMetaObject::invokeMethod(DependencyManager::get().data(), - "toggleAddressBar", Qt::QueuedConnection); -} - void DialogsManagerScriptingInterface::showAddressBar() { QMetaObject::invokeMethod(DependencyManager::get().data(), "showAddressBar", Qt::QueuedConnection); diff --git a/interface/src/scripting/DialogsManagerScriptingInterface.h b/interface/src/scripting/DialogsManagerScriptingInterface.h index aa231afb4a..e4dd18aedf 100644 --- a/interface/src/scripting/DialogsManagerScriptingInterface.h +++ b/interface/src/scripting/DialogsManagerScriptingInterface.h @@ -22,12 +22,10 @@ public: Q_INVOKABLE void showFeed(); public slots: - void toggleAddressBar(); void showAddressBar(); void hideAddressBar(); signals: - void addressBarToggled(); void addressBarShown(bool visible); }; diff --git a/interface/src/ui/DialogsManager.cpp b/interface/src/ui/DialogsManager.cpp index c5932aae07..96b5da3a55 100644 --- a/interface/src/ui/DialogsManager.cpp +++ b/interface/src/ui/DialogsManager.cpp @@ -46,42 +46,6 @@ void DialogsManager::maybeCreateDialog(QPointer& member) { } } -void DialogsManager::toggleAddressBar() { - auto hmd = DependencyManager::get(); - auto tabletScriptingInterface = DependencyManager::get(); - auto tablet = dynamic_cast(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); - if (tablet->getToolbarMode()) { - if (tablet->isPathLoaded(TABLET_ADDRESS_DIALOG)) { - tablet->gotoHomeScreen(); - emit addressBarToggled(); - } else { - tablet->loadQMLSource(TABLET_ADDRESS_DIALOG); - emit addressBarToggled(); - } - } else { - if (hmd->getShouldShowTablet()) { - if (tablet->isPathLoaded(TABLET_ADDRESS_DIALOG) && _closeAddressBar) { - tablet->gotoHomeScreen(); - hmd->closeTablet(); - _closeAddressBar = false; - emit addressBarToggled(); - } else { - tablet->loadQMLSource(TABLET_ADDRESS_DIALOG); - qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID()); - _closeAddressBar = true; - emit addressBarToggled(); - } - } else { - tablet->loadQMLSource(TABLET_ADDRESS_DIALOG); - hmd->openTablet(); - qApp->setKeyboardFocusOverlay(hmd->getCurrentTabletScreenID()); - _closeAddressBar = true; - emit addressBarToggled(); - } - - } -} - void DialogsManager::showAddressBar() { auto hmd = DependencyManager::get(); auto tabletScriptingInterface = DependencyManager::get(); diff --git a/interface/src/ui/DialogsManager.h b/interface/src/ui/DialogsManager.h index 76c4f083d2..3a40b15a3b 100644 --- a/interface/src/ui/DialogsManager.h +++ b/interface/src/ui/DialogsManager.h @@ -41,7 +41,6 @@ public: void emitAddressBarShown(bool visible) { emit addressBarShown(visible); } public slots: - void toggleAddressBar(); void showAddressBar(); void hideAddressBar(); void showFeed(); @@ -58,7 +57,6 @@ public slots: void showUpdateDialog(); signals: - void addressBarToggled(); void addressBarShown(bool visible); void setUseFeed(bool useFeed);