mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:28:46 +02:00
bubble state
This commit is contained in:
parent
1970deab92
commit
8b9efb461e
5 changed files with 22 additions and 17 deletions
|
@ -886,3 +886,9 @@ void NodeList::muteNodeBySessionID(const QUuid& nodeID) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeList::toggleIgnoreRadius() {
|
||||||
|
bool isIgnored = !getIgnoreRadiusEnabled();
|
||||||
|
ignoreNodesInRadius(getIgnoreRadius(), isIgnored);
|
||||||
|
emit ignoreRadiusEnabledChanged(isIgnored);
|
||||||
|
}
|
|
@ -74,7 +74,7 @@ public:
|
||||||
void ignoreNodesInRadius(float radiusToIgnore, bool enabled = true);
|
void ignoreNodesInRadius(float radiusToIgnore, bool enabled = true);
|
||||||
float getIgnoreRadius() const { return _ignoreRadius.get(); }
|
float getIgnoreRadius() const { return _ignoreRadius.get(); }
|
||||||
bool getIgnoreRadiusEnabled() const { return _ignoreRadiusEnabled.get(); }
|
bool getIgnoreRadiusEnabled() const { return _ignoreRadiusEnabled.get(); }
|
||||||
void toggleIgnoreRadius() { ignoreNodesInRadius(getIgnoreRadius(), !getIgnoreRadiusEnabled()); }
|
void toggleIgnoreRadius();
|
||||||
void enableIgnoreRadius() { ignoreNodesInRadius(getIgnoreRadius(), true); }
|
void enableIgnoreRadius() { ignoreNodesInRadius(getIgnoreRadius(), true); }
|
||||||
void disableIgnoreRadius() { ignoreNodesInRadius(getIgnoreRadius(), false); }
|
void disableIgnoreRadius() { ignoreNodesInRadius(getIgnoreRadius(), false); }
|
||||||
void ignoreNodeBySessionID(const QUuid& nodeID);
|
void ignoreNodeBySessionID(const QUuid& nodeID);
|
||||||
|
@ -108,6 +108,7 @@ signals:
|
||||||
void limitOfSilentDomainCheckInsReached();
|
void limitOfSilentDomainCheckInsReached();
|
||||||
void receivedDomainServerList();
|
void receivedDomainServerList();
|
||||||
void ignoredNode(const QUuid& nodeID);
|
void ignoredNode(const QUuid& nodeID);
|
||||||
|
void ignoreRadiusEnabledChanged(bool isIgnored);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void stopKeepalivePingTimer();
|
void stopKeepalivePingTimer();
|
||||||
|
@ -154,7 +155,7 @@ private:
|
||||||
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;
|
tbb::concurrent_unordered_set<QUuid, UUIDHasher> _ignoredNodeIDs;
|
||||||
|
|
||||||
void sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationNode);
|
void sendIgnoreRadiusStateToNode(const SharedNodePointer& destinationNode);
|
||||||
Setting::Handle<bool> _ignoreRadiusEnabled { "IgnoreRadiusEnabled", false };
|
Setting::Handle<bool> _ignoreRadiusEnabled { "IgnoreRadiusEnabled", true };
|
||||||
Setting::Handle<float> _ignoreRadius { "IgnoreRadius", 1.0f };
|
Setting::Handle<float> _ignoreRadius { "IgnoreRadius", 1.0f };
|
||||||
|
|
||||||
#if (PR_BUILD || DEV_BUILD)
|
#if (PR_BUILD || DEV_BUILD)
|
||||||
|
|
|
@ -17,6 +17,7 @@ UsersScriptingInterface::UsersScriptingInterface() {
|
||||||
// emit a signal when kick permissions have changed
|
// emit a signal when kick permissions have changed
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
connect(nodeList.data(), &LimitedNodeList::canKickChanged, this, &UsersScriptingInterface::canKickChanged);
|
connect(nodeList.data(), &LimitedNodeList::canKickChanged, this, &UsersScriptingInterface::canKickChanged);
|
||||||
|
connect(nodeList.data(), &NodeList::ignoreRadiusEnabledChanged, this, &UsersScriptingInterface::ignoreRadiusEnabledChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsersScriptingInterface::ignore(const QUuid& nodeID) {
|
void UsersScriptingInterface::ignore(const QUuid& nodeID) {
|
||||||
|
|
|
@ -100,6 +100,7 @@ public slots:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void canKickChanged(bool canKick);
|
void canKickChanged(bool canKick);
|
||||||
|
void ignoreRadiusEnabledChanged(bool isEnabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,34 +25,30 @@ function buttonImageURL() {
|
||||||
return TOOLS_PATH + 'bubble.svg';
|
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
|
// setup the mod button and add it to the toolbar
|
||||||
var button = toolbar.addButton({
|
var button = toolbar.addButton({
|
||||||
objectName: 'bubble',
|
objectName: 'bubble',
|
||||||
imageURL: buttonImageURL(),
|
imageURL: buttonImageURL(),
|
||||||
visible: true,
|
visible: true,
|
||||||
buttonState: bubbleActive ? 0 : 1,
|
|
||||||
defaultState: bubbleActive ? 0 : 1,
|
|
||||||
hoverState: bubbleActive ? 2 : 3,
|
|
||||||
alpha: 0.9
|
alpha: 0.9
|
||||||
});
|
});
|
||||||
|
onBubbleToggled();
|
||||||
|
|
||||||
|
button.clicked.connect(Users.toggleIgnoreRadius);
|
||||||
// handle clicks on the toolbar button
|
Users.ignoreRadiusEnabledChanged.connect(onBubbleToggled);
|
||||||
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);
|
|
||||||
|
|
||||||
// cleanup the toolbar button and overlays when script is stopped
|
// cleanup the toolbar button and overlays when script is stopped
|
||||||
Script.scriptEnding.connect(function() {
|
Script.scriptEnding.connect(function() {
|
||||||
toolbar.removeButton('bubble');
|
toolbar.removeButton('bubble');
|
||||||
|
button.clicked.disconnect(Users.toggleIgnoreRadius);
|
||||||
|
Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled);
|
||||||
});
|
});
|
||||||
|
|
||||||
}()); // END LOCAL_SCOPE
|
}()); // END LOCAL_SCOPE
|
||||||
|
|
Loading…
Reference in a new issue