More CR & simplifications

This commit is contained in:
Zach Fox 2017-01-04 12:41:30 -08:00
parent 14def61eb8
commit dde5f69ac9
4 changed files with 5 additions and 17 deletions

View file

@ -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])})
}
}

View file

@ -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) {

View file

@ -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

View file

@ -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();
});