mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Merge pull request #8481 from howard-stearns/discovery-code-cleanup
discovery code cleanup
This commit is contained in:
commit
e45f390fd2
7 changed files with 16 additions and 18 deletions
|
@ -73,8 +73,7 @@ Window {
|
|||
property var allStories: [];
|
||||
property int cardWidth: 200;
|
||||
property int cardHeight: 152;
|
||||
property string metaverseBase: "https://metaverse.highfidelity.com/api/v1/";
|
||||
//property string metaverseBase: "http://10.0.0.241:3000/api/v1/";
|
||||
property string metaverseBase: addressBarDialog.metaverseServerUrl + "/api/v1/";
|
||||
property bool useHTML: false; // fixme: remove this and all false branches after the server is updated
|
||||
|
||||
AddressBarDialog {
|
||||
|
|
|
@ -266,7 +266,7 @@ signals:
|
|||
void activeDisplayPluginChanged();
|
||||
|
||||
void uploadRequest(QString path);
|
||||
void receivedHifiSchemeURL(QString path);
|
||||
void receivedHifiSchemeURL(const QString& url);
|
||||
|
||||
public slots:
|
||||
QVector<EntityItemID> pasteEntities(float x, float y, float z);
|
||||
|
|
|
@ -63,7 +63,7 @@ signals:
|
|||
void svoImportRequested(const QString& url);
|
||||
void domainConnectionRefused(const QString& reasonMessage, int reasonCode);
|
||||
void snapshotTaken(const QString& path, bool notify);
|
||||
void snapshotShared(bool success);
|
||||
void snapshotShared(const QString& error);
|
||||
|
||||
private slots:
|
||||
WebWindowClass* doCreateWebWindow(const QString& title, const QString& url, int width, int height);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#define hifi_AddressBarDialog_h
|
||||
|
||||
#include <OffscreenQmlDialog.h>
|
||||
#include <NetworkingConstants.h>
|
||||
|
||||
class AddressBarDialog : public OffscreenQmlDialog {
|
||||
Q_OBJECT
|
||||
|
@ -21,6 +22,7 @@ class AddressBarDialog : public OffscreenQmlDialog {
|
|||
Q_PROPERTY(bool backEnabled READ backEnabled NOTIFY backEnabledChanged)
|
||||
Q_PROPERTY(bool forwardEnabled READ forwardEnabled NOTIFY forwardEnabledChanged)
|
||||
Q_PROPERTY(bool useFeed READ useFeed WRITE setUseFeed NOTIFY useFeedChanged)
|
||||
Q_PROPERTY(QString metaverseServerUrl READ metaverseServerUrl)
|
||||
|
||||
public:
|
||||
AddressBarDialog(QQuickItem* parent = nullptr);
|
||||
|
@ -28,12 +30,13 @@ public:
|
|||
bool forwardEnabled() { return _forwardEnabled; }
|
||||
bool useFeed() { return _useFeed; }
|
||||
void setUseFeed(bool useFeed) { if (_useFeed != useFeed) { _useFeed = useFeed; emit useFeedChanged(); } }
|
||||
QString metaverseServerUrl() { return NetworkingConstants::METAVERSE_SERVER_URL.toString(); }
|
||||
|
||||
signals:
|
||||
void backEnabledChanged();
|
||||
void forwardEnabledChanged();
|
||||
void useFeedChanged();
|
||||
void receivedHifiSchemeURL(QString url);
|
||||
void receivedHifiSchemeURL(const QString& url);
|
||||
|
||||
protected:
|
||||
void displayAddressOfflineMessage();
|
||||
|
|
|
@ -215,20 +215,18 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
|
|||
QJsonDocument(rootObject).toJson());
|
||||
|
||||
} else {
|
||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(false);
|
||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(contents);
|
||||
}
|
||||
}
|
||||
|
||||
void SnapshotUploader::uploadFailure(QNetworkReply& reply) {
|
||||
// TODO: parse response, potentially helpful for logging (?)
|
||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(false);
|
||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(reply.readAll());
|
||||
}
|
||||
|
||||
void SnapshotUploader::createStorySuccess(QNetworkReply& reply) {
|
||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(true);
|
||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared("");
|
||||
}
|
||||
|
||||
void SnapshotUploader::createStoryFailure(QNetworkReply& reply) {
|
||||
// TODO: parse response, potentially helpful for logging (?)
|
||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(false);
|
||||
emit DependencyManager::get<WindowScriptingInterface>()->snapshotShared(reply.readAll());
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ function showFeedWindow() {
|
|||
|
||||
var outstanding;
|
||||
function confirmShare(data) {
|
||||
var dialog = new OverlayWebWindow('Snapshot Review', Script.resolvePath("html/ShareSnapshot.html"), 800, 470);
|
||||
var dialog = new OverlayWebWindow('Snapshot Review', Script.resolvePath("html/SnapshotReview.html"), 800, 470);
|
||||
function onMessage(message) {
|
||||
// Receives message from the html dialog via the qwebchannel EventBridge. This is complicated by the following:
|
||||
// 1. Although we can send POJOs, we cannot receive a toplevel object. (Arrays of POJOs are fine, though.)
|
||||
|
@ -82,13 +82,11 @@ function confirmShare(data) {
|
|||
dialog.raise();
|
||||
}
|
||||
|
||||
function snapshotShared(success) {
|
||||
if (success) {
|
||||
// for now just print status
|
||||
function snapshotShared(errorMessage) {
|
||||
if (!errorMessage) {
|
||||
print('snapshot uploaded and shared');
|
||||
} else {
|
||||
// for now just print an error.
|
||||
print('snapshot upload/share failed');
|
||||
print(errorMessage);
|
||||
}
|
||||
if ((--outstanding <= 0) && shouldOpenFeedAfterShare()) {
|
||||
showFeedWindow();
|
||||
|
@ -139,7 +137,7 @@ function resetButtons(path, notify) {
|
|||
confirmShare([
|
||||
{ localPath: path },
|
||||
{
|
||||
canShare: Boolean(Window.location.placename),
|
||||
canShare: Boolean(location.placename),
|
||||
isLoggedIn: true, // Just have the dialog act as though we are. To be removed at both ends later.
|
||||
openFeedAfterShare: shouldOpenFeedAfterShare()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue