From 82422edb59c3150c5a029ab22e53c1869d1dff5a Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Mon, 14 May 2018 18:51:39 -0700 Subject: [PATCH] fixinig the controller settings page and have menu option on by default --- .../qml/hifi/tablet/CalibratingScreen.qml | 2 +- .../qml/hifi/tablet/ControllerSettings.qml | 491 ++++++++++-------- .../tabletWindows/TabletPreferencesDialog.qml | 6 +- interface/src/Menu.cpp | 9 +- scripts/system/edit.js | 49 +- 5 files changed, 293 insertions(+), 264 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/CalibratingScreen.qml b/interface/resources/qml/hifi/tablet/CalibratingScreen.qml index 6c26bd87c5..e3115a5738 100644 --- a/interface/resources/qml/hifi/tablet/CalibratingScreen.qml +++ b/interface/resources/qml/hifi/tablet/CalibratingScreen.qml @@ -18,7 +18,7 @@ import "../../controls-uit" as HifiControls Rectangle { id: info - + anchors.fill: parent signal canceled() signal restart() diff --git a/interface/resources/qml/hifi/tablet/ControllerSettings.qml b/interface/resources/qml/hifi/tablet/ControllerSettings.qml index 4ee69c4982..f08d6899a3 100644 --- a/interface/resources/qml/hifi/tablet/ControllerSettings.qml +++ b/interface/resources/qml/hifi/tablet/ControllerSettings.qml @@ -8,6 +8,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import Qt.labs.settings 1.0 import "../../styles-uit" @@ -15,237 +16,275 @@ import "../../controls" import "../../controls-uit" as HifiControls import "../../dialogs" import "../../dialogs/preferences" +import "tabletWindows" +import "../audio" -PreferencesDialog { - id: root - objectName: "ControlSettings" - title: "Control Settings" - showCategories: ["VR Movement", inputConfigurationComponents] - property var settings: Settings { - category: root.objectName - property alias x: root.x - property alias y: root.y - property alias width: root.width - property alias height: root.height - } - Component { - id: inputConfigurationComponents +Item { + id: controllerSettings + height: parent.height + width: parent.width - Preference { + HifiConstants { id: hifi } - StackView { - id: stack - initialItem: inputConfiguration - property alias messageVisible: imageMessageBox.visible - property alias selectedPlugin: box.currentText - Rectangle { - id: inputConfiguration - anchors.fill: parent + TabBar { + id: bar + spacing: 0 + width: parent.width - HifiConstants { id: hifi } - - color: hifi.colors.baseGray - - property var pluginSettings: null - - HifiControls.ImageMessageBox { - id: imageMessageBox - anchors.fill: parent - z: 2000 - imageWidth: 442 - imageHeight: 670 - source: "../../../images/calibration-help.png" - } - - Rectangle { - width: inputConfiguration.width - height: 1 - color: hifi.colors.baseGrayShadow - x: -hifi.dimensions.contentMargin.x - } - - RalewayRegular { - id: header - text: "Control Settings" - size: 22 - color: "white" - - anchors.top: inputConfiguration.top - anchors.left: inputConfiguration.left - anchors.leftMargin: 20 - anchors.topMargin: 20 - } - - Separator { - id: headerSeparator - width: inputConfiguration.width - anchors.top: header.bottom - anchors.topMargin: 10 - } - - HiFiGlyphs { - id: sourceGlyph - text: hifi.glyphs.source - size: 36 - color: hifi.colors.blueHighlight - - anchors.top: headerSeparator.bottom - anchors.left: inputConfiguration.left - anchors.leftMargin: 40 - anchors.topMargin: 20 - } - - RalewayRegular { - id: configuration - text: "SELECT DEVICE" - size: 15 - color: hifi.colors.lightGrayText - - - anchors.top: headerSeparator.bottom - anchors.left: sourceGlyph.right - anchors.leftMargin: 10 - anchors.topMargin: 30 - } - - Row { - id: configRow - z: 999 - anchors.top: sourceGlyph.bottom - anchors.topMargin: 20 - anchors.left: sourceGlyph.left - anchors.leftMargin: 40 - spacing: 10 - HifiControls.ComboBox { - id: box - width: 160 - z: 999 - editable: true - colorScheme: hifi.colorSchemes.dark - model: inputPlugins() - label: "" - - onCurrentIndexChanged: { - changeSource(); - } - } - - HifiControls.CheckBox { - id: checkBox - colorScheme: hifi.colorSchemes.dark - text: "show all input devices" - - onClicked: { - inputPlugins(); - changeSource(); - } - } - } - - - Separator { - id: configurationSeparator - z: 0 - width: inputConfiguration.width - anchors.top: configRow.bottom - anchors.topMargin: 10 - } - - - HiFiGlyphs { - id: sliderGlyph - text: hifi.glyphs.sliders - size: 36 - color: hifi.colors.blueHighlight - - anchors.top: configurationSeparator.bottom - anchors.left: inputConfiguration.left - anchors.leftMargin: 40 - anchors.topMargin: 20 - } - - RalewayRegular { - id: configurationHeader - text: "CONFIGURATION" - size: 15 - color: hifi.colors.lightGrayText - - - anchors.top: configurationSeparator.bottom - anchors.left: sliderGlyph.right - anchors.leftMargin: 10 - anchors.topMargin: 30 - } - - Loader { - id: loader - asynchronous: false - - width: inputConfiguration.width - anchors.left: inputConfiguration.left - anchors.right: inputConfiguration.right - anchors.top: configurationHeader.bottom - anchors.topMargin: 10 - anchors.bottom: inputConfiguration.bottom - - source: InputConfiguration.configurationLayout(box.currentText); - onLoaded: { - if (loader.item.hasOwnProperty("pluginName")) { - if (box.currentText === "Vive") { - loader.item.pluginName = "OpenVR"; - } else { - loader.item.pluginName = box.currentText; - } - } - - if (loader.item.hasOwnProperty("displayInformation")) { - loader.item.displayConfiguration(); - } - } - } - } - - - function inputPlugins() { - if (checkBox.checked) { - return InputConfiguration.inputPlugins(); - } else { - return InputConfiguration.activeInputPlugins(); - } - } - - function initialize() { - changeSource(); - } - - function changeSource() { - loader.source = ""; - var source = ""; - if (box.currentText == "Vive") { - source = InputConfiguration.configurationLayout("OpenVR"); - } else { - source = InputConfiguration.configurationLayout(box.currentText); - } - - loader.source = source; - if (source === "") { - box.label = "(not configurable)"; - } else { - box.label = ""; - } - } - - Timer { - id: timer - repeat: false - interval: 300 - onTriggered: initialize() - } - - Component.onCompleted: { - timer.start(); - } + TabButton { + height: parent.height + text: qsTr("Settings") + onClicked: { + stackView.clear(); + stackView.push(controllerPreferencesComponent); + } + } + TabButton { + height: parent.height + text: qsTr("Calibration") + onClicked: { + stackView.clear(); + stackView.push(inputConfigurationComponent); } } } + + + StackView { + id: stackView + anchors.top: bar.bottom + anchors.bottom: controllerSettings.bottom + anchors.left: controllerSettings.left + anchors.right: controllerSettings.right + + initialItem: controllerPreferencesComponent + } + + Component { + id: inputConfigurationComponent + StackView { + id: stack + initialItem: inputConfiguration + property alias messageVisible: imageMessageBox.visible + property alias selectedPlugin: box.currentText + Rectangle { + id: inputConfiguration + anchors.fill: parent + + HifiConstants { id: hifi } + + color: hifi.colors.baseGray + + property var pluginSettings: null + + HifiControls.ImageMessageBox { + id: imageMessageBox + anchors.fill: parent + z: 2000 + imageWidth: 442 + imageHeight: 670 + source: "../../../images/calibration-help.png" + } + + Rectangle { + width: inputConfiguration.width + height: 1 + color: hifi.colors.baseGrayShadow + x: -hifi.dimensions.contentMargin.x + } + + RalewayRegular { + id: header + text: "Control Settings" + size: 22 + color: "white" + + anchors.top: inputConfiguration.top + anchors.left: inputConfiguration.left + anchors.leftMargin: 20 + anchors.topMargin: 20 + } + + Separator { + id: headerSeparator + width: inputConfiguration.width + anchors.top: header.bottom + anchors.topMargin: 10 + } + + HiFiGlyphs { + id: sourceGlyph + text: hifi.glyphs.source + size: 36 + color: hifi.colors.blueHighlight + + anchors.top: headerSeparator.bottom + anchors.left: inputConfiguration.left + anchors.leftMargin: 40 + anchors.topMargin: 20 + } + + RalewayRegular { + id: configuration + text: "SELECT DEVICE" + size: 15 + color: hifi.colors.lightGrayText + + + anchors.top: headerSeparator.bottom + anchors.left: sourceGlyph.right + anchors.leftMargin: 10 + anchors.topMargin: 30 + } + + Row { + id: configRow + z: 999 + anchors.top: sourceGlyph.bottom + anchors.topMargin: 20 + anchors.left: sourceGlyph.left + anchors.leftMargin: 40 + spacing: 10 + HifiControls.ComboBox { + id: box + width: 160 + z: 999 + editable: true + colorScheme: hifi.colorSchemes.dark + model: inputPlugins() + label: "" + + onCurrentIndexChanged: { + changeSource(); + } + } + + HifiControls.CheckBox { + id: checkBox + colorScheme: hifi.colorSchemes.dark + text: "show all input devices" + + onClicked: { + inputPlugins(); + changeSource(); + } + } + } + + + Separator { + id: configurationSeparator + z: 0 + width: inputConfiguration.width + anchors.top: configRow.bottom + anchors.topMargin: 10 + } + + + HiFiGlyphs { + id: sliderGlyph + text: hifi.glyphs.sliders + size: 36 + color: hifi.colors.blueHighlight + + anchors.top: configurationSeparator.bottom + anchors.left: inputConfiguration.left + anchors.leftMargin: 40 + anchors.topMargin: 20 + } + + RalewayRegular { + id: configurationHeader + text: "CONFIGURATION" + size: 15 + color: hifi.colors.lightGrayText + + + anchors.top: configurationSeparator.bottom + anchors.left: sliderGlyph.right + anchors.leftMargin: 10 + anchors.topMargin: 30 + } + + Loader { + id: loader + asynchronous: false + + width: inputConfiguration.width + anchors.left: inputConfiguration.left + anchors.right: inputConfiguration.right + anchors.top: configurationHeader.bottom + anchors.topMargin: 10 + anchors.bottom: inputConfiguration.bottom + + source: InputConfiguration.configurationLayout(box.currentText); + onLoaded: { + if (loader.item.hasOwnProperty("pluginName")) { + if (box.currentText === "Vive") { + loader.item.pluginName = "OpenVR"; + } else { + loader.item.pluginName = box.currentText; + } + } + + if (loader.item.hasOwnProperty("displayInformation")) { + loader.item.displayConfiguration(); + } + } + } + } + + + function inputPlugins() { + if (checkBox.checked) { + return InputConfiguration.inputPlugins(); + } else { + return InputConfiguration.activeInputPlugins(); + } + } + + function initialize() { + changeSource(); + } + + function changeSource() { + loader.source = ""; + var source = ""; + if (box.currentText == "Vive") { + source = InputConfiguration.configurationLayout("OpenVR"); + } else { + source = InputConfiguration.configurationLayout(box.currentText); + } + + loader.source = source; + if (source === "") { + box.label = "(not configurable)"; + } else { + box.label = ""; + } + } + + Timer { + id: timer + repeat: false + interval: 300 + onTriggered: initialize() + } + + Component.onCompleted: { + timer.start(); + } + } + } + + + Component { + id: controllerPreferencesComponent + TabletPreferencesDialog { + anchors.fill: stackView + id: controllerPrefereneces + objectName: "TabletControllerPreferences" + showCategories: ["VR Movement"] + } + } } diff --git a/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml b/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml index a5ef3d2686..646a0d2c77 100644 --- a/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml +++ b/interface/resources/qml/hifi/tablet/tabletWindows/TabletPreferencesDialog.qml @@ -19,6 +19,7 @@ Item { id: dialog width: parent.width height: parent.height + anchors.fill: parent HifiConstants { id: hifi } property var sections: [] @@ -158,14 +159,15 @@ Item { Rectangle { id: footer - height: 40 + height: dialog.height * 0.15 + anchors.bottom: dialog.bottom anchors { bottom: keyboard.top left: parent.left right: parent.right } - + color: hifi.colors.baseGray Row { diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index be50fe9119..dad79faedf 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -236,8 +236,13 @@ Menu::Menu() { // Settings > Controls... action = addActionToQMenuAndActionHash(settingsMenu, "Controls..."); connect(action, &QAction::triggered, [] { - qApp->showDialog(QString("hifi/tablet/ControllerSettings.qml"), - QString("hifi/tablet/ControllerSettings.qml"), "ControlSettings"); + auto tablet = DependencyManager::get()->getTablet("com.highfidelity.interface.tablet.system"); + auto hmd = DependencyManager::get(); + tablet->loadQMLSource("hifi/tablet/ControllerSettings.qml"); + + if (!hmd->getShouldShowTablet()) { + hmd->toggleShouldShowTablet(); + } }); // Settings > Audio... diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 523582836f..f378389d0b 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -1150,8 +1150,7 @@ function setupModelMenus() { Menu.addMenuItem({ menuName: "Edit", menuItemName: "Entities", - isSeparator: true, - grouping: "Advanced" + isSeparator: true }); if (!Menu.menuItemExists("Edit", "Delete")) { Menu.addMenuItem({ @@ -1161,7 +1160,6 @@ function setupModelMenus() { text: "delete" }, afterItem: "Entities", - grouping: "Advanced" }); modelMenuAddedDelete = true; } @@ -1169,15 +1167,13 @@ function setupModelMenus() { Menu.addMenuItem({ menuName: "Edit", menuItemName: "Parent Entity to Last", - afterItem: "Entities", - grouping: "Advanced" + afterItem: "Entities" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Unparent Entity", - afterItem: "Parent Entity to Last", - grouping: "Advanced" + afterItem: "Parent Entity to Last" }); Menu.addMenuItem({ @@ -1185,8 +1181,7 @@ function setupModelMenus() { menuItemName: MENU_CREATE_ENTITIES_GRABBABLE, afterItem: "Unparent Entity", isCheckable: true, - isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_CREATE_ENTITIES_GRABBABLE, true), - grouping: "Advanced" + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_CREATE_ENTITIES_GRABBABLE, true) }); Menu.addMenuItem({ @@ -1194,87 +1189,75 @@ function setupModelMenus() { menuItemName: MENU_ALLOW_SELECTION_LARGE, afterItem: MENU_CREATE_ENTITIES_GRABBABLE, isCheckable: true, - isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LARGE, true), - grouping: "Advanced" + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LARGE, true) }); Menu.addMenuItem({ menuName: "Edit", menuItemName: MENU_ALLOW_SELECTION_SMALL, afterItem: MENU_ALLOW_SELECTION_LARGE, isCheckable: true, - isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_SMALL, true), - grouping: "Advanced" + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_SMALL, true) }); Menu.addMenuItem({ menuName: "Edit", menuItemName: MENU_ALLOW_SELECTION_LIGHTS, afterItem: MENU_ALLOW_SELECTION_SMALL, isCheckable: true, - isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LIGHTS, false), - grouping: "Advanced" + isChecked: Settings.getValue(SETTING_EDIT_PREFIX + MENU_ALLOW_SELECTION_LIGHTS, false) }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Select All Entities In Box", - afterItem: "Allow Selecting of Lights", - grouping: "Advanced" + afterItem: "Allow Selecting of Lights" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Select All Entities Touching Box", - afterItem: "Select All Entities In Box", - grouping: "Advanced" + afterItem: "Select All Entities In Box" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Export Entities", - afterItem: "Entities", - grouping: "Advanced" + afterItem: "Entities" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Import Entities", - afterItem: "Export Entities", - grouping: "Advanced" + afterItem: "Export Entities" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Import Entities from URL", - afterItem: "Import Entities", - grouping: "Advanced" + afterItem: "Import Entities" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: MENU_AUTO_FOCUS_ON_SELECT, isCheckable: true, - isChecked: Settings.getValue(SETTING_AUTO_FOCUS_ON_SELECT) === "true", - grouping: "Advanced" + isChecked: Settings.getValue(SETTING_AUTO_FOCUS_ON_SELECT) === "true" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: MENU_EASE_ON_FOCUS, afterItem: MENU_AUTO_FOCUS_ON_SELECT, isCheckable: true, - isChecked: Settings.getValue(SETTING_EASE_ON_FOCUS) === "true", - grouping: "Advanced" + isChecked: Settings.getValue(SETTING_EASE_ON_FOCUS) === "true" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE, afterItem: MENU_EASE_ON_FOCUS, isCheckable: true, - isChecked: Settings.getValue(SETTING_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE) !== "false", - grouping: "Advanced" + isChecked: Settings.getValue(SETTING_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE) !== "false" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: MENU_SHOW_ZONES_IN_EDIT_MODE, afterItem: MENU_SHOW_LIGHTS_AND_PARTICLES_IN_EDIT_MODE, isCheckable: true, - isChecked: Settings.getValue(SETTING_SHOW_ZONES_IN_EDIT_MODE) !== "false", - grouping: "Advanced" + isChecked: Settings.getValue(SETTING_SHOW_ZONES_IN_EDIT_MODE) !== "false" }); Entities.setLightsArePickable(false);