diff --git a/interface/resources/qml/controls-uit/Slider.qml b/interface/resources/qml/controls-uit/Slider.qml index 5ddd97f3f6..2a5d4c137d 100644 --- a/interface/resources/qml/controls-uit/Slider.qml +++ b/interface/resources/qml/controls-uit/Slider.qml @@ -24,6 +24,7 @@ Slider { property alias minimumValue: slider.from property alias maximumValue: slider.to + property alias step: slider.stepSize property bool tickmarksEnabled: false height: hifi.fontSizes.textFieldInput + 14 // Match height of TextField control. diff --git a/interface/resources/qml/dialogs/preferences/SliderPreference.qml b/interface/resources/qml/dialogs/preferences/SliderPreference.qml index 79c7149f3e..2bdda09fc3 100644 --- a/interface/resources/qml/dialogs/preferences/SliderPreference.qml +++ b/interface/resources/qml/dialogs/preferences/SliderPreference.qml @@ -55,6 +55,7 @@ Preference { value: preference.value minimumValue: preference.min maximumValue: preference.max + step: preference.step width: 130 anchors { right: parent.right diff --git a/interface/resources/qml/hifi/tablet/ControllerSettings.qml b/interface/resources/qml/hifi/tablet/ControllerSettings.qml index 5cad32cf34..da8334f831 100644 --- a/interface/resources/qml/hifi/tablet/ControllerSettings.qml +++ b/interface/resources/qml/hifi/tablet/ControllerSettings.qml @@ -29,7 +29,10 @@ Item { TabBar { id: bar spacing: 0 + anchors.top: controllerSettings.top width: parent.width + height: 40 + z: 10 TabButton { height: parent.height @@ -284,7 +287,7 @@ Item { anchors.fill: stackView id: controllerPrefereneces objectName: "TabletControllerPreferences" - showCategories: ["VR Movement"] + showCategories: ["VR Movement", "Game Controller", "Sixense Controllers", "Perception Neuron", "Leap Motion"] } } } diff --git a/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml b/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml index 810f5bb43f..63801019b9 100644 --- a/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml +++ b/interface/resources/qml/hifi/tablet/TabletGeneralPreferences.qml @@ -32,6 +32,6 @@ StackView { TabletPreferencesDialog { id: root objectName: "TabletGeneralPreferences" - showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Game Controller", "Sixense Controllers", "Perception Neuron", "Kinect", "Leap Motion"] + showCategories: ["User Interface", "HMD", "Snapshots", "Privacy"] } } diff --git a/interface/resources/qml/hifi/toolbars/Toolbar.qml b/interface/resources/qml/hifi/toolbars/Toolbar.qml index b31a61e066..b32d9c7428 100644 --- a/interface/resources/qml/hifi/toolbars/Toolbar.qml +++ b/interface/resources/qml/hifi/toolbars/Toolbar.qml @@ -50,8 +50,6 @@ Window { property var proxy: modelData; onClicked: proxy.clicked() Component.onCompleted: updateProperties() - //menu button should be visible only in VR mode - visible: text !== "MENU" Connections { target: proxy; diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index a4e7e49026..d79ac1c644 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -58,39 +58,55 @@ void setupPreferences() { { static const float MAX_DESKTOP_FPS = 60; static const float MAX_HMD_FPS = 90; - static const float MIN_HMD_FPS = 35; + static const float LOW = 0.25f; + static const float MEDIUM = 0.5f; + static const float HIGH = 0.75f; auto getter = []()->float { auto lodManager = DependencyManager::get(); - float sliderValue = 0; bool inHMD = qApp->isHMDMode(); + float increaseFPS = 0; if (inHMD) { - float hmdMinFPS = lodManager->getHMDLODDecreaseFPS(); - sliderValue = (MAX_HMD_FPS - hmdMinFPS) / MAX_HMD_FPS; + increaseFPS = lodManager->getHMDLODDecreaseFPS(); } else { - float desktopMinFPS = lodManager->getDesktopLODDecreaseFPS(); - sliderValue = (MAX_DESKTOP_FPS - desktopMinFPS) / MAX_DESKTOP_FPS; + increaseFPS = lodManager->getDesktopLODDecreaseFPS(); } - return sliderValue; + float maxFPS = inHMD ? MAX_HMD_FPS : MAX_DESKTOP_FPS; + float percentage = increaseFPS / maxFPS; + + if (percentage >= HIGH) { + return HIGH; + } else if (percentage >= LOW) { + return MEDIUM; + } + return LOW; }; auto setter = [](float value) { static const float THRASHING_DIFFERENCE = 10; auto lodManager = DependencyManager::get(); - if (qApp->isHMDMode()) { - float desiredHMDFPS = (MAX_HMD_FPS - (MAX_HMD_FPS * value)) - THRASHING_DIFFERENCE; - float actualHMDFPS = desiredHMDFPS > MIN_HMD_FPS ? desiredHMDFPS : MIN_HMD_FPS; - lodManager->setHMDLODDecreaseFPS(actualHMDFPS); + + bool isMaxValue = value == HIGH; + bool isHMDMode = qApp->isHMDMode(); + + float maxFPS = isHMDMode ? MAX_HMD_FPS : MAX_DESKTOP_FPS; + float desiredFPS = maxFPS - THRASHING_DIFFERENCE; + + if (!isMaxValue) { + desiredFPS = (maxFPS * value) - THRASHING_DIFFERENCE; + } + + if (isHMDMode) { + lodManager->setHMDLODDecreaseFPS(desiredFPS); } else { - float desiredDesktopFPS = (MAX_DESKTOP_FPS - (MAX_DESKTOP_FPS * value)) - THRASHING_DIFFERENCE; - lodManager->setDesktopLODDecreaseFPS(desiredDesktopFPS); + lodManager->setDesktopLODDecreaseFPS(desiredFPS); } }; auto wodSlider = new SliderPreference(GRAPHICS_QUALITY, "World Detail", getter, setter); - wodSlider->setMin(0); - wodSlider->setMax(1); - wodSlider->setStep(0.1f); + wodSlider->setMin(0.25f); + wodSlider->setMax(0.75f); + wodSlider->setStep(0.25f); preferences->addPreference(wodSlider); auto getterShadow = []()->bool { diff --git a/scripts/system/menu.js b/scripts/system/menu.js index c27dae6780..d669d3d918 100644 --- a/scripts/system/menu.js +++ b/scripts/system/menu.js @@ -9,17 +9,29 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // +/* jslint bitwise: true */ + +/* global Script, HMD, Tablet, Entities */ + var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png"; // var HOME_BUTTON_TEXTURE = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png"; (function() { - var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - var button = tablet.addButton({ + var lastHMDStatus = false; + var buttonProperties = { icon: "icons/tablet-icons/menu-i.svg", activeIcon: "icons/tablet-icons/menu-a.svg", text: "MENU", sortOrder: 3 - }); + }; + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + var button = null; + + if (HMD.active) { + button = tablet.addButton(buttonProperties); + button.clicked.connect(onClicked); + lastHMDStatus = true; + } var onMenuScreen = false; @@ -35,19 +47,37 @@ var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet- } } + HMD.displayModeChanged.connect(function(isHMDMode) { + if (lastHMDStatus !== isHMDMode) { + if (isHMDMode) { + button = tablet.addButton(buttonProperties); + button.clicked.connect(onClicked); + } else if (button) { + button.clicked.disconnect(onClicked); + tablet.removeButton(button); + button = null; + } + lastHMDStatus = isHMDMode; + } + }); + function onScreenChanged(type, url) { onMenuScreen = type === "Menu"; - button.editProperties({isActive: onMenuScreen}); + if (button) { + button.editProperties({isActive: onMenuScreen}); + } } - button.clicked.connect(onClicked); tablet.screenChanged.connect(onScreenChanged); Script.scriptEnding.connect(function () { if (onMenuScreen) { tablet.gotoHomeScreen(); } - button.clicked.disconnect(onClicked); + + if (button) { + button.clicked.disconnect(onClicked); + } tablet.removeButton(button); tablet.screenChanged.disconnect(onScreenChanged); });