mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 08:30:35 +02:00
Tablet and desktop versions of avatar attachments dialog
This commit is contained in:
parent
22e5229036
commit
1fc6d82456
5 changed files with 141 additions and 31 deletions
45
interface/resources/qml/hifi/dialogs/AttachmentsDialog.qml
Normal file
45
interface/resources/qml/hifi/dialogs/AttachmentsDialog.qml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
//
|
||||||
|
// 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 QtQuick.Controls 1.4
|
||||||
|
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 }
|
||||||
|
|
||||||
|
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,47 +1,29 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 1.4
|
||||||
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
import QtQuick.Dialogs 1.2 as OriginalDialogs
|
||||||
import Qt.labs.settings 1.0
|
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
|
||||||
import "../../styles-uit"
|
import "../../../styles-uit"
|
||||||
import "../../controls-uit" as HifiControls
|
import "../../../controls-uit" as HifiControls
|
||||||
import "../../windows"
|
import "../../../windows"
|
||||||
import "attachments"
|
import "../attachments"
|
||||||
|
|
||||||
ScrollingWindow {
|
Item {
|
||||||
id: root
|
id: content
|
||||||
title: "Attachments"
|
|
||||||
objectName: "AttachmentsDialog"
|
|
||||||
width: 600
|
|
||||||
height: 600
|
|
||||||
resizable: true
|
|
||||||
destroyOnHidden: true
|
|
||||||
minSize: Qt.vector2d(400, 500)
|
|
||||||
|
|
||||||
HifiConstants { id: hifi }
|
|
||||||
|
|
||||||
readonly property var originalAttachments: MyAvatar.getAttachmentsVariant();
|
readonly property var originalAttachments: MyAvatar.getAttachmentsVariant();
|
||||||
property var attachments: [];
|
property var attachments: [];
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for (var i = 0; i < originalAttachments.length; ++i) {
|
for (var i = 0; i < originalAttachments.length; ++i) {
|
||||||
var attachment = originalAttachments[i];
|
var attachment = originalAttachments[i];
|
||||||
root.attachments.push(attachment);
|
content.attachments.push(attachment);
|
||||||
listView.model.append({});
|
listView.model.append({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: pane.contentWidth
|
width: pane.width
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -118,7 +100,7 @@ ScrollingWindow {
|
||||||
Attachment {
|
Attachment {
|
||||||
id: attachmentView
|
id: attachmentView
|
||||||
width: scrollView.width
|
width: scrollView.width
|
||||||
attachment: root.attachments[index]
|
attachment: content.attachments[index]
|
||||||
onDeleteAttachment: {
|
onDeleteAttachment: {
|
||||||
attachments.splice(index, 1);
|
attachments.splice(index, 1);
|
||||||
listView.model.remove(index, 1);
|
listView.model.remove(index, 1);
|
||||||
|
@ -190,7 +172,7 @@ ScrollingWindow {
|
||||||
text: "Cancel"
|
text: "Cancel"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
MyAvatar.setAttachmentsVariant(originalAttachments);
|
MyAvatar.setAttachmentsVariant(originalAttachments);
|
||||||
root.destroy()
|
closeDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,12 +185,14 @@ ScrollingWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
MyAvatar.setAttachmentsVariant(attachments);
|
MyAvatar.setAttachmentsVariant(attachments);
|
||||||
root.destroy()
|
closeDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
/*
|
||||||
onKeyboardRaisedChanged: {
|
onKeyboardRaisedChanged: {
|
||||||
if (keyboardEnabled && keyboardRaised) {
|
if (keyboardEnabled && keyboardRaised) {
|
||||||
// Scroll to item with focus if necessary.
|
// Scroll to item with focus if necessary.
|
||||||
|
@ -225,5 +209,6 @@ ScrollingWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
//
|
||||||
|
// 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 QtQuick.Controls 1.4
|
||||||
|
|
||||||
|
import "../../controls-uit" as HifiControls
|
||||||
|
import "../../styles-uit"
|
||||||
|
import "../dialogs/content"
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
objectName: "AttachmentsDialog"
|
||||||
|
|
||||||
|
property bool keyboardEnabled: false
|
||||||
|
property bool keyboardRaised: false
|
||||||
|
property bool punctuationMode: false
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: pane // Surrogate for ScrollingWindow's pane.
|
||||||
|
anchors.fill: parent
|
||||||
|
color: hifi.colors.baseGray // Match that of dialog so that dialog's rounded corners don't show.
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeDialog() {
|
||||||
|
Tablet.getTablet("com.highfidelity.interface.tablet.system").gotoHomeScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
AttachmentsContent {
|
||||||
|
id: attachments
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: keyboard.top
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
// Defocuses any current control so that the keyboard gets hidden.
|
||||||
|
id: mouseArea
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
keyboardEnabled = HMD.active;
|
||||||
|
}
|
||||||
|
}
|
|
@ -171,10 +171,10 @@ Menu::Menu() {
|
||||||
// Avatar > Attachments...
|
// Avatar > Attachments...
|
||||||
auto action = addActionToQMenuAndActionHash(avatarMenu, MenuOption::Attachments);
|
auto action = addActionToQMenuAndActionHash(avatarMenu, MenuOption::Attachments);
|
||||||
connect(action, &QAction::triggered, [] {
|
connect(action, &QAction::triggered, [] {
|
||||||
DependencyManager::get<OffscreenUi>()->show(QString("hifi/dialogs/AttachmentsDialog.qml"), "AttachmentsDialog");
|
qApp->showDialog(QString("hifi/dialogs/AttachmentsDialog.qml"),
|
||||||
|
QString("../../hifi/tablet/TabletAttachmentsDialog.qml"), "AttachmentsDialog");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Avatar > Size
|
// Avatar > Size
|
||||||
MenuWrapper* avatarSizeMenu = avatarMenu->addMenu("Size");
|
MenuWrapper* avatarSizeMenu = avatarMenu->addMenu("Size");
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <ScriptEngines.h>
|
#include <ScriptEngines.h>
|
||||||
#include "FileDialogHelper.h"
|
#include "FileDialogHelper.h"
|
||||||
#include "AudioClient.h"
|
#include "AudioClient.h"
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
|
|
||||||
|
|
||||||
static const float DPI = 30.47f;
|
static const float DPI = 30.47f;
|
||||||
|
@ -174,7 +175,9 @@ void Web3DOverlay::loadSourceURL() {
|
||||||
_webSurface->getRootContext()->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
|
_webSurface->getRootContext()->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
_webSurface->getRootContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());
|
_webSurface->getRootContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());
|
||||||
|
_webSurface->getRootContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
|
||||||
_webSurface->getRootContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
_webSurface->getRootContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
|
||||||
|
_webSurface->getRootContext()->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
|
||||||
_webSurface->getRootContext()->setContextProperty("pathToFonts", "../../");
|
_webSurface->getRootContext()->setContextProperty("pathToFonts", "../../");
|
||||||
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface->getRootItem(), _webSurface.data());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue