From b9869264badce1cf473d86d3ccfbb64a6f91e419 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 2 Mar 2017 13:16:23 +1300 Subject: [PATCH] Display avatar settings dialog in tablet --- .../hifi/tablet/TabletAvatarPreferences.qml | 41 +++++++++++++++++++ interface/src/Application.cpp | 10 +++++ interface/src/Application.h | 2 + interface/src/Menu.cpp | 3 +- 4 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml diff --git a/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml b/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml new file mode 100644 index 0000000000..a4a0dabd58 --- /dev/null +++ b/interface/resources/qml/hifi/tablet/TabletAvatarPreferences.qml @@ -0,0 +1,41 @@ +// +// TabletAvatarPreferences.qml +// +// Created by Davd Rowe on 2 Mar 2017. +// Copyright 2017 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 "tabletWindows" +import "../../dialogs" +import QtQuick.Controls 1.4 +import QtQuick.Controls.Styles 1.4 +import QtGraphicalEffects 1.0 + +StackView { + id: profileRoot + initialItem: root + objectName: "stack" + + property var eventBridge; + signal sendToScript(var message); + + function pushSource(path) { + editRoot.push(Qt.reslovedUrl(path)); + } + + function popSource() { + + } + + TabletPreferencesDialog { + id: root + objectName: "TabletAvatarPreferences" + width: parent.width + height: parent.height + showCategories: ["Avatar Basics", "Avatar Tuning", "Avatar Camera"] + } +} diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8bb2092f94..7f6a6ce2b3 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5853,6 +5853,16 @@ void Application::addAssetToWorldFromURL(QString url) { request->send(); } +void Application::showDialog(const QString& desktopURL, const QString& tabletURL, const QString& name) const { + auto tabletScriptingInterface = DependencyManager::get(); + auto tablet = dynamic_cast(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); + if (tablet->getToolbarMode() && tablet->getTabletRoot() && !isHMDMode()) { + DependencyManager::get()->show(desktopURL, name); + } else { + tablet->loadQMLSource(tabletURL); + } +} + void Application::addAssetToWorldFromURLRequestFinished() { auto request = qobject_cast(sender()); auto url = request->getUrl().toString(); diff --git a/interface/src/Application.h b/interface/src/Application.h index 13c1458aee..c4e1fad207 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -331,6 +331,8 @@ public slots: void toggleRunningScriptsWidget() const; Q_INVOKABLE void showAssetServerWidget(QString filePath = ""); + void showDialog(const QString& desktopURL, const QString& tabletURL, const QString& name) const; + // FIXME: Move addAssetToWorld* methods to own class? void addAssetToWorldFromURL(QString url); void addAssetToWorldFromURLRequestFinished(); diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index acf97ad5f7..f5f624caf1 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -300,7 +300,8 @@ Menu::Menu() { // Settings > Avatar... action = addActionToQMenuAndActionHash(settingsMenu, "Avatar..."); connect(action, &QAction::triggered, [] { - DependencyManager::get()->toggle(QString("hifi/dialogs/AvatarPreferencesDialog.qml"), "AvatarPreferencesDialog"); + qApp->showDialog(QString("hifi/dialogs/AvatarPreferencesDialog.qml"), + QString("../../hifi/tablet/TabletAvatarPreferences.qml"), "AvatarPreferencesDialog"); }); // Settings > LOD...