mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 15:13:41 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into armstrong
This commit is contained in:
commit
617453da8c
4 changed files with 11 additions and 44 deletions
|
@ -177,11 +177,11 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
|
||||
audioThread->start();
|
||||
|
||||
connect(nodeList, SIGNAL(domainChanged(const QString&)), SLOT(domainChanged(const QString&)));
|
||||
|
||||
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer)));
|
||||
connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), &_voxels, SLOT(nodeAdded(SharedNodePointer)));
|
||||
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), &_voxels, SLOT(nodeKilled(SharedNodePointer)));
|
||||
|
||||
nodeList->addDomainListener(this);
|
||||
|
||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||
QSettings applicationInfo("resources/info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||
|
@ -265,7 +265,6 @@ Application::~Application() {
|
|||
_audio.thread()->wait();
|
||||
|
||||
storeSizeAndPosition();
|
||||
NodeList::getInstance()->removeDomainListener(this);
|
||||
|
||||
_sharedVoxelSystem.changeTree(new VoxelTree);
|
||||
|
||||
|
@ -4078,9 +4077,9 @@ void Application::updateWindowTitle(){
|
|||
_window->setWindowTitle(title);
|
||||
}
|
||||
|
||||
void Application::domainChanged(QString domain) {
|
||||
void Application::domainChanged(const QString& domainHostname) {
|
||||
// update the user's last domain in their Profile (which will propagate to data-server)
|
||||
_profile.updateDomain(domain);
|
||||
_profile.updateDomain(domainHostname);
|
||||
|
||||
updateWindowTitle();
|
||||
|
||||
|
@ -4093,7 +4092,7 @@ void Application::domainChanged(QString domain) {
|
|||
_particleServerJurisdictions.clear();
|
||||
|
||||
// reset our persist thread
|
||||
qDebug() << "domainChanged()... domain=" << domain << " swapping persist cache\n";
|
||||
qDebug() << "domainChanged()... domain=" << domainHostname << " swapping persist cache\n";
|
||||
updateLocalOctreeCache();
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,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 PacketSenderNotify, public DomainChangeListener {
|
||||
class Application : public QApplication, public PacketSenderNotify {
|
||||
Q_OBJECT
|
||||
|
||||
friend class VoxelPacketProcessor;
|
||||
|
@ -197,8 +197,6 @@ public:
|
|||
|
||||
virtual void packetSentNotification(ssize_t length);
|
||||
|
||||
virtual void domainChanged(QString domain);
|
||||
|
||||
VoxelShader& getVoxelShader() { return _voxelShader; }
|
||||
PointShader& getPointShader() { return _pointShader; }
|
||||
FileLogger* getLogger() { return _logger; }
|
||||
|
@ -213,6 +211,7 @@ public:
|
|||
void setIsHighlightVoxel(bool isHighlightVoxel) { _isHighlightVoxel = isHighlightVoxel; }
|
||||
|
||||
public slots:
|
||||
void domainChanged(const QString& domainHostname);
|
||||
void nodeKilled(SharedNodePointer node);
|
||||
|
||||
void processDatagrams();
|
||||
|
|
|
@ -105,7 +105,7 @@ void NodeList::setDomainHostname(const QString& domainHostname) {
|
|||
|
||||
// reset our _domainIP to the null address so that a lookup happens on next check in
|
||||
_domainSockAddr.setAddress(QHostAddress::Null);
|
||||
notifyDomainChanged();
|
||||
emit domainChanged(_domainHostname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -813,7 +813,7 @@ void NodeList::loadData(QSettings *settings) {
|
|||
|
||||
if (domainServerHostname.size() > 0) {
|
||||
_domainHostname = domainServerHostname;
|
||||
notifyDomainChanged();
|
||||
emit domainChanged(_domainHostname);
|
||||
}
|
||||
|
||||
settings->endGroup();
|
||||
|
@ -831,25 +831,4 @@ void NodeList::saveData(QSettings* settings) {
|
|||
}
|
||||
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void NodeList::addDomainListener(DomainChangeListener* listener) {
|
||||
_domainListeners.push_back(listener);
|
||||
QString domain = _domainHostname.isEmpty() ? _domainSockAddr.getAddress().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::notifyDomainChanged() {
|
||||
for (int i = 0; i < _domainListeners.size(); i++) {
|
||||
_domainListeners[i]->domainChanged(_domainHostname);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,11 +45,6 @@ const int MAX_SILENT_DOMAIN_SERVER_CHECK_INS = 5;
|
|||
class Assignment;
|
||||
class HifiSockAddr;
|
||||
|
||||
class DomainChangeListener {
|
||||
public:
|
||||
virtual void domainChanged(QString domain) = 0;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<Node> SharedNodePointer;
|
||||
typedef QHash<QUuid, SharedNodePointer> NodeHash;
|
||||
Q_DECLARE_METATYPE(SharedNodePointer)
|
||||
|
@ -120,15 +115,13 @@ public:
|
|||
void loadData(QSettings* settings);
|
||||
void saveData(QSettings* settings);
|
||||
|
||||
void addDomainListener(DomainChangeListener* listener);
|
||||
void removeDomainListener(DomainChangeListener* listener);
|
||||
|
||||
const HifiSockAddr* getNodeActiveSocketOrPing(Node* node);
|
||||
public slots:
|
||||
void sendDomainServerCheckIn();
|
||||
void pingInactiveNodes();
|
||||
void removeSilentNodes();
|
||||
signals:
|
||||
void domainChanged(const QString& domainHostname);
|
||||
void nodeAdded(SharedNodePointer);
|
||||
void nodeKilled(SharedNodePointer);
|
||||
private:
|
||||
|
@ -162,10 +155,7 @@ private:
|
|||
void activateSocketFromNodeCommunication(const HifiSockAddr& nodeSockAddr);
|
||||
void timePingReply(const HifiSockAddr& nodeAddress, unsigned char *packetData);
|
||||
|
||||
std::vector<DomainChangeListener*> _domainListeners;
|
||||
|
||||
void resetDomainData(char domainField[], const char* domainData);
|
||||
void notifyDomainChanged();
|
||||
void domainLookup();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue