mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 10:13:15 +02:00
Handle domain reconnections
This commit is contained in:
parent
191121888c
commit
35f8afe456
2 changed files with 27 additions and 6 deletions
|
@ -18,18 +18,21 @@ EntityScriptServerLogDialog::EntityScriptServerLogDialog(QWidget* parent) : Base
|
||||||
auto& packetReceiver = nodeList->getPacketReceiver();
|
auto& packetReceiver = nodeList->getPacketReceiver();
|
||||||
packetReceiver.registerListener(PacketType::EntityServerScriptLog, this, "handleEntityServerScriptLogPacket");
|
packetReceiver.registerListener(PacketType::EntityServerScriptLog, this, "handleEntityServerScriptLogPacket");
|
||||||
|
|
||||||
auto shouldEnableLog = [this] {
|
QObject::connect(nodeList.data(), &NodeList::nodeActivated, this, &EntityScriptServerLogDialog::nodeActivated);
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
QObject::connect(nodeList.data(), &NodeList::nodeKilled, this, &EntityScriptServerLogDialog::nodeKilled);
|
||||||
enableToEntityServerScriptLog(nodeList->getThisNodeCanRez() || nodeList->getThisNodeCanRezTmp());
|
|
||||||
};
|
QObject::connect(nodeList.data(), &NodeList::canRezChanged, this, &EntityScriptServerLogDialog::shouldEnableLog);
|
||||||
QObject::connect(nodeList.data(), &NodeList::canRezChanged, this, shouldEnableLog);
|
QObject::connect(nodeList.data(), &NodeList::canRezTmpChanged, this, &EntityScriptServerLogDialog::shouldEnableLog);
|
||||||
QObject::connect(nodeList.data(), &NodeList::canRezTmpChanged, this, shouldEnableLog);
|
|
||||||
shouldEnableLog();
|
shouldEnableLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityScriptServerLogDialog::~EntityScriptServerLogDialog() {
|
EntityScriptServerLogDialog::~EntityScriptServerLogDialog() {
|
||||||
enableToEntityServerScriptLog(false);
|
enableToEntityServerScriptLog(false);
|
||||||
}
|
}
|
||||||
|
void EntityScriptServerLogDialog::shouldEnableLog() {
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
enableToEntityServerScriptLog(nodeList->getThisNodeCanRez() || nodeList->getThisNodeCanRezTmp());
|
||||||
|
};
|
||||||
|
|
||||||
void EntityScriptServerLogDialog::enableToEntityServerScriptLog(bool enable) {
|
void EntityScriptServerLogDialog::enableToEntityServerScriptLog(bool enable) {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
@ -56,3 +59,16 @@ void EntityScriptServerLogDialog::handleEntityServerScriptLogPacket(QSharedPoint
|
||||||
auto lines = QString::fromUtf8(message->readAll());
|
auto lines = QString::fromUtf8(message->readAll());
|
||||||
QMetaObject::invokeMethod(this, "appendLogLine", Q_ARG(QString, lines));
|
QMetaObject::invokeMethod(this, "appendLogLine", Q_ARG(QString, lines));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityScriptServerLogDialog::nodeActivated(SharedNodePointer activatedNode) {
|
||||||
|
if (_subscribed && activatedNode->getType() == NodeType::EntityScriptServer) {
|
||||||
|
_subscribed = false;
|
||||||
|
shouldEnableLog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EntityScriptServerLogDialog::nodeKilled(SharedNodePointer killedNode) {
|
||||||
|
if (killedNode->getType() == NodeType::EntityScriptServer) {
|
||||||
|
appendLogLine("====================== Connection to the Entity Script Server lost ======================");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,11 @@ private slots:
|
||||||
void enableToEntityServerScriptLog(bool enable);
|
void enableToEntityServerScriptLog(bool enable);
|
||||||
void handleEntityServerScriptLogPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
|
void handleEntityServerScriptLogPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer senderNode);
|
||||||
|
|
||||||
|
void nodeActivated(SharedNodePointer activatedNode);
|
||||||
|
void nodeKilled(SharedNodePointer killedNode);
|
||||||
|
|
||||||
|
void shouldEnableLog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _subscribed { false };
|
bool _subscribed { false };
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue