mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 10:29:01 +02:00
expose domain connection error to Window
This commit is contained in:
parent
07bda90519
commit
0f25756908
6 changed files with 20 additions and 12 deletions
|
@ -1211,8 +1211,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
|
|
||||||
auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>();
|
auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>();
|
||||||
connect(&locationUpdateTimer, &QTimer::timeout, discoverabilityManager.data(), &DiscoverabilityManager::updateLocation);
|
connect(&locationUpdateTimer, &QTimer::timeout, discoverabilityManager.data(), &DiscoverabilityManager::updateLocation);
|
||||||
connect(&domainHandler, &DomainHandler::domainConnectionErrorChanged, DependencyManager::get<AddressManager>().data(),
|
|
||||||
&AddressManager::setLastDomainConnectionError);
|
|
||||||
connect(&locationUpdateTimer, &QTimer::timeout,
|
connect(&locationUpdateTimer, &QTimer::timeout,
|
||||||
DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
|
DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
|
||||||
locationUpdateTimer.start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
|
locationUpdateTimer.start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
|
||||||
|
|
|
@ -39,6 +39,9 @@ WindowScriptingInterface::WindowScriptingInterface() {
|
||||||
connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &WindowScriptingInterface::disconnectedFromDomain);
|
connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &WindowScriptingInterface::disconnectedFromDomain);
|
||||||
|
|
||||||
connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused);
|
connect(&domainHandler, &DomainHandler::domainConnectionRefused, this, &WindowScriptingInterface::domainConnectionRefused);
|
||||||
|
connect(&domainHandler, &DomainHandler::domainConnectionErrorChanged, this, [this](int reasonCode) {
|
||||||
|
_lastDomainConnectionError = reasonCode;
|
||||||
|
});
|
||||||
|
|
||||||
connect(qApp, &Application::svoImportRequested, [this](const QString& urlString) {
|
connect(qApp, &Application::svoImportRequested, [this](const QString& urlString) {
|
||||||
static const QMetaMethod svoImportRequestedSignal =
|
static const QMetaMethod svoImportRequestedSignal =
|
||||||
|
@ -409,6 +412,10 @@ glm::vec2 WindowScriptingInterface::getDeviceSize() const {
|
||||||
return qApp->getDeviceSize();
|
return qApp->getDeviceSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WindowScriptingInterface::getLastDominConnectionError() const {
|
||||||
|
return DependencyManager::get<NodeList>()->getDomainHandler().getLastDomainConnectionError();
|
||||||
|
}
|
||||||
|
|
||||||
int WindowScriptingInterface::getX() {
|
int WindowScriptingInterface::getX() {
|
||||||
return qApp->getWindow()->geometry().x();
|
return qApp->getWindow()->geometry().x();
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,6 +491,13 @@ public slots:
|
||||||
*/
|
*/
|
||||||
glm::vec2 getDeviceSize() const;
|
glm::vec2 getDeviceSize() const;
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Gets the last domain connection error when a connection is refused.
|
||||||
|
* @function Window.getLastDomainConnectionError
|
||||||
|
* @returns {Window.ConnectionRefusedReason} Integer number that enumerates the last domain connection refused.
|
||||||
|
*/
|
||||||
|
int getLastDominConnectionError() const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Open a non-modal message box that can have a variety of button combinations. See also,
|
* Open a non-modal message box that can have a variety of button combinations. See also,
|
||||||
* {@link Window.updateMessageBox|updateMessageBox} and {@link Window.closeMessageBox|closeMessageBox}.
|
* {@link Window.updateMessageBox|updateMessageBox} and {@link Window.closeMessageBox|closeMessageBox}.
|
||||||
|
|
|
@ -56,9 +56,6 @@ const QString GET_PLACE = "/api/v1/places/%1";
|
||||||
* <em>Read-only.</em>
|
* <em>Read-only.</em>
|
||||||
* @property {boolean} isConnected - <code>true</code> if you're connected to the domain in your current <code>href</code>
|
* @property {boolean} isConnected - <code>true</code> if you're connected to the domain in your current <code>href</code>
|
||||||
* metaverse address, otherwise <code>false</code>.
|
* metaverse address, otherwise <code>false</code>.
|
||||||
* @property {Window.ConnectionRefusedReason} lastDomainConnectionError - The last error saved from connecting to a domain
|
|
||||||
* unsuccessfully.
|
|
||||||
* <em>Read-only.</em>
|
|
||||||
* @property {string} pathname - The location and orientation in your current <code>href</code> metaverse address
|
* @property {string} pathname - The location and orientation in your current <code>href</code> metaverse address
|
||||||
* (e.g., <code>"/15,-10,26/0,0,0,1"</code>).
|
* (e.g., <code>"/15,-10,26/0,0,0,1"</code>).
|
||||||
* <em>Read-only.</em>
|
* <em>Read-only.</em>
|
||||||
|
@ -76,7 +73,6 @@ class AddressManager : public QObject, public Dependency {
|
||||||
Q_PROPERTY(QUrl href READ currentShareableAddress)
|
Q_PROPERTY(QUrl href READ currentShareableAddress)
|
||||||
Q_PROPERTY(QString protocol READ getProtocol)
|
Q_PROPERTY(QString protocol READ getProtocol)
|
||||||
Q_PROPERTY(QString hostname READ getHost)
|
Q_PROPERTY(QString hostname READ getHost)
|
||||||
Q_PROPERTY(int lastDomainConnectionError READ getLastDomainConnectionError)
|
|
||||||
Q_PROPERTY(QString pathname READ currentPath)
|
Q_PROPERTY(QString pathname READ currentPath)
|
||||||
Q_PROPERTY(QString placename READ getPlaceName)
|
Q_PROPERTY(QString placename READ getPlaceName)
|
||||||
Q_PROPERTY(QString domainID READ getDomainID)
|
Q_PROPERTY(QString domainID READ getDomainID)
|
||||||
|
@ -187,9 +183,6 @@ public:
|
||||||
|
|
||||||
QUrl getDomainURL() { return _domainURL; }
|
QUrl getDomainURL() { return _domainURL; }
|
||||||
|
|
||||||
int getLastDomainConnectionError() { return _lastDomainConnectionError; }
|
|
||||||
void setLastDomainConnectionError(int reasonCode) { _lastDomainConnectionError = reasonCode; }
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Go to a specified metaverse address.
|
* Go to a specified metaverse address.
|
||||||
|
@ -470,8 +463,6 @@ private:
|
||||||
|
|
||||||
QUrl _domainURL;
|
QUrl _domainURL;
|
||||||
QUrl _lastVisitedURL;
|
QUrl _lastVisitedURL;
|
||||||
// domain connection error from domain handler.
|
|
||||||
int _lastDomainConnectionError{ -1 };
|
|
||||||
|
|
||||||
QUuid _rootPlaceID;
|
QUuid _rootPlaceID;
|
||||||
PositionGetter _positionGetter;
|
PositionGetter _positionGetter;
|
||||||
|
|
|
@ -480,7 +480,7 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
||||||
} else {
|
} else {
|
||||||
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
||||||
}
|
}
|
||||||
emit domainConnectionErrorChanged((int)reasonCode);
|
_lastDomainConnectionError = (int)reasonCode;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,8 @@ public:
|
||||||
QUrl getErrorDomainURL(){ return _errorDomainURL; }
|
QUrl getErrorDomainURL(){ return _errorDomainURL; }
|
||||||
void setErrorDomainURL(const QUrl& url);
|
void setErrorDomainURL(const QUrl& url);
|
||||||
|
|
||||||
|
int getLastDomainConnectionError() { return _lastDomainConnectionError; }
|
||||||
|
|
||||||
const QHostAddress& getIP() const { return _sockAddr.getAddress(); }
|
const QHostAddress& getIP() const { return _sockAddr.getAddress(); }
|
||||||
void setIPToLocalhost() { _sockAddr.setAddress(QHostAddress(QHostAddress::LocalHost)); }
|
void setIPToLocalhost() { _sockAddr.setAddress(QHostAddress(QHostAddress::LocalHost)); }
|
||||||
|
|
||||||
|
@ -220,6 +222,9 @@ private:
|
||||||
QTimer _apiRefreshTimer;
|
QTimer _apiRefreshTimer;
|
||||||
|
|
||||||
std::map<QString, QString> _namedPaths;
|
std::map<QString, QString> _namedPaths;
|
||||||
|
|
||||||
|
// domain connection error upon connection refusal.
|
||||||
|
int _lastDomainConnectionError{ -1 };
|
||||||
};
|
};
|
||||||
|
|
||||||
const QString DOMAIN_SPAWNING_POINT { "/0, -10, 0" };
|
const QString DOMAIN_SPAWNING_POINT { "/0, -10, 0" };
|
||||||
|
|
Loading…
Reference in a new issue