mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:58:59 +02:00
commit
8a70e53131
10 changed files with 138 additions and 69 deletions
|
@ -16,6 +16,7 @@ Windows.Window {
|
||||||
closable: true
|
closable: true
|
||||||
visible: false
|
visible: false
|
||||||
width: 384; height: 640;
|
width: 384; height: 640;
|
||||||
|
title: "Tools"
|
||||||
property string newTabSource
|
property string newTabSource
|
||||||
property alias tabView: tabView
|
property alias tabView: tabView
|
||||||
onParentChanged: {
|
onParentChanged: {
|
||||||
|
|
|
@ -1,21 +1,54 @@
|
||||||
import QtQuick 2.3
|
import QtQuick 2.3
|
||||||
import QtQuick.Controls 1.3 as Original
|
import QtQuick.Controls 1.3 as Original
|
||||||
import QtQuick.Controls.Styles 1.3 as OriginalStyles
|
import QtQuick.Controls.Styles 1.3 as OriginalStyles
|
||||||
|
|
||||||
import "."
|
import "."
|
||||||
import "../styles"
|
import "../styles"
|
||||||
|
|
||||||
Original.Button {
|
Original.Button {
|
||||||
|
id: root
|
||||||
property color iconColor: "black"
|
property color iconColor: "black"
|
||||||
FontLoader { id: iconFont; source: "../../fonts/fontawesome-webfont.ttf"; }
|
property real size: 32
|
||||||
style: OriginalStyles.ButtonStyle {
|
SystemPalette { id: palette; colorGroup: SystemPalette.Active }
|
||||||
label: Text {
|
SystemPalette { id: disabledPalette; colorGroup: SystemPalette.Disabled }
|
||||||
renderType: Text.NativeRendering
|
style: OriginalStyles.ButtonStyle {
|
||||||
|
label: FontAwesome {
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
font.family: iconFont.name
|
font.pixelSize: control.size - 4
|
||||||
font.pointSize: 20
|
color: control.enabled ? palette.buttonText : disabledPalette.buttonText
|
||||||
color: control.enabled ? control.iconColor : "gray"
|
|
||||||
text: control.text
|
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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,19 +230,23 @@ FocusScope {
|
||||||
return;
|
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);
|
var newPosition = Qt.vector2d(targetWindow.x, targetWindow.y);
|
||||||
if (newPosition.x === -1 && newPosition.y === -1) {
|
// If the window is completely offscreen, reposition it
|
||||||
// Set initial window position
|
if ((targetWindow.x > desktop.width || (targetWindow.x + targetWindow.width) < 0) ||
|
||||||
// newPosition = Utils.randomPosition(minPosition, maxPosition);
|
(targetWindow.y > desktop.height || (targetWindow.y + targetWindow.height) < 0)) {
|
||||||
console.log("Target has no defined position, putting in center of the screen")
|
newPosition.x = -1
|
||||||
newPosition = Qt.vector2d(desktop.width / 2 - windowRect.width / 2,
|
newPosition.y = -1
|
||||||
desktop.height / 2 - windowRect.height / 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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.x = newPosition.x;
|
||||||
targetWindow.y = newPosition.y;
|
targetWindow.y = newPosition.y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,35 +55,39 @@ ModalWindow {
|
||||||
anchors { left: parent.left; top: parent.top; margins: 8 }
|
anchors { left: parent.left; top: parent.top; margins: 8 }
|
||||||
spacing: 8
|
spacing: 8
|
||||||
// FIXME implement back button
|
// FIXME implement back button
|
||||||
// VrControls.FontAwesome {
|
//VrControls.ButtonAwesome {
|
||||||
// id: backButton
|
// id: backButton
|
||||||
// text: "\uf0a8"
|
// text: "\uf0a8"
|
||||||
// size: currentDirectory.height
|
// size: currentDirectory.height
|
||||||
// enabled: d.backStack.length != 0
|
// enabled: d.backStack.length != 0
|
||||||
// MouseArea { anchors.fill: parent; onClicked: d.navigateBack() }
|
// MouseArea { anchors.fill: parent; onClicked: d.navigateBack() }
|
||||||
// }
|
//}
|
||||||
VrControls.FontAwesome {
|
VrControls.ButtonAwesome {
|
||||||
id: upButton
|
id: upButton
|
||||||
|
enabled: model.parentFolder && model.parentFolder !== ""
|
||||||
text: "\uf0aa"
|
text: "\uf0aa"
|
||||||
size: currentDirectory.height
|
size: 32
|
||||||
color: enabled ? "black" : "gray"
|
onClicked: d.navigateUp();
|
||||||
MouseArea { anchors.fill: parent; onClicked: d.navigateUp() }
|
|
||||||
}
|
}
|
||||||
VrControls.FontAwesome {
|
VrControls.ButtonAwesome {
|
||||||
id: homeButton
|
id: homeButton
|
||||||
property var destination: helper.home();
|
property var destination: helper.home();
|
||||||
visible: destination ? true : false
|
enabled: d.homeDestination ? true : false
|
||||||
text: "\uf015"
|
text: "\uf015"
|
||||||
size: currentDirectory.height
|
size: 32
|
||||||
MouseArea { anchors.fill: parent; onClicked: model.folder = parent.destination }
|
onClicked: d.navigateHome();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
id: currentDirectory
|
id: currentDirectory
|
||||||
|
height: homeButton.height
|
||||||
anchors { left: navControls.right; right: parent.right; top: parent.top; margins: 8 }
|
anchors { left: navControls.right; right: parent.right; top: parent.top; margins: 8 }
|
||||||
property var lastValidFolder: helper.urlToPath(model.folder)
|
property var lastValidFolder: helper.urlToPath(model.folder)
|
||||||
onLastValidFolderChanged: text = lastValidFolder;
|
onLastValidFolderChanged: text = lastValidFolder;
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
font.pointSize: 14
|
||||||
|
font.bold: true
|
||||||
|
|
||||||
// FIXME add support auto-completion
|
// FIXME add support auto-completion
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
|
@ -93,7 +97,6 @@ ModalWindow {
|
||||||
}
|
}
|
||||||
model.folder = helper.pathToUrl(text);
|
model.folder = helper.pathToUrl(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
@ -104,6 +107,7 @@ ModalWindow {
|
||||||
property var backStack: []
|
property var backStack: []
|
||||||
property var tableViewConnection: Connections { target: fileTableView; onCurrentRowChanged: d.update(); }
|
property var tableViewConnection: Connections { target: fileTableView; onCurrentRowChanged: d.update(); }
|
||||||
property var modelConnection: Connections { target: model; onFolderChanged: d.update(); }
|
property var modelConnection: Connections { target: model; onFolderChanged: d.update(); }
|
||||||
|
property var homeDestination: helper.home();
|
||||||
Component.onCompleted: update();
|
Component.onCompleted: update();
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
|
@ -127,12 +131,20 @@ ModalWindow {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function navigateHome() {
|
||||||
|
model.folder = homeDestination;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileTableView {
|
FileTableView {
|
||||||
id: fileTableView
|
id: fileTableView
|
||||||
anchors { left: parent.left; right: parent.right; top: currentDirectory.bottom; bottom: currentSelection.top; margins: 8 }
|
anchors { left: parent.left; right: parent.right; top: currentDirectory.bottom; bottom: currentSelection.top; margins: 8 }
|
||||||
onDoubleClicked: navigateToRow(row);
|
onDoubleClicked: navigateToRow(row);
|
||||||
|
focus: true
|
||||||
|
Keys.onReturnPressed: navigateToCurrentRow();
|
||||||
|
Keys.onEnterPressed: navigateToCurrentRow();
|
||||||
model: FolderListModel {
|
model: FolderListModel {
|
||||||
id: model
|
id: model
|
||||||
nameFilters: selectionType.currentFilter
|
nameFilters: selectionType.currentFilter
|
||||||
|
@ -146,6 +158,7 @@ ModalWindow {
|
||||||
upButton.enabled = Qt.binding(function() { return (model.parentFolder && model.parentFolder != "") ? true : false; });
|
upButton.enabled = Qt.binding(function() { return (model.parentFolder && model.parentFolder != "") ? true : false; });
|
||||||
showFiles = !root.selectDirectory
|
showFiles = !root.selectDirectory
|
||||||
}
|
}
|
||||||
|
onFolderChanged: fileTableView.currentRow = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function navigateToRow(row) {
|
function navigateToRow(row) {
|
||||||
|
@ -159,10 +172,9 @@ ModalWindow {
|
||||||
var file = model.get(row, "fileURL");
|
var file = model.get(row, "fileURL");
|
||||||
if (isFolder) {
|
if (isFolder) {
|
||||||
fileTableView.model.folder = file
|
fileTableView.model.folder = file
|
||||||
currentRow = -1;
|
|
||||||
} else {
|
} else {
|
||||||
root.selectedFile(file);
|
root.selectedFile(file);
|
||||||
root.visible = false;
|
root.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,6 +183,7 @@ ModalWindow {
|
||||||
id: currentSelection
|
id: currentSelection
|
||||||
anchors { right: root.selectDirectory ? parent.right : selectionType.left; rightMargin: 8; left: parent.left; leftMargin: 8; top: selectionType.top }
|
anchors { right: root.selectDirectory ? parent.right : selectionType.left; rightMargin: 8; left: parent.left; leftMargin: 8; top: selectionType.top }
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
activeFocusOnTab: false
|
||||||
}
|
}
|
||||||
|
|
||||||
FileTypeSelection {
|
FileTypeSelection {
|
||||||
|
@ -187,17 +200,7 @@ ModalWindow {
|
||||||
anchors.rightMargin: 8
|
anchors.rightMargin: 8
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: 8
|
anchors.bottomMargin: 8
|
||||||
layoutDirection: Qt.RightToLeft
|
|
||||||
spacing: 8
|
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 {
|
Button {
|
||||||
id: openButton
|
id: openButton
|
||||||
text: root.selectDirectory ? "Choose" : "Open"
|
text: root.selectDirectory ? "Choose" : "Open"
|
||||||
|
@ -209,12 +212,28 @@ ModalWindow {
|
||||||
KeyNavigation.left: selectionType
|
KeyNavigation.left: selectionType
|
||||||
KeyNavigation.right: cancelButton
|
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: {
|
Keys.onPressed: {
|
||||||
if (event.key === Qt.Key_Backspace && d.navigateUp()) {
|
switch (event.key) {
|
||||||
event.accepted = true
|
case Qt.Key_Backspace:
|
||||||
|
event.accepted = d.navigateUp();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt.Key_Home:
|
||||||
|
event.accepted = d.navigateHome();
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ ModalWindow {
|
||||||
|
|
||||||
VrControls.ComboBox {
|
VrControls.ComboBox {
|
||||||
id: comboBox
|
id: comboBox
|
||||||
focus: items ? true : false
|
focus: true
|
||||||
visible: items ? true : false
|
visible: items ? true : false
|
||||||
anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter }
|
anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter }
|
||||||
model: items ? items : []
|
model: items ? items : []
|
||||||
|
|
|
@ -10,7 +10,7 @@ TableView {
|
||||||
Text {
|
Text {
|
||||||
x: 3
|
x: 3
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: root.activeFocus && styleData.row === root.currentRow ? "yellow" : styleData.textColor
|
color: styleData.textColor
|
||||||
elide: styleData.elideMode
|
elide: styleData.elideMode
|
||||||
text: getText();
|
text: getText();
|
||||||
font.italic: root.model.get(styleData.row, "fileIsDir") ? true : false
|
font.italic: root.model.get(styleData.row, "fileIsDir") ? true : false
|
||||||
|
|
|
@ -54,10 +54,10 @@ Frame {
|
||||||
Text {
|
Text {
|
||||||
id: titleText
|
id: titleText
|
||||||
anchors { left: parent.left; leftMargin: iconSize; right: controlsRow.left; rightMargin: iconSize; top: parent.top; topMargin: iconSize / 2; }
|
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
|
elide: Text.ElideRight
|
||||||
font.bold: true
|
font.bold: true
|
||||||
color: window.focus ? "white" : "gray"
|
color: (window && window.focus) ? "white" : "gray"
|
||||||
style: Text.Outline;
|
style: Text.Outline;
|
||||||
styleColor: "black"
|
styleColor: "black"
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ Item {
|
||||||
id: debugZ
|
id: debugZ
|
||||||
visible: DebugQML
|
visible: DebugQML
|
||||||
text: window ? "Z: " + window.z : ""
|
text: window ? "Z: " + window.z : ""
|
||||||
y: window.height + 4
|
y: window ? window.height + 4 : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function deltaSize(dx, dy) {
|
function deltaSize(dx, dy) {
|
||||||
|
|
|
@ -6,23 +6,31 @@ import "../controls"
|
||||||
Frame {
|
Frame {
|
||||||
id: frame
|
id: frame
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -4096
|
|
||||||
visible: window.visible
|
Rectangle {
|
||||||
color: "#7f7f7f7f";
|
id: background
|
||||||
radius: 3;
|
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -351,8 +351,12 @@ float OpenGLDisplayPlugin::presentRate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::drawUnitQuad() {
|
void OpenGLDisplayPlugin::drawUnitQuad() {
|
||||||
_program->Bind();
|
try {
|
||||||
_plane->Draw();
|
_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) {
|
void OpenGLDisplayPlugin::enableVsync(bool enable) {
|
||||||
|
|
Loading…
Reference in a new issue