mirror of
https://github.com/lubosz/overte.git
synced 2025-04-09 09:44:33 +02:00
commit
030f0d7103
5 changed files with 19 additions and 16 deletions
|
@ -751,6 +751,7 @@ bool NodeList::sockAddrBelongsToDomainOrNode(const HifiSockAddr& sockAddr) {
|
|||
}
|
||||
|
||||
void NodeList::ignoreNodesInRadius(float radiusToIgnore, bool enabled) {
|
||||
bool isEnabledChange = _ignoreRadiusEnabled.get() != enabled;
|
||||
_ignoreRadiusEnabled.set(enabled);
|
||||
_ignoreRadius.set(radiusToIgnore);
|
||||
|
||||
|
@ -759,6 +760,9 @@ void NodeList::ignoreNodesInRadius(float radiusToIgnore, bool enabled) {
|
|||
}, [this](const SharedNodePointer& destinationNode) {
|
||||
sendIgnoreRadiusStateToNode(destinationNode);
|
||||
});
|
||||
if (isEnabledChange) {
|
||||
emit ignoreRadiusEnabledChanged(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeList::sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationNode) {
|
||||
|
|
|
@ -108,6 +108,7 @@ signals:
|
|||
void limitOfSilentDomainCheckInsReached();
|
||||
void receivedDomainServerList();
|
||||
void ignoredNode(const QUuid& nodeID);
|
||||
void ignoreRadiusEnabledChanged(bool isIgnored);
|
||||
|
||||
private slots:
|
||||
void stopKeepalivePingTimer();
|
||||
|
@ -154,7 +155,7 @@ private:
|
|||
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;
|
||||
|
||||
void sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationNode);
|
||||
Setting::Handle<bool> _ignoreRadiusEnabled { "IgnoreRadiusEnabled", false };
|
||||
Setting::Handle<bool> _ignoreRadiusEnabled { "IgnoreRadiusEnabled", true };
|
||||
Setting::Handle<float> _ignoreRadius { "IgnoreRadius", 1.0f };
|
||||
|
||||
#if (PR_BUILD || DEV_BUILD)
|
||||
|
|
|
@ -17,6 +17,7 @@ UsersScriptingInterface::UsersScriptingInterface() {
|
|||
// emit a signal when kick permissions have changed
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
connect(nodeList.data(), &LimitedNodeList::canKickChanged, this, &UsersScriptingInterface::canKickChanged);
|
||||
connect(nodeList.data(), &NodeList::ignoreRadiusEnabledChanged, this, &UsersScriptingInterface::ignoreRadiusEnabledChanged);
|
||||
}
|
||||
|
||||
void UsersScriptingInterface::ignore(const QUuid& nodeID) {
|
||||
|
|
|
@ -100,6 +100,7 @@ public slots:
|
|||
|
||||
signals:
|
||||
void canKickChanged(bool canKick);
|
||||
void ignoreRadiusEnabledChanged(bool isEnabled);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -25,34 +25,30 @@ function buttonImageURL() {
|
|||
return TOOLS_PATH + 'bubble.svg';
|
||||
}
|
||||
|
||||
var bubbleActive = Users.getIgnoreRadiusEnabled();
|
||||
function onBubbleToggled() {
|
||||
var bubbleActive = Users.getIgnoreRadiusEnabled();
|
||||
button.writeProperty('buttonState', bubbleActive ? 0 : 1);
|
||||
button.writeProperty('defaultState', bubbleActive ? 0 : 1);
|
||||
button.writeProperty('hoverState', bubbleActive ? 2 : 3);
|
||||
}
|
||||
|
||||
// setup the mod button and add it to the toolbar
|
||||
var button = toolbar.addButton({
|
||||
objectName: 'bubble',
|
||||
imageURL: buttonImageURL(),
|
||||
visible: true,
|
||||
buttonState: bubbleActive ? 0 : 1,
|
||||
defaultState: bubbleActive ? 0 : 1,
|
||||
hoverState: bubbleActive ? 2 : 3,
|
||||
alpha: 0.9
|
||||
});
|
||||
onBubbleToggled();
|
||||
|
||||
|
||||
// handle clicks on the toolbar button
|
||||
function buttonClicked(){
|
||||
Users.toggleIgnoreRadius();
|
||||
bubbleActive = Users.getIgnoreRadiusEnabled();
|
||||
button.writeProperty('buttonState', bubbleActive ? 0 : 1);
|
||||
button.writeProperty('defaultState', bubbleActive ? 0 : 1);
|
||||
button.writeProperty('hoverState', bubbleActive ? 2 : 3);
|
||||
}
|
||||
|
||||
button.clicked.connect(buttonClicked);
|
||||
button.clicked.connect(Users.toggleIgnoreRadius);
|
||||
Users.ignoreRadiusEnabledChanged.connect(onBubbleToggled);
|
||||
|
||||
// cleanup the toolbar button and overlays when script is stopped
|
||||
Script.scriptEnding.connect(function() {
|
||||
toolbar.removeButton('bubble');
|
||||
button.clicked.disconnect(Users.toggleIgnoreRadius);
|
||||
Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled);
|
||||
});
|
||||
|
||||
}()); // END LOCAL_SCOPE
|
||||
|
|
Loading…
Reference in a new issue