Merge pull request #7231 from ctrlaltdavid/20812

Restyle settings dialogs
This commit is contained in:
Brad Davis 2016-03-04 14:33:21 -08:00
commit 468cb05571
37 changed files with 1210 additions and 352 deletions

View file

@ -18,7 +18,7 @@ Original.Button {
id: button
property int color: 0
width: 120
height: 30
height: 28
style: ButtonStyle {

View file

@ -0,0 +1,70 @@
//
// CheckBox.qml
//
// Created by David Rowe on 26 Feb 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4 as Original
import QtQuick.Controls.Styles 1.4
import "../styles-uit"
Original.CheckBox {
id: checkBox
HifiConstants { id: hifi }
property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
readonly property int boxSize: 14
readonly property int boxRadius: 3
readonly property int checkSize: 10
readonly property int checkRadius: 2
style: CheckBoxStyle {
indicator: Rectangle {
id: box
width: boxSize
height: boxSize
radius: boxRadius
gradient: Gradient {
GradientStop {
position: 0.2
color: pressed || hovered
? (checkBox.isLightColorScheme ? hifi.colors.checkboxDarkStart : hifi.colors.checkboxLightStart)
: (checkBox.isLightColorScheme ? hifi.colors.checkboxLightStart : hifi.colors.checkboxDarkStart)
}
GradientStop {
position: 1.0
color: pressed || hovered
? (checkBox.isLightColorScheme ? hifi.colors.checkboxDarkFinish : hifi.colors.checkboxLightFinish)
: (checkBox.isLightColorScheme ? hifi.colors.checkboxLightFinish : hifi.colors.checkboxDarkFinish)
}
}
Rectangle {
id: check
width: checkSize
height: checkSize
radius: checkRadius
anchors.centerIn: parent
color: hifi.colors.checkboxChecked
border.width: 1
border.color: hifi.colors.checkboxCheckedBorder
visible: checked && !pressed || !checked && pressed
}
}
label: Label {
text: control.text
colorScheme: checkBox.colorScheme
x: checkBox.boxSize / 2
wrapMode: Text.Wrap
}
}
}

View file

@ -0,0 +1,202 @@
//
// ComboBox.qml
//
// Created by Bradley Austin David on 27 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../styles-uit"
import "../controls-uit" as HifiControls
import "." as VrControls
FocusScope {
id: root
property alias model: comboBox.model;
property alias comboBox: comboBox
readonly property alias currentText: comboBox.currentText;
property alias currentIndex: comboBox.currentIndex;
property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
property string label: ""
property real controlHeight: height + (comboBoxLabel.visible ? comboBoxLabel.height + comboBoxLabel.anchors.bottomMargin : 0)
readonly property ComboBox control: comboBox
implicitHeight: comboBox.height;
focus: true
Rectangle {
id: background
gradient: Gradient {
GradientStop {
position: 0.2
color: popup.visible
? (isLightColorScheme ? hifi.colors.dropDownPressedLight : hifi.colors.dropDownPressedDark)
: (isLightColorScheme ? hifi.colors.dropDownLightStart : hifi.colors.dropDownDarkStart)
}
GradientStop {
position: 1.0
color: popup.visible
? (isLightColorScheme ? hifi.colors.dropDownPressedLight : hifi.colors.dropDownPressedDark)
: (isLightColorScheme ? hifi.colors.dropDownLightFinish : hifi.colors.dropDownDarkFinish)
}
}
anchors.fill: parent
}
SystemPalette { id: palette }
ComboBox {
id: comboBox
anchors.fill: parent
visible: false
height: hifi.fontSizes.textFieldInput + 14 // Match height of TextField control.
}
FiraSansSemiBold {
id: textField
anchors {
left: parent.left
leftMargin: hifi.dimensions.textPadding
right: dropIcon.left
verticalCenter: parent.verticalCenter
}
size: hifi.fontSizes.textFieldInput
text: comboBox.currentText
elide: Text.ElideRight
color: controlHover.containsMouse || popup.visible ? hifi.colors.baseGray : (isLightColorScheme ? hifi.colors.lightGray : hifi.colors.lightGrayText )
}
Item {
id: dropIcon
anchors { right: parent.right; verticalCenter: parent.verticalCenter }
height: background.height
width: height
Rectangle {
width: 1
height: parent.height
anchors.top: parent.top
anchors.left: parent.left
color: isLightColorScheme ? hifi.colors.faintGray : hifi.colors.baseGray
}
HiFiGlyphs {
anchors {
top: parent.top
topMargin: -8
horizontalCenter: parent.horizontalCenter
}
size: hifi.dimensions.spinnerSize
text: hifi.glyphs.caratDn
color: controlHover.containsMouse || popup.visible ? hifi.colors.baseGray : (isLightColorScheme ? hifi.colors.lightGray : hifi.colors.lightGrayText)
}
}
MouseArea {
id: controlHover
hoverEnabled: true
anchors.fill: parent
onClicked: toggleList();
}
function toggleList() {
if (popup.visible) {
hideList();
} else {
showList();
}
}
function showList() {
var r = desktop.mapFromItem(root, 0, 0, root.width, root.height);
listView.currentIndex = root.currentIndex
scrollView.x = r.x;
scrollView.y = r.y + r.height;
var bottom = scrollView.y + scrollView.height;
if (bottom > desktop.height) {
scrollView.y -= bottom - desktop.height + 8;
}
popup.visible = true;
popup.forceActiveFocus();
}
function hideList() {
popup.visible = false;
}
FocusScope {
id: popup
parent: desktop
anchors.fill: parent
z: desktop.zLevels.menu
visible: false
focus: true
MouseArea {
anchors.fill: parent
onClicked: hideList();
}
function previousItem() { listView.currentIndex = (listView.currentIndex + listView.count - 1) % listView.count; }
function nextItem() { listView.currentIndex = (listView.currentIndex + listView.count + 1) % listView.count; }
function selectCurrentItem() { root.currentIndex = listView.currentIndex; hideList(); }
function selectSpecificItem(index) { root.currentIndex = index; hideList(); }
Keys.onUpPressed: previousItem();
Keys.onDownPressed: nextItem();
Keys.onSpacePressed: selectCurrentItem();
Keys.onRightPressed: selectCurrentItem();
Keys.onReturnPressed: selectCurrentItem();
Keys.onEscapePressed: hideList();
ScrollView {
id: scrollView
height: 480
ListView {
id: listView
height: textField.height * count * 1.4
model: root.model
delegate: Rectangle {
width: root.width + 4
height: popupText.implicitHeight * 1.4
color: popupHover.containsMouse ? hifi.colors.primaryHighlight : (isLightColorScheme ? hifi.colors.dropDownPressedLight : hifi.colors.dropDownPressedDark)
FiraSansSemiBold {
anchors.left: parent.left
anchors.leftMargin: hifi.dimensions.textPadding
anchors.verticalCenter: parent.verticalCenter
id: popupText
text: listView.model[index]
size: hifi.fontSizes.textFieldInput
color: hifi.colors.baseGray
}
MouseArea {
id: popupHover
anchors.fill: parent;
hoverEnabled: true
onEntered: listView.currentIndex = index;
onClicked: popup.selectSpecificItem(index)
}
}
}
}
}
HifiControls.Label {
id: comboBoxLabel
text: root.label
colorScheme: root.colorScheme
anchors.left: parent.left
anchors.bottom: parent.top
anchors.bottomMargin: 4
visible: label != ""
}
}

View file

@ -0,0 +1,133 @@
//
// ContentSection.qml
//
// Created by David Rowe on 16 Feb 2016
// Copyright 2016 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.5
import QtGraphicalEffects 1.0
import "../styles-uit"
Column {
property string name: "Static Section"
property bool isFirst: false
property bool isCollapsible: false // Set at creation.
property bool isCollapsed: false
spacing: 0 // Defer spacing decisions to individual controls.
anchors {
left: parent.left
leftMargin: hifi.dimensions.contentMargin.x
right: parent.right
rightMargin: hifi.dimensions.contentMargin.x
}
function toggleCollapsed() {
if (isCollapsible) {
isCollapsed = !isCollapsed;
for (var i = 1; i < children.length; i++) {
children[i].visible = !isCollapsed;
}
}
}
Item {
id: sectionName
anchors.left: parent.left
anchors.right: parent.right
height: leadingSpace.height + topBar.height + heading.height + bottomBar.height
Item {
id: leadingSpace
width: 1
height: isFirst ? hifi.dimensions.contentSpacing.y : hifi.dimensions.controlInterlineHeight
anchors.top: parent.top
}
Item {
id: topBar
visible: !isFirst
height: visible ? 2 : 0
anchors.top: leadingSpace.bottom
Rectangle {
id: shadow
width: frame.width
height: 1
color: hifi.colors.baseGrayShadow
x: -hifi.dimensions.contentMargin.x
}
Rectangle {
width: frame.width
height: 1
color: hifi.colors.baseGrayHighlight
x: -hifi.dimensions.contentMargin.x
anchors.top: shadow.bottom
}
}
Item {
id: heading
anchors {
left: parent.left
right: parent.right
top: topBar.bottom
}
height: (isCollapsible ? 3 : 2) * hifi.dimensions.contentSpacing.y
RalewayRegular {
id: title
anchors {
left: parent.left
top: parent.top
topMargin: hifi.dimensions.contentSpacing.y
}
size: hifi.fontSizes.sectionName
font.capitalization: Font.AllUppercase
text: name
color: hifi.colors.lightGrayText
}
HiFiGlyphs {
anchors {
verticalCenter: title.verticalCenter
right: parent.right
rightMargin: -4
}
y: -2
size: hifi.fontSizes.disclosureButton
text: isCollapsed ? hifi.glyphs.disclosureButtonExpand : hifi.glyphs.disclosureButtonCollapse
color: hifi.colors.lightGrayText
visible: isCollapsible
}
MouseArea {
anchors.fill: parent
onClicked: toggleCollapsed()
}
}
LinearGradient {
id: bottomBar
visible: isCollapsible
width: frame.width
height: visible ? 4 : 0
x: -hifi.dimensions.contentMargin.x
anchors.top: heading.bottom
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.baseGray } // Equivalent of darkGray0 over baseGray background.
}
cached: true
}
}
}

