mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 13:06:14 +02:00
269 lines
9.8 KiB
QML
269 lines
9.8 KiB
QML
import QtQuick 2.5
|
|
import QtQuick.Controls 1.4
|
|
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
|
import Qt.labs.settings 1.0
|
|
|
|
import "../../../interface/resources/qml"
|
|
//import "../../../interface/resources/qml/windows"
|
|
import "../../../interface/resources/qml/windows-uit"
|
|
import "../../../interface/resources/qml/dialogs"
|
|
import "../../../interface/resources/qml/hifi"
|
|
import "../../../interface/resources/qml/hifi/dialogs"
|
|
|
|
ApplicationWindow {
|
|
id: appWindow
|
|
visible: true
|
|
width: 1280
|
|
height: 800
|
|
title: qsTr("Scratch App")
|
|
|
|
Desktop {
|
|
id: desktop
|
|
anchors.fill: parent
|
|
rootMenu: StubMenu { id: rootMenu }
|
|
//Component.onCompleted: offscreenWindow = appWindow
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
acceptedButtons: Qt.RightButton
|
|
onClicked: desktop.popupMenu(Qt.vector2d(mouseX, mouseY));
|
|
}
|
|
|
|
Row {
|
|
id: testButtons
|
|
anchors { margins: 8; left: parent.left; top: parent.top }
|
|
spacing: 8
|
|
property int count: 0
|
|
|
|
property var tabs: [];
|
|
property var urls: [];
|
|
|
|
Button {
|
|
text: "Running Scripts"
|
|
property var builder: Component {
|
|
RunningScripts { }
|
|
}
|
|
onClicked: {
|
|
var runningScripts = builder.createObject(desktop);
|
|
}
|
|
}
|
|
|
|
Button {
|
|
text: "Attachments"
|
|
property var builder: Component {
|
|
AttachmentsDialog { }
|
|
}
|
|
onClicked: {
|
|
var attachmentsDialog = builder.createObject(desktop);
|
|
}
|
|
}
|
|
|
|
/*
|
|
Button {
|
|
text: "restore all"
|
|
onClicked: {
|
|
for (var i = 0; i < desktop.windows.length; ++i) {
|
|
desktop.windows[i].visible = true
|
|
}
|
|
}
|
|
}
|
|
Button {
|
|
text: "toggle blue visible"
|
|
onClicked: {
|
|
blue.visible = !blue.visible
|
|
}
|
|
}
|
|
Button {
|
|
text: "toggle blue enabled"
|
|
onClicked: {
|
|
blue.enabled = !blue.enabled
|
|
}
|
|
}
|
|
*/
|
|
Button {
|
|
// Replicates message box that pops up after selecting new avatar. Includes title.
|
|
text: "Confirm Avatar"
|
|
onClicked: {
|
|
var messageBox = desktop.messageBox({
|
|
title: "Set Avatar",
|
|
text: "Would you like to use 'Albert' for your avatar?",
|
|
icon: OriginalDialogs.StandardIcon.Question,
|
|
//icon: OriginalDialogs.StandardIcon.Information, // Test informaton icon
|
|
//icon: OriginalDialogs.StandardIcon.Warning, // Test warning icon
|
|
//icon: OriginalDialogs.StandardIcon.Critical, // Test critical icon
|
|
buttons: OriginalDialogs.StandardButton.Ok + OriginalDialogs.StandardButton.Cancel
|
|
});
|
|
messageBox.selected.connect(function(button) {
|
|
console.log("You clicked " + button)
|
|
})
|
|
}
|
|
}
|
|
Button {
|
|
// Message without title.
|
|
text: "Show Error"
|
|
onClicked: {
|
|
var messageBox = desktop.messageBox({
|
|
text: "Diagnostic cycle will be complete in 30 seconds",
|
|
icon: OriginalDialogs.StandardIcon.Critical,
|
|
});
|
|
messageBox.selected.connect(function(button) {
|
|
console.log("You clicked " + button)
|
|
})
|
|
}
|
|
}
|
|
Button {
|
|
// detailedText is not currently used anywhere in Interface but it is easier to leave in and style good enough.
|
|
text: "Show Long Error"
|
|
onClicked: {
|
|
desktop.messageBox({
|
|
informativeText: "Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds Diagnostic cycle will be complete in 30 seconds ",
|
|
text: "Baloney",
|
|
icon: OriginalDialogs.StandardIcon.Warning,
|
|
detailedText: "sakjd;laskj dksa;dl jka;lsd j;lkjas ;dlkaj s;dlakjd ;alkjda; slkjda; lkjda;lksjd ;alksjd; alksjd ;alksjd; alksjd; alksdjas;ldkjas;lkdja ;kj ;lkasjd; lkj as;dlka jsd;lka jsd;laksjd a"
|
|
});
|
|
}
|
|
}
|
|
/*
|
|
// There is no such desktop.queryBox() function; may need to update test to cover QueryDialog.qml?
|
|
Button {
|
|
text: "Show Query"
|
|
onClicked: {
|
|
var queryBox = desktop.queryBox({
|
|
text: "Have you stopped beating your wife?",
|
|
placeholderText: "Are you sure?",
|
|
// icon: OriginalDialogs.StandardIcon.Critical,
|
|
});
|
|
queryBox.selected.connect(function(result) {
|
|
console.log("User responded with " + result);
|
|
});
|
|
|
|
queryBox.canceled.connect(function() {
|
|
console.log("User cancelled query box ");
|
|
})
|
|
}
|
|
}
|
|
*/
|
|
Button {
|
|
text: "Open Directory"
|
|
property var builder: Component {
|
|
FileDialog { selectDirectory: true }
|
|
}
|
|
|
|
onClicked: {
|
|
var fileDialog = builder.createObject(desktop);
|
|
fileDialog.canceled.connect(function(){
|
|
console.log("Cancelled")
|
|
})
|
|
fileDialog.selectedFile.connect(function(file){
|
|
console.log("Selected " + file)
|
|
})
|
|
}
|
|
}
|
|
|
|
Button {
|
|
text: "Add Tab"
|
|
onClicked: {
|
|
console.log(desktop.toolWindow);
|
|
desktop.toolWindow.addWebTab({ source: "Foo" });
|
|
desktop.toolWindow.showTabForUrl("Foo", true);
|
|
}
|
|
}
|
|
|
|
Button {
|
|
text: "Destroy Tab"
|
|
onClicked: {
|
|
console.log(desktop.toolWindow);
|
|
desktop.toolWindow.removeTabForUrl("Foo");
|
|
}
|
|
}
|
|
|
|
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 {
|
|
id: blue
|
|
closable: true
|
|
visible: true
|
|
resizable: true
|
|
destroyOnInvisible: false
|
|
|
|
width: 100; height: 100
|
|
x: 1280 / 2; y: 720 / 2
|
|
Settings {
|
|
category: "TestWindow.Blue"
|
|
property alias x: blue.x
|
|
property alias y: blue.y
|
|
property alias width: blue.width
|
|
property alias height: blue.height
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
visible: true
|
|
color: "blue"
|
|
Component.onDestruction: console.log("Blue destroyed")
|
|
}
|
|
}
|
|
*/
|
|
/*
|
|
Window {
|
|
id: green
|
|
alwaysOnTop: true
|
|
closable: true
|
|
visible: true
|
|
resizable: false
|
|
x: 1280 / 2; y: 720 / 2
|
|
Settings {
|
|
category: "TestWindow.Green"
|
|
property alias x: green.x
|
|
property alias y: green.y
|
|
property alias width: green.width
|
|
property alias height: green.height
|
|
}
|
|
width: 100; height: 100
|
|
Rectangle { anchors.fill: parent; color: "green" }
|
|
}
|
|
|
|
Window {
|
|
id: yellow
|
|
objectName: "Yellow"
|
|
closable: true
|
|
visible: true
|
|
resizable: true
|
|
width: 100; height: 100
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
visible: true
|
|
color: "yellow"
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|
|
Action {
|
|
text: "Open Browser"
|
|
shortcut: "Ctrl+Shift+X"
|
|
onTriggered: {
|
|
builder.createObject(desktop);
|
|
}
|
|
property var builder: Component {
|
|
ModelBrowserDialog{}
|
|
}
|
|
}
|
|
}
|