Fix up audio stats displayed in tablet

This commit is contained in:
David Rowe 2017-03-03 16:45:35 +13:00
parent 02a2bb6fc3
commit 3285816fca
4 changed files with 94 additions and 8 deletions

View file

@ -40,6 +40,7 @@
#include <Preferences.h>
#include <ScriptEngines.h>
#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<AddressManager>().data());
_webSurface->getRootContext()->setContextProperty("Account", AccountScriptingInterface::getInstance());
_webSurface->getRootContext()->setContextProperty("AudioStats", DependencyManager::get<AudioClient>()->getStats().data());
_webSurface->getRootContext()->setContextProperty("HMD", DependencyManager::get<HMDScriptingInterface>().data());
_webSurface->getRootContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());
_webSurface->getRootContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());

View file

@ -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 {
}
}
}

View file

@ -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
}
}
}
}

View file

@ -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,