View file

@ -0,0 +1,20 @@
//
// Label.qml
//
// Created by David Rowe on 26 Feb 2016
// Copyright 2016 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.5
import "../styles-uit"
RalewaySemibold {
property int colorScheme: hifi.colorSchemes.light
size: hifi.fontSizes.inputLabel
color: colorScheme == hifi.colorSchemes.light ? hifi.colors.lightGray : hifi.colors.lightGrayText
}

View file

@ -0,0 +1,98 @@
//
// Slider.qml
//
// Created by David Rowe on 27 Feb 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../styles-uit"
import "../controls-uit" as HifiControls
Slider {
id: slider
property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
property string label: ""
property real controlHeight: height + (sliderLabel.visible ? sliderLabel.height + sliderLabel.anchors.bottomMargin : 0)
height: hifi.fontSizes.textFieldInput + 14 // Match height of TextField control.
y: sliderLabel.visible ? sliderLabel.height + sliderLabel.anchors.bottomMargin : 0
style: SliderStyle {
groove: Rectangle {
implicitWidth: 50
implicitHeight: hifi.dimensions.sliderGrooveHeight
radius: height / 2
color: isLightColorScheme ? hifi.colors.sliderGutterLight : hifi.colors.sliderGutterDark
Rectangle {
width: parent.height - 2
height: slider.value * slider.width - 1
radius: height / 2
anchors {
top: parent.top
topMargin: width + 1
left: parent.left
leftMargin: 1
}
transformOrigin: Item.TopLeft
rotation: -90
gradient: Gradient {
GradientStop { position: 0.0; color: hifi.colors.blueAccent }
GradientStop { position: 1.0; color: hifi.colors.primaryHighlight }
}
}
}
handle: Rectangle {
implicitWidth: hifi.dimensions.sliderHandleSize
implicitHeight: hifi.dimensions.sliderHandleSize
radius: height / 2
border.width: 1
border.color: isLightColorScheme ? hifi.colors.sliderBorderLight : hifi.colors.sliderBorderDark
gradient: Gradient {
GradientStop {
position: 0.0
color: pressed || hovered
? (isLightColorScheme ? hifi.colors.sliderDarkStart : hifi.colors.sliderLightStart )
: (isLightColorScheme ? hifi.colors.sliderLightStart : hifi.colors.sliderDarkStart )
}
GradientStop {
position: 1.0
color: pressed || hovered
? (isLightColorScheme ? hifi.colors.sliderDarkFinish : hifi.colors.sliderLightFinish )
: (isLightColorScheme ? hifi.colors.sliderLightFinish : hifi.colors.sliderDarkFinish )
}
}
Rectangle {
height: parent.height - 2
width: height
radius: height / 2
anchors.centerIn: parent
color: hifi.colors.transparent
border.width: 1
border.color: hifi.colors.black
}
}
}
HifiControls.Label {
id: sliderLabel
text: slider.label
colorScheme: slider.colorScheme
anchors.left: parent.left
anchors.bottom: parent.top
anchors.bottomMargin: 2
visible: label != ""
}
}

View file

@ -0,0 +1,79 @@
//
// SpinBox.qml
//
// Created by David Rowe on 26 Feb 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../styles-uit"
import "../controls-uit" as HifiControls
SpinBox {
id: spinBox
property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
property string label: ""
property real controlHeight: height + (spinBoxLabel.visible ? spinBoxLabel.height + spinBoxLabel.anchors.bottomMargin : 0)
FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; }
font.family: firaSansSemiBold.name
font.pixelSize: hifi.fontSizes.textFieldInput
height: hifi.fontSizes.textFieldInput + 14 // Match height of TextField control.
y: spinBoxLabel.visible ? spinBoxLabel.height + spinBoxLabel.anchors.bottomMargin : 0
style: SpinBoxStyle {
background: Rectangle {
color: isLightColorScheme
? (spinBox.focus ? hifi.colors.white : hifi.colors.lightGray)
: (spinBox.focus ? hifi.colors.black : hifi.colors.baseGrayShadow)
border.color: hifi.colors.primaryHighlight
border.width: spinBox.focus ? 1 : 0
}
textColor: isLightColorScheme
? (spinBox.focus ? hifi.colors.black : hifi.colors.lightGray)
: (spinBox.focus ? hifi.colors.white : hifi.colors.lightGrayText)
selectedTextColor: hifi.colors.black
selectionColor: hifi.colors.primaryHighlight
horizontalAlignment: Qt.AlignLeft
padding.left: hifi.dimensions.textPadding
padding.right: hifi.dimensions.spinnerSize
incrementControl: HiFiGlyphs {
id: incrementButton
text: hifi.glyphs.caratUp
x: 6
y: 2
size: hifi.dimensions.spinnerSize
color: styleData.upPressed ? (isLightColorScheme ? hifi.colors.black : hifi.colors.white) : hifi.colors.gray
}
decrementControl: HiFiGlyphs {
text: hifi.glyphs.caratDn
x: 6
y: -3
size: hifi.dimensions.spinnerSize
color: styleData.downPressed ? (isLightColorScheme ? hifi.colors.black : hifi.colors.white) : hifi.colors.gray
}
}
HifiControls.Label {
id: spinBoxLabel
text: spinBox.label
colorScheme: spinBox.colorScheme
anchors.left: parent.left
anchors.bottom: parent.top
anchors.bottomMargin: 4
visible: label != ""
}
}

View file

