mirror of
https://github.com/overte-org/overte.git
synced 2025-04-17 14:46:40 +02:00
add new address accessor for 'public' addresses, use it for snapshot and stream
This commit is contained in:
parent
148007435e
commit
8de545acdf
4 changed files with 26 additions and 9 deletions
|
@ -129,7 +129,7 @@ void DiscoverabilityManager::updateLocation() {
|
|||
|
||||
// Update Steam
|
||||
if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
|
||||
steamClient->updateLocation(domainHandler.getHostname(), addressManager->currentFacingShareableAddress());
|
||||
steamClient->updateLocation(domainHandler.getHostname(), addressManager->currentFacingPublicAddress());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ QTemporaryFile* Snapshot::saveTempSnapshot(QImage image) {
|
|||
QFile* Snapshot::savedFileForSnapshot(QImage & shot, bool isTemporary, const QString& userSelectedFilename) {
|
||||
|
||||
// adding URL to snapshot
|
||||
QUrl currentURL = DependencyManager::get<AddressManager>()->currentShareableAddress();
|
||||
QUrl currentURL = DependencyManager::get<AddressManager>()->currentPublicAddress();
|
||||
shot.setText(URL, currentURL.toString());
|
||||
|
||||
QString username = DependencyManager::get<AccountManager>()->getAccountInfo().getUsername();
|
||||
|
|
|
@ -60,7 +60,6 @@ QUrl AddressManager::currentFacingAddress() const {
|
|||
}
|
||||
|
||||
QUrl AddressManager::currentShareableAddress(bool domainOnly) const {
|
||||
QUrl shareableAddress;
|
||||
if (!_shareablePlaceName.isEmpty()) {
|
||||
// if we have a shareable place name use that instead of whatever the current host is
|
||||
QUrl hifiURL;
|
||||
|
@ -72,18 +71,23 @@ QUrl AddressManager::currentShareableAddress(bool domainOnly) const {
|
|||
hifiURL.setPath(currentPath());
|
||||
}
|
||||
|
||||
shareableAddress = hifiURL;
|
||||
return hifiURL;
|
||||
} else {
|
||||
shareableAddress = currentAddress(domainOnly);
|
||||
return currentAddress(domainOnly);
|
||||
}
|
||||
}
|
||||
|
||||
QUrl AddressManager::currentPublicAddress(bool domainOnly) const {
|
||||
// return an address that can be used by others to visit this client's current location. If
|
||||
// in a serverless domain (which can't be visited) return an empty URL.
|
||||
QUrl shareableAddress = currentShareableAddress(domainOnly);
|
||||
if (shareableAddress.scheme() != URL_SCHEME_HIFI) {
|
||||
return QUrl(); // file: urls aren't shareable
|
||||
return QUrl(); // file: urls aren't public
|
||||
}
|
||||
|
||||
return shareableAddress;
|
||||
}
|
||||
|
||||
|
||||
QUrl AddressManager::currentFacingShareableAddress() const {
|
||||
auto hifiURL = currentShareableAddress();
|
||||
if (hifiURL.scheme() == URL_SCHEME_HIFI) {
|
||||
|
@ -93,6 +97,17 @@ QUrl AddressManager::currentFacingShareableAddress() const {
|
|||
return hifiURL;
|
||||
}
|
||||
|
||||
QUrl AddressManager::currentFacingPublicAddress() const {
|
||||
// return an address that can be used by others to visit this client's current location. If
|
||||
// in a serverless domain (which can't be visited) return an empty URL.
|
||||
QUrl shareableAddress = currentFacingShareableAddress();
|
||||
if (shareableAddress.scheme() != URL_SCHEME_HIFI) {
|
||||
return QUrl(); // file: urls aren't public
|
||||
}
|
||||
return shareableAddress;
|
||||
}
|
||||
|
||||
|
||||
void AddressManager::loadSettings(const QString& lookupString) {
|
||||
#if defined(USE_GLES) && defined(Q_OS_WIN)
|
||||
handleUrl(QUrl("hifi://127.0.0.0"), LookupTrigger::StartupFromSettings);
|
||||
|
@ -825,8 +840,8 @@ void AddressManager::copyAddress() {
|
|||
return;
|
||||
}
|
||||
|
||||
// currentShareableAddress will be blank for serverless domains, so use currentFacingAddress here
|
||||
QGuiApplication::clipboard()->setText(currentFacingAddress().toString());
|
||||
// assume that the address is being copied because the user wants a shareable address
|
||||
QGuiApplication::clipboard()->setText(currentShareableAddress().toString());
|
||||
}
|
||||
|
||||
void AddressManager::copyPath() {
|
||||
|
|
|
@ -150,7 +150,9 @@ public:
|
|||
QUrl currentAddress(bool domainOnly = false) const;
|
||||
QUrl currentFacingAddress() const;
|
||||
QUrl currentShareableAddress(bool domainOnly = false) const;
|
||||
QUrl currentPublicAddress(bool domainOnly = false) const;
|
||||
QUrl currentFacingShareableAddress() const;
|
||||
QUrl currentFacingPublicAddress() const;
|
||||
QString currentPath(bool withOrientation = true) const;
|
||||
QString currentFacingPath() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue