From 1c4eed640fcdd1747484e383b8d59b4f092dbaea Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 25 May 2016 13:10:26 +1200 Subject: [PATCH] Fix up file browser resize handle and outlining --- .../resources/qml/dialogs/FileDialog.qml | 2 ++ .../qml/styles-uit/HifiConstants.qml | 1 + .../qml/windows-uit/DefaultFrame.qml | 24 ++++++++++------ interface/resources/qml/windows-uit/Frame.qml | 28 +++++++++---------- .../resources/qml/windows-uit/ModalFrame.qml | 13 ++++++--- .../resources/qml/windows-uit/ModalWindow.qml | 2 ++ .../resources/qml/windows-uit/Window.qml | 1 + 7 files changed, 45 insertions(+), 26 deletions(-) diff --git a/interface/resources/qml/dialogs/FileDialog.qml b/interface/resources/qml/dialogs/FileDialog.qml index 0b539f9667..7921e2549d 100644 --- a/interface/resources/qml/dialogs/FileDialog.qml +++ b/interface/resources/qml/dialogs/FileDialog.qml @@ -29,6 +29,8 @@ ModalWindow { implicitWidth: 640 implicitHeight: 480 + minSize: Qt.vector2d(300, 240) + HifiConstants { id: hifi } Settings { diff --git a/interface/resources/qml/styles-uit/HifiConstants.qml b/interface/resources/qml/styles-uit/HifiConstants.qml index 16f150b2d9..f2698da574 100644 --- a/interface/resources/qml/styles-uit/HifiConstants.qml +++ b/interface/resources/qml/styles-uit/HifiConstants.qml @@ -141,6 +141,7 @@ Item { readonly property real textPadding: 8 readonly property real sliderHandleSize: 18 readonly property real sliderGrooveHeight: 8 + readonly property real frameIconSize: 22 readonly property real spinnerSize: 50 readonly property real tablePadding: 12 readonly property real tableRowHeight: largeScreen ? 26 : 23 diff --git a/interface/resources/qml/windows-uit/DefaultFrame.qml b/interface/resources/qml/windows-uit/DefaultFrame.qml index 04905656ce..6334086e4e 100644 --- a/interface/resources/qml/windows-uit/DefaultFrame.qml +++ b/interface/resources/qml/windows-uit/DefaultFrame.qml @@ -20,6 +20,14 @@ Frame { Rectangle { // Dialog frame id: frameContent + + readonly property int iconSize: hifi.dimensions.frameIconSize + readonly property int frameMargin: 9 + readonly property int frameMarginLeft: frameMargin + readonly property int frameMarginRight: frameMargin + readonly property int frameMarginTop: 2 * frameMargin + iconSize + readonly property int frameMarginBottom: iconSize + 11 + anchors { topMargin: -frameMarginTop leftMargin: -frameMarginLeft @@ -45,17 +53,17 @@ Frame { anchors { right: parent.right; top: parent.top; - topMargin: frameMargin + 1 // Move down a little to visually align with the title - rightMargin: frameMarginRight; + topMargin: frameContent.frameMargin + 1 // Move down a little to visually align with the title + rightMargin: frameContent.frameMarginRight; } - spacing: iconSize / 4 + spacing: frameContent.iconSize / 4 HiFiGlyphs { // "Pin" button visible: false text: (frame.pinned && !pinClickArea.containsMouse) || (!frame.pinned && pinClickArea.containsMouse) ? hifi.glyphs.pinInverted : hifi.glyphs.pin color: pinClickArea.containsMouse && !pinClickArea.pressed ? hifi.colors.redHighlight : hifi.colors.white - size: iconSize + size: frameContent.iconSize MouseArea { id: pinClickArea anchors.fill: parent @@ -70,7 +78,7 @@ Frame { visible: window ? window.closable : false text: closeClickArea.containsPress ? hifi.glyphs.closeInverted : hifi.glyphs.close color: closeClickArea.containsMouse ? hifi.colors.redHighlight : hifi.colors.white - size: iconSize + size: frameContent.iconSize MouseArea { id: closeClickArea anchors.fill: parent @@ -85,11 +93,11 @@ Frame { id: titleText anchors { left: parent.left - leftMargin: frameMarginLeft + hifi.dimensions.contentMargin.x + leftMargin: frameContent.frameMarginLeft + hifi.dimensions.contentMargin.x right: controlsRow.left - rightMargin: iconSize + rightMargin: frameContent.iconSize top: parent.top - topMargin: frameMargin + topMargin: frameContent.frameMargin } text: window ? window.title : "" color: hifi.colors.white diff --git a/interface/resources/qml/windows-uit/Frame.qml b/interface/resources/qml/windows-uit/Frame.qml index f21097ea62..9519a44cf0 100644 --- a/interface/resources/qml/windows-uit/Frame.qml +++ b/interface/resources/qml/windows-uit/Frame.qml @@ -22,12 +22,10 @@ Item { property bool gradientsSupported: desktop.gradientsSupported - readonly property int iconSize: 22 - readonly property int frameMargin: 9 - readonly property int frameMarginLeft: frameMargin - readonly property int frameMarginRight: frameMargin - readonly property int frameMarginTop: 2 * frameMargin + iconSize - readonly property int frameMarginBottom: iconSize + 11 + readonly property int frameMarginLeft: frameContent.frameMarginLeft + readonly property int frameMarginRight: frameContent.frameMarginRight + readonly property int frameMarginTop: frameContent.frameMarginTop + readonly property int frameMarginBottom: frameContent.frameMarginBottom // Frames always fill their parents, but their decorations may extend // beyond the window via negative margin sizes @@ -76,8 +74,8 @@ Item { id: sizeOutline x: -frameMarginLeft y: -frameMarginTop - width: window ? window.width + frameMarginLeft + frameMarginRight : 0 - height: window ? window.height + frameMarginTop + frameMarginBottom : 0 + width: window ? window.width + frameMarginLeft + frameMarginRight + 2 : 0 + height: window ? window.height + frameMarginTop + frameMarginBottom + 2 : 0 color: hifi.colors.baseGrayHighlight15 border.width: 3 border.color: hifi.colors.white50 @@ -88,11 +86,11 @@ Item { MouseArea { // Resize handle id: sizeDrag - width: iconSize - height: iconSize + width: hifi.dimensions.frameIconSize + height: hifi.dimensions.frameIconSize enabled: window ? window.resizable : false hoverEnabled: true - x: window ? window.width + frameMarginRight - iconSize : 0 + x: window ? window.width + frameMarginRight - hifi.dimensions.frameIconSize : 0 y: window ? window.height + 4 : 0 property vector2d pressOrigin property vector2d sizeOrigin @@ -124,10 +122,12 @@ Item { HiFiGlyphs { visible: sizeDrag.enabled x: -11 // Move a little to visually align - y: -4 // "" + y: window.modality == Qt.ApplicationModal ? -6 : -4 text: hifi.glyphs.resizeHandle - size: iconSize + 10 - color: sizeDrag.containsMouse || sizeDrag.pressed ? hifi.colors.white : hifi.colors.white50 + size: hifi.dimensions.frameIconSize + 10 + color: sizeDrag.containsMouse || sizeDrag.pressed + ? hifi.colors.white + : (window.colorScheme == hifi.colorSchemes.dark ? hifi.colors.white50 : hifi.colors.lightGrayText80) } } } diff --git a/interface/resources/qml/windows-uit/ModalFrame.qml b/interface/resources/qml/windows-uit/ModalFrame.qml index 415ae03284..13c560a519 100644 --- a/interface/resources/qml/windows-uit/ModalFrame.qml +++ b/interface/resources/qml/windows-uit/ModalFrame.qml @@ -22,12 +22,17 @@ Frame { readonly property bool hasTitle: window.title != "" + readonly property int frameMarginLeft: hifi.dimensions.modalDialogMargin.x + readonly property int frameMarginRight: hifi.dimensions.modalDialogMargin.x + readonly property int frameMarginTop: hifi.dimensions.modalDialogMargin.y + (frameContent.hasTitle ? hifi.dimensions.modalDialogTitleHeight + 10 : 0) + readonly property int frameMarginBottom: hifi.dimensions.modalDialogMargin.y + anchors { fill: parent - topMargin: -hifi.dimensions.modalDialogMargin.y - (frameContent.hasTitle ? hifi.dimensions.modalDialogTitleHeight + 10 : 0) - leftMargin: -hifi.dimensions.modalDialogMargin.x - rightMargin: -hifi.dimensions.modalDialogMargin.x - bottomMargin: -hifi.dimensions.modalDialogMargin.y + topMargin: -frameMarginTop + leftMargin: -frameMarginLeft + rightMargin: -frameMarginRight + bottomMargin: -frameMarginBottom } border { diff --git a/interface/resources/qml/windows-uit/ModalWindow.qml b/interface/resources/qml/windows-uit/ModalWindow.qml index af099eb275..6b007160d5 100644 --- a/interface/resources/qml/windows-uit/ModalWindow.qml +++ b/interface/resources/qml/windows-uit/ModalWindow.qml @@ -19,4 +19,6 @@ Window { destroyOnCloseButton: true destroyOnInvisible: true frame: ModalFrame{} + + property int colorScheme: hifi.colorSchemes.light } diff --git a/interface/resources/qml/windows-uit/Window.qml b/interface/resources/qml/windows-uit/Window.qml index e9477f3c7e..d614b21ce2 100644 --- a/interface/resources/qml/windows-uit/Window.qml +++ b/interface/resources/qml/windows-uit/Window.qml @@ -52,6 +52,7 @@ Fadable { // property bool pinned: false property bool resizable: false property bool gradientsSupported: desktop.gradientsSupported + property int colorScheme: hifi.colorSchemes.dark property vector2d minSize: Qt.vector2d(100, 100) property vector2d maxSize: Qt.vector2d(1280, 800)