mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 19:55:07 +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>();
|
||||
connect(&locationUpdateTimer, &QTimer::timeout, discoverabilityManager.data(), &DiscoverabilityManager::updateLocation);
|
||||
connect(&domainHandler, &DomainHandler::domainConnectionErrorChanged, DependencyManager::get<AddressManager>().data(),
|
||||
&AddressManager::setLastDomainConnectionError);
|
||||
connect(&locationUpdateTimer, &QTimer::timeout,
|
||||
DependencyManager::get<AddressManager>().data(), &AddressManager::storeCurrentAddress);
|
||||
locationUpdateTimer.start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
|
||||
|
|
|
@ -39,6 +39,9 @@ WindowScriptingInterface::WindowScriptingInterface() {
|
|||
connect(&domainHandler, &DomainHandler::disconnectedFromDomain, this, &WindowScriptingInterface::disconnectedFromDomain);
|
||||
|
||||
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) {
|
||||
static const QMetaMethod svoImportRequestedSignal =
|
||||
|
@ -409,6 +412,10 @@ glm::vec2 WindowScriptingInterface::getDeviceSize() const {
|
|||
return qApp->getDeviceSize();
|
||||
}
|
||||
|
||||
int WindowScriptingInterface::getLastDominConnectionError() const {
|
||||
return DependencyManager::get<NodeList>()->getDomainHandler().getLastDomainConnectionError();
|
||||
}
|
||||
|
||||
int WindowScriptingInterface::getX() {
|
||||
return qApp->getWindow()->geometry().x();
|
||||
}
|
||||
|
|
|
@ -491,6 +491,13 @@ public slots:
|
|||
*/
|
||||
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
|
||||
* 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}.
|
||||
|
|
|
@ -56,9 +56,6 @@ const QString GET_PLACE = "/api/v1/places/%1";
|
|||
* <em>Read-only.</em>
|
||||
* @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>.
|
||||
* @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
|
||||
* (e.g., <code>"/15,-10,26/0,0,0,1"</code>).
|
||||
* <em>Read-only.</em>
|
||||
|
@ -76,7 +73,6 @@ class AddressManager : public QObject, public Dependency {
|
|||
Q_PROPERTY(QUrl href READ currentShareableAddress)
|
||||
Q_PROPERTY(QString protocol READ getProtocol)
|
||||
Q_PROPERTY(QString hostname READ getHost)
|
||||
Q_PROPERTY(int lastDomainConnectionError READ getLastDomainConnectionError)
|
||||
Q_PROPERTY(QString pathname READ currentPath)
|
||||
Q_PROPERTY(QString placename READ getPlaceName)
|
||||
Q_PROPERTY(QString domainID READ getDomainID)
|
||||
|
@ -187,9 +183,6 @@ public:
|
|||
|
||||
QUrl getDomainURL() { return _domainURL; }
|
||||
|
||||
int getLastDomainConnectionError() { return _lastDomainConnectionError; }
|
||||
void setLastDomainConnectionError(int reasonCode) { _lastDomainConnectionError = reasonCode; }
|
||||
|
||||
public slots:
|
||||
/**jsdoc
|
||||
* Go to a specified metaverse address.
|
||||
|
@ -470,8 +463,6 @@ private:
|
|||
|
||||
QUrl _domainURL;
|
||||
QUrl _lastVisitedURL;
|
||||
// domain connection error from domain handler.
|
||||
int _lastDomainConnectionError{ -1 };
|
||||
|
||||
QUuid _rootPlaceID;
|
||||
PositionGetter _positionGetter;
|
||||
|
|
|
@ -480,7 +480,7 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
|||
} else {
|
||||
emit domainConnectionRefused(reasonMessage, (int)reasonCode, extraInfo);
|
||||
}
|
||||
emit domainConnectionErrorChanged((int)reasonCode);
|
||||
_lastDomainConnectionError = (int)reasonCode;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
QUrl getErrorDomainURL(){ return _errorDomainURL; }
|
||||
void setErrorDomainURL(const QUrl& url);
|
||||
|
||||
int getLastDomainConnectionError() { return _lastDomainConnectionError; }
|
||||
|
||||
const QHostAddress& getIP() const { return _sockAddr.getAddress(); }
|
||||
void setIPToLocalhost() { _sockAddr.setAddress(QHostAddress(QHostAddress::LocalHost)); }
|
||||
|
||||
|
@ -220,6 +222,9 @@ private:
|
|||
QTimer _apiRefreshTimer;
|
||||
|
||||
std::map<QString, QString> _namedPaths;
|
||||
|
||||
// domain connection error upon connection refusal.
|
||||
int _lastDomainConnectionError{ -1 };
|
||||
};
|
||||
|
||||
const QString DOMAIN_SPAWNING_POINT { "/0, -10, 0" };
|
||||
|
|
Loading…
Reference in a new issue