rearrange domain-url-changed signals

This commit is contained in:
Seth Alves 2018-03-21 14:30:00 -07:00
parent 4033af9b11
commit ef52ae13ee
5 changed files with 14 additions and 31 deletions

View file

@ -1183,8 +1183,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle); connect(addressManager.data(), &AddressManager::hostChanged, this, &Application::updateWindowTitle);
connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress); connect(this, &QCoreApplication::aboutToQuit, addressManager.data(), &AddressManager::storeCurrentAddress);
connect(addressManager.data(), &AddressManager::urlHandled, this, &Application::setIsServerlessDomain);
connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateThreadPoolCount); connect(this, &Application::activeDisplayPluginChanged, this, &Application::updateThreadPoolCount);
connect(this, &Application::activeDisplayPluginChanged, this, [](){ connect(this, &Application::activeDisplayPluginChanged, this, [](){
qApp->setProperty(hifi::properties::HMD, qApp->isHMDMode()); qApp->setProperty(hifi::properties::HMD, qApp->isHMDMode());
@ -3119,11 +3117,8 @@ bool Application::isServerlessMode() const {
return false; return false;
} }
void Application::setIsServerlessDomain(bool serverlessDomain) { void Application::setIsServerlessMode(bool serverlessDomain) {
auto tree = getEntities()->getTree(); auto tree = getEntities()->getTree();
if (tree->isServerlessMode() && !serverlessDomain) {
disconnectFromDomain();
}
if (tree) { if (tree) {
tree->setIsServerlessMode(serverlessDomain); tree->setIsServerlessMode(serverlessDomain);
} }
@ -3135,8 +3130,6 @@ void Application::loadServerlessDomain(QUrl domainURL) {
return; return;
} }
disconnectFromDomain();
if (domainURL.isEmpty()) { if (domainURL.isEmpty()) {
return; return;
} }
@ -3167,15 +3160,6 @@ void Application::loadServerlessDomain(QUrl domainURL) {
_fullSceneReceivedCounter++; _fullSceneReceivedCounter++;
} }
void Application::disconnectFromDomain() {
auto nodeList = DependencyManager::get<NodeList>();
clearDomainOctreeDetails();
getMyAvatar()->setSessionUUID(QUuid()); // clear the sessionID
NodePermissions permissions; // deny all permissions
permissions.setAll(false);
nodeList->setPermissions(permissions);
}
bool Application::importImage(const QString& urlString) { bool Application::importImage(const QString& urlString) {
qCDebug(interfaceapp) << "An image file has been dropped in"; qCDebug(interfaceapp) << "An image file has been dropped in";
QString filepath(urlString); QString filepath(urlString);
@ -5898,17 +5882,25 @@ void Application::clearDomainAvatars() {
} }
void Application::domainURLChanged(QUrl domainURL) { void Application::domainURLChanged(QUrl domainURL) {
updateWindowTitle();
// disable physics until we have enough information about our new location to not cause craziness. // disable physics until we have enough information about our new location to not cause craziness.
resetPhysicsReadyInformation(); resetPhysicsReadyInformation();
if (domainURL.scheme() != URL_SCHEME_HIFI) { setIsServerlessMode(domainURL.scheme() != URL_SCHEME_HIFI);
if (isServerlessMode()) {
loadServerlessDomain(domainURL); loadServerlessDomain(domainURL);
} }
updateWindowTitle();
} }
void Application::resettingDomain() { void Application::resettingDomain() {
_notifiedPacketVersionMismatchThisDomain = false; _notifiedPacketVersionMismatchThisDomain = false;
auto nodeList = DependencyManager::get<NodeList>();
clearDomainOctreeDetails();
getMyAvatar()->setSessionUUID(QUuid()); // clear the sessionID
NodePermissions permissions; // deny all permissions
permissions.setAll(false);
nodeList->setPermissions(permissions);
} }
void Application::nodeAdded(SharedNodePointer node) const { void Application::nodeAdded(SharedNodePointer node) const {

View file

@ -392,9 +392,8 @@ public slots:
const QString getPreferredCursor() const { return _preferredCursor.get(); } const QString getPreferredCursor() const { return _preferredCursor.get(); }
void setPreferredCursor(const QString& cursor); void setPreferredCursor(const QString& cursor);
void setIsServerlessDomain(bool serverlessDomain); void setIsServerlessMode(bool serverlessDomain);
void loadServerlessDomain(QUrl domainURL); void loadServerlessDomain(QUrl domainURL);
void disconnectFromDomain();
Q_INVOKABLE bool askBeforeSetAvatarUrl(const QString& avatarUrl) { return askToSetAvatarUrl(avatarUrl); } Q_INVOKABLE bool askBeforeSetAvatarUrl(const QString& avatarUrl) { return askToSetAvatarUrl(avatarUrl); }

View file

@ -210,7 +210,6 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
qCDebug(networking) << "Trying to go to URL" << lookupUrl.toString(); qCDebug(networking) << "Trying to go to URL" << lookupUrl.toString();
emit urlHandled(false);
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::LookupAddress); DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::LookupAddress);
// there are 4 possible lookup strings // there are 4 possible lookup strings
@ -295,7 +294,6 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
lookupUrl.scheme() == URL_SCHEME_FILE) { lookupUrl.scheme() == URL_SCHEME_FILE) {
_previousLookup.clear(); _previousLookup.clear();
QUrl domainURL = PathUtils::expandToLocalDataAbsolutePath(lookupUrl); QUrl domainURL = PathUtils::expandToLocalDataAbsolutePath(lookupUrl);
emit urlHandled(true);
setDomainInfo(domainURL, trigger); setDomainInfo(domainURL, trigger);
DependencyManager::get<NodeList>()->getDomainHandler().setIsConnected(true); DependencyManager::get<NodeList>()->getDomainHandler().setIsConnected(true);
emit lookupResultsFinished(); emit lookupResultsFinished();

View file

@ -406,8 +406,6 @@ signals:
*/ */
void goForwardPossible(bool isPossible); void goForwardPossible(bool isPossible);
void urlHandled(bool isNonHifiScheme);
private slots: private slots:
void handleAPIResponse(QNetworkReply& requestReply); void handleAPIResponse(QNetworkReply& requestReply);
void handleAPIError(QNetworkReply& errorReply); void handleAPIError(QNetworkReply& errorReply);

View file

@ -192,12 +192,6 @@ void DomainHandler::setURLAndID(QUrl domainURL, QUuid domainID) {
void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname, const QUuid& id) { void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname, const QUuid& id) {
if (isServerless()) {
// if we were connected to a serverless domain, clear the octree, etc
_domainURL = QUrl();
emit domainURLChanged(_domainURL);
}
if (_iceServerSockAddr.getAddress().toString() != iceServerHostname || id != _pendingDomainID) { if (_iceServerSockAddr.getAddress().toString() != iceServerHostname || id != _pendingDomainID) {
// re-set the domain info to connect to new domain // re-set the domain info to connect to new domain
hardReset(); hardReset();
@ -232,6 +226,7 @@ void DomainHandler::activateICELocalSocket() {
_sockAddr = _icePeer.getLocalSocket(); _sockAddr = _icePeer.getLocalSocket();
_domainURL.setScheme(URL_SCHEME_HIFI); _domainURL.setScheme(URL_SCHEME_HIFI);
_domainURL.setHost(_sockAddr.getAddress().toString()); _domainURL.setHost(_sockAddr.getAddress().toString());
emit domainURLChanged(_domainURL);
emit completedSocketDiscovery(); emit completedSocketDiscovery();
} }
@ -240,6 +235,7 @@ void DomainHandler::activateICEPublicSocket() {
_sockAddr = _icePeer.getPublicSocket(); _sockAddr = _icePeer.getPublicSocket();
_domainURL.setScheme(URL_SCHEME_HIFI); _domainURL.setScheme(URL_SCHEME_HIFI);
_domainURL.setHost(_sockAddr.getAddress().toString()); _domainURL.setHost(_sockAddr.getAddress().toString());
emit domainURLChanged(_domainURL);
emit completedSocketDiscovery(); emit completedSocketDiscovery();
} }