mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 13:07:04 +02:00
DEV-122: Add a developer menu in Settings
This commit is contained in:
parent
973e93aa2f
commit
7bdd3084e9
2 changed files with 134 additions and 0 deletions
|
@ -14,17 +14,42 @@ import stylesUit 1.0 as HifiStylesUit
|
||||||
import "./audio" as AudioSettings
|
import "./audio" as AudioSettings
|
||||||
import "./general" as GeneralSettings
|
import "./general" as GeneralSettings
|
||||||
import "./vr" as VrSettings
|
import "./vr" as VrSettings
|
||||||
|
import "./dev" as DevSettings
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property string activeTabView: "generalTabView"
|
property string activeTabView: "generalTabView"
|
||||||
id: root
|
id: root
|
||||||
color: simplifiedUI.colors.darkBackground
|
color: simplifiedUI.colors.darkBackground
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
property bool developerModeEnabled: Settings.getValue("simplifiedUI/developerModeEnabled", false)
|
||||||
|
|
||||||
SimplifiedConstants.SimplifiedConstants {
|
SimplifiedConstants.SimplifiedConstants {
|
||||||
id: simplifiedUI
|
id: simplifiedUI
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focus: true
|
||||||
|
Keys.onPressed: {
|
||||||
|
if ((event.key == Qt.Key_D) && (event.modifiers & Qt.ControlModifier && event.modifiers & Qt.AltModifier && event.modifiers & Qt.ShiftModifier)) {
|
||||||
|
var currentSetting = Settings.getValue("simplifiedUI/developerModeEnabled", false);
|
||||||
|
var newSetting = !currentSetting;
|
||||||
|
Settings.setValue("simplifiedUI/developerModeEnabled", newSetting);
|
||||||
|
root.developerModeEnabled = newSetting;
|
||||||
|
if (newSetting) {
|
||||||
|
console.log("Developer mode ON. You are now a developer!");
|
||||||
|
} else {
|
||||||
|
console.log("Developer mode OFF.");
|
||||||
|
if (root.activeTabView === "devTabView") {
|
||||||
|
tabListView.currentIndex = 2;
|
||||||
|
root.activeTabView = "vrTabView";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
root.forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: tabContainer
|
id: tabContainer
|
||||||
|
@ -49,6 +74,10 @@ Rectangle {
|
||||||
tabTitle: "VR"
|
tabTitle: "VR"
|
||||||
tabViewName: "vrTabView"
|
tabViewName: "vrTabView"
|
||||||
}
|
}
|
||||||
|
ListElement {
|
||||||
|
tabTitle: "Dev"
|
||||||
|
tabViewName: "devTabView"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,6 +99,8 @@ Rectangle {
|
||||||
highlight: highlightBar
|
highlight: highlightBar
|
||||||
interactive: contentItem.width > width
|
interactive: contentItem.width > width
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
|
visible: model.tabTitle !== "Dev" || (model.tabTitle === "Dev" && root.developerModeEnabled)
|
||||||
|
|
||||||
width: tabTitleText.paintedWidth + 64
|
width: tabTitleText.paintedWidth + 64
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
|
@ -125,6 +156,12 @@ Rectangle {
|
||||||
visible: activeTabView === "vrTabView"
|
visible: activeTabView === "vrTabView"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DevSettings.Dev {
|
||||||
|
id: devTabViewContainer
|
||||||
|
visible: activeTabView === "devTabView"
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
//
|
||||||
|
// Dev.qml
|
||||||
|
//
|
||||||
|
// Created by Zach Fox on 2019-06-11
|
||||||
|
// 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 QtQuick 2.10
|
||||||
|
import QtQuick.Controls 2.3
|
||||||
|
import "../../simplifiedConstants" as SimplifiedConstants
|
||||||
|
import "../../simplifiedControls" as SimplifiedControls
|
||||||
|
import stylesUit 1.0 as HifiStylesUit
|
||||||
|
import QtQuick.Layouts 1.3
|
||||||
|
|
||||||
|
Flickable {
|
||||||
|
id: root
|
||||||
|
contentWidth: parent.width
|
||||||
|
contentHeight: devColumnLayout.height
|
||||||
|
topMargin: 24
|
||||||
|
bottomMargin: 24
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
root.contentX = 0;
|
||||||
|
root.contentY = -root.topMargin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SimplifiedConstants.SimplifiedConstants {
|
||||||
|
id: simplifiedUI
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: devColumnLayout
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
spacing: simplifiedUI.margins.settings.spacingBetweenSettings
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: uiControlsContainer
|
||||||
|
Layout.preferredWidth: parent.width
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
HifiStylesUit.GraphikRegular {
|
||||||
|
id: uiControlsTitle
|
||||||
|
text: "User Interface"
|
||||||
|
Layout.maximumWidth: parent.width
|
||||||
|
height: paintedHeight
|
||||||
|
size: 22
|
||||||
|
color: simplifiedUI.colors.text.white
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiStylesUit.GraphikRegular {
|
||||||
|
id: uiControlsSubtitle
|
||||||
|
text: "You'll have to restart Interface after changing either of these settings. If you don't get any Toolbar apps back after restarting, run defaultScripts.js manually."
|
||||||
|
Layout.maximumWidth: parent.width
|
||||||
|
height: paintedHeight
|
||||||
|
size: 16
|
||||||
|
color: simplifiedUI.colors.text.white
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: uiControlsSwitchGroup
|
||||||
|
Layout.topMargin: simplifiedUI.margins.settings.settingsGroupTopMargin
|
||||||
|
|
||||||
|
SimplifiedControls.Switch {
|
||||||
|
id: keepMenusSwitch
|
||||||
|
width: parent.width
|
||||||
|
height: 18
|
||||||
|
labelTextOn: "Keep Old Menus (File, Edit, etc)"
|
||||||
|
checked: Settings.getValue("simplifiedUI/keepMenus", false);
|
||||||
|
onClicked: {
|
||||||
|
Settings.setValue("simplifiedUI/keepMenus", !Settings.getValue("simplifiedUI/keepMenus", false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SimplifiedControls.Switch {
|
||||||
|
id: keepOldUIAndScriptsSwitch
|
||||||
|
width: parent.width
|
||||||
|
height: 18
|
||||||
|
labelTextOn: "Keep Old UI and Scripts"
|
||||||
|
checked: Settings.getValue("simplifiedUI/keepExistingUIAndScripts", false);
|
||||||
|
onClicked: {
|
||||||
|
Settings.setValue("simplifiedUI/keepExistingUIAndScripts", !Settings.getValue("simplifiedUI/keepExistingUIAndScripts", false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue