mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-21 13:15:30 +02:00
remove attachments menu item / dialogs / related components
This commit is contained in:
parent
c1ebadfdd8
commit
5ba68cbfac
10 changed files with 0 additions and 931 deletions
|
@ -1,48 +0,0 @@
|
|||
//
|
||||
// AttachmentsDialog.qml
|
||||
//
|
||||
// Created by David Rowe on 9 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 Qt.labs.settings 1.0
|
||||
|
||||
import "../../styles-uit"
|
||||
import "../../windows"
|
||||
import "content"
|
||||
|
||||
ScrollingWindow {
|
||||
id: root
|
||||
title: "Attachments"
|
||||
objectName: "AttachmentsDialog"
|
||||
width: 600
|
||||
height: 600
|
||||
resizable: true
|
||||
destroyOnHidden: true
|
||||
minSize: Qt.vector2d(400, 500)
|
||||
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
// This is for JS/QML communication, which is unused in the AttachmentsDialog,
|
||||
// but not having this here results in spurious warnings about a
|
||||
// missing signal
|
||||
signal sendToScript(var message);
|
||||
|
||||
property var settings: Settings {
|
||||
category: "AttachmentsDialog"
|
||||
property alias x: root.x
|
||||
property alias y: root.y
|
||||
property alias width: root.width
|
||||
property alias height: root.height
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
root.destroy();
|
||||
}
|
||||
|
||||
AttachmentsContent { }
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.5
|
||||
import QtQuick.XmlListModel 2.0
|
||||
import QtQuick.Controls.Styles 1.4
|
||||
|
||||
import "../../windows"
|
||||
import "../../js/Utils.js" as Utils
|
||||
import "../models"
|
||||
|
||||
ModalWindow {
|
||||
id: root
|
||||
resizable: true
|
||||
width: 640
|
||||
height: 480
|
||||
|
||||
property var result;
|
||||
|
||||
signal selected(var modelUrl);
|
||||
signal canceled();
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "white"
|
||||
|
||||
Item {
|
||||
anchors { fill: parent; margins: 8 }
|
||||
|
||||
TextField {
|
||||
id: filterEdit
|
||||
anchors { left: parent.left; right: parent.right; top: parent.top }
|
||||
style: TextFieldStyle { renderType: Text.QtRendering }
|
||||
placeholderText: "filter"
|
||||
onTextChanged: tableView.model.filter = text
|
||||
}
|
||||
|
||||
TableView {
|
||||
id: tableView
|
||||
anchors { left: parent.left; right: parent.right; top: filterEdit.bottom; topMargin: 8; bottom: buttonRow.top; bottomMargin: 8 }
|
||||
model: S3Model{}
|
||||
onCurrentRowChanged: {
|
||||
if (currentRow == -1) {
|
||||
root.result = null;
|
||||
return;
|
||||
}
|
||||
result = model.baseUrl + "/" + model.get(tableView.currentRow).key;
|
||||
}
|
||||
itemDelegate: Component {
|
||||
Item {
|
||||
clip: true
|
||||
Text {
|
||||
x: 3
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: tableView.activeFocus && styleData.row === tableView.currentRow ? "yellow" : styleData.textColor
|
||||
elide: styleData.elideMode
|
||||
text: getText()
|
||||
|
||||
function getText() {
|
||||
switch(styleData.column) {
|
||||
case 1:
|
||||
return Utils.formatSize(styleData.value)
|
||||
default:
|
||||
return styleData.value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
TableViewColumn {
|
||||
role: "name"
|
||||
title: "Name"
|
||||
width: 200
|
||||
}
|
||||
TableViewColumn {
|
||||
role: "size"
|
||||
title: "Size"
|
||||
width: 100
|
||||
}
|
||||
TableViewColumn {
|
||||
role: "modified"
|
||||
title: "Last Modified"
|
||||
width: 200
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: tableView.model.status !== XmlListModel.Ready
|
||||
color: "#7fffffff"
|
||||
BusyIndicator {
|
||||
anchors.centerIn: parent
|
||||
width: 48; height: 48
|
||||
running: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: buttonRow
|
||||
anchors { right: parent.right; bottom: parent.bottom }
|
||||
Button { action: acceptAction }
|
||||
Button { action: cancelAction }
|
||||
}
|
||||
|
||||
Action {
|
||||
id: acceptAction
|
||||
text: qsTr("OK")
|
||||
enabled: root.result ? true : false
|
||||
shortcut: "Return"
|
||||
onTriggered: {
|
||||
root.selected(root.result);
|
||||
root.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
id: cancelAction
|
||||
text: qsTr("Cancel")
|
||||
shortcut: "Esc"
|
||||
onTriggered: {
|
||||
root.canceled();
|
||||
root.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,230 +0,0 @@
|
|||
import QtQuick 2.5
|
||||
|
||||
import "."
|
||||
import ".."
|
||||
import "../../tablet"
|
||||
import "../../../styles-uit"
|
||||
import "../../../controls-uit" as HifiControls
|
||||
import "../../../windows"
|
||||
|
||||
Item {
|
||||
height: column.height + 2 * 8
|
||||
|
||||
property var attachment;
|
||||
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
signal selectAttachment();
|
||||
signal deleteAttachment(var attachment);
|
||||
signal updateAttachment();
|
||||
property bool completed: false;
|
||||
|
||||
function doSelectAttachment(control, focus) {
|
||||
if (focus) {
|
||||
selectAttachment();
|
||||
|
||||
// Refocus control after possibly changing focus to attachment.
|
||||
if (control.setControlFocus !== undefined) {
|
||||
control.setControlFocus();
|
||||
} else {
|
||||
control.focus = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle { color: hifi.colors.baseGray; anchors.fill: parent; radius: 4 }
|
||||
|
||||
Component.onCompleted: {
|
||||
jointChooser.model = MyAvatar.jointNames;
|
||||
completed = true;
|
||||
}
|
||||
|
||||
Column {
|
||||
y: 8
|
||||
id: column
|
||||
anchors { left: parent.left; right: parent.right; margins: 20 }
|
||||
spacing: 8
|
||||
|
||||
Item {
|
||||
height: modelChooserButton.height + urlLabel.height + 4
|
||||
anchors { left: parent.left; right: parent.right;}
|
||||
HifiControls.Label { id: urlLabel; color: hifi.colors.lightGrayText; text: "Model URL"; anchors.top: parent.top;}
|
||||
HifiControls.TextField {
|
||||
id: modelUrl;
|
||||
height: jointChooser.height;
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
anchors { bottom: parent.bottom; left: parent.left; rightMargin: 8; right: modelChooserButton.left }
|
||||
text: attachment ? attachment.modelUrl : ""
|
||||
onTextChanged: {
|
||||
if (completed && attachment && attachment.modelUrl !== text) {
|
||||
attachment.modelUrl = text;
|
||||
updateAttachment();
|
||||
}
|
||||
}
|
||||
onFocusChanged: doSelectAttachment(this, focus);
|
||||
}
|
||||
HifiControls.Button {
|
||||
id: modelChooserButton;
|
||||
text: "Choose";
|
||||
color: hifi.buttons.black
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
anchors { right: parent.right; verticalCenter: modelUrl.verticalCenter }
|
||||
Component {
|
||||
id: modelBrowserBuilder;
|
||||
ModelBrowserDialog {}
|
||||
}
|
||||
Component {
|
||||
id: tabletModelBrowserBuilder;
|
||||
TabletModelBrowserDialog {}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
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;
|
||||
tabletRoot.openModal = null;
|
||||
});
|
||||
browser.canceled.connect(function() {
|
||||
tabletRoot.openModal = null;
|
||||
});
|
||||
|
||||
// Make dialog modal.
|
||||
tabletRoot.openModal = browser;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
z: 1000
|
||||
height: jointChooser.height + jointLabel.height + 4
|
||||
anchors { left: parent.left; right: parent.right; }
|
||||
HifiControls.Label {
|
||||
id: jointLabel;
|
||||
text: "Joint";
|
||||
color: hifi.colors.lightGrayText;
|
||||
anchors.top: parent.top
|
||||
}
|
||||
HifiControls.ComboBox {
|
||||
id: jointChooser;
|
||||
dropdownHeight: (typeof desktop !== "undefined") ? 480 : 206
|
||||
anchors { bottom: parent.bottom; left: parent.left; right: parent.right }
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
currentIndex: attachment ? model.indexOf(attachment.jointName) : -1
|
||||
onCurrentIndexChanged: {
|
||||
if (completed && attachment && currentIndex != -1 && attachment.jointName !== model[currentIndex]) {
|
||||
attachment.jointName = model[currentIndex];
|
||||
updateAttachment();
|
||||
}
|
||||
}
|
||||
onFocusChanged: doSelectAttachment(this, focus);
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
height: translation.height + translationLabel.height + 4
|
||||
anchors { left: parent.left; right: parent.right; }
|
||||
HifiControls.Label { id: translationLabel; color: hifi.colors.lightGrayText; text: "Translation"; anchors.top: parent.top; }
|
||||
Translation {
|
||||
id: translation;
|
||||
anchors { left: parent.left; right: parent.right; bottom: parent.bottom}
|
||||
vector: attachment ? attachment.translation : {x: 0, y: 0, z: 0};
|
||||
onValueChanged: {
|
||||
if (completed && attachment) {
|
||||
attachment.translation = vector;
|
||||
updateAttachment();
|
||||
}
|
||||
}
|
||||
onControlFocusChanged: doSelectAttachment(this, controlFocus);
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
height: rotation.height + rotationLabel.height + 4
|
||||
anchors { left: parent.left; right: parent.right; }
|
||||
HifiControls.Label { id: rotationLabel; color: hifi.colors.lightGrayText; text: "Rotation"; anchors.top: parent.top; }
|
||||
Rotation {
|
||||
id: rotation;
|
||||
anchors { left: parent.left; right: parent.right; bottom: parent.bottom; }
|
||||
vector: attachment ? attachment.rotation : {x: 0, y: 0, z: 0};
|
||||
onValueChanged: {
|
||||
if (completed && attachment) {
|
||||
attachment.rotation = vector;
|
||||
updateAttachment();
|
||||
}
|
||||
}
|
||||
onControlFocusChanged: doSelectAttachment(this, controlFocus);
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
height: scaleItem.height
|
||||
anchors { left: parent.left; right: parent.right; }
|
||||
|
||||
Item {
|
||||
id: scaleItem
|
||||
height: scaleSpinner.height + scaleLabel.height + 4
|
||||
width: parent.width / 3 - 8
|
||||
anchors { right: parent.right; }
|
||||
HifiControls.Label { id: scaleLabel; color: hifi.colors.lightGrayText; text: "Scale"; anchors.top: parent.top; }
|
||||
HifiControls.SpinBox {
|
||||
id: scaleSpinner;
|
||||
anchors { left: parent.left; right: parent.right; bottom: parent.bottom; }
|
||||
decimals: 2;
|
||||
minimumValue: 0.01
|
||||
maximumValue: 10
|
||||
realStepSize: 0.05;
|
||||
realValue: attachment ? attachment.scale : 1.0
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
onRealValueChanged: {
|
||||
if (completed && attachment && attachment.scale !== realValue) {
|
||||
attachment.scale = realValue;
|
||||
updateAttachment();
|
||||
}
|
||||
}
|
||||
onFocusChanged: doSelectAttachment(this, focus);
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: isSoftItem
|
||||
height: scaleSpinner.height
|
||||
anchors {
|
||||
left: parent.left
|
||||
bottom: parent.bottom
|
||||
}
|
||||
HifiControls.CheckBox {
|
||||
id: soft
|
||||
text: "Is soft"
|
||||
anchors {
|
||||
left: parent.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
checked: attachment ? attachment.soft : false
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
onCheckedChanged: {
|
||||
if (completed && attachment && attachment.soft !== checked) {
|
||||
attachment.soft = checked;
|
||||
updateAttachment();
|
||||
}
|
||||
}
|
||||
onFocusChanged: doSelectAttachment(this, focus);
|
||||
}
|
||||
}
|
||||
}
|
||||
HifiControls.Button {
|
||||
color: hifi.buttons.black
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
anchors { left: parent.left; right: parent.right; }
|
||||
text: "Delete"
|
||||
onClicked: deleteAttachment(root.attachment);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
import "."
|
||||
|
||||
Vector3 {
|
||||
decimals: 1;
|
||||
stepSize: 1;
|
||||
maximumValue: 180
|
||||
minimumValue: -180
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import "."
|
||||
|
||||
Vector3 {
|
||||
decimals: 3;
|
||||
stepSize: 0.01;
|
||||
maximumValue: 10
|
||||
minimumValue: -10
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
import QtQuick 2.5
|
||||
|
||||
import "../../../styles-uit"
|
||||
import "../../../controls-uit" as HifiControls
|
||||
import "../../../windows"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
implicitHeight: xspinner.height
|
||||
readonly property real spacing: 8
|
||||
property real spinboxWidth: (width / 3) - spacing
|
||||
property var vector;
|
||||
property real decimals: 0
|
||||
property real stepSize: 1
|
||||
property real maximumValue: 99
|
||||
property real minimumValue: 0
|
||||
property bool controlFocus: false; // True if one of the ordinate controls has focus.
|
||||
property var controlFocusControl: undefined
|
||||
|
||||
signal valueChanged();
|
||||
|
||||
function setControlFocus() {
|
||||
if (controlFocusControl) {
|
||||
controlFocusControl.focus = true;
|
||||
// The controlFocus value is updated via onFocusChanged.
|
||||
}
|
||||
}
|
||||
|
||||
function setFocus(control, focus) {
|
||||
if (focus) {
|
||||
controlFocusControl = control;
|
||||
setControlFocusTrue.start(); // After any subsequent false from previous control.
|
||||
} else {
|
||||
controlFocus = false;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: setControlFocusTrue
|
||||
interval: 50
|
||||
repeat: false
|
||||
running: false
|
||||
onTriggered: {
|
||||
controlFocus = true;
|
||||
}
|
||||
}
|
||||
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
HifiControls.SpinBox {
|
||||
id: xspinner
|
||||
width: root.spinboxWidth
|
||||
anchors { left: parent.left }
|
||||
realValue: root.vector.x
|
||||
labelInside: "X:"
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
colorLabelInside: hifi.colors.redHighlight
|
||||
decimals: root.decimals
|
||||
realStepSize: root.stepSize
|
||||
maximumValue: root.maximumValue
|
||||
minimumValue: root.minimumValue
|
||||
onRealValueChanged: {
|
||||
if (realValue !== vector.x) {
|
||||
vector.x = realValue
|
||||
root.valueChanged();
|
||||
}
|
||||
}
|
||||
onFocusChanged: setFocus(this, focus);
|
||||
}
|
||||
|
||||
HifiControls.SpinBox {
|
||||
id: yspinner
|
||||
width: root.spinboxWidth
|
||||
anchors { horizontalCenter: parent.horizontalCenter }
|
||||
realValue: root.vector.y
|
||||
labelInside: "Y:"
|
||||
colorLabelInside: hifi.colors.greenHighlight
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
decimals: root.decimals
|
||||
realStepSize: root.stepSize
|
||||
maximumValue: root.maximumValue
|
||||
minimumValue: root.minimumValue
|
||||
onRealValueChanged: {
|
||||
if (realValue !== vector.y) {
|
||||
vector.y = realValue
|
||||
root.valueChanged();
|
||||
}
|
||||
}
|
||||
onFocusChanged: setFocus(this, focus);
|
||||
}
|
||||
|
||||
HifiControls.SpinBox {
|
||||
id: zspinner
|
||||
width: root.spinboxWidth
|
||||
anchors { right: parent.right; }
|
||||
realValue: root.vector.z
|
||||
labelInside: "Z:"
|
||||
colorLabelInside: hifi.colors.primaryHighlight
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
decimals: root.decimals
|
||||
realStepSize: root.stepSize
|
||||
maximumValue: root.maximumValue
|
||||
minimumValue: root.minimumValue
|
||||
onRealValueChanged: {
|
||||
if (realValue !== vector.z) {
|
||||
vector.z = realValue
|
||||
root.valueChanged();
|
||||
}
|
||||
}
|
||||
onFocusChanged: setFocus(this, focus);
|
||||
}
|
||||
}
|
|
@ -1,282 +0,0 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
||||
|
||||
import "../../../styles-uit"
|
||||
import "../../../controls-uit" as HifiControls
|
||||
import "../../../windows"
|
||||
import "../attachments"
|
||||
|
||||
Item {
|
||||
id: content
|
||||
|
||||
readonly property var originalAttachments: MyAvatar.getAttachmentsVariant();
|
||||
property var attachments: [];
|
||||
|
||||
function reload(){
|
||||
content.attachments = [];
|
||||
var currentAttachments = MyAvatar.getAttachmentsVariant();
|
||||
listView.model.clear();
|
||||
for (var i = 0; i < currentAttachments.length; ++i) {
|
||||
var attachment = currentAttachments[i];
|
||||
content.attachments.push(attachment);
|
||||
listView.model.append({});
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
id: onAttachmentsChangedConnection
|
||||
target: MyAvatar
|
||||
onAttachmentsChanged: reload()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
reload()
|
||||
}
|
||||
|
||||
function setAttachmentsVariant(attachments) {
|
||||
onAttachmentsChangedConnection.enabled = false;
|
||||
MyAvatar.setAttachmentsVariant(attachments);
|
||||
onAttachmentsChangedConnection.enabled = true;
|
||||
}
|
||||
|
||||
Column {
|
||||
width: pane.width
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: root.height - (keyboardEnabled && keyboardRaised ? 200 : 0)
|
||||
color: hifi.colors.baseGray
|
||||
|
||||
Rectangle {
|
||||
id: attachmentsBackground
|
||||
anchors {
|
||||
left: parent.left; right: parent.right; top: parent.top; bottom: newAttachmentButton.top;
|
||||
margins: hifi.dimensions.contentMargin.x
|
||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
||||
}
|
||||
color: hifi.colors.baseGrayShadow
|
||||
radius: 4
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: scrollBar.left
|
||||
bottom: parent.bottom
|
||||
margins: 4
|
||||
}
|
||||
clip: true
|
||||
cacheBuffer: 4000
|
||||
|
||||
model: ListModel {}
|
||||
delegate: Item {
|
||||
id: attachmentDelegate
|
||||
implicitHeight: attachmentView.height + 8;
|
||||
implicitWidth: attachmentView.width
|
||||
|
||||
MouseArea {
|
||||
// User can click on whitespace to select item.
|
||||
anchors.fill: parent
|
||||
propagateComposedEvents: true
|
||||
onClicked: {
|
||||
listView.currentIndex = index;
|
||||
attachmentsBackground.forceActiveFocus(); // Unfocus from any control.
|
||||
mouse.accepted = false;
|
||||
}
|
||||
}
|
||||
|
||||
Attachment {
|
||||
id: attachmentView
|
||||
width: listView.width
|
||||
attachment: content.attachments[index]
|
||||
onSelectAttachment: {
|
||||
listView.currentIndex = index;
|
||||
}
|
||||
onDeleteAttachment: {
|
||||
attachments.splice(index, 1);
|
||||
listView.model.remove(index, 1);
|
||||
}
|
||||
onUpdateAttachment: {
|
||||
setAttachmentsVariant(attachments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onCountChanged: {
|
||||
setAttachmentsVariant(attachments);
|
||||
}
|
||||
|
||||
/*
|
||||
// DEBUG
|
||||
highlight: Rectangle { color: "#40ffff00" }
|
||||
highlightFollowsCurrentItem: true
|
||||
*/
|
||||
|
||||
onHeightChanged: {
|
||||
// Keyboard has been raised / lowered.
|
||||
positionViewAtIndex(listView.currentIndex, ListView.SnapPosition);
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
if (!yScrollTimer.running) {
|
||||
scrollSlider.y = currentIndex * (scrollBar.height - scrollSlider.height) / (listView.count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
onContentYChanged: {
|
||||
// User may have dragged content up/down.
|
||||
yScrollTimer.restart();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: yScrollTimer
|
||||
interval: 200
|
||||
repeat: false
|
||||
running: false
|
||||
onTriggered: {
|
||||
var index = (listView.count - 1) * listView.contentY / (listView.contentHeight - scrollBar.height);
|
||||
index = Math.round(index);
|
||||
listView.currentIndex = index;
|
||||
scrollSlider.y = index * (scrollBar.height - scrollSlider.height) / (listView.count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: scrollBar
|
||||
|
||||
property bool scrolling: listView.contentHeight > listView.height
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
topMargin: 4
|
||||
bottomMargin: 4
|
||||
}
|
||||
width: scrolling ? 18 : 0
|
||||
radius: attachmentsBackground.radius
|
||||
color: hifi.colors.baseGrayShadow
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: {
|
||||
var index = listView.currentIndex;
|
||||
index = index + (mouse.y <= scrollSlider.y ? -1 : 1);
|
||||
if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
if (index > listView.count - 1) {
|
||||
index = listView.count - 1;
|
||||
}
|
||||
listView.currentIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: scrollSlider
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: 3
|
||||
}
|
||||
width: 16
|
||||
height: (listView.height / listView.contentHeight) * listView.height
|
||||
radius: width / 2
|
||||
color: hifi.colors.lightGray
|
||||
|
||||
visible: scrollBar.scrolling;
|
||||
|
||||
onYChanged: {
|
||||
var index = y * (listView.count - 1) / (scrollBar.height - scrollSlider.height);
|
||||
index = Math.round(index);
|
||||
listView.currentIndex = index;
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
drag.target: scrollSlider
|
||||
drag.axis: Drag.YAxis
|
||||
drag.minimumY: 0
|
||||
drag.maximumY: scrollBar.height - scrollSlider.height
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HifiControls.Button {
|
||||
id: newAttachmentButton
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: buttonRow.top
|
||||
margins: hifi.dimensions.contentMargin.x;
|
||||
topMargin: hifi.dimensions.contentSpacing.y
|
||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
||||
}
|
||||
text: "New Attachment"
|
||||
color: hifi.buttons.black
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
onClicked: {
|
||||
var template = {
|
||||
modelUrl: "",
|
||||
translation: { x: 0, y: 0, z: 0 },
|
||||
rotation: { x: 0, y: 0, z: 0 },
|
||||
scale: 1,
|
||||
jointName: MyAvatar.jointNames[0],
|
||||
soft: false
|
||||
};
|
||||
attachments.push(template);
|
||||
listView.model.append({});
|
||||
setAttachmentsVariant(attachments);
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: buttonRow
|
||||
spacing: 8
|
||||
anchors {
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: hifi.dimensions.contentMargin.x
|
||||
topMargin: hifi.dimensions.contentSpacing.y
|
||||
bottomMargin: hifi.dimensions.contentSpacing.y
|
||||
}
|
||||
HifiControls.Button {
|
||||
action: okAction
|
||||
color: hifi.buttons.black
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
}
|
||||
HifiControls.Button {
|
||||
action: cancelAction
|
||||
color: hifi.buttons.black
|
||||
colorScheme: hifi.colorSchemes.dark
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
id: cancelAction
|
||||
text: "Cancel"
|
||||
onTriggered: {
|
||||
setAttachmentsVariant(originalAttachments);
|
||||
closeDialog();
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
id: okAction
|
||||
text: "OK"
|
||||
onTriggered: {
|
||||
for (var i = 0; i < attachments.length; ++i) {
|
||||
console.log("Attachment " + i + ": " + attachments[i]);
|
||||
}
|
||||
|
||||
setAttachmentsVariant(attachments);
|
||||
closeDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
//
|
||||
// TabletAttachmentsDialog.qml
|
||||
//
|
||||
// Created by David Rowe on 9 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 "../../controls-uit" as HifiControls
|
||||
import "../../styles-uit"
|
||||
import "../dialogs/content"
|
||||
|
||||
Item {
|
||||
id: root
|
||||
objectName: "AttachmentsDialog"
|
||||
|
||||
property string title: "Avatar Attachments"
|
||||
|
||||
property bool keyboardEnabled: false
|
||||
property bool keyboardRaised: false
|
||||
property bool punctuationMode: false
|
||||
|
||||
signal sendToScript(var message);
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
Rectangle {
|
||||
id: pane // Surrogate for ScrollingWindow's pane.
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
Tablet.getTablet("com.highfidelity.interface.tablet.system").gotoHomeScreen();
|
||||
}
|
||||
|
||||
anchors.topMargin: hifi.dimensions.tabletMenuHeader // Space for header.
|
||||
|
||||
HifiControls.TabletHeader {
|
||||
id: header
|
||||
title: root.title
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.top
|
||||
}
|
||||
}
|
||||
|
||||
AttachmentsContent {
|
||||
id: attachments
|
||||
|
||||
anchors {
|
||||
top: header.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: keyboard.top
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
// Defocuses any current control so that the keyboard gets hidden.
|
||||
id: defocuser
|
||||
anchors.fill: parent
|
||||
propagateComposedEvents: true
|
||||
acceptedButtons: Qt.AllButtons
|
||||
onPressed: {
|
||||
parent.forceActiveFocus();
|
||||
mouse.accepted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HifiControls.Keyboard {
|
||||
id: keyboard
|
||||
raised: parent.keyboardEnabled && parent.keyboardRaised
|
||||
numeric: parent.punctuationMode
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: activator
|
||||
anchors.fill: parent
|
||||
propagateComposedEvents: true
|
||||
enabled: true
|
||||
acceptedButtons: Qt.AllButtons
|
||||
onPressed: {
|
||||
mouse.accepted = false;
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
keyboardEnabled = HMD.active;
|
||||
}
|
||||
}
|
|
@ -275,13 +275,6 @@ Menu::Menu() {
|
|||
QString("hifi/tablet/TabletGraphicsPreferences.qml"), "GraphicsPreferencesDialog");
|
||||
});
|
||||
|
||||
// Settings > Attachments...
|
||||
action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Attachments);
|
||||
connect(action, &QAction::triggered, [] {
|
||||
qApp->showDialog(QString("hifi/dialogs/AttachmentsDialog.qml"),
|
||||
QString("hifi/tablet/TabletAttachmentsDialog.qml"), "AttachmentsDialog");
|
||||
});
|
||||
|
||||
// Settings > Developer Menu
|
||||
addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menu", 0, false, this, SLOT(toggleDeveloperMenus()));
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ namespace MenuOption {
|
|||
const QString AskToResetSettings = "Ask To Reset Settings on Start";
|
||||
const QString AssetMigration = "ATP Asset Migration";
|
||||
const QString AssetServer = "Asset Browser";
|
||||
const QString Attachments = "Attachments...";
|
||||
const QString AudioScope = "Show Scope";
|
||||
const QString AudioScopeFiftyFrames = "Fifty";
|
||||
const QString AudioScopeFiveFrames = "Five";
|
||||
|
|
Loading…
Reference in a new issue