From dff567054dc0d2f4891fc5b60138b3c94d58628c Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 13 Sep 2016 11:17:00 -0700 Subject: [PATCH] qml keyboard for avatar preferences dialog --- .../dialogs/preferences/AvatarPreference.qml | 39 +++++++++- .../preferences/BrowsablePreference.qml | 73 ++++++++++--------- .../preferences/EditablePreference.qml | 58 +++++++++++++-- 3 files changed, 126 insertions(+), 44 deletions(-) diff --git a/interface/resources/qml/dialogs/preferences/AvatarPreference.qml b/interface/resources/qml/dialogs/preferences/AvatarPreference.qml index 8f05ca4ffe..16a96f791f 100644 --- a/interface/resources/qml/dialogs/preferences/AvatarPreference.qml +++ b/interface/resources/qml/dialogs/preferences/AvatarPreference.qml @@ -12,6 +12,7 @@ import QtQuick 2.5 import "../../dialogs" import "../../controls-uit" +import "../../controls" as Controls Preference { id: root @@ -53,12 +54,16 @@ Preference { Item { id: control + + property bool keyboardRaised: false + property bool punctuationMode: false + anchors { left: parent.left right: parent.right bottom: parent.bottom } - height: Math.max(dataTextField.controlHeight, button.height) + height: Math.max(dataTextField.controlHeight, button.height) + (keyboardRaised ? 200 : 0) TextField { id: dataTextField @@ -69,7 +74,7 @@ Preference { left: parent.left right: button.left rightMargin: hifi.dimensions.contentSpacing.x - bottom: parent.bottom + bottom: keyboard1.top } colorScheme: hifi.colorSchemes.dark } @@ -94,5 +99,35 @@ Preference { } } + // virtual keyboard, letters + Controls.Keyboard { + id: keyboard1 + // y: parent.keyboardRaised ? parent.height : 0 + height: parent.keyboardRaised ? 200 : 0 + visible: parent.keyboardRaised && !parent.punctuationMode + enabled: parent.keyboardRaised && !parent.punctuationMode + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y + } + + Controls.KeyboardPunctuation { + id: keyboard2 + // y: parent.keyboardRaised ? parent.height : 0 + height: parent.keyboardRaised ? 200 : 0 + visible: parent.keyboardRaised && parent.punctuationMode + enabled: parent.keyboardRaised && parent.punctuationMode + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y + } } } diff --git a/interface/resources/qml/dialogs/preferences/BrowsablePreference.qml b/interface/resources/qml/dialogs/preferences/BrowsablePreference.qml index 2e5ea7578c..4989c57694 100644 --- a/interface/resources/qml/dialogs/preferences/BrowsablePreference.qml +++ b/interface/resources/qml/dialogs/preferences/BrowsablePreference.qml @@ -19,10 +19,7 @@ Preference { id: root property alias text: dataTextField.text property alias placeholderText: dataTextField.placeholderText - height: control.height + hifi.dimensions.controlInterlineHeight + (keyboardRaised ? 200 : 0) - - property bool keyboardRaised: false - property bool punctuationMode: false + height: control.height + hifi.dimensions.controlInterlineHeight Component.onCompleted: { dataTextField.text = preference.value; @@ -35,12 +32,16 @@ Preference { Item { id: control + + property bool keyboardRaised: false + property bool punctuationMode: false + anchors { left: parent.left right: parent.right - bottom: keyboard1.top + bottom: parent.bottom } - height: Math.max(dataTextField.controlHeight, button.height) + height: Math.max(dataTextField.controlHeight, button.height) + (keyboardRaised ? 200 : 0) TextField { id: dataTextField @@ -49,7 +50,7 @@ Preference { left: parent.left right: button.left rightMargin: hifi.dimensions.contentSpacing.x - bottom: parent.bottom + bottom: keyboard1.top } label: root.label @@ -80,36 +81,36 @@ Preference { }); } } - } - // virtual keyboard, letters - Controls.Keyboard { - id: keyboard1 - // y: parent.keyboardRaised ? parent.height : 0 - height: parent.keyboardRaised ? 200 : 0 - visible: parent.keyboardRaised && !parent.punctuationMode - enabled: parent.keyboardRaised && !parent.punctuationMode - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y - } + // virtual keyboard, letters + Controls.Keyboard { + id: keyboard1 + // y: parent.keyboardRaised ? parent.height : 0 + height: parent.keyboardRaised ? 200 : 0 + visible: parent.keyboardRaised && !parent.punctuationMode + enabled: parent.keyboardRaised && !parent.punctuationMode + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y + } - Controls.KeyboardPunctuation { - id: keyboard2 - // y: parent.keyboardRaised ? parent.height : 0 - height: parent.keyboardRaised ? 200 : 0 - visible: parent.keyboardRaised && parent.punctuationMode - enabled: parent.keyboardRaised && parent.punctuationMode - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y + Controls.KeyboardPunctuation { + id: keyboard2 + // y: parent.keyboardRaised ? parent.height : 0 + height: parent.keyboardRaised ? 200 : 0 + visible: parent.keyboardRaised && parent.punctuationMode + enabled: parent.keyboardRaised && parent.punctuationMode + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + anchors.bottom: parent.bottom + anchors.bottomMargin: 0 + // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y + } } } diff --git a/interface/resources/qml/dialogs/preferences/EditablePreference.qml b/interface/resources/qml/dialogs/preferences/EditablePreference.qml index 8acf8e1f76..40df94dd9f 100644 --- a/interface/resources/qml/dialogs/preferences/EditablePreference.qml +++ b/interface/resources/qml/dialogs/preferences/EditablePreference.qml @@ -12,10 +12,11 @@ import QtQuick 2.5 import "../../dialogs" import "../../controls-uit" +import "../../controls" as Controls Preference { id: root - height: dataTextField.controlHeight + hifi.dimensions.controlInterlineHeight + height: dataTextField.controlHeight + hifi.dimensions.controlInterlineHeight + (editablePreferenceColumn.keyboardRaised ? 200 : 0) Component.onCompleted: { dataTextField.text = preference.value; @@ -26,16 +27,61 @@ Preference { preference.save(); } - TextField { - id: dataTextField - placeholderText: preference.placeholderText - label: root.label - colorScheme: hifi.colorSchemes.dark + Column { + id: editablePreferenceColumn + height: dataTextField.height + (keyboardRaised ? 200 : 0) + + property bool keyboardRaised: false + property bool punctuationMode: false anchors { left: parent.left right: parent.right bottom: parent.bottom } + + TextField { + id: dataTextField + placeholderText: preference.placeholderText + label: root.label + colorScheme: hifi.colorSchemes.dark + + anchors { + left: parent.left + right: parent.right + // bottom: keyboard1.bottom + } + } + + // virtual keyboard, letters + Controls.Keyboard { + id: keyboard1 + // y: parent.keyboardRaised ? parent.height : 0 + height: parent.keyboardRaised ? 200 : 0 + visible: parent.keyboardRaised && !parent.punctuationMode + enabled: parent.keyboardRaised && !parent.punctuationMode + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + // anchors.bottom: parent.bottom + // anchors.bottomMargin: 0 + // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y + } + + Controls.KeyboardPunctuation { + id: keyboard2 + // y: parent.keyboardRaised ? parent.height : 0 + height: parent.keyboardRaised ? 200 : 0 + visible: parent.keyboardRaised && parent.punctuationMode + enabled: parent.keyboardRaised && parent.punctuationMode + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 0 + // anchors.bottom: parent.bottom + // anchors.bottomMargin: 0 + // anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y + } } }