History

Handle domain reconnections

Atlante45 committed 9 years ago

Commit 35f8afe1 parent 19112182 files · +27 −6Browse files

Showing the changes to interface/src/ui/EntityScriptServerLogDialog.cpp (1 of 2 files). Show all

Unified · Split

interface/src/ui/EntityScriptServerLogDialog.cpp+22−6
@@ -18,18 +18,21 @@ EntityScriptServerLogDialog::EntityScriptServerLogDialog(QWidget* parent) : Base · 17 unmodified lines
1818 auto& packetReceiver = nodeList->getPacketReceiver();
1919 packetReceiver.registerListener(PacketType::EntityServerScriptLog, this, "handleEntityServerScriptLogPacket");
2020
21− auto shouldEnableLog = [this] {
22− auto nodeList = DependencyManager::get<NodeList>();
23− enableToEntityServerScriptLog(nodeList->getThisNodeCanRez() || nodeList->getThisNodeCanRezTmp());
24− };
25− QObject::connect(nodeList.data(), &NodeList::canRezChanged, this, shouldEnableLog);
26− QObject::connect(nodeList.data(), &NodeList::canRezTmpChanged, this, shouldEnableLog);
21+ QObject::connect(nodeList.data(), &NodeList::nodeActivated, this, &EntityScriptServerLogDialog::nodeActivated);
22+ QObject::connect(nodeList.data(), &NodeList::nodeKilled, this, &EntityScriptServerLogDialog::nodeKilled);
23+
24+ QObject::connect(nodeList.data(), &NodeList::canRezChanged, this, &EntityScriptServerLogDialog::shouldEnableLog);
25+ QObject::connect(nodeList.data(), &NodeList::canRezTmpChanged, this, &EntityScriptServerLogDialog::shouldEnableLog);
2726 shouldEnableLog();
2827 }
2928
3029 EntityScriptServerLogDialog::~EntityScriptServerLogDialog() {
3130 enableToEntityServerScriptLog(false);
3231 }
32+void EntityScriptServerLogDialog::shouldEnableLog() {
33+ auto nodeList = DependencyManager::get<NodeList>();
34+ enableToEntityServerScriptLog(nodeList->getThisNodeCanRez() || nodeList->getThisNodeCanRezTmp());
35+};
3336
3437 void EntityScriptServerLogDialog::enableToEntityServerScriptLog(bool enable) {
3538 auto nodeList = DependencyManager::get<NodeList>();
@@ -56,3 +59,16 @@ void EntityScriptServerLogDialog::handleEntityServerScriptLogPacket(QSharedPoint · 20 unmodified lines
5659 auto lines = QString::fromUtf8(message->readAll());
5760 QMetaObject::invokeMethod(this, "appendLogLine", Q_ARG(QString, lines));
5861 }
62+
63+void EntityScriptServerLogDialog::nodeActivated(SharedNodePointer activatedNode) {
64+ if (_subscribed && activatedNode->getType() == NodeType::EntityScriptServer) {
65+ _subscribed = false;
66+ shouldEnableLog();
67+ }
68+}
69+
70+void EntityScriptServerLogDialog::nodeKilled(SharedNodePointer killedNode) {
71+ if (killedNode->getType() == NodeType::EntityScriptServer) {
72+ appendLogLine("====================== Connection to the Entity Script Server lost ======================");
73+ }
74+}