From 3285816fca60d813bdc97aea6e4b16993dea2855 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 3 Mar 2017 16:45:35 +1300 Subject: [PATCH] Fix up audio stats displayed in tablet --- interface/src/ui/overlays/Web3DOverlay.cpp | 2 + .../audio/{DesktopStats.qml => Stats.qml} | 7 +- .../developer/utilities/audio/TabletStats.qml | 89 +++++++++++++++++++ scripts/developer/utilities/audio/stats.js | 4 +- 4 files changed, 94 insertions(+), 8 deletions(-) rename scripts/developer/utilities/audio/{DesktopStats.qml => Stats.qml} (96%) create mode 100644 scripts/developer/utilities/audio/TabletStats.qml diff --git a/interface/src/ui/overlays/Web3DOverlay.cpp b/interface/src/ui/overlays/Web3DOverlay.cpp index 8d72f877b6..508ac00c5f 100644 --- a/interface/src/ui/overlays/Web3DOverlay.cpp +++ b/interface/src/ui/overlays/Web3DOverlay.cpp @@ -40,6 +40,7 @@ #include #include #include "FileDialogHelper.h" +#include "AudioClient.h" static const float DPI = 30.47f; @@ -170,6 +171,7 @@ void Web3DOverlay::loadSourceURL() { _webSurface->getRootContext()->setContextProperty("offscreenFlags", flags); _webSurface->getRootContext()->setContextProperty("AddressManager", DependencyManager::get().data()); _webSurface->getRootContext()->setContextProperty("Account", AccountScriptingInterface::getInstance()); + _webSurface->getRootContext()->setContextProperty("AudioStats", DependencyManager::get()->getStats().data()); _webSurface->getRootContext()->setContextProperty("HMD", DependencyManager::get().data()); _webSurface->getRootContext()->setContextProperty("fileDialogHelper", new FileDialogHelper()); _webSurface->getRootContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get().data()); diff --git a/scripts/developer/utilities/audio/DesktopStats.qml b/scripts/developer/utilities/audio/Stats.qml similarity index 96% rename from scripts/developer/utilities/audio/DesktopStats.qml rename to scripts/developer/utilities/audio/Stats.qml index 346e5e3544..614c682f98 100644 --- a/scripts/developer/utilities/audio/DesktopStats.qml +++ b/scripts/developer/utilities/audio/Stats.qml @@ -1,5 +1,5 @@ // -// stats.qml +// Stats.qml // scripts/developer/utilities/audio // // Created by Zach Pomerantz on 9/22/2016 @@ -15,7 +15,6 @@ import QtQuick.Layouts 1.3 Column { id: stats width: parent.width - height: parent.height property bool showGraphs: toggleGraphs.checked RowLayout { @@ -35,11 +34,9 @@ Column { Grid { width: parent.width - height: parent.height - 30 Column { width: parent.width / 2 - height: parent.height Section { label: "Latency" @@ -76,7 +73,6 @@ Column { Column { width: parent.width / 2 - height: parent.height Section { label: "Mixer (upstream)" @@ -92,4 +88,3 @@ Column { } } } - diff --git a/scripts/developer/utilities/audio/TabletStats.qml b/scripts/developer/utilities/audio/TabletStats.qml new file mode 100644 index 0000000000..130b90f032 --- /dev/null +++ b/scripts/developer/utilities/audio/TabletStats.qml @@ -0,0 +1,89 @@ +// +// TabletStats.qml +// scripts/developer/utilities/audio +// +// Created by David Rowe on 3 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 QtQuick.Layouts 1.3 + +import "../../../../resources/qml/styles-uit" + +Item { + id: dialog + width: 480 + height: 720 + + HifiConstants { id: hifi } + + Rectangle { + id: header + height: 90 + anchors { + top: parent.top + left: parent.left + right: parent.right + } + z: 100 + + gradient: Gradient { + GradientStop { + position: 0 + color: "#2b2b2b" + } + + GradientStop { + position: 1 + color: "#1e1e1e" + } + } + + RalewayBold { + text: "Audio Interface Statistics" + size: 26 + color: "#34a2c7" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: hifi.dimensions.contentMargin.x // ####### hifi is not defined + } + } + + Rectangle { + id: main + anchors { + top: header.bottom + bottom: parent.bottom + left: parent.left + right: parent.right + } + + gradient: Gradient { + GradientStop { + position: 0 + color: "#2b2b2b" + } + + GradientStop { + position: 1 + color: "#0f212e" + } + } + + Flickable { + id: scrollView + width: parent.width + height: parent.height + contentWidth: parent.width + contentHeight: stats.height + + Stats { + id: stats + } + } + } +} diff --git a/scripts/developer/utilities/audio/stats.js b/scripts/developer/utilities/audio/stats.js index 064fd72fe5..382e14df5f 100644 --- a/scripts/developer/utilities/audio/stats.js +++ b/scripts/developer/utilities/audio/stats.js @@ -11,7 +11,7 @@ if (HMD.active && !Settings.getValue("HUDUIEnabled")) { var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); - var qml = Script.resolvePath("stats.qml"); + var qml = Script.resolvePath("TabletStats.qml"); tablet.loadQMLSource(qml); Script.stop(); @@ -19,7 +19,7 @@ if (HMD.active && !Settings.getValue("HUDUIEnabled")) { var INITIAL_WIDTH = 400; var INITIAL_OFFSET = 50; - var qml = Script.resolvePath("stats.qml"); + var qml = Script.resolvePath("Stats.qml"); var window = new OverlayWindow({ title: "Audio Interface Statistics", source: qml,