basic prefreneces done

This commit is contained in:
Dante Ruiz 2017-02-11 00:51:01 +00:00
parent 46cfa7cf13
commit 888d4ff706
6 changed files with 186 additions and 194 deletions

View file

@ -12,6 +12,25 @@
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
StackView {
id: profileRoot
initialItem: root
objectName: "stack"
property var eventBridge;
signal sendToScript(var message);
function pushSource(path) {
editRoot.push(Qt.reslovedUrl(path));
}
function popSource() {
}
TabletPreferencesDialog { TabletPreferencesDialog {
id: root id: root
@ -21,3 +40,5 @@ TabletPreferencesDialog {
showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers", "Perception Neuron", "Kinect"] showCategories: ["UI", "Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers", "Perception Neuron", "Kinect"]
} }
}

View file

@ -13,30 +13,64 @@ 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();
}
}
Rectangle {
id: main
height: parent.height - 40
anchors {
top: parent.top
bottom: footer.top
left: parent.left
right: parent.right
}
gradient: Gradient {
GradientStop {
position: 0
color: "#2b2b2b"
} }
ListView { GradientStop {
position: 1
color: "#0f212e"
}
}
Flickable {
id: scrollView
width: parent.width
height: parent.height
contentWidth: parent.width
contentHeight: getSectionsHeight();
Column {
width: 480
Component { Component {
id: sectionBuilder id: sectionBuilder
Section {} Section {}
@ -67,18 +101,78 @@ Item {
sections[0].expanded = true sections[0].expanded = true
} else { } else {
for (i = 0; i < sections.length; i++) { for (i = 0; i < sections.length; i++) {
sections[i].collapsable = true; sections[i].collapsable = false;
sections[i].expanded = true; sections[i].expanded = true;
} }
} }
sections[0].isFirst = true; sections[0].isFirst = true;
sections[sections.length - 1].isLast = true; sections[sections.length - 1].isLast = true;
} }
scrollView.contentHeight = scrollView.getSectionsHeight();
} }
Column { Column {
id: prefControls id: prefControls
width: 320 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"
}
}
Row {
anchors {
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()
}
} }
} }

View file

@ -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
}
}
} }
} }
} }

View file

@ -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

View file

@ -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)
}); });

View file

@ -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