From d9ca8a826d4ea438db10693f07d7a580e0035b3c Mon Sep 17 00:00:00 2001 From: Vladyslav Stelmakhovskyi Date: Tue, 14 Mar 2017 17:02:09 +0100 Subject: [PATCH] TabletEntityStatistics.qml refactored. Text now wrapped. TODO: coloring, server stats --- .../hifi/dialogs/TabletEntityStatistics.qml | 144 +++--------------- .../dialogs/TabletEntityStatisticsItem.qml | 48 ++++++ interface/src/ui/OctreeStatsProvider.cpp | 1 + 3 files changed, 74 insertions(+), 119 deletions(-) create mode 100644 interface/resources/qml/hifi/dialogs/TabletEntityStatisticsItem.qml diff --git a/interface/resources/qml/hifi/dialogs/TabletEntityStatistics.qml b/interface/resources/qml/hifi/dialogs/TabletEntityStatistics.qml index bd7796927e..f6fdf90474 100644 --- a/interface/resources/qml/hifi/dialogs/TabletEntityStatistics.qml +++ b/interface/resources/qml/hifi/dialogs/TabletEntityStatistics.qml @@ -55,179 +55,91 @@ Rectangle { y: hifi.dimensions.tabletMenuHeader //-bgNavBar spacing: 20 - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Elements on Servers:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: elementsOnServerLabel - size: 16 + titleText: qsTr("Elements on Servers:") text: OctreeStats.serverElements - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Local Elements:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: localElementsLabel - size: 16 + titleText: qsTr("Local Elements:") text: OctreeStats.localElements - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Elements Memory:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: elementsMemoryLabel - size: 16 + titleText: qsTr("Elements Memory:") text: OctreeStats.localElementsMemory - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Sending Mode:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: sendingModeLabel - size: 16 + titleText: qsTr("Sending Mode:") text: OctreeStats.sendingMode - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Incoming Entity Packets:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: incomingEntityPacketsLabel - size: 16 + titleText: qsTr("Incoming Entity Packets:") text: OctreeStats.processedPackets - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Processed Packets Elements:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: processedPacketsElementsLabel - size: 16 + titleText: qsTr("Processed Packets Elements:") text: OctreeStats.processedPacketsElements - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Processed Packets Entities:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: processedPacketsEntitiesLabel - size: 16 + titleText: qsTr("Processed Packets Entities:") text: OctreeStats.processedPacketsEntities - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Processed Packets Timing:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: processedPacketsTimingLabel - size: 16 + titleText: qsTr("Processed Packets Timing:") text: OctreeStats.processedPacketsTiming - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Outbound Entity Packets:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: outboundEntityPacketsLabel - size: 16 + titleText: qsTr("Outbound Entity Packets:") text: OctreeStats.outboundEditPackets - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Entity Update Time:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: entityUpdateTimeLabel - size: 16 + titleText: qsTr("Entity Update Time:") text: OctreeStats.entityUpdateTime - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } - HifiControls.Label { - size: 20 + TabletEntityStatisticsItem { anchors.left: parent.left anchors.right: parent.right - text: qsTr("Entity Updates:") - colorScheme: root.colorScheme - } - HifiControls.Label { - id: entityUpdatesLabel - size: 16 + titleText: qsTr("Entity Updates:") text: OctreeStats.entityUpdates - anchors.left: parent.left - anchors.right: parent.right colorScheme: root.colorScheme } @@ -242,18 +154,12 @@ Rectangle { state: "less" - HifiControls.Label { - size: 20 - width: parent.width - text: qsTr("Entity Server ") + (index+1) + ":" - colorScheme: root.colorScheme - } - HifiControls.Label { - id: entityServer1Label - size: 20 + TabletEntityStatisticsItem { width: parent.width + titleText: qsTr("Entity Server ") + (index+1) + ":" colorScheme: root.colorScheme } + Row { id: buttonsRow width: parent.width diff --git a/interface/resources/qml/hifi/dialogs/TabletEntityStatisticsItem.qml b/interface/resources/qml/hifi/dialogs/TabletEntityStatisticsItem.qml new file mode 100644 index 0000000000..c4509d5a76 --- /dev/null +++ b/interface/resources/qml/hifi/dialogs/TabletEntityStatisticsItem.qml @@ -0,0 +1,48 @@ +// +// TabletEntityStatistics.qml +// +// Created by Vlad Stelmahovsky on 3/11/17 +// 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 QtQuick.Controls 1.4 +import Qt.labs.settings 1.0 + +import "../../styles-uit" +import "../../controls-uit" as HifiControls + +Column { + id: root + property int colorScheme: hifi.colorSchemes.dark + + property alias titleText: titleLabel.text + property alias text: valueLabel.text + + HifiConstants { id: hifi } + + anchors.left: parent.left + anchors.right: parent.right + spacing: 10 + + HifiControls.Label { + id: titleLabel + size: 20 + anchors.left: parent.left + anchors.right: parent.right + colorScheme: root.colorScheme + } + + RalewaySemiBold { + id: valueLabel + anchors.left: parent.left + anchors.right: parent.right + wrapMode: Text.WordWrap + size: 16 + color: enabled ? (root.colorScheme == hifi.colorSchemes.light ? hifi.colors.lightGray : hifi.colors.lightGrayText) + : (root.colorScheme == hifi.colorSchemes.light ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight); + } +} diff --git a/interface/src/ui/OctreeStatsProvider.cpp b/interface/src/ui/OctreeStatsProvider.cpp index 057056d8ce..e8d863e2b8 100644 --- a/interface/src/ui/OctreeStatsProvider.cpp +++ b/interface/src/ui/OctreeStatsProvider.cpp @@ -151,6 +151,7 @@ void OctreeStatsProvider::updateOctreeStatsData() { unsigned long totalInternal = 0; unsigned long totalLeaves = 0; + m_sendingMode.clear(); NodeToOctreeSceneStats* sceneStats = qApp->getOcteeSceneStats(); sceneStats->withReadLock([&] { for (NodeToOctreeSceneStatsIterator i = sceneStats->begin(); i != sceneStats->end(); i++) {