From 2f114b9c9205c36c9bdab97dd6005c19b2f7a542 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 16 Aug 2016 10:38:00 -0700 Subject: [PATCH 1/8] fix image link. How did this ever work? --- interface/resources/qml/hifi/UserStoryCard.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/UserStoryCard.qml b/interface/resources/qml/hifi/UserStoryCard.qml index 4b6c37dae8..ef8b03d406 100644 --- a/interface/resources/qml/hifi/UserStoryCard.qml +++ b/interface/resources/qml/hifi/UserStoryCard.qml @@ -25,7 +25,7 @@ Rectangle { property string actionPhrase: "did something"; property string timePhrase: ""; property string hifiUrl: storyCard.placeName; - property string imageUrl: Qt.resolvedUrl("../images/default-domain.gif"); + property string imageUrl: Qt.resolvedUrl("../../images/default-domain.gif"); property var visitPlace: function (ignore) { }; color: "white"; HifiStyles.HifiConstants { id: otherHifi } From 4da2cb685cbf4d96a70c4c18739738b8a97a773d Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 16 Aug 2016 10:43:05 -0700 Subject: [PATCH 2/8] Set full url path to where the picture was taken. Expand width of scroll, but leave a margin at both ends. Include an image at the end to indicate that the scroll is swipable. Adjust ighlight color and border size. --- .../resources/images/Swipe-Icon-single.svg | 42 +++++++++++++++++++ interface/resources/qml/AddressBarDialog.qml | 16 +++++-- 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 interface/resources/images/Swipe-Icon-single.svg diff --git a/interface/resources/images/Swipe-Icon-single.svg b/interface/resources/images/Swipe-Icon-single.svg new file mode 100644 index 0000000000..277a6050db --- /dev/null +++ b/interface/resources/images/Swipe-Icon-single.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + diff --git a/interface/resources/qml/AddressBarDialog.qml b/interface/resources/qml/AddressBarDialog.qml index 988f13a0a7..122033b241 100644 --- a/interface/resources/qml/AddressBarDialog.qml +++ b/interface/resources/qml/AddressBarDialog.qml @@ -53,6 +53,7 @@ Window { storyCard.placeName = card.placeName; storyCard.actionPhrase = card.actionPhrase; storyCard.timePhrase = card.timePhrase; + storyCard.hifiUrl = card.hifiUrl; storyCard.visible = true; return; } @@ -78,7 +79,7 @@ Window { ListView { id: scroll - width: (3 * cardWidth) + (2 * hifi.layout.spacing); + width: backgroundImage.width; height: cardHeight; spacing: hifi.layout.spacing; clip: true; @@ -106,9 +107,18 @@ Window { } highlightMoveDuration: -1; highlightMoveVelocity: -1; - highlight: Rectangle { color: "transparent"; border.width: 2; border.color: "#1FA5E8"; z: 1; } + highlight: Rectangle { color: "transparent"; border.width: 4; border.color: "#1DB5ED"; z: 1; } + leftMargin: 50; // Start the first item over be about the same amount as the last item peeks through on the other side. + rightMargin: 50; + } + Image { // Just a visual indicator that the user can swipe the cards over to see more. + source: "../images/Swipe-Icon-single.svg" + width: 50; + anchors { + right: scroll.right; + verticalCenter: scroll.verticalCenter; + } } - Image { id: backgroundImage source: "../images/address-bar.svg" From a8fd92d2bfb7a4aa268f00e3fdad33190db23251 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Tue, 16 Aug 2016 12:35:49 -0700 Subject: [PATCH 3/8] Hide reticle during snapshot --- scripts/system/snapshot.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 39bcc7fe90..795e469c83 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -9,7 +9,7 @@ // var SNAPSHOT_DELAY = 500; // 500ms var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); -var resetOverlays; +var resetOverlays, recticleVisible; var button = toolBar.addButton({ objectName: "snapshot", imageURL: Script.resolvePath("assets/images/tools/snap.svg"), @@ -57,6 +57,8 @@ function snapshotShared(success) { function onClicked() { // update button states resetOverlays = Menu.isOptionChecked("Overlays"); + reticleVisible = Reticle.visible; + Reticle.visible = false; Window.snapshotTaken.connect(resetButtons); button.writeProperty("buttonState", 0); @@ -84,6 +86,7 @@ function resetButtons(path, notify) { } // show hud toolBar.writeProperty("visible", true); + Reticle.visible = reticleVisible; // update button states button.writeProperty("buttonState", 1); From 48ff26eeb7d75534efde05e4d00aceee08f81e45 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 17 Aug 2016 09:50:38 -0700 Subject: [PATCH 4/8] provide a way to programmatically show the feed (showing address bar in feed mode). --- interface/src/ui/AddressBarDialog.cpp | 1 + interface/src/ui/AddressBarDialog.h | 5 +++++ interface/src/ui/DialogsManager.cpp | 5 +++++ interface/src/ui/DialogsManager.h | 2 ++ 4 files changed, 13 insertions(+) diff --git a/interface/src/ui/AddressBarDialog.cpp b/interface/src/ui/AddressBarDialog.cpp index a4ef8a913f..e5b4262770 100644 --- a/interface/src/ui/AddressBarDialog.cpp +++ b/interface/src/ui/AddressBarDialog.cpp @@ -38,6 +38,7 @@ AddressBarDialog::AddressBarDialog(QQuickItem* parent) : OffscreenQmlDialog(pare }); _backEnabled = !(DependencyManager::get()->getBackStack().isEmpty()); _forwardEnabled = !(DependencyManager::get()->getForwardStack().isEmpty()); + connect(DependencyManager::get().data(), &DialogsManager::setUseFeed, this, &AddressBarDialog::setUseFeed); } void AddressBarDialog::loadAddress(const QString& address, bool fromSuggestions) { diff --git a/interface/src/ui/AddressBarDialog.h b/interface/src/ui/AddressBarDialog.h index 6c7620164b..10f0e0822a 100644 --- a/interface/src/ui/AddressBarDialog.h +++ b/interface/src/ui/AddressBarDialog.h @@ -20,15 +20,19 @@ class AddressBarDialog : public OffscreenQmlDialog { HIFI_QML_DECL 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) public: AddressBarDialog(QQuickItem* parent = nullptr); bool backEnabled() { return _backEnabled; } bool forwardEnabled() { return _forwardEnabled; } + bool useFeed() { return _useFeed; } + void setUseFeed(bool useFeed) { if (_useFeed != useFeed) { _useFeed = useFeed; emit useFeedChanged(); } } signals: void backEnabledChanged(); void forwardEnabledChanged(); + void useFeedChanged(); protected: void displayAddressOfflineMessage(); @@ -42,6 +46,7 @@ protected: bool _backEnabled; bool _forwardEnabled; + bool _useFeed { false }; }; #endif diff --git a/interface/src/ui/DialogsManager.cpp b/interface/src/ui/DialogsManager.cpp index dc06c50626..1b868f4154 100644 --- a/interface/src/ui/DialogsManager.cpp +++ b/interface/src/ui/DialogsManager.cpp @@ -54,6 +54,11 @@ void DialogsManager::showAddressBar() { AddressBarDialog::show(); } +void DialogsManager::showFeed() { + AddressBarDialog::show(); + emit setUseFeed(true); +} + void DialogsManager::toggleDiskCacheEditor() { maybeCreateDialog(_diskCacheEditor); _diskCacheEditor->toggle(); diff --git a/interface/src/ui/DialogsManager.h b/interface/src/ui/DialogsManager.h index 5b4995029f..5e25afd130 100644 --- a/interface/src/ui/DialogsManager.h +++ b/interface/src/ui/DialogsManager.h @@ -45,6 +45,7 @@ public: public slots: void toggleAddressBar(); void showAddressBar(); + void showFeed(); void toggleDiskCacheEditor(); void toggleLoginDialog(); void showLoginDialog(); @@ -63,6 +64,7 @@ public slots: signals: void addressBarToggled(); void addressBarShown(bool visible); + void setUseFeed(bool useFeed); private slots: void hmdToolsClosed(); From 2a099d55774cc9807e7d9201d0e35da6235fa8e3 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 17 Aug 2016 09:53:26 -0700 Subject: [PATCH 5/8] expose to scripts the ability to open the feed --- interface/src/scripting/DialogsManagerScriptingInterface.cpp | 5 +++++ interface/src/scripting/DialogsManagerScriptingInterface.h | 1 + 2 files changed, 6 insertions(+) diff --git a/interface/src/scripting/DialogsManagerScriptingInterface.cpp b/interface/src/scripting/DialogsManagerScriptingInterface.cpp index cbca7ff4ff..1604c45593 100644 --- a/interface/src/scripting/DialogsManagerScriptingInterface.cpp +++ b/interface/src/scripting/DialogsManagerScriptingInterface.cpp @@ -26,3 +26,8 @@ void DialogsManagerScriptingInterface::toggleAddressBar() { QMetaObject::invokeMethod(DependencyManager::get().data(), "toggleAddressBar", Qt::QueuedConnection); } + +void DialogsManagerScriptingInterface::showFeed() { + QMetaObject::invokeMethod(DependencyManager::get().data(), + "showFeed", Qt::QueuedConnection); +} diff --git a/interface/src/scripting/DialogsManagerScriptingInterface.h b/interface/src/scripting/DialogsManagerScriptingInterface.h index 075b89f0e5..86cd22af1c 100644 --- a/interface/src/scripting/DialogsManagerScriptingInterface.h +++ b/interface/src/scripting/DialogsManagerScriptingInterface.h @@ -18,6 +18,7 @@ class DialogsManagerScriptingInterface : public QObject { Q_OBJECT public: DialogsManagerScriptingInterface(); + Q_INVOKABLE void showFeed(); public slots: void toggleAddressBar(); From 347b20e5062bc577ee79c6b2631f9600c01db2e1 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 17 Aug 2016 09:54:15 -0700 Subject: [PATCH 6/8] expose to scripts the ability to show dedicated qml windows such as preferences --- interface/src/scripting/DesktopScriptingInterface.cpp | 10 ++++++++++ interface/src/scripting/DesktopScriptingInterface.h | 1 + 2 files changed, 11 insertions(+) diff --git a/interface/src/scripting/DesktopScriptingInterface.cpp b/interface/src/scripting/DesktopScriptingInterface.cpp index f7bc8afe36..efab178798 100644 --- a/interface/src/scripting/DesktopScriptingInterface.cpp +++ b/interface/src/scripting/DesktopScriptingInterface.cpp @@ -17,6 +17,8 @@ #include "Application.h" #include "MainWindow.h" #include +#include +#include int DesktopScriptingInterface::getWidth() { QSize size = qApp->getWindow()->windowHandle()->screen()->virtualSize(); @@ -31,3 +33,11 @@ void DesktopScriptingInterface::setOverlayAlpha(float alpha) { qApp->getApplicationCompositor().setAlpha(alpha); } +void DesktopScriptingInterface::show(const QString& path, const QString& title) { + if (QThread::currentThread() != thread()) { + QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection, Q_ARG(QString, path), Q_ARG(QString, title)); + return; + } + DependencyManager::get()->show(path, title); +} + diff --git a/interface/src/scripting/DesktopScriptingInterface.h b/interface/src/scripting/DesktopScriptingInterface.h index 8da502cb11..2825065e90 100644 --- a/interface/src/scripting/DesktopScriptingInterface.h +++ b/interface/src/scripting/DesktopScriptingInterface.h @@ -23,6 +23,7 @@ class DesktopScriptingInterface : public QObject, public Dependency { public: Q_INVOKABLE void setOverlayAlpha(float alpha); + Q_INVOKABLE void show(const QString& path, const QString& title); int getWidth(); int getHeight(); From 17d9db487d1a06bfd55298111d265eccc4dbc329 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 17 Aug 2016 09:57:46 -0700 Subject: [PATCH 7/8] adjust .qml for useFeed being a c++ property instead of qml. --- interface/resources/qml/AddressBarDialog.qml | 35 +++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/interface/resources/qml/AddressBarDialog.qml b/interface/resources/qml/AddressBarDialog.qml index 122033b241..832ba14013 100644 --- a/interface/resources/qml/AddressBarDialog.qml +++ b/interface/resources/qml/AddressBarDialog.qml @@ -47,7 +47,7 @@ Window { } function goCard(card) { - if (useFeed) { + if (addressBarDialog.useFeed) { storyCard.imageUrl = card.imageUrl; storyCard.userName = card.userName; storyCard.placeName = card.placeName; @@ -60,7 +60,6 @@ Window { addressLine.text = card.hifiUrl; toggleOrGo(true); } - property bool useFeed: false; property var allPlaces: []; property var allStories: []; property int cardWidth: 200; @@ -74,6 +73,7 @@ Window { // The buttons have their button state changed on hover, so we have to manually fix them up here onBackEnabledChanged: backArrow.buttonState = addressBarDialog.backEnabled ? 1 : 0; onForwardEnabledChanged: forwardArrow.buttonState = addressBarDialog.forwardEnabled ? 1 : 0; + onUseFeedChanged: { updateFeedState(); } ListModel { id: suggestions } @@ -191,9 +191,9 @@ Window { id: placesButton imageURL: "../images/places.svg" buttonState: 1 - defaultState: useFeed ? 0 : 1; - hoverState: useFeed ? 2 : -1; - onClicked: useFeed ? toggleFeed() : identity() + defaultState: addressBarDialog.useFeed ? 0 : 1; + hoverState: addressBarDialog.useFeed ? 2 : -1; + onClicked: addressBarDialog.useFeed ? toggleFeed() : identity() anchors { right: feedButton.left; bottom: addressLine.bottom; @@ -203,9 +203,9 @@ Window { id: feedButton; imageURL: "../images/snap-feed.svg"; buttonState: 0 - defaultState: useFeed ? 1 : 0; - hoverState: useFeed ? -1 : 2; - onClicked: useFeed ? identity() : toggleFeed(); + defaultState: addressBarDialog.useFeed ? 1 : 0; + hoverState: addressBarDialog.useFeed ? -1 : 2; + onClicked: addressBarDialog.useFeed ? identity() : toggleFeed(); anchors { right: parent.right; bottom: addressLine.bottom; @@ -231,10 +231,13 @@ Window { } - function toggleFeed () { - useFeed = !useFeed; - placesButton.buttonState = useFeed ? 0 : 1; - feedButton.buttonState = useFeed ? 1 : 0; + function toggleFeed() { + addressBarDialog.useFeed = !addressBarDialog.useFeed; + updateFeedState(); + } + function updateFeedState() { + placesButton.buttonState = addressBarDialog.useFeed ? 0 : 1; + feedButton.buttonState = addressBarDialog.useFeed ? 1 : 0; filterChoicesByText(); } function getRequest(url, cb) { // cb(error, responseOfCorrectContentType) of url. General for 'get' text/html/json, but without redirects. @@ -371,7 +374,7 @@ Window { } function suggestable(place) { - if (useFeed) { + if (addressBarDialog.useFeed) { return true; } return (place.place_name !== AddressManager.hostname) // Not our entry, but do show other entry points to current domain. @@ -406,7 +409,7 @@ Window { // pageResults is now [ [ placeDataOneForDomainOne, placeDataTwoForDomainOne, ...], [ placeDataTwoForDomainTwo...] ] pageResults.forEach(function (domainResults) { allPlaces = allPlaces.concat(domainResults); - if (!addressLine.text && !useFeed) { // Don't add if the user is already filtering + if (!addressLine.text && !addressBarDialog.useFeed) { // Don't add if the user is already filtering domainResults.forEach(function (place) { if (suggestable(place)) { suggestions.append(place); @@ -431,7 +434,7 @@ Window { return makeModelData(story); }); allStories = allStories.concat(stories); - if (!addressLine.text && useFeed) { // Don't add if the user is already filtering + if (!addressLine.text && addressBarDialog.useFeed) { // Don't add if the user is already filtering stories.forEach(function (story) { suggestions.append(story); }); @@ -445,7 +448,7 @@ Window { function filterChoicesByText() { suggestions.clear(); var words = addressLine.text.toUpperCase().split(/\s+/).filter(identity), - data = useFeed ? allStories : allPlaces; + data = addressBarDialog.useFeed ? allStories : allPlaces; function matches(place) { if (!words.length) { return suggestable(place); From 8823f486666c799be58e11dbbcaea39f9a262422 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 17 Aug 2016 10:00:20 -0700 Subject: [PATCH 8/8] new snapshot review behavior --- scripts/system/html/ShareSnapshot.html | 47 ++++++++++++++++++------- scripts/system/snapshot.js | 48 ++++++++++++++++++-------- 2 files changed, 67 insertions(+), 28 deletions(-) diff --git a/scripts/system/html/ShareSnapshot.html b/scripts/system/html/ShareSnapshot.html index 7754371547..9098b30121 100644 --- a/scripts/system/html/ShareSnapshot.html +++ b/scripts/system/html/ShareSnapshot.html @@ -21,6 +21,15 @@ max-width: 100%; height:auto; } + .prompt { + font-family: Raleway-SemiBold; + text-transform: none; + } + + .sub-section-header > div > input { + margin-top:20px; + } + span.inline-checkbox { display:inline; } @media (max-width: 768px){ .snapshot-column-left{ @@ -37,6 +46,8 @@ .snapsection{ width:95% !important; padding-right:0px; + margin-left: auto; + margin-right: auto; } div#sharing { margin-top:50px; @@ -104,11 +115,14 @@ }; // beware of bug: Cannot send objects at top level. (Nested in arrays is fine.) - shareSelected = function() { - EventBridge.emitWebEvent(paths); + shareSelected = function () { + EventBridge.emitWebEvent(paths.concat({openFeed: document.getElementById("openFeed").checked})); }; - doNotShare = function() { - EventBridge.emitWebEvent([]); + doNotShare = function () { + EventBridge.emitWebEvent([{openFeed: document.getElementById("openFeed").checked}]); + }; + snapshotSettings = function () { + EventBridge.emitWebEvent("openSettings"); }; @@ -120,16 +134,23 @@
-
-
- -
-
- -
-
- +
+
+
Would you like to share your pic in the Snapshots feed?
+
+
+
+
+ +
+
+
+ + + + +
diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 795e469c83..6c9132194e 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -20,24 +20,39 @@ var button = toolBar.addButton({ alpha: 0.9, }); +function showFeedWindow() { + DialogsManager.showFeed(); +} + +var openFeed, outstanding; function confirmShare(data) { - var dialog = new OverlayWebWindow('Snapshot', Script.resolvePath("html/ShareSnapshot.html"), 800, 470); + var dialog = new OverlayWebWindow('Snapshot Review', Script.resolvePath("html/ShareSnapshot.html"), 800, 470); function onMessage(message) { - if (message == 'ready') { // The window can now receive data from us. + switch (message) { + case 'ready': dialog.emitScriptEvent(data); // Send it. - return; - } // Rest is confirmation processing - dialog.webEventReceived.disconnect(onMessage); // I'm not certain that this is necessary. If it is, what do we do on normal close? - dialog.close(); - dialog.deleteLater(); - message = message.filter(function (picture) { return picture.share; }); - if (message.length) { - print('sharing', message.map(function (picture) { return picture.localPath; }).join(', ')); - message.forEach(function (data) { - Window.shareSnapshot(data.localPath); + openFeed = false; + outstanding = 0; + break; + case 'openSettings': + Desktop.show("hifi/dialogs/GeneralPreferencesDialog.qml", "GeneralPreferencesDialog"); + break; + default: + dialog.webEventReceived.disconnect(onMessage); // I'm not certain that this is necessary. If it is, what do we do on normal close? + dialog.close(); + dialog.deleteLater(); + message.forEach(function (submessage) { + if (submessage.share) { + print('sharing', submessage.localPath); + outstanding++; + Window.shareSnapshot(submessage.localPath); + } else if (submessage.openFeed) { + openFeed = true; + } }); - } else { - print('declined to share', JSON.stringify(data)); + if (openFeed && !outstanding) { + showFeedWindow(); + } } } dialog.webEventReceived.connect(onMessage); @@ -51,7 +66,10 @@ function snapshotShared(success) { } else { // for now just print an error. print('snapshot upload/share failed'); - } + } + if ((--outstanding <= 0) && openFeed) { + showFeedWindow(); + } } function onClicked() {