From 7938270802eb0975c2a4c6f1d0291707016ef33b Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 1 Feb 2016 14:12:59 -0800 Subject: [PATCH 1/8] Fix modal frame decoration --- .../resources/qml/windows/ModalFrame.qml | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/interface/resources/qml/windows/ModalFrame.qml b/interface/resources/qml/windows/ModalFrame.qml index 09dbf04b5c..eb4641bc75 100644 --- a/interface/resources/qml/windows/ModalFrame.qml +++ b/interface/resources/qml/windows/ModalFrame.qml @@ -6,23 +6,31 @@ import "../controls" Frame { id: frame - Rectangle { + Item { anchors.fill: parent - anchors.margins: -4096 - visible: window.visible - color: "#7f7f7f7f"; - radius: 3; + + Rectangle { + id: background + anchors.fill: parent + anchors.margins: -4096 + visible: window.visible + color: "#7f7f7f7f"; + radius: 3; + } + + Text { + y: -implicitHeight - iconSize / 2 + text: window.title + elide: Text.ElideRight + font.bold: true + color: window.focus ? "white" : "gray" + style: Text.Outline; + styleColor: "black" + } } - Text { - y: -implicitHeight - iconSize / 2 - text: window.title - elide: Text.ElideRight - font.bold: true - color: window.focus ? "white" : "gray" - style: Text.Outline; - styleColor: "black" - } + + } From 4b9e5746cd2c39cec3fdf9d91071b2a18faf6591 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 1 Feb 2016 14:13:32 -0800 Subject: [PATCH 2/8] Removing some runtime warnings about null values --- interface/resources/qml/windows/DefaultFrame.qml | 4 ++-- interface/resources/qml/windows/Frame.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/windows/DefaultFrame.qml b/interface/resources/qml/windows/DefaultFrame.qml index 505e653940..a082db5a92 100644 --- a/interface/resources/qml/windows/DefaultFrame.qml +++ b/interface/resources/qml/windows/DefaultFrame.qml @@ -54,10 +54,10 @@ Frame { Text { id: titleText anchors { left: parent.left; leftMargin: iconSize; right: controlsRow.left; rightMargin: iconSize; top: parent.top; topMargin: iconSize / 2; } - text: window.title + text: window ? window.title : "" elide: Text.ElideRight font.bold: true - color: window.focus ? "white" : "gray" + color: (window && window.focus) ? "white" : "gray" style: Text.Outline; styleColor: "black" } diff --git a/interface/resources/qml/windows/Frame.qml b/interface/resources/qml/windows/Frame.qml index 3cbc31fce6..20bf669b9a 100644 --- a/interface/resources/qml/windows/Frame.qml +++ b/interface/resources/qml/windows/Frame.qml @@ -25,7 +25,7 @@ Item { id: debugZ visible: DebugQML text: window ? "Z: " + window.z : "" - y: window.height + 4 + y: window ? window.height + 4 : 0 } function deltaSize(dx, dy) { From 093ccb483dd1f4be41da8add6cb02d479fea6f1f Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 1 Feb 2016 14:14:47 -0800 Subject: [PATCH 3/8] FontAwseome button polish --- .../resources/qml/controls/ButtonAwesome.qml | 49 ++++++++++++++++--- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/controls/ButtonAwesome.qml b/interface/resources/qml/controls/ButtonAwesome.qml index 47c9fdc742..bb1df94471 100644 --- a/interface/resources/qml/controls/ButtonAwesome.qml +++ b/interface/resources/qml/controls/ButtonAwesome.qml @@ -1,21 +1,54 @@ import QtQuick 2.3 import QtQuick.Controls 1.3 as Original import QtQuick.Controls.Styles 1.3 as OriginalStyles + import "." import "../styles" Original.Button { + id: root property color iconColor: "black" - FontLoader { id: iconFont; source: "../../fonts/fontawesome-webfont.ttf"; } - style: OriginalStyles.ButtonStyle { - label: Text { - renderType: Text.NativeRendering + property real size: 32 + SystemPalette { id: palette; colorGroup: SystemPalette.Active } + SystemPalette { id: disabledPalette; colorGroup: SystemPalette.Disabled } + style: OriginalStyles.ButtonStyle { + label: FontAwesome { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - font.family: iconFont.name - font.pointSize: 20 - color: control.enabled ? control.iconColor : "gray" + font.pixelSize: control.size - 4 + color: control.enabled ? palette.buttonText : disabledPalette.buttonText text: control.text - } + } + background: Rectangle { + id: background + implicitWidth: size + implicitHeight: size + border.width: 1 + border.color: "black" + radius: 4 + color: control.enabled ? palette.button : disabledPalette.button + + Connections { + target: control + onActiveFocusChanged: { + if (control.activeFocus) { + pulseAnimation.restart(); + } else { + pulseAnimation.stop(); + } + background.border.width = 1; + } + } + + SequentialAnimation { + id: pulseAnimation; + running: false + NumberAnimation { target: border; property: "width"; to: 3; duration: 500 } + NumberAnimation { target: border; property: "width"; to: 1; duration: 500 } + onStopped: if (control.activeFocus) { start(); } + } + } } + Keys.onEnterPressed: root.clicked(); + Keys.onReturnPressed: root.clicked(); } From 9da0181b728df5362a8fe7fafbc725624541f0d2 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 1 Feb 2016 14:15:57 -0800 Subject: [PATCH 4/8] Don't try to be clever with coloring table rows --- interface/resources/qml/dialogs/fileDialog/FileTableView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/dialogs/fileDialog/FileTableView.qml b/interface/resources/qml/dialogs/fileDialog/FileTableView.qml index aa5264ad34..de9126c987 100644 --- a/interface/resources/qml/dialogs/fileDialog/FileTableView.qml +++ b/interface/resources/qml/dialogs/fileDialog/FileTableView.qml @@ -10,7 +10,7 @@ TableView { Text { x: 3 anchors.verticalCenter: parent.verticalCenter - color: root.activeFocus && styleData.row === root.currentRow ? "yellow" : styleData.textColor + color: styleData.textColor elide: styleData.elideMode text: getText(); font.italic: root.model.get(styleData.row, "fileIsDir") ? true : false From 4393a754e20cdaf28606b35831d4d59ba76746e5 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 1 Feb 2016 14:18:27 -0800 Subject: [PATCH 5/8] File dialog polish --- .../resources/qml/dialogs/FileDialog.qml | 79 ++++++++++++------- .../resources/qml/dialogs/QueryDialog.qml | 2 +- 2 files changed, 50 insertions(+), 31 deletions(-) diff --git a/interface/resources/qml/dialogs/FileDialog.qml b/interface/resources/qml/dialogs/FileDialog.qml index 353e2df494..96a0c95e88 100644 --- a/interface/resources/qml/dialogs/FileDialog.qml +++ b/interface/resources/qml/dialogs/FileDialog.qml @@ -55,35 +55,39 @@ ModalWindow { anchors { left: parent.left; top: parent.top; margins: 8 } spacing: 8 // FIXME implement back button -// VrControls.FontAwesome { -// id: backButton -// text: "\uf0a8" -// size: currentDirectory.height -// enabled: d.backStack.length != 0 -// MouseArea { anchors.fill: parent; onClicked: d.navigateBack() } -// } - VrControls.FontAwesome { + //VrControls.ButtonAwesome { + // id: backButton + // text: "\uf0a8" + // size: currentDirectory.height + // enabled: d.backStack.length != 0 + // MouseArea { anchors.fill: parent; onClicked: d.navigateBack() } + //} + VrControls.ButtonAwesome { id: upButton + enabled: model.parentFolder && model.parentFolder !== "" text: "\uf0aa" - size: currentDirectory.height - color: enabled ? "black" : "gray" - MouseArea { anchors.fill: parent; onClicked: d.navigateUp() } + size: 32 + onClicked: d.navigateUp(); } - VrControls.FontAwesome { + VrControls.ButtonAwesome { id: homeButton property var destination: helper.home(); - visible: destination ? true : false + enabled: d.homeDestination ? true : false text: "\uf015" - size: currentDirectory.height - MouseArea { anchors.fill: parent; onClicked: model.folder = parent.destination } + size: 32 + onClicked: d.navigateHome(); } } TextField { id: currentDirectory + height: homeButton.height anchors { left: navControls.right; right: parent.right; top: parent.top; margins: 8 } property var lastValidFolder: helper.urlToPath(model.folder) onLastValidFolderChanged: text = lastValidFolder; + verticalAlignment: Text.AlignVCenter + font.pointSize: 14 + font.bold: true // FIXME add support auto-completion onAccepted: { @@ -93,7 +97,6 @@ ModalWindow { } model.folder = helper.pathToUrl(text); } - } QtObject { @@ -104,6 +107,7 @@ ModalWindow { property var backStack: [] property var tableViewConnection: Connections { target: fileTableView; onCurrentRowChanged: d.update(); } property var modelConnection: Connections { target: model; onFolderChanged: d.update(); } + property var homeDestination: helper.home(); Component.onCompleted: update(); function update() { @@ -127,12 +131,20 @@ ModalWindow { return true; } } + + function navigateHome() { + model.folder = homeDestination; + return true; + } } FileTableView { id: fileTableView anchors { left: parent.left; right: parent.right; top: currentDirectory.bottom; bottom: currentSelection.top; margins: 8 } onDoubleClicked: navigateToRow(row); + focus: true + Keys.onReturnPressed: navigateToCurrentRow(); + Keys.onEnterPressed: navigateToCurrentRow(); model: FolderListModel { id: model nameFilters: selectionType.currentFilter @@ -146,6 +158,7 @@ ModalWindow { upButton.enabled = Qt.binding(function() { return (model.parentFolder && model.parentFolder != "") ? true : false; }); showFiles = !root.selectDirectory } + onFolderChanged: fileTableView.currentRow = 0; } function navigateToRow(row) { @@ -159,10 +172,9 @@ ModalWindow { var file = model.get(row, "fileURL"); if (isFolder) { fileTableView.model.folder = file - currentRow = -1; } else { root.selectedFile(file); - root.visible = false; + root.destroy(); } } } @@ -171,6 +183,7 @@ ModalWindow { id: currentSelection anchors { right: root.selectDirectory ? parent.right : selectionType.left; rightMargin: 8; left: parent.left; leftMargin: 8; top: selectionType.top } readOnly: true + activeFocusOnTab: false } FileTypeSelection { @@ -187,17 +200,7 @@ ModalWindow { anchors.rightMargin: 8 anchors.bottom: parent.bottom anchors.bottomMargin: 8 - layoutDirection: Qt.RightToLeft spacing: 8 - Button { - id: cancelButton - text: "Cancel" - KeyNavigation.up: selectionType - KeyNavigation.left: openButton - KeyNavigation.right: fileTableView.contentItem - Keys.onReturnPressed: { canceled(); root.enabled = false } - onClicked: { canceled(); root.visible = false; } - } Button { id: openButton text: root.selectDirectory ? "Choose" : "Open" @@ -209,12 +212,28 @@ ModalWindow { KeyNavigation.left: selectionType KeyNavigation.right: cancelButton } + Button { + id: cancelButton + text: "Cancel" + KeyNavigation.up: selectionType + KeyNavigation.left: openButton + KeyNavigation.right: fileTableView.contentItem + Keys.onReturnPressed: { canceled(); root.enabled = false } + onClicked: { canceled(); root.visible = false; } + } } } Keys.onPressed: { - if (event.key === Qt.Key_Backspace && d.navigateUp()) { - event.accepted = true + switch (event.key) { + case Qt.Key_Backspace: + event.accepted = d.navigateUp(); + break; + + case Qt.Key_Home: + event.accepted = d.navigateHome(); + break; + } } } diff --git a/interface/resources/qml/dialogs/QueryDialog.qml b/interface/resources/qml/dialogs/QueryDialog.qml index 159bb95b5d..fecd69a4c6 100644 --- a/interface/resources/qml/dialogs/QueryDialog.qml +++ b/interface/resources/qml/dialogs/QueryDialog.qml @@ -71,7 +71,7 @@ ModalWindow { VrControls.ComboBox { id: comboBox - focus: items ? true : false + focus: true visible: items ? true : false anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter } model: items ? items : [] From c71a20b2f0e3839ce8426bf6df25c5579acbb6e3 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 1 Feb 2016 14:58:11 -0800 Subject: [PATCH 6/8] Move a QML window to the center of the desktop if it's completely off --- interface/resources/qml/desktop/Desktop.qml | 24 ++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/interface/resources/qml/desktop/Desktop.qml b/interface/resources/qml/desktop/Desktop.qml index 79babcb87d..7fb5cd3127 100644 --- a/interface/resources/qml/desktop/Desktop.qml +++ b/interface/resources/qml/desktop/Desktop.qml @@ -230,19 +230,23 @@ FocusScope { return; } - var windowRect = targetWindow.framedRect(); - var minPosition = Qt.vector2d(-windowRect.x, -windowRect.y); - var maxPosition = Qt.vector2d(desktop.width - windowRect.width, desktop.height - windowRect.height); var newPosition = Qt.vector2d(targetWindow.x, targetWindow.y); - if (newPosition.x === -1 && newPosition.y === -1) { - // Set initial window position - // newPosition = Utils.randomPosition(minPosition, maxPosition); - console.log("Target has no defined position, putting in center of the screen") - newPosition = Qt.vector2d(desktop.width / 2 - windowRect.width / 2, - desktop.height / 2 - windowRect.height / 2); + // If the window is completely offscreen, reposition it + if ((targetWindow.x > desktop.width || (targetWindow.x + targetWindow.width) < 0) || + (targetWindow.y > desktop.height || (targetWindow.y + targetWindow.height) < 0)) { + newPosition.x = -1 + newPosition.y = -1 } - newPosition = Utils.clampVector(newPosition, minPosition, maxPosition); + if (newPosition.x === -1 && newPosition.y === -1) { + // Set initial window position + // var minPosition = Qt.vector2d(-windowRect.x, -windowRect.y); + // var maxPosition = Qt.vector2d(desktop.width - windowRect.width, desktop.height - windowRect.height); + // newPosition = Utils.clampVector(newPosition, minPosition, maxPosition); + // newPosition = Utils.randomPosition(minPosition, maxPosition); + newPosition = Qt.vector2d(desktop.width / 2 - targetWindow.width / 2, + desktop.height / 2 - targetWindow.height / 2); + } targetWindow.x = newPosition.x; targetWindow.y = newPosition.y; } From aecf582593ec9b3a28d2d9540ec6f55e42ffe7fc Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 1 Feb 2016 18:26:32 -0800 Subject: [PATCH 7/8] Don't crash on GL error in present thread --- .../src/display-plugins/OpenGLDisplayPlugin.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp index ffe8fbe3c1..55023eea0e 100644 --- a/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/OpenGLDisplayPlugin.cpp @@ -351,8 +351,12 @@ float OpenGLDisplayPlugin::presentRate() { } void OpenGLDisplayPlugin::drawUnitQuad() { - _program->Bind(); - _plane->Draw(); + try { + _program->Bind(); + _plane->Draw(); + } catch (const oglplus::Error& error) { + qWarning() << "The present thread encountered an error writing the scene texture to the output: " << error.what(); + } } void OpenGLDisplayPlugin::enableVsync(bool enable) { From 4860c7d4f17660377221739751637241d5a9bf39 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Mon, 1 Feb 2016 18:28:23 -0800 Subject: [PATCH 8/8] Give title to tool window --- interface/resources/qml/ToolWindow.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/resources/qml/ToolWindow.qml b/interface/resources/qml/ToolWindow.qml index 9aad639ff3..9241200dba 100644 --- a/interface/resources/qml/ToolWindow.qml +++ b/interface/resources/qml/ToolWindow.qml @@ -16,6 +16,7 @@ Windows.Window { closable: true visible: false width: 384; height: 640; + title: "Tools" property string newTabSource property alias tabView: tabView onParentChanged: {