@ -1,65 +0,0 @@
//
// StaticSection.qml
//
// Created by David Rowe on 16 Feb 2016
// Copyright 2016 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.5
import "../styles-uit"
Column {
property string name: "Static Section"
property bool hasSeparator: false
spacing: hifi.dimensions.contentSpacing.y
anchors {
left: parent.left
leftMargin: hifi.dimensions.contentMargin.x
right: parent.right
rightMargin: hifi.dimensions.contentMargin.x
}
VerticalSpacer { }
Item {
visible: hasSeparator
anchors.top: sectionName.top
Rectangle {
width: frame.width
height: 1
color: hifi.colors.baseGrayShadow
x: -hifi.dimensions.contentMargin.x
anchors.bottom: highlight.top
}
Rectangle {
id: highlight
width: frame.width
height: 1
color: hifi.colors.baseGrayHighlight
x: -hifi.dimensions.contentMargin.x
anchors.bottom: parent.top
}
}
RalewayRegular {
id: sectionName
text: parent.name
size: hifi.fontSizes.sectionName
font.capitalization: Font.AllUppercase
color: hifi.colors.lightGrayText
verticalAlignment: Text.AlignBottom
height: {
if (hasSeparator) {
hifi.dimensions.contentMargin.y
}
}
}
}

View file

