mirror of
https://github.com/overte-org/overte.git
synced 2025-06-27 01:10:32 +02:00
Switch file selection dialog over to using UI Toolkit files
This commit is contained in:
parent
312ea20e15
commit
6e59abc8f6
2 changed files with 54 additions and 37 deletions
|
@ -1,4 +1,14 @@
|
||||||
import QtQuick 2.0
|
//
|
||||||
|
// Desktop.qml
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 14 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 QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import Qt.labs.folderlistmodel 2.1
|
import Qt.labs.folderlistmodel 2.1
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
|
@ -6,17 +16,19 @@ import QtQuick.Controls.Styles 1.4
|
||||||
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
||||||
|
|
||||||
import ".."
|
import ".."
|
||||||
import "../windows"
|
import "../controls-uit"
|
||||||
import "../styles"
|
import "../styles-uit"
|
||||||
import "../controls" as VrControls
|
import "../windows-uit"
|
||||||
|
|
||||||
import "fileDialog"
|
import "fileDialog"
|
||||||
|
|
||||||
//FIXME implement shortcuts for favorite location
|
//FIXME implement shortcuts for favorite location
|
||||||
ModalWindow {
|
ModalWindow {
|
||||||
id: root
|
id: root
|
||||||
resizable: true
|
//resizable: true
|
||||||
width: 640
|
implicitWidth: 640
|
||||||
height: 480
|
implicitHeight: 480
|
||||||
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
category: "FileDialog"
|
category: "FileDialog"
|
||||||
|
@ -46,6 +58,8 @@ ModalWindow {
|
||||||
property alias model: fileTableView.model
|
property alias model: fileTableView.model
|
||||||
property var drives: helper.drives()
|
property var drives: helper.drives()
|
||||||
|
|
||||||
|
property int titleWidth: 0
|
||||||
|
|
||||||
signal selectedFile(var file);
|
signal selectedFile(var file);
|
||||||
signal canceled();
|
signal canceled();
|
||||||
|
|
||||||
|
@ -56,14 +70,17 @@ ModalWindow {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Item {
|
||||||
anchors.fill: parent
|
clip: true
|
||||||
color: "white"
|
width: pane.width
|
||||||
|
height: pane.height
|
||||||
|
anchors.margins: 0
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: navControls
|
id: navControls
|
||||||
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.ButtonAwesome {
|
//VrControls.ButtonAwesome {
|
||||||
// id: backButton
|
// id: backButton
|
||||||
|
@ -72,30 +89,29 @@ ModalWindow {
|
||||||
// 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.ButtonAwesome {
|
|
||||||
|
Button {
|
||||||
id: upButton
|
id: upButton
|
||||||
enabled: model.parentFolder && model.parentFolder !== ""
|
enabled: model.parentFolder && model.parentFolder !== ""
|
||||||
text: "\uf0aa"
|
text: "up"
|
||||||
size: 32
|
|
||||||
onClicked: d.navigateUp();
|
onClicked: d.navigateUp();
|
||||||
}
|
}
|
||||||
VrControls.ButtonAwesome {
|
|
||||||
|
Button {
|
||||||
id: homeButton
|
id: homeButton
|
||||||
property var destination: helper.home();
|
property var destination: helper.home();
|
||||||
enabled: d.homeDestination ? true : false
|
enabled: d.homeDestination ? true : false
|
||||||
text: "\uf015"
|
text: "home"
|
||||||
size: 32
|
|
||||||
onClicked: d.navigateHome();
|
onClicked: d.navigateHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
VrControls.ComboBox {
|
ComboBox {
|
||||||
id: drivesSelector
|
id: drivesSelector
|
||||||
width: 48
|
width: 48
|
||||||
height: homeButton.height
|
height: homeButton.height
|
||||||
model: drives
|
model: drives
|
||||||
visible: drives.length > 1
|
visible: drives.length > 1
|
||||||
currentIndex: 0
|
currentIndex: 0
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,5 +401,3 @@ ModalWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,26 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: "Open File"
|
||||||
|
property var builder: Component {
|
||||||
|
FileDialog {
|
||||||
|
title: "Open File"
|
||||||
|
filter: "*.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var fileDialog = builder.createObject(desktop);
|
||||||
|
fileDialog.canceled.connect(function(){
|
||||||
|
console.log("Cancelled")
|
||||||
|
})
|
||||||
|
fileDialog.selectedFile.connect(function(file){
|
||||||
|
console.log("Selected " + file)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Add Tab"
|
text: "Add Tab"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -246,24 +266,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
|
||||||
text: "Open File"
|
|
||||||
property var builder: Component {
|
|
||||||
FileDialog { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
var fileDialog = builder.createObject(desktop);
|
|
||||||
fileDialog.canceled.connect(function(){
|
|
||||||
console.log("Cancelled")
|
|
||||||
})
|
|
||||||
fileDialog.selectedFile.connect(function(file){
|
|
||||||
console.log("Selected " + file)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Window {
|
Window {
|
||||||
id: blue
|
id: blue
|
||||||
|
|
Loading…
Reference in a new issue