From 095b4ba5f2c8e6ea5b650c23fccb26636c5e6072 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 10 Apr 2018 16:02:58 -0700 Subject: [PATCH] Reduce logging from some Commerce/Discovery features --- .../resources/qml/controls-uit/TextField.qml | 12 +- interface/src/commerce/Wallet.cpp | 1 - scripts/system/commerce/wallet.js | 7 +- scripts/system/pal.js | 149 +++++++++--------- 4 files changed, 82 insertions(+), 87 deletions(-) diff --git a/interface/resources/qml/controls-uit/TextField.qml b/interface/resources/qml/controls-uit/TextField.qml index 6743d08275..f94541897b 100644 --- a/interface/resources/qml/controls-uit/TextField.qml +++ b/interface/resources/qml/controls-uit/TextField.qml @@ -163,18 +163,10 @@ TextField { text: textField.label colorScheme: textField.colorScheme anchors.left: parent.left - - Binding on anchors.right { - when: parent.right - value: parent.right - } - Binding on wrapMode { - when: parent.right - value: Text.WordWrap - } - + anchors.right: parent.right anchors.bottom: parent.top anchors.bottomMargin: 3 + wrapMode: Text.WordWrap visible: label != "" } } diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index c632c9d94a..3e0e4adf18 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -567,7 +567,6 @@ bool Wallet::generateKeyPair() { } QStringList Wallet::listPublicKeys() { - qCInfo(commerce) << "Enumerating public keys."; return _publicKeys; } diff --git a/scripts/system/commerce/wallet.js b/scripts/system/commerce/wallet.js index 9130985cd8..9403a824e3 100644 --- a/scripts/system/commerce/wallet.js +++ b/scripts/system/commerce/wallet.js @@ -691,18 +691,19 @@ var isWired = false; var isUpdateOverlaysWired = false; function off() { - if (isWired) { // It is not ok to disconnect these twice, hence guard. + if (isWired) { Users.usernameFromIDReply.disconnect(usernameFromIDReply); Controller.mousePressEvent.disconnect(handleMouseEvent); Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); + triggerMapping.disable(); + triggerPressMapping.disable(); + isWired = false; } if (isUpdateOverlaysWired) { Script.update.disconnect(updateOverlays); isUpdateOverlaysWired = false; } - triggerMapping.disable(); // It's ok if we disable twice. - triggerPressMapping.disable(); // see above removeOverlays(); } function shutdown() { diff --git a/scripts/system/pal.js b/scripts/system/pal.js index 647497335e..c24e34cc1b 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -40,7 +40,6 @@ var HOVER_TEXTURES = { var UNSELECTED_COLOR = { red: 0x1F, green: 0xC6, blue: 0xA6}; var SELECTED_COLOR = {red: 0xF3, green: 0x91, blue: 0x29}; var HOVER_COLOR = {red: 0xD0, green: 0xD0, blue: 0xD0}; // almost white for now -var PAL_QML_SOURCE = "hifi/Pal.qml"; var conserveResources = true; Script.include("/~/system/libraries/controllers.js"); @@ -668,57 +667,6 @@ triggerMapping.from(Controller.Standard.RTClick).peek().to(makeClickHandler(Cont triggerMapping.from(Controller.Standard.LTClick).peek().to(makeClickHandler(Controller.Standard.LeftHand)); triggerPressMapping.from(Controller.Standard.RT).peek().to(makePressHandler(Controller.Standard.RightHand)); triggerPressMapping.from(Controller.Standard.LT).peek().to(makePressHandler(Controller.Standard.LeftHand)); -// -// Manage the connection between the button and the window. -// -var button; -var buttonName = "PEOPLE"; -var tablet = null; - -function startup() { - tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - button = tablet.addButton({ - text: buttonName, - icon: "icons/tablet-icons/people-i.svg", - activeIcon: "icons/tablet-icons/people-a.svg", - sortOrder: 7 - }); - button.clicked.connect(onTabletButtonClicked); - tablet.screenChanged.connect(onTabletScreenChanged); - Window.domainChanged.connect(clearLocalQMLDataAndClosePAL); - Window.domainConnectionRefused.connect(clearLocalQMLDataAndClosePAL); - Messages.subscribe(CHANNEL); - Messages.messageReceived.connect(receiveMessage); - Users.avatarDisconnected.connect(avatarDisconnected); - AvatarList.avatarAddedEvent.connect(avatarAdded); - AvatarList.avatarRemovedEvent.connect(avatarRemoved); - AvatarList.avatarSessionChangedEvent.connect(avatarSessionChanged); -} - -startup(); - -var isWired = false; -var audioTimer; -var AUDIO_LEVEL_UPDATE_INTERVAL_MS = 100; // 10hz for now (change this and change the AVERAGING_RATIO too) -var AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS = 300; -function off() { - if (isWired) { // It is not ok to disconnect these twice, hence guard. - Script.update.disconnect(updateOverlays); - Controller.mousePressEvent.disconnect(handleMouseEvent); - Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); - tablet.tabletShownChanged.disconnect(tabletVisibilityChanged); - Users.usernameFromIDReply.disconnect(usernameFromIDReply); - isWired = false; - ContextOverlay.enabled = true - } - if (audioTimer) { - Script.clearInterval(audioTimer); - } - triggerMapping.disable(); // It's ok if we disable twice. - triggerPressMapping.disable(); // see above - removeOverlays(); - Users.requestsDomainListData = false; -} function tabletVisibilityChanged() { if (!tablet.tabletShown) { @@ -728,26 +676,17 @@ function tabletVisibilityChanged() { } var onPalScreen = false; - +var PAL_QML_SOURCE = "hifi/Pal.qml"; function onTabletButtonClicked() { + if (!tablet) { + print("Warning in onTabletButtonClicked(): 'tablet' undefined!"); + return; + } if (onPalScreen) { - // for toolbar-mode: go back to home screen, this will close the window. + // In Toolbar Mode, `gotoHomeScreen` will close the app window. tablet.gotoHomeScreen(); - ContextOverlay.enabled = true; } else { - ContextOverlay.enabled = false; tablet.loadQMLSource(PAL_QML_SOURCE); - tablet.tabletShownChanged.connect(tabletVisibilityChanged); - Users.requestsDomainListData = true; - populateNearbyUserList(); - isWired = true; - Script.update.connect(updateOverlays); - Controller.mousePressEvent.connect(handleMouseEvent); - Controller.mouseMoveEvent.connect(handleMouseMoveEvent); - Users.usernameFromIDReply.connect(usernameFromIDReply); - triggerMapping.enable(); - triggerPressMapping.enable(); - audioTimer = createAudioInterval(conserveResources ? AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS : AUDIO_LEVEL_UPDATE_INTERVAL_MS); } } var hasEventBridge = false; @@ -771,9 +710,25 @@ function onTabletScreenChanged(type, url) { // for toolbar mode: change button to active when window is first openend, false otherwise. button.editProperties({isActive: onPalScreen}); - // disable sphere overlays when not on pal screen. - if (!onPalScreen) { + if (onPalScreen) { + isWired = true; + + ContextOverlay.enabled = false; + Users.requestsDomainListData = true; + populateNearbyUserList(); + + audioTimer = createAudioInterval(conserveResources ? AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS : AUDIO_LEVEL_UPDATE_INTERVAL_MS); + + tablet.tabletShownChanged.connect(tabletVisibilityChanged); + Script.update.connect(updateOverlays); + Controller.mousePressEvent.connect(handleMouseEvent); + Controller.mouseMoveEvent.connect(handleMouseMoveEvent); + Users.usernameFromIDReply.connect(usernameFromIDReply); + triggerMapping.enable(); + triggerPressMapping.enable(); + } else { off(); + ContextOverlay.enabled = true; } } @@ -884,6 +839,58 @@ function avatarSessionChanged(avatarID) { sendToQml({ method: 'palIsStale', params: [avatarID, 'avatarSessionChanged'] }); } + +var button; +var buttonName = "PEOPLE"; +var tablet = null; +function startup() { + tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + button = tablet.addButton({ + text: buttonName, + icon: "icons/tablet-icons/people-i.svg", + activeIcon: "icons/tablet-icons/people-a.svg", + sortOrder: 7 + }); + button.clicked.connect(onTabletButtonClicked); + tablet.screenChanged.connect(onTabletScreenChanged); + Window.domainChanged.connect(clearLocalQMLDataAndClosePAL); + Window.domainConnectionRefused.connect(clearLocalQMLDataAndClosePAL); + Messages.subscribe(CHANNEL); + Messages.messageReceived.connect(receiveMessage); + Users.avatarDisconnected.connect(avatarDisconnected); + AvatarList.avatarAddedEvent.connect(avatarAdded); + AvatarList.avatarRemovedEvent.connect(avatarRemoved); + AvatarList.avatarSessionChangedEvent.connect(avatarSessionChanged); +} +startup(); + + +var isWired = false; +var audioTimer; +var AUDIO_LEVEL_UPDATE_INTERVAL_MS = 100; // 10hz for now (change this and change the AVERAGING_RATIO too) +var AUDIO_LEVEL_CONSERVED_UPDATE_INTERVAL_MS = 300; +function off() { + if (isWired) { + Script.update.disconnect(updateOverlays); + Controller.mousePressEvent.disconnect(handleMouseEvent); + Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); + tablet.tabletShownChanged.disconnect(tabletVisibilityChanged); + Users.usernameFromIDReply.disconnect(usernameFromIDReply); + ContextOverlay.enabled = true + triggerMapping.disable(); + triggerPressMapping.disable(); + Users.requestsDomainListData = false; + + isWired = false; + + if (audioTimer) { + Script.clearInterval(audioTimer); + } + } + + removeOverlays(); +} + function shutdown() { if (onPalScreen) { tablet.gotoHomeScreen(); @@ -901,10 +908,6 @@ function shutdown() { AvatarList.avatarSessionChangedEvent.disconnect(avatarSessionChanged); off(); } - -// -// Cleanup. -// Script.scriptEnding.connect(shutdown); }()); // END LOCAL_SCOPE