From 4caa00d6cc0707dec74c4b5edb384b4569c6c372 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 10 Jul 2019 16:42:48 -0700 Subject: [PATCH] Start BUGZ-814: Start working on a new Graphics dialog for Metaverse version of Interface --- .../dialogs/graphics/GraphicsSettings.qml | 158 ++++++++++++++++++ interface/src/Menu.cpp | 9 +- 2 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml diff --git a/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml new file mode 100644 index 0000000000..530b125ffc --- /dev/null +++ b/interface/resources/qml/hifi/dialogs/graphics/GraphicsSettings.qml @@ -0,0 +1,158 @@ +// +// GraphicsSettings.qml +// qml\hifi\dialogs\graphics +// +// Created by Zach Fox on 2019-07-10 +// Copyright 2019 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 Hifi 1.0 as Hifi +import QtQuick 2.10 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.12 +import stylesUit 1.0 as HifiStylesUit +import controlsUit 1.0 as HifiControlsUit +import "qrc:////qml//controls" as HifiControls + +Flickable { + HifiStylesUit.HifiConstants { id: hifi; } + + id: root; + contentWidth: parent.width + contentHeight: graphicsSettingsColumnLayout.height + clip: true + + ColumnLayout { + id: graphicsSettingsColumnLayout + anchors.left: parent.left + anchors.leftMargin: 26 + anchors.right: parent.right + anchors.rightMargin: 26 + anchors.top: parent.top + spacing: 8 + + ColumnLayout { + id: avatarNameTagsContainer + Layout.preferredWidth: parent.width + Layout.topMargin: 38 + spacing: 0 + + HifiStylesUit.RalewayRegular { + text: "GRAPHICS SETTINGS" + Layout.maximumWidth: parent.width + height: paintedHeight + size: 16 + color: "#FFFFFF" + } + + ColumnLayout { + Layout.topMargin: 10 + Layout.preferredWidth: parent.width + spacing: 0 + + HifiControlsUit.RadioButton { + id: performanceLow + colorScheme: hifi.colorSchemes.dark + fontSize: 16 + leftPadding: 0 + text: "Low" + checked: Performance.getPerformancePreset() === PerformanceEnums.LOW + onClicked: { + Performance.setPerformancePreset(PerformanceEnums.LOW); + } + } + + HifiControlsUit.RadioButton { + id: performanceMedium + colorScheme: hifi.colorSchemes.dark + fontSize: 16 + leftPadding: 0 + text: "Medium" + checked: Performance.getPerformancePreset() === PerformanceEnums.MID + onClicked: { + Performance.setPerformancePreset(PerformanceEnums.MID); + } + } + + HifiControlsUit.RadioButton { + id: performanceHigh + colorScheme: hifi.colorSchemes.dark + fontSize: 16 + leftPadding: 0 + text: "High" + checked: Performance.getPerformancePreset() === PerformanceEnums.HIGH + onClicked: { + Performance.setPerformancePreset(PerformanceEnums.HIGH); + } + } + + HifiControlsUit.RadioButton { + id: performanceCustom + colorScheme: hifi.colorSchemes.dark + fontSize: 16 + leftPadding: 0 + text: "Custom" + checked: !(performanceLow.checked || performanceMedium.checked || performanceHigh.checked) + onClicked: { + + } + } + } + + ColumnLayout { + Layout.topMargin: 10 + Layout.preferredWidth: parent.width + spacing: 0 + + Item { + Layout.preferredWidth: parent.width + + HifiStylesUit.RalewayRegular { + id: resolutionHeader + text: "Resolution Scale (" + Number.parseFloat(Render.viewportResolutionScale).toPrecision(3) + ")" + anchors.left: parent.left + anchors.top: parent.top + width: 130 + height: paintedHeight + size: 16 + color: "#FFFFFF" + } + + HifiControlsUit.Slider { + id: resolutionScaleSlider + enabled: performanceCustom.checked + anchors.left: resolutionHeader.right + anchors.leftMargin: 57 + anchors.top: parent.top + width: 150 + height: resolutionHeader.height + colorScheme: hifi.colorSchemes.dark + minimumValue: 0.25 + maximumValue: 1.5 + stepSize: 0.02 + value: Render.viewportResolutionScale + live: true + + function updateResolutionScale(sliderValue) { + if (Render.viewportResolutionScale !== sliderValue) { + Render.viewportResolutionScale = sliderValue; + } + } + + onValueChanged: { + updateResolutionScale(value); + } + onPressedChanged: { + if (!pressed) { + updateResolutionScale(value); + } + } + } + } + } + } + } +} diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 8bee8de8c3..4cf78c23ee 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -266,8 +266,13 @@ Menu::Menu() { // Settings > Graphics... action = addActionToQMenuAndActionHash(settingsMenu, "Graphics..."); connect(action, &QAction::triggered, [] { - qApp->showDialog(QString("hifi/dialogs/GraphicsPreferencesDialog.qml"), - QString("hifi/tablet/TabletGraphicsPreferences.qml"), "GraphicsPreferencesDialog"); + auto tablet = DependencyManager::get()->getTablet("com.highfidelity.interface.tablet.system"); + auto hmd = DependencyManager::get(); + tablet->pushOntoStack("hifi/dialogs/graphics/GraphicsSettings.qml"); + + if (!hmd->getShouldShowTablet()) { + hmd->toggleShouldShowTablet(); + } }); // Settings > Security...