mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 03:34:24 +02:00
Tablet and desktop versions of attachment model browser dialog
This commit is contained in:
parent
d261e48b9d
commit
ffbb04d3bc
4 changed files with 179 additions and 80 deletions
36
interface/resources/qml/hifi/dialogs/ModelBrowserDialog.qml
Normal file
36
interface/resources/qml/hifi/dialogs/ModelBrowserDialog.qml
Normal file
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// ModelBrowserDialog.qml
|
||||
//
|
||||
// Created by David Rowe on 11 Mar 2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
import "../../windows"
|
||||
import "content"
|
||||
|
||||
ScrollingWindow {
|
||||
id: root
|
||||
objectName: "ModelBrowserDialog"
|
||||
title: "Attachment Model"
|
||||
resizable: true
|
||||
width: 600
|
||||
height: 480
|
||||
closable: false
|
||||
|
||||
//HifiConstants { id: hifi }
|
||||
|
||||
property var result
|
||||
|
||||
signal selected(var modelUrl)
|
||||
signal canceled()
|
||||
|
||||
ModelBrowserContent {
|
||||
id: modelBrowserContent
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import Qt.labs.settings 1.0
|
|||
|
||||
import "."
|
||||
import ".."
|
||||
import "../../tablet"
|
||||
import "../../../styles-uit"
|
||||
import "../../../controls-uit" as HifiControls
|
||||
import "../../../windows"
|
||||
|
@ -76,12 +77,24 @@ Item {
|
|||
id: modelBrowserBuilder;
|
||||
ModelBrowserDialog {}
|
||||
}
|
||||
Component {
|
||||
id: tabletModelBrowserBuilder;
|
||||
TabletModelBrowserDialog {}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
var browser = modelBrowserBuilder.createObject(desktop);
|
||||
browser.selected.connect(function(newModelUrl){
|
||||
modelUrl.text = newModelUrl;
|
||||
})
|
||||
var browser;
|
||||
if (typeof desktop !== "undefined") {
|
||||
browser = modelBrowserBuilder.createObject(desktop);
|
||||
browser.selected.connect(function(newModelUrl){
|
||||
modelUrl.text = newModelUrl;
|
||||
});
|
||||
} else {
|
||||
browser = tabletModelBrowserBuilder.createObject(tabletRoot);
|
||||
browser.selected.connect(function(newModelUrl){
|
||||
modelUrl.text = newModelUrl;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,92 +1,64 @@
|
|||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.XmlListModel 2.0
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import "../../windows"
|
||||
import "../../js/Utils.js" as Utils
|
||||
import "../models"
|
||||
import "../../../controls-uit" as HifiControls
|
||||
|
||||
import "../../styles-uit"
|
||||
import "../../controls-uit" as HifiControls
|
||||
import "../../windows"
|
||||
Column {
|
||||
width: pane.contentWidth
|
||||
|
||||
ScrollingWindow {
|
||||
id: root
|
||||
resizable: true
|
||||
width: 600
|
||||
height: 480
|
||||
closable: false
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: root.height - (keyboardEnabled && keyboardRaised ? 200 : 0)
|
||||
color: hifi.colors.baseGray
|
||||
|
||||
property var result;
|
||||
HifiControls.TextField {
|
||||
id: filterEdit
|
||||
anchors { left: parent.left; right: parent.right; top: parent.top ; margins: 8}
|
||||
placeholderText: "filter"
|
||||
onTextChanged: tableView.model.filter = text
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
}
|
||||
|
||||
signal selected(var modelUrl);
|
||||
signal canceled();
|
||||
|
||||
HifiConstants {id: hifi}
|
||||
|
||||
Column {
|
||||
width: pane.contentWidth
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: root.height - (keyboardEnabled && keyboardRaised ? 200 : 0)
|
||||
radius: 4
|
||||
color: hifi.colors.baseGray
|
||||
|
||||
HifiControls.TextField {
|
||||
id: filterEdit
|
||||
anchors { left: parent.left; right: parent.right; top: parent.top ; margins: 8}
|
||||
placeholderText: "filter"
|
||||
onTextChanged: tableView.model.filter = text
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
}
|
||||
|
||||
HifiControls.AttachmentsTable {
|
||||
id: tableView
|
||||
anchors { left: parent.left; right: parent.right; top: filterEdit.bottom; bottom: buttonRow.top; margins: 8; }
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
onCurrentRowChanged: {
|
||||
if (currentRow == -1) {
|
||||
root.result = null;
|
||||
return;
|
||||
}
|
||||
result = model.baseUrl + "/" + model.get(tableView.currentRow).key;
|
||||
HifiControls.AttachmentsTable {
|
||||
id: tableView
|
||||
anchors { left: parent.left; right: parent.right; top: filterEdit.bottom; bottom: buttonRow.top; margins: 8; }
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
onCurrentRowChanged: {
|
||||
if (currentRow == -1) {
|
||||
root.result = null;
|
||||
return;
|
||||
}
|
||||
result = model.baseUrl + "/" + model.get(tableView.currentRow).key;
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: buttonRow
|
||||
spacing: 8
|
||||
anchors { right: parent.right; rightMargin: 8; bottom: parent.bottom; bottomMargin: 8; }
|
||||
HifiControls.Button { action: acceptAction ; color: hifi.buttons.black; colorScheme: hifi.colorSchemes.dark }
|
||||
HifiControls.Button { action: cancelAction ; color: hifi.buttons.black; colorScheme: hifi.colorSchemes.dark }
|
||||
Row {
|
||||
id: buttonRow
|
||||
spacing: 8
|
||||
anchors { right: parent.right; rightMargin: 8; bottom: parent.bottom; bottomMargin: 8; }
|
||||
HifiControls.Button { action: acceptAction ; color: hifi.buttons.black; colorScheme: hifi.colorSchemes.dark }
|
||||
HifiControls.Button { action: cancelAction ; color: hifi.buttons.black; colorScheme: hifi.colorSchemes.dark }
|
||||
}
|
||||
|
||||
Action {
|
||||
id: acceptAction
|
||||
text: qsTr("OK")
|
||||
enabled: root.result ? true : false
|
||||
shortcut: Qt.Key_Return
|
||||
onTriggered: {
|
||||
root.selected(root.result);
|
||||
root.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
id: acceptAction
|
||||
text: qsTr("OK")
|
||||
enabled: root.result ? true : false
|
||||
shortcut: Qt.Key_Return
|
||||
onTriggered: {
|
||||
root.selected(root.result);
|
||||
root.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
id: cancelAction
|
||||
text: qsTr("Cancel")
|
||||
shortcut: Qt.Key_Escape
|
||||
onTriggered: {
|
||||
root.canceled();
|
||||
root.destroy();
|
||||
}
|
||||
Action {
|
||||
id: cancelAction
|
||||
text: qsTr("Cancel")
|
||||
shortcut: Qt.Key_Escape
|
||||
onTriggered: {
|
||||
root.canceled();
|
||||
root.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
//
|
||||
// TabletModelBrowserDialog.qml
|
||||
//
|
||||
// Created by David Rowe on 11 Mar 2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
import QtQuick 2.5
|
||||
import QtQuick.Controls 1.4
|
||||
|
||||
import "../../styles-uit"
|
||||
import "../dialogs/content"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
objectName: "ModelBrowserDialog"
|
||||
|
||||
property string title: "Attachment Model"
|
||||
|
||||
property var result
|
||||
|
||||
signal selected(var modelUrl)
|
||||
signal canceled()
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
id: pane // Surrogate for ScrollingWindow's pane.
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
anchors.topMargin: 90 // Space for header.
|
||||
|
||||
// FIXME: Refactor with other tablet headers.
|
||||
Rectangle {
|
||||
id: header
|
||||
height: 90
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.top
|
||||
}
|
||||
z: 100
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop {
|
||||
position: 0
|
||||
color: "#2b2b2b"
|
||||
}
|
||||
|
||||
GradientStop {
|
||||
position: 1
|
||||
color: "#1e1e1e"
|
||||
}
|
||||
}
|
||||
|
||||
RalewayBold {
|
||||
text: title
|
||||
size: 26
|
||||
color: "#34a2c7"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: hifi.dimensions.contentMargin.x
|
||||
}
|
||||
}
|
||||
|
||||
ModelBrowserContent {
|
||||
anchors {
|
||||
top: header.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.top
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue