rounded sparkline graph, fixed network usage accumulation spikes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Internal
|
||||
import qs.Modules.Resources
|
||||
import qs.Helpers
|
||||
import qs.Components
|
||||
import qs.Config
|
||||
@@ -8,6 +9,8 @@ import qs.Config
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
required property Wrapper wrapper
|
||||
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitHeight: 220
|
||||
implicitWidth: 300
|
||||
@@ -47,6 +50,7 @@ CustomRect {
|
||||
SparklineItem {
|
||||
id: sparkline
|
||||
|
||||
property bool initialized: false
|
||||
property real smoothMax: targetMax
|
||||
property real targetMax: 1024
|
||||
|
||||
@@ -59,12 +63,23 @@ CustomRect {
|
||||
line2Color: DynamicColors.palette.m3tertiary
|
||||
line2FillAlpha: 0.2
|
||||
maxValue: smoothMax
|
||||
slideProgress: 1
|
||||
|
||||
Behavior on smoothMax {
|
||||
enabled: sparkline.initialized
|
||||
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
sparkline.targetMax = Math.max(NetworkUsage.downloadBuffer.maximum, NetworkUsage.uploadBuffer.maximum, 1024);
|
||||
|
||||
sparkline.smoothMax = Qt.binding(() => sparkline.targetMax);
|
||||
|
||||
sparkline.initialized = true;
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onValuesChanged(): void {
|
||||
sparkline.targetMax = Math.max(NetworkUsage.downloadBuffer.maximum, NetworkUsage.uploadBuffer.maximum, 1024);
|
||||
|
||||
@@ -9,6 +9,8 @@ import qs.Config
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property Wrapper wrapper
|
||||
|
||||
implicitHeight: content.implicitHeight + Appearance.padding.normal * 2
|
||||
implicitWidth: content.implicitWidth
|
||||
|
||||
@@ -98,6 +100,7 @@ Item {
|
||||
active: Config.dashboard.performance.showNetwork
|
||||
|
||||
sourceComponent: NetworkCard {
|
||||
wrapper: root.wrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ Item {
|
||||
anchors.centerIn: parent
|
||||
|
||||
sourceComponent: Content {
|
||||
wrapper: root
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user