@ -13,25 +13,31 @@ import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../styles-uit"
import "../controls-uit" as HifiControls
TextField {
id: textField
property int colorScheme: hifi.colorSchemes.light
readonly property bool isLightColorScheme: colorScheme == hifi.colorSchemes.light
property string label: ""
property real controlHeight: height + (textFieldLabel.visible ? textFieldLabel.height : 0)
placeholderText: textField.placeholderText
FontLoader { id: firaSansSemiBold; source: "../../fonts/FiraSans-SemiBold.ttf"; }
font.family: firaSansSemiBold.name
font.pixelSize: hifi.fontSizes.textFieldInput
height: implicitHeight + 4 // Make surrounding box higher so that highlight is vertically centered.
placeholderText: textField.label // Instead of separate label (see below).
y: textFieldLabel.visible ? textFieldLabel.height + textFieldLabel.anchors.bottomMargin : 0
style: TextFieldStyle {
textColor: textField.colorScheme == hifi.colorSchemes.light
textColor: isLightColorScheme
? (textField.focus ? hifi.colors.black : hifi.colors.lightGray)
: (textField.focus ? hifi.colors.white : hifi.colors.lightGrayText)
background: Rectangle {
color: textField.colorScheme == hifi.colorSchemes.light
color: isLightColorScheme
? (textField.focus ? hifi.colors.white : hifi.colors.lightGray)
: (textField.focus ? hifi.colors.black : hifi.colors.baseGrayShadow)
border.color: hifi.colors.primaryHighlight
@ -44,16 +50,13 @@ TextField {
padding.right: hifi.dimensions.textPadding
}
/*
// Separate label instead of placeholderText.
RalewaySemibold {
HifiControls.Label {
id: textFieldLabel
text: textField.label
size: hifi.fontSizes.inputLabel
color: hifi.colors.lightGrayText
colorScheme: textField.colorScheme
anchors.left: parent.left
anchors.bottom: parent.top
anchors.bottomMargin: 4
visible: label != ""
}
*/
}

View file

@ -55,8 +55,8 @@ TreeView {
alternateBackgroundColor: parent.isLightColorScheme ? hifi.colors.tableRowLightOdd : hifi.colors.tableRowDarkOdd
branchDelegate: HiFiGlyphs {
text: styleData.isExpanded ? hifi.glyphs.disclosureCollapse : hifi.glyphs.disclosureExpand
size: hifi.fontSizes.tableText * 2.5
text: styleData.isExpanded ? hifi.glyphs.caratDn : hifi.glyphs.caratR
size: hifi.fontSizes.carat
color: colorScheme == hifi.colorSchemes.light
? (styleData.selected
? hifi.colors.black

View file

@ -14,5 +14,5 @@ import "../styles-uit"
Item {
width: 1 // Must be non-zero
height: hifi.dimensions.contentSpacing.y
height: hifi.dimensions.controlInterlineHeight
}

View file

@ -1,10 +1,19 @@
//
// PreferencesDialog.qml
//
// Created by Bradley Austin Davis on 24 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2 as OriginalDialogs
import Qt.labs.settings 1.0
import "../controls" as HifiControls
import "../windows"
import "../controls-uit" as HifiControls
import "../styles-uit"
import "../windows-uit"
import "preferences"
Window {
@ -16,6 +25,9 @@ Window {
height: 577
property var sections: []
property var showCategories: []
minSize: Qt.vector2d(400, 500)
HifiConstants { id: hifi }
function saveAll() {
for (var i = 0; i < sections.length; ++i) {
@ -33,10 +45,8 @@ Window {
destroy();
}
Rectangle {
anchors.fill: parent
clip: true
color: "white"
Column {
width: pane.contentWidth
Component {
id: sectionBuilder
@ -64,45 +74,45 @@ Window {
}
if (sections.length) {
sections[0].expanded = true;
// 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 = true;
sections[i].expanded = true;
}
}
sections[0].isFirst = true;
sections[sections.length - 1].isLast = true;
}
}
Flickable {
id: flickable
clip: true
interactive: true
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: dialogButtons.top
anchors.bottomMargin: 8
contentHeight: prefControls.height
contentWidth: parent.width
Column {
id: prefControls
anchors.left: parent.left
anchors.right: parent.right
}
Column {
id: prefControls
width: pane.contentWidth
}
Row {
id: dialogButtons
anchors { bottom: parent.bottom; right: parent.right; margins: 8 }
}
Button {
text: "Cancel";
onClicked: root.restoreAll();
}
footer: Row {
anchors {
right: parent.right;
rightMargin: hifi.dimensions.contentMargin.x
verticalCenter: parent.verticalCenter
}
spacing: hifi.dimensions.contentSpacing.x
Button {
text: "Save all changes"
onClicked: root.saveAll();
}
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

@ -1,15 +1,25 @@
//
// AvatarPreference.qml
//
// Created by Bradley Austin Davis on 22 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../../dialogs"
import "../../controls-uit"
Preference {
id: root
property alias buttonText: button.text
property alias text: dataTextField.text
property alias buttonText: button.text
property alias placeholderText: dataTextField.placeholderText
property real spacing: 8
property var browser;
height: labelText.height + Math.max(dataTextField.height, button.height) + spacing
height: control.height + hifi.dimensions.controlInterlineHeight
Component.onCompleted: {
dataTextField.text = preference.value;
@ -41,40 +51,48 @@ Preference {
preference.save();
}
Text {
id: labelText
color: enabled ? "black" : "gray"
text: root.label
}
TextField {
id: dataTextField
placeholderText: root.placeholderText
text: preference.value
style: TextFieldStyle { renderType: Text.QtRendering }
Item {
id: control
anchors {
top: labelText.bottom
left: parent.left
right: button.left
topMargin: root.spacing
rightMargin: root.spacing
right: parent.right
bottom: parent.bottom
}
}
height: Math.max(dataTextField.controlHeight, button.height)
Component {
id: avatarBrowserBuilder;
AvatarBrowser { }
}
Button {
id: button
anchors { right: parent.right; verticalCenter: dataTextField.verticalCenter }
text: "Browse"
onClicked: {
root.browser = avatarBrowserBuilder.createObject(desktop);
root.browser.windowDestroyed.connect(function(){
root.browser = null;
})
TextField {
id: dataTextField
placeholderText: root.placeholderText
text: preference.value
label: root.label
anchors {
left: parent.left
right: button.left
rightMargin: hifi.dimensions.contentSpacing.x
bottom: parent.bottom
}
colorScheme: hifi.colorSchemes.dark
}
Component {
id: avatarBrowserBuilder;
AvatarBrowser { }
}
Button {
id: button
text: "Browse"
anchors {
right: parent.right
verticalCenter: dataTextField.verticalCenter
}
onClicked: {
root.browser = avatarBrowserBuilder.createObject(desktop);
root.browser.windowDestroyed.connect(function(){
root.browser = null;
})
}
}
}
}

View file

@ -1,16 +1,23 @@
//
// BrowsablePreference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../../dialogs"
import "../../controls-uit"
Preference {
id: root
property alias buttonText: button.text
property alias text: dataTextField.text
property alias placeholderText: dataTextField.placeholderText
property real spacing: 8
height: labelText.height + Math.max(dataTextField.height, button.height) + spacing
height: control.height + hifi.dimensions.controlInterlineHeight
Component.onCompleted: {
dataTextField.text = preference.value;
@ -21,42 +28,49 @@ Preference {
preference.save();
}
Text {
id: labelText
color: enabled ? "black" : "gray"
text: root.label
}
TextField {
id: dataTextField
placeholderText: root.placeholderText
text: preference.value
style: TextFieldStyle { renderType: Text.QtRendering }
Item {
id: control
anchors {
top: labelText.bottom
left: parent.left
right: button.left
topMargin: root.spacing
rightMargin: root.spacing
right: parent.right
bottom: parent.bottom
}
}
height: Math.max(dataTextField.controlHeight, button.height)
Component {
id: fileBrowserBuilder;
FileDialog { selectDirectory: true }
}
TextField {
id: dataTextField
Button {
id: button
anchors { right: parent.right; verticalCenter: dataTextField.verticalCenter }
text: preference.browseLabel
onClicked: {
var browser = fileBrowserBuilder.createObject(desktop, { selectDirectory: true, folder: fileDialogHelper.pathToUrl(preference.value) });
browser.selectedFile.connect(function(fileUrl){
console.log(fileUrl);
dataTextField.text = fileDialogHelper.urlToPath(fileUrl);
});
anchors {
left: parent.left
right: button.left
rightMargin: hifi.dimensions.contentSpacing.x
bottom: parent.bottom
}
label: root.label
placeholderText: root.placeholderText
colorScheme: hifi.colorSchemes.dark
}
Component {
id: fileBrowserBuilder;
FileDialog { selectDirectory: true }
}
Button {
id: button
text: preference.browseLabel
anchors {
right: parent.right
verticalCenter: dataTextField.verticalCenter
}
onClicked: {
var browser = fileBrowserBuilder.createObject(desktop, { selectDirectory: true, folder: fileDialogHelper.pathToUrl(preference.value) });
browser.selectedFile.connect(function(fileUrl){
console.log(fileUrl);
dataTextField.text = fileDialogHelper.urlToPath(fileUrl);
});
}
}
}
}

View file

@ -1,16 +1,29 @@
//
// ButtonPreference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4 as Original
import "../../controls-uit"
Preference {
id: root
height: button.height
height: button.height + hifi.dimensions.controlInterlineHeight
Component.onCompleted: button.text = preference.name;
function save() { }
Original.Button {
Button {
id: button
onClicked: preference.trigger()
width: 180
anchors.bottom: parent.bottom
}
}

View file

@ -1,10 +1,20 @@
//
// CheckBoxPreference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import "../../controls"
import "../../controls-uit"
Preference {
id: root
height: checkBox.implicitHeight
height: spacer.height + Math.max(hifi.dimensions.controlLineHeight, checkBox.implicitHeight)
Component.onCompleted: {
checkBox.checked = preference.value;
@ -16,9 +26,25 @@ Preference {
preference.save();
}
Item {
id: spacer
anchors {
top: parent.top
left: parent.left
right: parent.right
}
height: isFirstCheckBox ? hifi.dimensions.controlInterlineHeight : 0
}
CheckBox {
id: checkBox
anchors.fill: parent
anchors {
top: spacer.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
}
text: root.label
colorScheme: hifi.colorSchemes.dark
}
}

View file

@ -1,14 +1,26 @@
//
// ComboBoxPreference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../../controls-uit" as HiFiControls
import "../../styles-uit"
Preference {
id: root
property real spacing: 8
height: labelText.height + dataComboBox.height + spacing
height: control.height + hifi.dimensions.controlInterlineHeight
Component.onCompleted: {
dataComboBox.currentIndex = dataComboBox.find(preference.value);
dataComboBox.currentIndex = dataComboBox.comboBox.find(preference.value);
}
function save() {
@ -16,22 +28,38 @@ Preference {
preference.save();
}
Text {
id: labelText
color: enabled ? "black" : "gray"
text: root.label
}
ComboBox {
id: dataComboBox
model: preference.items
style: ComboBoxStyle { renderType: Text.QtRendering }
Item {
id: control
anchors {
top: labelText.bottom
left: parent.left
right: parent.right
topMargin: root.spacing
rightMargin: root.spacing
bottom: parent.bottom
}
height: Math.max(labelText.height, dataComboBox.controlHeight)
HiFiControls.Label {
id: labelText
text: root.label + ":"
colorScheme: hifi.colorSchemes.dark
anchors {
left: parent.left
right: dataComboBox.left
rightMargin: hifi.dimensions.labelPadding
verticalCenter: parent.verticalCenter
}
horizontalAlignment: Text.AlignRight
wrapMode: Text.Wrap
}
HiFiControls.ComboBox {
id: dataComboBox
model: preference.items
width: 150
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
colorScheme: hifi.colorSchemes.dark
}
}
}

View file

@ -1,11 +1,21 @@
//
// EditablePreference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import "../../dialogs"
import "../../controls-uit"
Preference {
id: root
property real spacing: 8
height: labelText.height + dataTextField.height + spacing
height: dataTextField.controlHeight + hifi.dimensions.controlInterlineHeight
Component.onCompleted: {
dataTextField.text = preference.value;
@ -16,22 +26,16 @@ Preference {
preference.save();
}
Text {
id: labelText
color: enabled ? "black" : "gray"
text: root.label
}
TextField {
id: dataTextField
placeholderText: preference.placeholderText
style: TextFieldStyle { renderType: Text.QtRendering }
label: root.label
colorScheme: hifi.colorSchemes.dark
anchors {
top: labelText.bottom
left: parent.left
right: parent.right
topMargin: root.spacing
rightMargin: root.spacing
bottom: parent.bottom
}
}
}

View file

@ -1,3 +1,13 @@
//
// Preference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
@ -6,6 +16,7 @@ Item {
anchors { left: parent.left; right: parent.right }
property var preference;
property string label: preference ? preference.name : "";
property bool isFirstCheckBox;
Component.onCompleted: {
if (preference) {
preference.load();

View file

@ -1,20 +1,33 @@
//
// Section.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import Hifi 1.0
import "../../controls" as VrControls
import "../../controls-uit" as HiFiControls
import "../../styles-uit"
import "."
Preference {
id: root
property bool collapsable: true
property bool expanded: false
property bool isFirst: false
property bool isLast: false
property string name: "Header"
property real spacing: 8
readonly property alias toggle: toggle
readonly property alias header: header
default property alias preferences: contentContainer.children
HifiConstants { id: hifi }
function saveAll() {
for (var i = 0; i < d.preferences.length; ++i) {
var preference = d.preferences[i];
@ -29,47 +42,24 @@ Preference {
}
}
clip: true
children: [ toggle, header, contentContainer ]
height: expanded ? header.height + contentContainer.height + root.spacing * 3
: Math.max(toggle.height, header.height) + root.spacing * 2
Behavior on height { PropertyAnimation {} }
children: [ contentContainer ]
height: contentContainer.height + (root.isLast ? 2 * hifi.dimensions.contentSpacing.y : 0)
Component.onCompleted: d.buildPreferences();
function toggleExpanded() {
root.expanded = !root.expanded;
}
VrControls.FontAwesome {
id: toggle
width: root.collapsable ? height : 0
anchors { left: parent.left; top: parent.top; margins: root.spacing }
visible: root.collapsable
enabled: root.collapsable
rotation: root.expanded ? 0 : -90
text: "\uf078"
Behavior on rotation { PropertyAnimation {} }
MouseArea { anchors.fill: parent; onClicked: root.toggleExpanded() }
}
Text {
id: header
anchors { left: toggle.right; top: parent.top; leftMargin: root.spacing * 2; margins: root.spacing }
font.bold: true
font.pointSize: 16
color: "#0e7077"
text: root.name
MouseArea { anchors.fill: parent; onClicked: root.toggleExpanded() }
}
Column {
HiFiControls.ContentSection {
id: contentContainer
spacing: root.spacing
anchors { left: toggle.right; top: header.bottom; topMargin: root.spacing; right: parent.right; margins: root.spacing }
enabled: root.expanded
visible: root.expanded
clip: true
name: root.name
isFirst: root.isFirst
isCollapsible: root.collapsable
isCollapsed: !root.expanded
anchors {
left: parent.left
right: parent.right
margins: 0
}
}
QtObject {
@ -83,6 +73,7 @@ Preference {
property var buttonBuilder: Component { ButtonPreference { } }
property var comboBoxBuilder: Component { ComboBoxPreference { } }
property var preferences: []
property int checkBoxCount: 0
function buildPreferences() {
var categoryPreferences = Preferences.preferencesByCategory[root.name];
@ -99,40 +90,49 @@ Preference {
var builder;
switch (preference.type) {
case Preference.Editable:
checkBoxCount = 0;
builder = editableBuilder;
break;
case Preference.Browsable:
checkBoxCount = 0;
builder = browsableBuilder;
break;
case Preference.Spinner:
checkBoxCount = 0;
builder = spinnerBuilder;
break;
case Preference.Slider:
checkBoxCount = 0;
builder = sliderBuilder;
break;
case Preference.Checkbox:
checkBoxCount++;
console.log("####### checkBoxCount = " + checkBoxCount);
builder = checkboxBuilder;
break;
case Preference.Avatar:
checkBoxCount = 0;
builder = avatarBuilder;
break;
case Preference.Button:
checkBoxCount = 0;
builder = buttonBuilder;
break;
case Preference.ComboBox:
checkBoxCount = 0;
builder = comboBoxBuilder;
break;
};
if (builder) {
preferences.push(builder.createObject(contentContainer, { preference: preference }));
preferences.push(builder.createObject(contentContainer, { preference: preference, isFirstCheckBox: (checkBoxCount === 1) }));
}
}
}

View file

@ -1,10 +1,22 @@
//
// SpinBoxPreference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import "../../dialogs"
import "../../controls-uit"
Preference {
id: root
property alias slider: slider
height: slider.height
height: control.height + hifi.dimensions.controlInterlineHeight
Component.onCompleted: {
slider.value = preference.value;
@ -15,16 +27,38 @@ Preference {
preference.save();
}
Text {
text: root.label
color: enabled ? "black" : "gray"
anchors.verticalCenter: slider.verticalCenter
}
Item {
id: control
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: Math.max(labelText.height, slider.height)
Slider {
id: slider
value: preference.value
width: 130
anchors { right: parent.right }
Label {
id: labelText
text: root.label + ":"
colorScheme: hifi.colorSchemes.dark
anchors {
left: parent.left
right: slider.left
rightMargin: hifi.dimensions.labelPadding
verticalCenter: parent.verticalCenter
}
horizontalAlignment: Text.AlignRight
wrapMode: Text.Wrap
}
Slider {
id: slider
value: preference.value
width: 130
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
colorScheme: hifi.colorSchemes.dark
}
}
}

View file

@ -1,10 +1,21 @@
//
// SpinBoxPreference.qml
//
// Created by Bradley Austin Davis on 18 Jan 2016
// Copyright 2016 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.5
import QtQuick.Controls 1.4
import "../../controls-uit"
Preference {
id: root
property alias spinner: spinner
height: spinner.height
height: control.height + hifi.dimensions.controlInterlineHeight
Component.onCompleted: {
spinner.value = preference.value;
@ -15,18 +26,40 @@ Preference {
preference.save();
}
Text {
text: root.label
color: root.enabled ? "black" : "gray"
anchors.verticalCenter: spinner.verticalCenter
}
Item {
id: control
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
height: Math.max(spinnerLabel.height, spinner.controlHeight)
SpinBox {
id: spinner
decimals: preference.decimals
minimumValue: preference.min
maximumValue: preference.max
width: 100
anchors { right: parent.right }
Label {
id: spinnerLabel
text: root.label + ":"
colorScheme: hifi.colorSchemes.dark
anchors {
left: parent.left
right: spinner.left
rightMargin: hifi.dimensions.labelPadding
verticalCenter: parent.verticalCenter
}
horizontalAlignment: Text.AlignRight
wrapMode: Text.Wrap
}
SpinBox {
id: spinner
decimals: preference.decimals
minimumValue: preference.min
maximumValue: preference.max
width: 100
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
colorScheme: hifi.colorSchemes.dark
}
}
}

View file

@ -6,7 +6,7 @@ import "../../dialogs"
PreferencesDialog {
id: root
objectName: "AudioPreferencesDialog"
title: "Audio Preferences"
title: "Audio Settings"
showCategories: ["Audio"]
property var settings: Settings {
category: root.objectName

View file

@ -6,7 +6,7 @@ import "../../dialogs"
PreferencesDialog {
id: root
objectName: "AvatarPreferencesDialog"
title: "Avatar Preferences"
title: "Avatar Settings"
showCategories: [ "Avatar Basics", "Avatar Tuning", "Avatar Camera" ]
property var settings: Settings {
category: root.objectName

View file

@ -1,3 +1,13 @@
//
// PreferencesDialog.qml
//
// Created by Bradley Austin Davis on 24 Jan 2016
// Copyright 2015 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.5
import Qt.labs.settings 1.0
@ -6,7 +16,7 @@ import "../../dialogs"
PreferencesDialog {
id: root
objectName: "GeneralPreferencesDialog"
title: "General Preferences"
title: "General Settings"
showCategories: ["Snapshots", "Scripts", "Privacy", "Octree", "HMD", "Sixense Controllers"]
property var settings: Settings {
category: root.objectName

View file

@ -6,7 +6,7 @@ import "../../dialogs"
PreferencesDialog {
id: root
objectName: "GraphicsPreferencesDialog"
title: "Graphics Preferences"
title: "Graphics Settings"
showCategories: ["Graphics"]
property var settings: Settings {
category: root.objectName

View file

@ -6,7 +6,7 @@ import "../../dialogs"
PreferencesDialog {
id: root
objectName: "LodPreferencesDialog"
title: "Level of Detail preferences"
title: "LOD Settings"
showCategories: ["Level of Detail Tuning"]
property var settings: Settings {
category: root.objectName

View file

@ -24,7 +24,7 @@ Window {
resizable: true
destroyOnInvisible: true
x: 40; y: 40
implicitWidth: 384; implicitHeight: 640
implicitWidth: 400; implicitHeight: 695
minSize: Qt.vector2d(200, 300)
HifiConstants { id: hifi }
@ -87,8 +87,11 @@ Window {
Column {
width: pane.contentWidth
HifiControls.StaticSection {
HifiControls.ContentSection {
name: "Currently Running"
isFirst: true
HifiControls.VerticalSpacer {}
Row {
spacing: hifi.dimensions.contentSpacing.x
@ -106,6 +109,8 @@ Window {
}
}
HifiControls.VerticalSpacer {}
HifiControls.Table {
tableModel: runningScriptsModel
height: 185
@ -113,11 +118,16 @@ Window {
anchors.left: parent.left
anchors.right: parent.right
}
HifiControls.VerticalSpacer {
height: 2 // Table view draws a little taller than it's height.
}
}
HifiControls.StaticSection {
HifiControls.ContentSection {
name: "Load Scripts"
hasSeparator: true
HifiControls.VerticalSpacer {}
Row {
spacing: hifi.dimensions.contentSpacing.x
@ -161,18 +171,21 @@ Window {
}
}
HifiControls.VerticalSpacer {}
HifiControls.TextField {
id: filterEdit
anchors.left: parent.left
anchors.right: parent.right
focus: true
colorScheme: hifi.colorSchemes.dark
//placeholderText: "filter"
label: "Filter"
placeholderText: "filter"
onTextChanged: scriptsModel.filterRegExp = new RegExp("^.*" + text + ".*$", "i")
Component.onCompleted: scriptsModel.filterRegExp = new RegExp("^.*$", "i")
}
HifiControls.VerticalSpacer {}
HifiControls.Tree {
id: treeView
height: 155
@ -182,6 +195,8 @@ Window {
anchors.right: parent.right
}
HifiControls.VerticalSpacer {}
HifiControls.TextField {
id: selectedScript
anchors.left: parent.left

View file

@ -48,11 +48,13 @@ Item {
// Other colors
readonly property color white: "#ffffff"
readonly property color gray: "#808080"
readonly property color black: "#000000"
// Semitransparent
readonly property color white50: "#80ffffff"
readonly property color white30: "#4dffffff"
readonly property color white25: "#40ffffff"
readonly property color transparent: "#00ffffff"
// Control specific colors
readonly property color tableRowLightOdd: white50
@ -61,6 +63,26 @@ Item {
readonly property color tableRowDarkEven: "#a6181818"
readonly property color tableScrollHandle: "#707070"
readonly property color tableScrollBackground: "#323232"
readonly property color checkboxLightStart: "#ffffff"
readonly property color checkboxLightFinish: "#afafaf"
readonly property color checkboxDarkStart: "#7d7d7d"
readonly property color checkboxDarkFinish: "#6b6a6b"
readonly property color checkboxChecked: primaryHighlight
readonly property color checkboxCheckedBorder: "#36cdff"
readonly property color sliderGutterLight: "#d4d4d4"
readonly property color sliderGutterDark: "#252525"
readonly property color sliderBorderLight: "#afafaf"
readonly property color sliderBorderDark: "#7d7d7d"
readonly property color sliderLightStart: "#ffffff"
readonly property color sliderLightFinish: "#afafaf"
readonly property color sliderDarkStart: "#7d7d7d"
readonly property color sliderDarkFinish: "#6b6a6b"
readonly property color dropDownPressedLight: "#d4d4d4"
readonly property color dropDownPressedDark: "#afafaf"
readonly property color dropDownLightStart: "#ffffff"
readonly property color dropDownLightFinish: "#afafaf"
readonly property color dropDownDarkStart: "#7d7d7d"
readonly property color dropDownDarkFinish: "#6b6a6b"
}
Item {
@ -76,39 +98,54 @@ Item {
readonly property real borderWidth: largeScreen ? 2 : 1
readonly property vector2d contentMargin: Qt.vector2d(12, 24)
readonly property vector2d contentSpacing: Qt.vector2d(8, 12)
readonly property real labelPadding: 40
readonly property real textPadding: 8
readonly property real sliderHandleSize: 18
readonly property real sliderGrooveHeight: 8
readonly property real spinnerSize: 42
readonly property real tablePadding: 12
readonly property real tableRowHeight: largeScreen ? 26 : 23
readonly property vector2d modalDialogMargin: Qt.vector2d(50, 30)
readonly property real modalDialogTitleHeight: 40
readonly property real controlLineHeight: 29 // Height of spinbox control on 1920 x 1080 monitor
readonly property real controlInterlineHeight: 22 // 75% of controlLineHeight
}
Item {
id: fontSizes // In pixels
readonly property real overlayTitle: dimensions.largeScreen? 18 : 14
readonly property real tabName: dimensions.largeScreen? 12 : 10
readonly property real sectionName: dimensions.largeScreen? 12 : 10
readonly property real inputLabel: dimensions.largeScreen? 14 : 10
readonly property real textFieldInput: dimensions.largeScreen? 15 : 12
readonly property real tableText: dimensions.largeScreen? 15 : 12
readonly property real buttonLabel: dimensions.largeScreen? 13 : 9
readonly property real iconButton: dimensions.largeScreen? 13 : 9
readonly property real listItem: dimensions.largeScreen? 15 : 11
readonly property real tabularData: dimensions.largeScreen? 15 : 11
readonly property real logs: dimensions.largeScreen? 16 : 12
readonly property real code: dimensions.largeScreen? 16 : 12
readonly property real rootMenu: dimensions.largeScreen? 15 : 11
readonly property real menuItem: dimensions.largeScreen? 15 : 11
readonly property real shortcutText: dimensions.largeScreen? 13 : 9
readonly property real overlayTitle: dimensions.largeScreen ? 18 : 14
readonly property real tabName: dimensions.largeScreen ? 12 : 10
readonly property real sectionName: dimensions.largeScreen ? 12 : 10
readonly property real inputLabel: dimensions.largeScreen ? 14 : 10
readonly property real textFieldInput: dimensions.largeScreen ? 15 : 12
readonly property real tableText: dimensions.largeScreen ? 15 : 12
readonly property real buttonLabel: dimensions.largeScreen ? 13 : 9
readonly property real iconButton: dimensions.largeScreen ? 13 : 9
readonly property real listItem: dimensions.largeScreen ? 15 : 11
readonly property real tabularData: dimensions.largeScreen ? 15 : 11
readonly property real logs: dimensions.largeScreen ? 16 : 12
readonly property real code: dimensions.largeScreen ? 16 : 12
readonly property real rootMenu: dimensions.largeScreen ? 15 : 11
readonly property real menuItem: dimensions.largeScreen ? 15 : 11
readonly property real shortcutText: dimensions.largeScreen ? 13 : 9
readonly property real carat: dimensions.largeScreen ? 38 : 30
readonly property real disclosureButton: dimensions.largeScreen ? 20 : 15
}
Item {
id: glyphs
readonly property string backward: "E"
readonly property string caratDn: "5"
readonly property string caratR: "3"
readonly property string caratUp: "6"
readonly property string close: "w"
readonly property string closeInverted: "x"
readonly property string closeSmall: "C"
readonly property string disclosureButtonCollapse: "M"
readonly property string disclosureButtonExpand: "L"
readonly property string disclosureCollapse: "Z"
readonly property string disclosureExpand: "B"
readonly property string forward: "D"
readonly property string pin: "y"
readonly property string pinInverted: "z"
readonly property string reloadSmall: "a"

View file

@ -99,8 +99,8 @@ Frame {
DropShadow {
source: titleText
anchors.fill: titleText
horizontalOffset: 1
verticalOffset: 1
horizontalOffset: 2
verticalOffset: 2
samples: 2
color: hifi.colors.baseGrayShadow60
visible: (window && window.focus)

View file

@ -58,6 +58,8 @@ Fadable {
// The content to place inside the window, determined by the client
default property var content
property var footer: Item { } // Optional static footer at the bottom of the dialog.
function setDefaultFocus() {} // Default function; can be overridden by dialogs.
property var rectifier: Timer {
@ -125,7 +127,8 @@ Fadable {
// Scrollable window content.
property var pane: Item {
property bool isScrolling: scrollView.height < scrollView.contentItem.height
property int contentWidth: scrollView.width - (isScrolling ? 11 : 0)
property int contentWidth: scrollView.width - (isScrolling ? 10 : 0)
property int scrollHeight: scrollView.height
anchors.fill: parent
anchors.rightMargin: isScrolling ? 11 : 0
@ -162,6 +165,7 @@ Fadable {
verticalScrollBarPolicy: Qt.ScrollBarAsNeeded
anchors.fill: parent
anchors.rightMargin: parent.isScrolling ? 1 : 0
anchors.bottomMargin: footer.height > 0 ? footerPane.height : 0
style: ScrollViewStyle {
@ -203,7 +207,46 @@ Fadable {
}
}
}
Rectangle {
// Optional non-scrolling footer.
id: footerPane
anchors {
left: parent.left
bottom: parent.bottom
}
width: parent.contentWidth
height: footer.height + 2 * hifi.dimensions.contentSpacing.y
color: hifi.colors.baseGray
visible: footer.height > 0
Item {
// Horizontal rule.
anchors.fill: parent
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.fill: parent
anchors.topMargin: 3 // Horizontal rule.
children: [ footer ]
}
}
}
children: [ swallower, frame, pane, activator ]
Component.onCompleted: { raise(); setDefaultFocus(); }

View file

@ -36,8 +36,7 @@ void setupPreferences() {
{
auto getter = [=]()->QString {return myAvatar->getDisplayName(); };
auto setter = [=](const QString& value) { myAvatar->setDisplayName(value); };
const QString label = "Avatar display name <font color=\"#909090\">(optional)</font>";
auto preference = new EditPreference(AVATAR_BASICS, label, getter, setter);
auto preference = new EditPreference(AVATAR_BASICS, "Avatar display name (optional)", getter, setter);
preference->setPlaceholderText("Not showing a name");
preferences->addPreference(preference);
}
@ -45,8 +44,7 @@ void setupPreferences() {
{
auto getter = [=]()->QString {return myAvatar->getCollisionSoundURL(); };
auto setter = [=](const QString& value) { myAvatar->setCollisionSoundURL(value); };
const QString label = "Avatar collision sound URL <font color=\"#909090\">(optional)</font>";
auto preference = new EditPreference(AVATAR_BASICS, label, getter, setter);
auto preference = new EditPreference(AVATAR_BASICS, "Avatar collision sound URL (optional)", getter, setter);
preference->setPlaceholderText("Enter the URL of a sound to play when you bump into something");
preferences->addPreference(preference);
}
@ -54,18 +52,18 @@ void setupPreferences() {
{
auto getter = [=]()->QString { return myAvatar->getFullAvatarURLFromPreferences().toString(); };
auto setter = [=](const QString& value) { myAvatar->useFullAvatarURL(value, ""); };
auto preference = new AvatarPreference(AVATAR_BASICS, "Appearance: ", getter, setter);
auto preference = new AvatarPreference(AVATAR_BASICS, "Appearance", getter, setter);
preferences->addPreference(preference);
}
{
auto getter = [=]()->bool {return myAvatar->getSnapTurn(); };
auto setter = [=](bool value) { myAvatar->setSnapTurn(value); };
preferences->addPreference(new CheckPreference(AVATAR_BASICS, "Snap Turn when in HMD", getter, setter));
preferences->addPreference(new CheckPreference(AVATAR_BASICS, "Snap turn when in HMD", getter, setter));
}
{
auto getter = []()->QString { return Snapshot::snapshotsLocation.get(); };
auto setter = [](const QString& value) { Snapshot::snapshotsLocation.set(value); };
auto preference = new BrowsePreference("Snapshots", "Place my Snapshots here:", getter, setter);
auto preference = new BrowsePreference("Snapshots", "Put my snapshots here", getter, setter);
preferences->addPreference(preference);
}
@ -73,7 +71,7 @@ void setupPreferences() {
{
auto getter = []()->QString { return DependencyManager::get<ScriptEngines>()->getScriptsLocation(); };
auto setter = [](const QString& value) { DependencyManager::get<ScriptEngines>()->setScriptsLocation(value); };
preferences->addPreference(new BrowsePreference("Scripts", "Load scripts from this directory:", getter, setter));
preferences->addPreference(new BrowsePreference("Scripts", "Load scripts from this directory", getter, setter));
}
preferences->addPreference(new ButtonPreference("Scripts", "Load Default Scripts", [] {
@ -83,14 +81,14 @@ void setupPreferences() {
{
auto getter = []()->bool {return !Menu::getInstance()->isOptionChecked(MenuOption::DisableActivityLogger); };
auto setter = [](bool value) { Menu::getInstance()->setIsOptionChecked(MenuOption::DisableActivityLogger, !value); };
preferences->addPreference(new CheckPreference("Privacy", "Send Data", getter, setter));
preferences->addPreference(new CheckPreference("Privacy", "Send data", getter, setter));
}
static const QString LOD_TUNING("Level of Detail Tuning");
{
auto getter = []()->float { return DependencyManager::get<LODManager>()->getDesktopLODDecreaseFPS(); };
auto setter = [](float value) { DependencyManager::get<LODManager>()->setDesktopLODDecreaseFPS(value); };
auto preference = new SpinnerPreference(LOD_TUNING, "Minimum Desktop FPS", getter, setter);
auto preference = new SpinnerPreference(LOD_TUNING, "Minimum desktop FPS", getter, setter);
preference->setMin(0);
preference->setMax(120);
preference->setStep(1);
@ -138,7 +136,7 @@ void setupPreferences() {
{
auto getter = [=]()->float { return myAvatar->getUniformScale(); };
auto setter = [=](float value) { myAvatar->setTargetScaleVerbose(value); }; // The hell?
auto preference = new SpinnerPreference(AVATAR_TUNING, "Avatar scale <font color=\"#909090\">(default is 1.0)</font>", getter, setter);
auto preference = new SpinnerPreference(AVATAR_TUNING, "Avatar scale (default is 1.0)", getter, setter);
preference->setMin(0.01f);
preference->setMax(99.9f);
preference->setDecimals(2);
@ -170,7 +168,7 @@ void setupPreferences() {
{
auto getter = [=]()->QString { return myAvatar->getAnimGraphUrl().toString(); };
auto setter = [=](const QString& value) { myAvatar->setAnimGraphUrl(value); };
auto preference = new EditPreference(AVATAR_TUNING, "Avatar Animation JSON", getter, setter);
auto preference = new EditPreference(AVATAR_TUNING, "Avatar animation JSON", getter, setter);
preference->setPlaceholderText("default");
preferences->addPreference(preference);
}
@ -179,7 +177,7 @@ void setupPreferences() {
{
auto getter = [=]()->float { return myAvatar->getPitchSpeed(); };
auto setter = [=](float value) { myAvatar->setPitchSpeed(value); };
auto preference = new SpinnerPreference(AVATAR_CAMERA, "Camera Pitch Speed (degrees/second)", getter, setter);
auto preference = new SpinnerPreference(AVATAR_CAMERA, "Camera pitch speed (degrees/second)", getter, setter);
preference->setMin(1.0f);
preference->setMax(360.0f);
preferences->addPreference(preference);
@ -187,7 +185,7 @@ void setupPreferences() {
{
auto getter = [=]()->float { return myAvatar->getYawSpeed(); };
auto setter = [=](float value) { myAvatar->setYawSpeed(value); };
auto preference = new SpinnerPreference(AVATAR_CAMERA, "Camera Yaw Speed (degrees/second)", getter, setter);
auto preference = new SpinnerPreference(AVATAR_CAMERA, "Camera yaw speed (degrees/second)", getter, setter);
preference->setMin(1.0f);
preference->setMax(360.0f);
preferences->addPreference(preference);
@ -197,13 +195,13 @@ void setupPreferences() {
{
auto getter = []()->bool {return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getDynamicJitterBuffers(); };
auto setter = [](bool value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setDynamicJitterBuffers(value); };
preferences->addPreference(new CheckPreference(AUDIO, "Enable Dynamic Jitter Buffers", getter, setter));
preferences->addPreference(new CheckPreference(AUDIO, "Enable dynamic jitter buffers", getter, setter));
}
{
auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getDesiredJitterBufferFrames(); };
auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setStaticDesiredJitterBufferFrames(value); };
auto preference = new SpinnerPreference(AUDIO, "Static Jitter Buffer Frames", getter, setter);
auto preference = new SpinnerPreference(AUDIO, "Static jitter buffer frames", getter, setter);
preference->setMin(0);
preference->setMax(10000);
preference->setStep(1);
@ -212,7 +210,7 @@ void setupPreferences() {
{
auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getMaxFramesOverDesired(); };
auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setMaxFramesOverDesired(value); };
auto preference = new SpinnerPreference(AUDIO, "Max Frames Over Desired", getter, setter);
auto preference = new SpinnerPreference(AUDIO, "Max frames over desired", getter, setter);
preference->setMax(10000);
preference->setStep(1);
preferences->addPreference(preference);
@ -220,12 +218,12 @@ void setupPreferences() {
{
auto getter = []()->bool {return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getUseStDevForJitterCalc(); };
auto setter = [](bool value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setUseStDevForJitterCalc(value); };
preferences->addPreference(new CheckPreference(AUDIO, "Use Stddev for Dynamic Jitter Calc", getter, setter));
preferences->addPreference(new CheckPreference(AUDIO, "Use standard deviation for dynamic jitter calc", getter, setter));
}
{
auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getWindowStarveThreshold(); };
auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setWindowStarveThreshold(value); };
auto preference = new SpinnerPreference(AUDIO, "Window A Starve Threshold", getter, setter);
auto preference = new SpinnerPreference(AUDIO, "Window A starve threshold", getter, setter);
preference->setMax(10000);
preference->setStep(1);
preferences->addPreference(preference);
@ -233,7 +231,7 @@ void setupPreferences() {
{
auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getWindowSecondsForDesiredCalcOnTooManyStarves(); };
auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setWindowSecondsForDesiredCalcOnTooManyStarves(value); };
auto preference = new SpinnerPreference(AUDIO, "Window A (raise desired on N starves) Seconds)", getter, setter);
auto preference = new SpinnerPreference(AUDIO, "Window A (raise desired on N starves) seconds", getter, setter);
preference->setMax(10000);
preference->setStep(1);
preferences->addPreference(preference);
@ -241,7 +239,7 @@ void setupPreferences() {
{
auto getter = []()->float { return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getWindowSecondsForDesiredReduction(); };
auto setter = [](float value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setWindowSecondsForDesiredReduction(value); };
auto preference = new SpinnerPreference(AUDIO, "Window B (desired ceiling) Seconds", getter, setter);
auto preference = new SpinnerPreference(AUDIO, "Window B (desired ceiling) seconds", getter, setter);
preference->setMax(10000);
preference->setStep(1);
preferences->addPreference(preference);
@ -249,12 +247,12 @@ void setupPreferences() {
{
auto getter = []()->bool {return DependencyManager::get<AudioClient>()->getReceivedAudioStream().getRepetitionWithFade(); };
auto setter = [](bool value) { DependencyManager::get<AudioClient>()->getReceivedAudioStream().setRepetitionWithFade(value); };
preferences->addPreference(new CheckPreference(AUDIO, "Repetition with Fade", getter, setter));
preferences->addPreference(new CheckPreference(AUDIO, "Repetition with fade", getter, setter));
}
{
auto getter = []()->float { return DependencyManager::get<AudioClient>()->getOutputBufferSize(); };
auto setter = [](float value) { DependencyManager::get<AudioClient>()->setOutputBufferSize(value); };
auto preference = new SpinnerPreference(AUDIO, "Output Buffer Initial Size (frames)", getter, setter);
auto preference = new SpinnerPreference(AUDIO, "Output buffer initial size (frames)", getter, setter);
preference->setMin(1);
preference->setMax(20);
preference->setStep(1);
@ -263,13 +261,13 @@ void setupPreferences() {
{
auto getter = []()->bool {return DependencyManager::get<AudioClient>()->getOutputStarveDetectionEnabled(); };
auto setter = [](bool value) { DependencyManager::get<AudioClient>()->setOutputStarveDetectionEnabled(value); };
auto preference = new CheckPreference(AUDIO, "Output Starve Detection (Automatic Buffer Size Increase)", getter, setter);
auto preference = new CheckPreference(AUDIO, "Output starve detection (automatic buffer size increase)", getter, setter);
preferences->addPreference(preference);
}
{
auto getter = []()->float { return DependencyManager::get<AudioClient>()->getOutputStarveDetectionThreshold(); };
auto setter = [](float value) { DependencyManager::get<AudioClient>()->setOutputStarveDetectionThreshold(value); };
auto preference = new SpinnerPreference(AUDIO, "Output Starve Detection Threshold", getter, setter);
auto preference = new SpinnerPreference(AUDIO, "Output starve detection threshold", getter, setter);
preference->setMin(1);
preference->setMax(500);
preference->setStep(1);
@ -278,7 +276,7 @@ void setupPreferences() {
{
auto getter = []()->float { return DependencyManager::get<AudioClient>()->getOutputStarveDetectionPeriod(); };
auto setter = [](float value) { DependencyManager::get<AudioClient>()->setOutputStarveDetectionPeriod(value); };
auto preference = new SpinnerPreference(AUDIO, "Output Starve Detection Period (ms)", getter, setter);
auto preference = new SpinnerPreference(AUDIO, "Output starve detection period (ms)", getter, setter);
preference->setMin(1);
preference->setMax((float)999999999);
preference->setStep(1);
@ -299,7 +297,7 @@ void setupPreferences() {
{
auto getter = []()->float { return qApp->getApplicationCompositor().getHmdUIAngularSize(); };
auto setter = [](float value) { qApp->getApplicationCompositor().setHmdUIAngularSize(value); };
auto preference = new SpinnerPreference("HMD", "User Interface Horizontal Angular Size (degrees)", getter, setter);
auto preference = new SpinnerPreference("HMD", "UI horizontal angular size (degrees)", getter, setter);
preference->setMin(30);
preference->setMax(160);
preference->setStep(1);
@ -310,7 +308,7 @@ void setupPreferences() {
{
auto getter = []()->float { return controller::InputDevice::getReticleMoveSpeed(); };
auto setter = [](float value) { controller::InputDevice::setReticleMoveSpeed(value); };
auto preference = new SpinnerPreference("Sixense Controllers", "Reticle Movement Speed", getter, setter);
auto preference = new SpinnerPreference("Sixense Controllers", "Reticle movement speed", getter, setter);
preference->setMin(0);
preference->setMax(100);
preference->setStep(1);
@ -325,7 +323,7 @@ void setupPreferences() {
{
auto getter = [ambientOcclusionConfig]()->QString { return ambientOcclusionConfig->getPreset(); };
auto setter = [ambientOcclusionConfig](QString preset) { ambientOcclusionConfig->setPreset(preset); };
auto preference = new ComboBoxPreference(RENDER, "Ambient Occlusion", getter, setter);
auto preference = new ComboBoxPreference(RENDER, "Ambient occlusion", getter, setter);
preference->setItems(ambientOcclusionConfig->getPresetList());
preferences->addPreference(preference);
}

View file

@ -528,10 +528,6 @@ Menu {
text: menuOption.turnWithHead;
checkable: true
}
MenuItem {
text: menuOption.comfortMode;
checkable: true
}
MenuItem {
text: menuOption.keyboardMotorControl;
checkable: true

View file

@ -23,6 +23,20 @@ Item {
function getUsername() { return "Jherico"; }
}
Item {
objectName: "ApplicationCompositor"
property bool reticleOverDesktop: true
}
Item {
objectName: "Preferences"
// List of categories obtained by logging categories as they are added in Interface in Preferences::addPreference().
property var categories: [
"Avatar Basics", "Snapshots", "Scripts", "Privacy", "Level of Detail Tuning", "Avatar Tuning", "Avatar Camera",
"Audio", "Octree", "HMD", "Sixense Controllers", "Graphics"
]
}
Item {
objectName: "ScriptDiscoveryService"
//property var scriptsModelFilter: scriptsModel

View file

@ -38,6 +38,18 @@ ApplicationWindow {
property var tabs: [];
property var urls: [];
Button {
// Shows the dialog with preferences sections but not each section's preference items
// because Preferences.preferencesByCategory() method is not stubbed out.
text: "Settings > General..."
property var builder: Component {
GeneralPreferencesDialog { }
}
onClicked: {
var runningScripts = builder.createObject(desktop);
}
}
Button {
text: "Running Scripts"
property var builder: Component {

View file

@ -85,9 +85,11 @@ int main(int argc, char *argv[]) {
setChild(engine, "offscreenFlags");
setChild(engine, "Account");
setChild(engine, "ApplicationCompositor");
setChild(engine, "Desktop");
setChild(engine, "ScriptDiscoveryService");
setChild(engine, "MenuHelper");
setChild(engine, "Preferences");
setChild(engine, "urlHandler");
engine.rootContext()->setContextProperty("DebugQML", true);
engine.rootContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());