diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index b8972378ad..ab0a98a8c5 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -56,7 +56,7 @@ StackView { Qt.callLater(function() { addressBarDialog.keyboardEnabled = HMD.active; addressLine.forceActiveFocus(); - addressBarDialog.raised = true; + addressBarDialog.keyboardRaised = true; }) } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index a9d75e745c..47a73cee57 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -371,6 +371,8 @@ static const QString INFO_HELP_PATH = "html/tabletHelp.html"; static const unsigned int THROTTLED_SIM_FRAMERATE = 15; static const int THROTTLED_SIM_FRAME_PERIOD_MS = MSECS_PER_SECOND / THROTTLED_SIM_FRAMERATE; +static const int ENTITY_SERVER_ADDED_TIMEOUT = 5000; +static const int ENTITY_SERVER_CONNECTION_TIMEOUT = 5000; static const uint32_t INVALID_FRAME = UINT32_MAX; @@ -1224,6 +1226,18 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo getOverlays().deleteOverlay(getTabletScreenID()); getOverlays().deleteOverlay(getTabletHomeButtonID()); getOverlays().deleteOverlay(getTabletFrameID()); + _failedToConnectToEntityServer = false; + }); + + _entityServerConnectionTimer.setSingleShot(true); + connect(&_entityServerConnectionTimer, &QTimer::timeout, this, &Application::setFailedToConnectToEntityServer); + + connect(&domainHandler, &DomainHandler::connectedToDomain, this, [this]() { + if (!isServerlessMode()) { + _entityServerConnectionTimer.setInterval(ENTITY_SERVER_ADDED_TIMEOUT); + _entityServerConnectionTimer.start(); + _failedToConnectToEntityServer = false; + } }); connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &Application::domainConnectionRefused); @@ -6630,7 +6644,13 @@ void Application::resettingDomain() { } void Application::nodeAdded(SharedNodePointer node) const { - // nothing to do here + if (node->getType() == NodeType::EntityServer) { + if (!_failedToConnectToEntityServer) { + _entityServerConnectionTimer.stop(); + _entityServerConnectionTimer.setInterval(ENTITY_SERVER_CONNECTION_TIMEOUT); + _entityServerConnectionTimer.start(); + } + } } void Application::nodeActivated(SharedNodePointer node) { @@ -6658,6 +6678,10 @@ void Application::nodeActivated(SharedNodePointer node) { if (node->getType() == NodeType::EntityServer) { _queryExpiry = SteadyClock::now(); _octreeQuery.incrementConnectionID(); + + if (!_failedToConnectToEntityServer) { + _entityServerConnectionTimer.stop(); + } } if (node->getType() == NodeType::AudioMixer && !isInterstitialMode()) { diff --git a/interface/src/Application.h b/interface/src/Application.h index 14e30b8006..053cb158e0 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -307,6 +307,7 @@ public: bool isServerlessMode() const; bool isInterstitialMode() const { return _interstitialMode; } + bool failedToConnectToEntityServer() const { return _failedToConnectToEntityServer; } void replaceDomainContent(const QString& url); @@ -460,6 +461,7 @@ private slots: void loadSettings(); void saveSettings() const; + void setFailedToConnectToEntityServer() { _failedToConnectToEntityServer = true; } bool acceptSnapshot(const QString& urlString); bool askToSetAvatarUrl(const QString& url); @@ -710,6 +712,7 @@ private: bool _isForeground = true; // starts out assumed to be in foreground bool _isGLInitialized { false }; bool _physicsEnabled { false }; + bool _failedToConnectToEntityServer { false }; bool _reticleClickPressed { false }; @@ -756,6 +759,7 @@ private: QStringList _addAssetToWorldInfoMessages; // Info message QTimer _addAssetToWorldInfoTimer; QTimer _addAssetToWorldErrorTimer; + mutable QTimer _entityServerConnectionTimer; FileScriptingInterface* _fileDownload; AudioInjectorPointer _snapshotSoundInjector; diff --git a/interface/src/octree/SafeLanding.cpp b/interface/src/octree/SafeLanding.cpp index ff32e03006..9efad22d09 100644 --- a/interface/src/octree/SafeLanding.cpp +++ b/interface/src/octree/SafeLanding.cpp @@ -11,9 +11,7 @@ #include "SafeLanding.h" -#include #include -#include #include "EntityTreeRenderer.h" #include "RenderableModelEntityItem.h" @@ -21,7 +19,6 @@ #include "Application.h" const int SafeLanding::SEQUENCE_MODULO = std::numeric_limits::max() + 1; -const quint64 MAX_ELAPSED_TIME = 1000; // msec namespace { template bool lessThanWraparound(int a, int b) { @@ -110,9 +107,7 @@ void SafeLanding::noteReceivedsequenceNumber(int sequenceNumber) { } bool SafeLanding::isLoadSequenceComplete() { - quint64 elapsedTime = (usecTimestampNow() - _startTime) / USECS_PER_MSEC; - if ((isEntityLoadingComplete() && isSequenceNumbersComplete()) || - (elapsedTime >= MAX_ELAPSED_TIME && isEntityServerNotRunning() && _sequenceNumbers.empty())) { + if ((isEntityLoadingComplete() && isSequenceNumbersComplete()) || qApp->failedToConnectToEntityServer()) { Locker lock(_lock); _initialStart = INVALID_SEQUENCE; _initialEnd = INVALID_SEQUENCE; @@ -124,14 +119,6 @@ bool SafeLanding::isLoadSequenceComplete() { return !_trackingEntities; } -bool SafeLanding::isEntityServerNotRunning() { - auto nodeList = DependencyManager::get(); - const auto& domainHandler = nodeList->getDomainHandler(); - auto entityServer = nodeList->soloNodeOfType(NodeType::EntityServer); - - return (domainHandler.isConnected() && !entityServer); -} - float SafeLanding::loadingProgressPercentage() { Locker lock(_lock); static const int MINIMUM_TRACKED_ENTITY_STABILITY_COUNT = 15; diff --git a/interface/src/octree/SafeLanding.h b/interface/src/octree/SafeLanding.h index 157fda53aa..51357b60ff 100644 --- a/interface/src/octree/SafeLanding.h +++ b/interface/src/octree/SafeLanding.h @@ -40,7 +40,6 @@ private: bool isSequenceNumbersComplete(); void debugDumpSequenceIDs() const; bool isEntityLoadingComplete(); - bool isEntityServerNotRunning(); std::mutex _lock; using Locker = std::lock_guard;