mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:44:01 +02:00
Merging changes
This commit is contained in:
parent
bac228bdb8
commit
a0f23d409e
3 changed files with 27 additions and 1 deletions
|
@ -3423,6 +3423,7 @@ void Application::attachNewHeadToNode(Node* newNode) {
|
|||
}
|
||||
|
||||
void Application::domainChanged(QString domain) {
|
||||
qDebug("Application title set to: %s.\n", domain.toStdString().c_str());
|
||||
_window->setWindowTitle(domain);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ static const float NODE_KILLED_RED = 1.0f;
|
|||
static const float NODE_KILLED_GREEN = 0.0f;
|
||||
static const float NODE_KILLED_BLUE = 0.0f;
|
||||
|
||||
class Application : public QApplication, public NodeListHook, public PacketSenderNotify {
|
||||
class Application : public QApplication, public NodeListHook, public PacketSenderNotify, public DomainChangeListener {
|
||||
Q_OBJECT
|
||||
|
||||
friend class VoxelPacketProcessor;
|
||||
|
@ -146,6 +146,8 @@ public:
|
|||
virtual void nodeKilled(Node* node);
|
||||
virtual void packetSentNotification(ssize_t length);
|
||||
|
||||
virtual void domainChanged(QString domain);
|
||||
|
||||
VoxelShader& getVoxelShader() { return _voxelShader; }
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -109,6 +109,7 @@ void NodeList::setDomainHostname(const QString& domainHostname) {
|
|||
|
||||
// reset our _domainIP to the null address so that a lookup happens on next check in
|
||||
_domainIP.clear();
|
||||
notifyDomainChanged();
|
||||
}
|
||||
|
||||
void NodeList::timePingReply(sockaddr *nodeAddress, unsigned char *packetData) {
|
||||
|
@ -585,6 +586,7 @@ void NodeList::loadData(QSettings *settings) {
|
|||
|
||||
if (domainServerHostname.size() > 0) {
|
||||
_domainHostname = domainServerHostname;
|
||||
notifyDomainChanged();
|
||||
}
|
||||
|
||||
settings->endGroup();
|
||||
|
@ -678,6 +680,21 @@ void NodeListIterator::skipDeadAndStopIncrement() {
|
|||
}
|
||||
}
|
||||
|
||||
void NodeList::addDomainListener(DomainChangeListener* listener) {
|
||||
_domainListeners.push_back(listener);
|
||||
QString domain = _domainHostname.isEmpty() ? _domainIP.toString() : _domainHostname;
|
||||
listener->domainChanged(domain);
|
||||
}
|
||||
|
||||
void NodeList::removeDomainListener(DomainChangeListener* listener) {
|
||||
for (int i = 0; i < _domainListeners.size(); i++) {
|
||||
if (_domainListeners[i] == listener) {
|
||||
_domainListeners.erase(_domainListeners.begin() + i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeList::addHook(NodeListHook* hook) {
|
||||
_hooks.push_back(hook);
|
||||
}
|
||||
|
@ -704,3 +721,9 @@ void NodeList::notifyHooksOfKilledNode(Node* node) {
|
|||
_hooks[i]->nodeKilled(node);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeList::notifyDomainChanged() {
|
||||
for (int i = 0; i < _domainListeners.size(); i++) {
|
||||
_domainListeners[i]->domainChanged(_domainHostname);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue