From 4bc050e5835b542b7df09328af44e73cd465033c Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 15 Mar 2017 19:26:50 +0100 Subject: [PATCH 1/5] added tablet notification --- libraries/script-engine/src/TabletScriptingInterface.h | 9 ++++++++- libraries/ui/src/OffscreenUi.cpp | 4 ++++ scripts/system/notifications.js | 10 ++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/libraries/script-engine/src/TabletScriptingInterface.h b/libraries/script-engine/src/TabletScriptingInterface.h index 00624254d7..acc53653f8 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.h +++ b/libraries/script-engine/src/TabletScriptingInterface.h @@ -56,7 +56,14 @@ public: QQuickWindow* getTabletWindow(); QObject* getFlags(); - +signals: + /** jsdoc + * Signaled when a tablet message or dialog is created + * @function TabletProxy#tabletNotification + * @returns {Signal} + */ + void tabletNotification(); + private: void processMenuEvents(QObject* object, const QKeyEvent* event); void processTabletEvents(QObject* object, const QKeyEvent* event); diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 982d58464f..1cb9045e79 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -223,6 +223,7 @@ QQuickItem* OffscreenUi::createMessageBox(Icon icon, const QString& title, const invokeResult = QMetaObject::invokeMethod(tabletRoot, "messageBox", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, QVariant::fromValue(map))); + emit tabletScriptingInterface->tabletNotification(); } if (!invokeResult) { @@ -430,6 +431,7 @@ QQuickItem* OffscreenUi::createInputDialog(const Icon icon, const QString& title invokeResult = QMetaObject::invokeMethod(tabletRoot, "inputDialog", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, QVariant::fromValue(map))); + emit tabletScriptingInterface->tabletNotification(); } if (!invokeResult) { qWarning() << "Failed to create message box"; @@ -457,6 +459,7 @@ QQuickItem* OffscreenUi::createCustomInputDialog(const Icon icon, const QString& invokeResult = QMetaObject::invokeMethod(tabletRoot, "inputDialog", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, QVariant::fromValue(map))); + emit tabletScriptingInterface->tabletNotification(); } if (!invokeResult) { @@ -614,6 +617,7 @@ QString OffscreenUi::fileDialog(const QVariantMap& properties) { invokeResult = QMetaObject::invokeMethod(tabletRoot, "fileDialog", Q_RETURN_ARG(QVariant, buildDialogResult), Q_ARG(QVariant, QVariant::fromValue(properties))); + emit tabletScriptingInterface->tabletNotification(); } if (!invokeResult) { diff --git a/scripts/system/notifications.js b/scripts/system/notifications.js index b2ebb1fd46..0b7c2fa1b3 100644 --- a/scripts/system/notifications.js +++ b/scripts/system/notifications.js @@ -94,11 +94,13 @@ var NotificationType = { LOD_WARNING: 2, CONNECTION_REFUSED: 3, EDIT_ERROR: 4, + TABLET: 5, properties: [ { text: "Snapshot" }, { text: "Level of Detail" }, { text: "Connection Refused" }, - { text: "Edit error" } + { text: "Edit error" }, + { text: "Tablet" } ], getTypeFromMenuItem: function(menuItemName) { if (menuItemName.substr(menuItemName.length - NOTIFICATION_MENU_ITEM_POST.length) !== NOTIFICATION_MENU_ITEM_POST) { @@ -535,6 +537,10 @@ function onSnapshotTaken(pathStillSnapshot, pathAnimatedSnapshot, notify) { } } +function tabletNotification() { + createNotification("Tablet need your attention", NotificationType.TABLET); +} + function processingGif() { createNotification("Processing GIF snapshot...", NotificationType.SNAPSHOT); } @@ -641,7 +647,7 @@ Window.snapshotTaken.connect(onSnapshotTaken); Window.processingGif.connect(processingGif); Window.notifyEditError = onEditError; Window.notify = onNotify; - +Tablet.tabletNotification.connect(tabletNotification); setup(); }()); // END LOCAL_SCOPE From a5f1fb9e9a3124b73f751c167fb1a7147e840c8f Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Wed, 15 Mar 2017 19:45:30 +0100 Subject: [PATCH 2/5] fixed notification spelling error --- scripts/system/notifications.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/notifications.js b/scripts/system/notifications.js index 0b7c2fa1b3..b527348733 100644 --- a/scripts/system/notifications.js +++ b/scripts/system/notifications.js @@ -538,7 +538,7 @@ function onSnapshotTaken(pathStillSnapshot, pathAnimatedSnapshot, notify) { } function tabletNotification() { - createNotification("Tablet need your attention", NotificationType.TABLET); + createNotification("Tablet needs your attention", NotificationType.TABLET); } function processingGif() { From f1947769d66f9654468aae74f6fb7bd286863b64 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 17 Mar 2017 11:15:56 +1300 Subject: [PATCH 3/5] Fix tablet settings dialogs' titles and make QML consistent --- .../hifi/tablet/TabletAudioPreferences.qml | 10 +++------- .../hifi/tablet/TabletAvatarPreferences.qml | 10 +++------- .../hifi/tablet/TabletGeneralPreferences.qml | 9 ++------- .../hifi/tablet/TabletGraphicsPreferences.qml | 20 +++++++++++-------- .../qml/hifi/tablet/TabletLodPreferences.qml | 20 +++++++++++-------- .../tablet/TabletNetworkingPreferences.qml | 12 ++++------- .../tabletWindows/TabletPreferencesDialog.qml | 13 +----------- 7 files changed, 37 insertions(+), 57 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAudioPreferences.qml b/interface/resources/qml/hifi/tablet/TabletAudioPreferences.qml index 1c18c44a97..75a243b188 100644 --- a/interface/resources/qml/hifi/tablet/TabletAudioPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletAudioPreferences.qml @@ -9,17 +9,16 @@ // import QtQuick 2.5 +import QtQuick.Controls 1.4 import "tabletWindows" import "../../dialogs" -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtGraphicalEffects 1.0 StackView { id: profileRoot initialItem: root objectName: "stack" - property var title: "Audio Preferences" + property string title: "Audio Settings" + property var eventBridge; signal sendToScript(var message); @@ -33,10 +32,7 @@ StackView { TabletPreferencesDialog { id: root - property string title: "Audio Settings" objectName: "TabletAudioPreferences" - width: parent.width - height: parent.height showCategories: ["Audio"] } } diff --git a/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml b/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml index b29164a30f..f189b5c1cd 100644 --- a/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml @@ -9,17 +9,16 @@ // import QtQuick 2.5 +import QtQuick.Controls 1.4 import "tabletWindows" import "../../dialogs" -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtGraphicalEffects 1.0 StackView { id: profileRoot initialItem: root objectName: "stack" - property var title: "Avatar Preferences" + property string title: "Avatar Settings" + property var eventBridge; signal sendToScript(var message); @@ -33,10 +32,7 @@ StackView { TabletPreferencesDialog { id: root - property string title: "Avatar Preferences" objectName: "TabletAvatarPreferences" - width: parent.width - height: parent.height showCategories: ["Avatar Basics", "Avatar Tuning", "Avatar Camera"] } } diff --git a/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml b/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml index 47e6a05f78..c790b18747 100644 --- a/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml @@ -9,17 +9,15 @@ // import QtQuick 2.5 +import QtQuick.Controls 1.4 import "tabletWindows" import "../../dialogs" -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtGraphicalEffects 1.0 StackView { id: profileRoot initialItem: root objectName: "stack" - property var title: "General Prefernces" + property string title: "General Settings" property var eventBridge; signal sendToScript(var message); @@ -34,10 +32,7 @@ StackView { TabletPreferencesDialog { id: root - property string title: "General Preferences" objectName: "TabletGeneralPreferences" - width: parent.width - height: parent.height showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers", "Perception Neuron", "Kinect"] } } diff --git a/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml b/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml index 2ca9634ee6..6420119480 100644 --- a/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml @@ -1,16 +1,23 @@ -import QtQuick 2.5 -import Qt.labs.settings 1.0 +// +// TabletGraphicsPreferences.qml +// +// Created by Vlad Stelmahovsky on 12 Mar 2017. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.5 +import QtQuick.Controls 1.4 import "tabletWindows" import "../../dialogs" -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtGraphicalEffects 1.0 StackView { id: profileRoot initialItem: root objectName: "stack" + property string title: "Graphics Settings" property var eventBridge; signal sendToScript(var message); @@ -25,10 +32,7 @@ StackView { TabletPreferencesDialog { id: root - property string title: "Graphics Settings" objectName: "TabletGraphicsPreferences" - width: parent.width - height: parent.height showCategories: ["Graphics"] } } diff --git a/interface/resources/qml/hifi/tablet/TabletLodPreferences.qml b/interface/resources/qml/hifi/tablet/TabletLodPreferences.qml index 8f03bdb0c5..d6affb25b0 100644 --- a/interface/resources/qml/hifi/tablet/TabletLodPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletLodPreferences.qml @@ -1,16 +1,23 @@ -import QtQuick 2.5 -import Qt.labs.settings 1.0 +// +// TabletLodPreferences.qml +// +// Created by Vlad Stelmahovsky on 11 Mar 2017. +// Copyright 2017 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.5 +import QtQuick.Controls 1.4 import "tabletWindows" import "../../dialogs" -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtGraphicalEffects 1.0 StackView { id: profileRoot initialItem: root objectName: "stack" + property string title: "LOD Settings" property var eventBridge; signal sendToScript(var message); @@ -25,10 +32,7 @@ StackView { TabletPreferencesDialog { id: root - property string title: "LOD Settings" objectName: "TabletLodPreferences" - width: parent.width - height: parent.height showCategories: ["Level of Detail Tuning"] } } diff --git a/interface/resources/qml/hifi/tablet/TabletNetworkingPreferences.qml b/interface/resources/qml/hifi/tablet/TabletNetworkingPreferences.qml index f48d270646..766446977d 100644 --- a/interface/resources/qml/hifi/tablet/TabletNetworkingPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletNetworkingPreferences.qml @@ -9,17 +9,16 @@ // import QtQuick 2.5 +import QtQuick.Controls 1.4 import "tabletWindows" import "../../dialogs" -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles 1.4 -import QtGraphicalEffects 1.0 StackView { id: profileRoot initialItem: root objectName: "stack" - property var title: "Network Preferences" + property var title: "Networking Settings" + property var eventBridge; signal sendToScript(var message); @@ -33,10 +32,7 @@ StackView { TabletPreferencesDialog { id: root - property string title: "Networking Settings" - objectName: "NetworkingPreferences" - width: parent.width - height: parent.height + objectName: "TabletNetworkingPreferences" showCategories: ["Networking"] } } diff --git a/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml b/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml index daa071d0ca..c96099a78a 100644 --- a/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml +++ b/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml @@ -58,21 +58,10 @@ Item { Tablet.getTablet("com.highfidelity.interface.tablet.system").gotoHomeScreen(); } - HifiControls.TabletHeader { - id: header - title: parent.title - - anchors { - top: parent.top - left: parent.left - right: parent.right - } - } - Rectangle { id: main anchors { - top: header.bottom + top: parent.top bottom: footer.top left: parent.left right: parent.right From 069e66b87570191f6791c8937e196a4a3d3791c2 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 17 Mar 2017 11:19:50 +1300 Subject: [PATCH 4/5] Fix stack functions --- .../resources/qml/hifi/tablet/TabletAudioPreferences.qml | 4 ++-- .../resources/qml/hifi/tablet/TabletAvatarPreferences.qml | 4 ++-- .../qml/hifi/tablet/TabletGeneralPreferences.qml | 8 ++++---- .../qml/hifi/tablet/TabletGraphicsPreferences.qml | 4 ++-- .../resources/qml/hifi/tablet/TabletLodPreferences.qml | 4 ++-- .../qml/hifi/tablet/TabletNetworkingPreferences.qml | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/TabletAudioPreferences.qml b/interface/resources/qml/hifi/tablet/TabletAudioPreferences.qml index 75a243b188..b21bc238ac 100644 --- a/interface/resources/qml/hifi/tablet/TabletAudioPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletAudioPreferences.qml @@ -23,11 +23,11 @@ StackView { signal sendToScript(var message); function pushSource(path) { - editRoot.push(Qt.reslovedUrl(path)); + profileRoot.push(Qt.reslovedUrl(path)); } function popSource() { - + profileRoot.pop(); } TabletPreferencesDialog { diff --git a/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml b/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml index f189b5c1cd..75973f32ae 100644 --- a/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml @@ -23,11 +23,11 @@ StackView { signal sendToScript(var message); function pushSource(path) { - editRoot.push(Qt.reslovedUrl(path)); + profileRoot.push(Qt.reslovedUrl(path)); } function popSource() { - + profileRoot.pop(); } TabletPreferencesDialog { diff --git a/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml b/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml index c790b18747..6fc29ac920 100644 --- a/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml @@ -21,15 +21,15 @@ StackView { property var eventBridge; signal sendToScript(var message); - + function pushSource(path) { - editRoot.push(Qt.reslovedUrl(path)); + profileRoot.push(Qt.reslovedUrl(path)); } function popSource() { - + profileRoot.pop(); } - + TabletPreferencesDialog { id: root objectName: "TabletGeneralPreferences" diff --git a/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml b/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml index 6420119480..67c466f991 100644 --- a/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletGraphicsPreferences.qml @@ -23,11 +23,11 @@ StackView { signal sendToScript(var message); function pushSource(path) { - editRoot.push(Qt.reslovedUrl(path)); + profileRoot.push(Qt.reslovedUrl(path)); } function popSource() { - + profileRoot.pop(); } TabletPreferencesDialog { diff --git a/interface/resources/qml/hifi/tablet/TabletLodPreferences.qml b/interface/resources/qml/hifi/tablet/TabletLodPreferences.qml index d6affb25b0..f61f6f8c4e 100644 --- a/interface/resources/qml/hifi/tablet/TabletLodPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletLodPreferences.qml @@ -23,11 +23,11 @@ StackView { signal sendToScript(var message); function pushSource(path) { - editRoot.push(Qt.reslovedUrl(path)); + profileRoot.push(Qt.reslovedUrl(path)); } function popSource() { - + profileRoot.pop(); } TabletPreferencesDialog { diff --git a/interface/resources/qml/hifi/tablet/TabletNetworkingPreferences.qml b/interface/resources/qml/hifi/tablet/TabletNetworkingPreferences.qml index 766446977d..db47c78c48 100644 --- a/interface/resources/qml/hifi/tablet/TabletNetworkingPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletNetworkingPreferences.qml @@ -23,11 +23,11 @@ StackView { signal sendToScript(var message); function pushSource(path) { - editRoot.push(Qt.reslovedUrl(path)); + profileRoot.push(Qt.reslovedUrl(path)); } function popSource() { - + profileRoot.pop(); } TabletPreferencesDialog { From 07e4b0ce4184d1fc7a8cc6b49da9689260fff52e Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 17 Mar 2017 11:28:14 +1300 Subject: [PATCH 5/5] Fix title menu icon getting stuck on white --- interface/resources/qml/hifi/tablet/TabletMenu.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/tablet/TabletMenu.qml b/interface/resources/qml/hifi/tablet/TabletMenu.qml index d7d5130bce..af36f72c82 100644 --- a/interface/resources/qml/hifi/tablet/TabletMenu.qml +++ b/interface/resources/qml/hifi/tablet/TabletMenu.qml @@ -60,7 +60,7 @@ FocusScope { anchors.fill: parent hoverEnabled: true onEntered: iconColorOverlay.color = "#1fc6a6"; - onExited: iconColorOverlay.color = "#ffffff"; + onExited: iconColorOverlay.color = "#34a2c7"; // navigate back to root level menu onClicked: { buildMenu();