mirror of
https://github.com/lubosz/overte.git
synced 2025-04-10 04:52:17 +02:00
Windows specific changes
This commit is contained in:
parent
43d2501993
commit
6fbe3c9187
6 changed files with 33 additions and 29 deletions
|
@ -182,23 +182,21 @@ void EntityScriptServer::updateEntityPPS() {
|
|||
void EntityScriptServer::handleEntityServerScriptLogPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode) {
|
||||
// These are temporary checks until we can ensure that nodes eventually disconnect if the Domain Server stops telling them
|
||||
// about each other.
|
||||
if (senderNode->getCanRez()) {
|
||||
bool enable = false;
|
||||
message->readPrimitive(&enable);
|
||||
bool enable = false;
|
||||
message->readPrimitive(&enable);
|
||||
|
||||
auto senderUUID = senderNode->getUUID();
|
||||
auto it = _logListeners.find(senderUUID);
|
||||
auto senderUUID = senderNode->getUUID();
|
||||
auto it = _logListeners.find(senderUUID);
|
||||
|
||||
if (enable) {
|
||||
if (it == std::end(_logListeners)) {
|
||||
_logListeners.insert(senderUUID);
|
||||
qInfo() << "Node" << senderUUID << "subscribed to log stream";
|
||||
}
|
||||
} else {
|
||||
if (it != std::end(_logListeners)) {
|
||||
_logListeners.erase(it);
|
||||
qInfo() << "Node" << senderUUID << "unsubscribed from log stream";
|
||||
}
|
||||
if (enable && senderNode->getCanRez()) {
|
||||
if (it == std::end(_logListeners)) {
|
||||
_logListeners.insert(senderUUID);
|
||||
qInfo() << "Node" << senderUUID << "subscribed to log stream";
|
||||
}
|
||||
} else {
|
||||
if (it != std::end(_logListeners)) {
|
||||
_logListeners.erase(it);
|
||||
qInfo() << "Node" << senderUUID << "unsubscribed from log stream";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,17 +22,22 @@ EntityScriptServerLogClient::EntityScriptServerLogClient() {
|
|||
QObject::connect(nodeList.data(), &NodeList::canRezChanged, this, &EntityScriptServerLogClient::canRezChanged);
|
||||
}
|
||||
|
||||
|
||||
void EntityScriptServerLogClient::connectNotify(const QMetaMethod& signal) {
|
||||
auto numReceivers = receivers(SIGNAL(receivedNewLogLines(QString)));
|
||||
if (!_subscribed && numReceivers > 0) {
|
||||
enableToEntityServerScriptLog(DependencyManager::get<NodeList>()->getThisNodeCanRez());
|
||||
}
|
||||
// This needs to be delayed or "receivers()" will return completely inconsistent values
|
||||
QMetaObject::invokeMethod(this, "connectionsChanged", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void EntityScriptServerLogClient::disconnectNotify(const QMetaMethod& signal) {
|
||||
// This needs to be delayed or "receivers()" will return completely inconsistent values
|
||||
QMetaObject::invokeMethod(this, "connectionsChanged", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void EntityScriptServerLogClient::connectionsChanged() {
|
||||
qDebug() << Q_FUNC_INFO << _subscribed << receivers(SIGNAL(receivedNewLogLines(QString)));
|
||||
auto numReceivers = receivers(SIGNAL(receivedNewLogLines(QString)));
|
||||
if (_subscribed && numReceivers == 0) {
|
||||
if (!_subscribed && numReceivers > 0) {
|
||||
enableToEntityServerScriptLog(DependencyManager::get<NodeList>()->getThisNodeCanRez());
|
||||
} else if (_subscribed && numReceivers == 0) {
|
||||
enableToEntityServerScriptLog(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ private slots:
|
|||
void nodeKilled(SharedNodePointer killedNode);
|
||||
void canRezChanged(bool canRez);
|
||||
|
||||
void connectionsChanged();
|
||||
|
||||
private:
|
||||
bool _subscribed { false };
|
||||
};
|
||||
|
|
|
@ -705,13 +705,11 @@ Menu::Menu() {
|
|||
qApp, SLOT(toggleLogDialog()));
|
||||
auto essLogAction = addActionToQMenuAndActionHash(developerMenu, MenuOption::EntityScriptServerLog, 0,
|
||||
qApp, SLOT(toggleEntityScriptServerLogDialog()));
|
||||
auto shouldEnableLog = [essLogAction] {
|
||||
QObject::connect(nodeList.data(), &NodeList::canRezChanged, essLogAction, [essLogAction] {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
essLogAction->setEnabled(nodeList->getThisNodeCanRez() || nodeList->getThisNodeCanRezTmp());
|
||||
};
|
||||
QObject::connect(nodeList.data(), &NodeList::canRezChanged, essLogAction, shouldEnableLog);
|
||||
QObject::connect(nodeList.data(), &NodeList::canRezTmpChanged, essLogAction, shouldEnableLog);
|
||||
shouldEnableLog();
|
||||
essLogAction->setEnabled(nodeList->getThisNodeCanRez());
|
||||
});
|
||||
essLogAction->setEnabled(nodeList->getThisNodeCanRez());
|
||||
|
||||
action = addActionToQMenuAndActionHash(developerMenu, "Script Log (HMD friendly)...");
|
||||
connect(action, &QAction::triggered, [] {
|
||||
|
|
|
@ -111,7 +111,8 @@ void BaseLogDialog::handleSearchTextChanged(QString searchText) {
|
|||
}
|
||||
|
||||
void BaseLogDialog::showLogData() {
|
||||
_logTextBox->setPlainText(getCurrentLog());
|
||||
_logTextBox->clear();
|
||||
_logTextBox->appendPlainText(getCurrentLog());
|
||||
_logTextBox->ensureCursorVisible();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ window.setPosition(25, 50);
|
|||
window.closed.connect(function() { Script.stop(); });
|
||||
|
||||
EntityScriptServerLog.receivedNewLogLines.connect(function(message) {
|
||||
window.sendToQml(message);
|
||||
window.sendToQml(message.trim());
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue