From dde5f69ac9ff44505b50c397b77be4a8376b70b7 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 4 Jan 2017 12:41:30 -0800 Subject: [PATCH] More CR & simplifications --- interface/resources/qml/hifi/Pal.qml | 11 +++++------ .../script-engine/src/UsersScriptingInterface.cpp | 1 - libraries/script-engine/src/UsersScriptingInterface.h | 1 - scripts/system/pal.js | 9 --------- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 2c3137c8a0..c9adb03d24 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -218,10 +218,9 @@ Item { id: actionCheckBox visible: isCheckBox anchors.centerIn: parent - checked: model && model[styleData.role] - // If this is a "personal mute" checkbox, and the model is valid, Check the checkbox if the Ignore - // checkbox is checked. - enabled: styleData.role === "personalMute" ? ((model && model["ignore"]) === true ? false : true) : true + checked: model[styleData.role] + // If this is a "Personal Mute" checkbox, disable the checkbox if the "Ignore" checkbox is checked. + enabled: !(styleData.role === "personalMute" && model["ignore"]) boxSize: 24 onClicked: { var newValue = !model[styleData.role] @@ -239,8 +238,8 @@ Item { } // http://doc.qt.io/qt-5/qtqml-syntax-propertybinding.html#creating-property-bindings-from-javascript // I'm using an explicit binding here because clicking a checkbox breaks the implicit binding as set by - // "checked: model[styleData.role]" above. - checked = Qt.binding(function() { return (model && model[styleData.role]) ? model[styleData.role] : false}) + // "checked:" statement above. + checked = Qt.binding(function() { return (model[styleData.role])}) } } diff --git a/libraries/script-engine/src/UsersScriptingInterface.cpp b/libraries/script-engine/src/UsersScriptingInterface.cpp index 81ed0c9c63..d0ad699846 100644 --- a/libraries/script-engine/src/UsersScriptingInterface.cpp +++ b/libraries/script-engine/src/UsersScriptingInterface.cpp @@ -19,7 +19,6 @@ UsersScriptingInterface::UsersScriptingInterface() { connect(nodeList.data(), &LimitedNodeList::canKickChanged, this, &UsersScriptingInterface::canKickChanged); connect(nodeList.data(), &NodeList::ignoreRadiusEnabledChanged, this, &UsersScriptingInterface::ignoreRadiusEnabledChanged); connect(nodeList.data(), &NodeList::usernameFromIDReply, this, &UsersScriptingInterface::usernameFromIDReply); - connect(nodeList.data(), &NodeList::ignoredNode, this, &UsersScriptingInterface::ignoredNode); } void UsersScriptingInterface::ignore(const QUuid& nodeID, bool ignoreEnabled) { diff --git a/libraries/script-engine/src/UsersScriptingInterface.h b/libraries/script-engine/src/UsersScriptingInterface.h index 06f1fb6fae..4182d5244c 100644 --- a/libraries/script-engine/src/UsersScriptingInterface.h +++ b/libraries/script-engine/src/UsersScriptingInterface.h @@ -117,7 +117,6 @@ public slots: signals: void canKickChanged(bool canKick); void ignoreRadiusEnabledChanged(bool isEnabled); - void ignoredNode(const QUuid& nodeID, bool enabled); /**jsdoc * Notifies scripts that another user has entered the ignore radius diff --git a/scripts/system/pal.js b/scripts/system/pal.js index d61c75099f..378d62c69c 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -333,14 +333,6 @@ pal.visibleChanged.connect(onVisibleChanged); pal.closed.connect(off); Users.usernameFromIDReply.connect(usernameFromIDReply); -function onIgnore(sessionId, enabled) { // make it go away in the usual way, since we'll still get data keeping it live - if (enabled) { - // Why doesn't this work from .qml? (crashes) - AvatarList.getAvatar(sessionId).setShouldDie(); - } -} -Users.ignoredNode.connect(onIgnore); - // // Cleanup. // @@ -350,7 +342,6 @@ Script.scriptEnding.connect(function () { pal.visibleChanged.disconnect(onVisibleChanged); pal.closed.disconnect(off); Users.usernameFromIDReply.disconnect(usernameFromIDReply); - Users.ignoredNode.disconnect(onIgnore); off(); });