mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:02:55 +02:00
basic prefreneces done
This commit is contained in:
parent
46cfa7cf13
commit
888d4ff706
6 changed files with 186 additions and 194 deletions
|
@ -12,12 +12,33 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import "tabletWindows"
|
import "tabletWindows"
|
||||||
import "../../dialogs"
|
import "../../dialogs"
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
TabletPreferencesDialog {
|
StackView {
|
||||||
id: root
|
id: profileRoot
|
||||||
objectName: "GeneralPreferencesDialog"
|
initialItem: root
|
||||||
width: parent.width
|
objectName: "stack"
|
||||||
height: parent.height
|
|
||||||
showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers", "Perception Neuron", "Kinect"]
|
property var eventBridge;
|
||||||
|
signal sendToScript(var message);
|
||||||
|
|
||||||
|
function pushSource(path) {
|
||||||
|
editRoot.push(Qt.reslovedUrl(path));
|
||||||
|
}
|
||||||
|
|
||||||
|
function popSource() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TabletPreferencesDialog {
|
||||||
|
id: root
|
||||||
|
objectName: "GeneralPreferencesDialog"
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers", "Perception Neuron", "Kinect"]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,72 +13,166 @@ import QtQuick.Controls 1.4
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
|
||||||
|
|
||||||
import "."
|
import "."
|
||||||
import "./preferences"
|
import "./preferences"
|
||||||
import "../../../styles-uit"
|
import "../../../styles-uit"
|
||||||
import "../../../controls-uit" as HifiControls
|
import "../../../controls-uit" as HifiControls
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: dialog
|
||||||
width: 480
|
width: 480
|
||||||
height: 600
|
height: 720
|
||||||
|
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
property var sections: []
|
property var sections: []
|
||||||
property var showCategories: []
|
property var showCategories: []
|
||||||
|
|
||||||
function saveAll() {
|
function saveAll() {
|
||||||
|
for (var i = 0; i < sections.length; ++i) {
|
||||||
|
var section = sections[i];
|
||||||
|
section.saveAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreAll() {
|
function restoreAll() {
|
||||||
|
for (var i = 0; i < sections.length; ++i) {
|
||||||
|
var section = sections[i];
|
||||||
|
section.restoreAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
Rectangle {
|
||||||
|
id: main
|
||||||
Component {
|
height: parent.height - 40
|
||||||
id: sectionBuilder
|
anchors {
|
||||||
Section {}
|
top: parent.top
|
||||||
|
bottom: footer.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
}
|
}
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop {
|
||||||
|
position: 0
|
||||||
|
color: "#2b2b2b"
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
var categories = Preferences.categories;
|
|
||||||
var i;
|
|
||||||
|
|
||||||
// build a map of valid categories.
|
|
||||||
var categoryMap = {};
|
|
||||||
for (i = 0; i < categories.length; i++) {
|
|
||||||
categoryMap[categories[i]] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a section for each valid category in showCategories
|
GradientStop {
|
||||||
// NOTE: the sort order of items in the showCategories array is the same order in the dialog.
|
position: 1
|
||||||
for (i = 0; i < showCategories.length; i++) {
|
color: "#0f212e"
|
||||||
if (categoryMap[showCategories[i]]) {
|
}
|
||||||
sections.push(sectionBuilder.createObject(prefControls, {name: showCategories[i]}));
|
}
|
||||||
|
Flickable {
|
||||||
|
id: scrollView
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height
|
||||||
|
contentWidth: parent.width
|
||||||
|
contentHeight: getSectionsHeight();
|
||||||
|
Column {
|
||||||
|
width: 480
|
||||||
|
Component {
|
||||||
|
id: sectionBuilder
|
||||||
|
Section {}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (sections.length) {
|
Component.onCompleted: {
|
||||||
// Default sections to expanded/collapsed as appropriate for dialog.
|
var categories = Preferences.categories;
|
||||||
if (sections.length === 1) {
|
var i;
|
||||||
sections[0].collapsable = false
|
|
||||||
sections[0].expanded = true
|
// build a map of valid categories.
|
||||||
} else {
|
var categoryMap = {};
|
||||||
for (i = 0; i < sections.length; i++) {
|
for (i = 0; i < categories.length; i++) {
|
||||||
sections[i].collapsable = true;
|
categoryMap[categories[i]] = true;
|
||||||
sections[i].expanded = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create a section for each valid category in showCategories
|
||||||
|
// NOTE: the sort order of items in the showCategories array is the same order in the dialog.
|
||||||
|
for (i = 0; i < showCategories.length; i++) {
|
||||||
|
if (categoryMap[showCategories[i]]) {
|
||||||
|
sections.push(sectionBuilder.createObject(prefControls, {name: showCategories[i]}));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sections.length) {
|
||||||
|
// Default sections to expanded/collapsed as appropriate for dialog.
|
||||||
|
if (sections.length === 1) {
|
||||||
|
sections[0].collapsable = false
|
||||||
|
sections[0].expanded = true
|
||||||
|
} else {
|
||||||
|
for (i = 0; i < sections.length; i++) {
|
||||||
|
sections[i].collapsable = false;
|
||||||
|
sections[i].expanded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sections[0].isFirst = true;
|
||||||
|
sections[sections.length - 1].isLast = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollView.contentHeight = scrollView.getSectionsHeight();
|
||||||
|
|
||||||
}
|
}
|
||||||
sections[0].isFirst = true;
|
|
||||||
sections[sections.length - 1].isLast = true;
|
|
||||||
|
Column {
|
||||||
|
id: prefControls
|
||||||
|
width: 480
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSectionsHeight() {
|
||||||
|
var totalHeight = 0;
|
||||||
|
for (var i = 0; i < sections.length; i++) {
|
||||||
|
totalHeight += sections[i].height
|
||||||
|
}
|
||||||
|
console.log(totalHeight);
|
||||||
|
return totalHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: footer
|
||||||
|
height: 40
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: main.bottom
|
||||||
|
bottom: parent.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop {
|
||||||
|
position: 0
|
||||||
|
color: "#2b2b2b"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GradientStop {
|
||||||
|
position: 1
|
||||||
|
color: "#0f212e"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Row {
|
||||||
id: prefControls
|
anchors {
|
||||||
width: 320
|
top: parent,top
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: hifi.dimensions.contentMargin.x
|
||||||
|
}
|
||||||
|
|
||||||
|
spacing: hifi.dimensions.contentSpacing.x
|
||||||
|
HifiControls.Button {
|
||||||
|
text: "Save changes"
|
||||||
|
color: hifi.buttons.blue
|
||||||
|
onClicked: root.saveAll()
|
||||||
|
}
|
||||||
|
|
||||||
|
HifiControls.Button {
|
||||||
|
text: "Cancel"
|
||||||
|
color: hifi.buttons.white
|
||||||
|
onClicked: root.restoreAll()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,157 +16,32 @@ import QtGraphicalEffects 1.0
|
||||||
import "."
|
import "."
|
||||||
import "../../../styles-uit"
|
import "../../../styles-uit"
|
||||||
import "../../../controls-uit" as HiFiControls
|
import "../../../controls-uit" as HiFiControls
|
||||||
FocusScope{
|
Item {
|
||||||
|
|
||||||
id: window
|
id: window
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
childern [ plane ]
|
children: [ pane ]
|
||||||
property var footer: Item {}
|
property var footer: Item {}
|
||||||
readonly var footerContentHeight: 40
|
|
||||||
property var pane: Item {
|
property var pane: Item {
|
||||||
property bool isScrolling: true//scrollView.height < scrollView.contentItem.height
|
|
||||||
property int contentWidth: scrollView.width - (isScrolling ? 10 : 0)
|
|
||||||
property int scrollHeight: scrollView.height
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.rightMargin: 11
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: contentBackground
|
id: contentBackground
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: hifi.colors.baseGray
|
width: 480
|
||||||
visible: true
|
//gradient: Gradient {
|
||||||
}
|
//GradientStop {
|
||||||
|
//position: 0
|
||||||
|
//color: "#2b2b2b"
|
||||||
|
|
||||||
LinearGradient {
|
//}
|
||||||
visible: true
|
|
||||||
anchors.top: contentBackground.bottom
|
|
||||||
anchors.left: contentBackground.left
|
|
||||||
width: contentBackground.width - 1
|
|
||||||
height: 4
|
|
||||||
start: Qt.point(0, 0)
|
|
||||||
end: Qt.point(0, 4)
|
|
||||||
gradient: Gradient {
|
|
||||||
GradientStop { position: 0.0; color: hifi.colors.darkGray }
|
|
||||||
GradientStop { position: 1.0; color: hifi.colors.darkGray0 }
|
|
||||||
}
|
|
||||||
cached: true
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollView {
|
//GradientStop {
|
||||||
id: scrollView
|
//position: 1
|
||||||
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
|
//color: "#0f212e"
|
||||||
verticalScrollBarPolicy: Qt.ScrollBarAsNeeded
|
//}
|
||||||
anchors.fill: parent
|
//}
|
||||||
anchors.rightMargin: parent.isScrolling ? 1 : 0
|
|
||||||
anchors.bottomMargin: footerPane.height
|
|
||||||
|
|
||||||
style: ScrollViewStyle {
|
|
||||||
|
|
||||||
padding.right: -7 // Move to right away from content.
|
|
||||||
|
|
||||||
handle: Item {
|
|
||||||
implicitWidth: 8
|
|
||||||
Rectangle {
|
|
||||||
radius: 4
|
|
||||||
color: hifi.colors.white30
|
|
||||||
anchors {
|
|
||||||
fill: parent
|
|
||||||
leftMargin: 2 // Finesse size and position.
|
|
||||||
topMargin: 1
|
|
||||||
bottomMargin: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollBarBackground: Item {
|
|
||||||
implicitWidth: 10
|
|
||||||
Rectangle {
|
|
||||||
color: hifi.colors.darkGray30
|
|
||||||
radius: 4
|
|
||||||
anchors {
|
|
||||||
fill: parent
|
|
||||||
topMargin: -1 // Finesse size
|
|
||||||
bottomMargin: -2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
incrementControl: Item {
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
|
|
||||||
decrementControl: Item {
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function scrollBy(delta) {
|
|
||||||
scrollView.flickableItem.contentY += delta;
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
// Optional non-scrolling footer.
|
|
||||||
id: footerPane
|
|
||||||
|
|
||||||
property alias keyboardOverride: window.keyboardOverride
|
|
||||||
property alias keyboardRaised: window.keyboardRaised
|
|
||||||
property alias punctuationMode: window.punctuationMode
|
|
||||||
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
bottom: parent.bottom
|
|
||||||
}
|
|
||||||
width: parent.contentWidth
|
|
||||||
height: footerContentHeight + (keyboard.enabled && keyboard.raised ? keyboard.height : 0)
|
|
||||||
color: hifi.colors.baseGray
|
|
||||||
visible: footer.height > 0 || keyboard.enabled && keyboard.raised
|
|
||||||
|
|
||||||
Item {
|
|
||||||
// Horizontal rule.
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
|
|
||||||
visible: footer.height > 0
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 1
|
|
||||||
y: 1 // Stop displaying content just above horizontal rule/=.
|
|
||||||
color: hifi.colors.baseGrayShadow
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
width: parent.width
|
|
||||||
height: 1
|
|
||||||
y: 2
|
|
||||||
color: hifi.colors.baseGrayHighlight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
top: parent.top
|
|
||||||
topMargin: hifi.dimensions.contentSpacing.y + 3
|
|
||||||
}
|
|
||||||
children: [ footer ]
|
|
||||||
}
|
|
||||||
|
|
||||||
HiFiControls.Keyboard {
|
|
||||||
id: keyboard
|
|
||||||
enabled: !keyboardOverride
|
|
||||||
raised: keyboardEnabled && keyboardRaised
|
|
||||||
numeric: punctuationMode
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ import "."
|
||||||
|
|
||||||
Preference {
|
Preference {
|
||||||
id: root
|
id: root
|
||||||
property bool collapsable: true
|
property bool collapsable: false
|
||||||
property bool expanded: false
|
property bool expanded: false
|
||||||
property bool isFirst: false
|
property bool isFirst: false
|
||||||
property bool isLast: false
|
property bool isLast: false
|
||||||
|
|
|
@ -65,7 +65,7 @@ Preference {
|
||||||
verticalCenter: dataTextField.verticalCenter
|
verticalCenter: dataTextField.verticalCenter
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var browser = fileBrowserBuilder.createObject(desktop, {
|
var browser = fileBrowserBuilder.createObject({
|
||||||
selectDirectory: true,
|
selectDirectory: true,
|
||||||
dir: fileDialogHelper.pathToUrl(preference.value)
|
dir: fileDialogHelper.pathToUrl(preference.value)
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "scripting/AccountScriptingInterface.h"
|
#include "scripting/AccountScriptingInterface.h"
|
||||||
#include "scripting/HMDScriptingInterface.h"
|
#include "scripting/HMDScriptingInterface.h"
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
|
#include "FileDialogHelper.h"
|
||||||
|
|
||||||
static const float DPI = 30.47f;
|
static const float DPI = 30.47f;
|
||||||
static const float INCHES_TO_METERS = 1.0f / 39.3701f;
|
static const float INCHES_TO_METERS = 1.0f / 39.3701f;
|
||||||
|
@ -168,6 +169,7 @@ void Web3DOverlay::loadSourceURL() {
|
||||||
_webSurface->getRootContext()->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
_webSurface->getRootContext()->setContextProperty("AddressManager", DependencyManager::get<AddressManager>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
_webSurface->getRootContext()->setContextProperty("Account", AccountScriptingInterface::getInstance());
|
||||||
_webSurface->getRootContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
_webSurface->getRootContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
||||||
|
_webSurface->getRootContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());
|
||||||
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
||||||
|
|
||||||
// Override min fps for tablet UI, for silky smooth scrolling
|
// Override min fps for tablet UI, for silky smooth scrolling
|
||||||
|
|
Loading…
Reference in a new issue