From 1c259d7878c00592916dc6acdb6e22771b22bbf1 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 12 Jul 2025 23:21:58 +0800 Subject: finish organize --- bar/Cpu.qml | 23 +++++------------------ bar/Gpu.qml | 22 ++++------------------ bar/Memory.qml | 21 ++++----------------- bar/Network.qml | 6 +++--- bar/Power.qml | 27 +++++++++++++++++++++++++++ bar/Temp.qml | 21 ++++----------------- bar/TimeDate.qml | 2 +- 7 files changed, 48 insertions(+), 74 deletions(-) create mode 100644 bar/Power.qml (limited to 'bar') diff --git a/bar/Cpu.qml b/bar/Cpu.qml index 5d65415..00cf53c 100644 --- a/bar/Cpu.qml +++ b/bar/Cpu.qml @@ -1,27 +1,14 @@ import QtQuick import QtQuick.Layouts +import qs.components +import qs.config import qs.services as Services -import qs.utils -import qs.config as Config Item { id: root - RowLayout { - Item { - Layout.fillWidth: true - } - anchors.fill: parent - spacing: Config.Bar.resourceIconTextSpacing - - Icons { - text: Config.Icons.resource.cpu - } - Text { - text: Math.round(Services.Resource.cpuUsage * 100) - } - Item { - Layout.fillWidth: true - } + SimpleResource { + text: Math.round(Services.Resource.cpuUsage * 100) + icon: Icons.resource.cpu } } diff --git a/bar/Gpu.qml b/bar/Gpu.qml index e47d8f8..a0e1dd6 100644 --- a/bar/Gpu.qml +++ b/bar/Gpu.qml @@ -2,26 +2,12 @@ import QtQuick import QtQuick.Layouts import qs.services as Services -import qs.utils +import qs.components import qs.config as Config Item { - id: root - RowLayout { - Item { - Layout.fillWidth: true - } - anchors.fill: parent - spacing: Config.Bar.resourceIconTextSpacing - - Icons { - text: Config.Icons.resource.gpu - } - Text { - text: Services.Resource.gpuUsage - } - Item { - Layout.fillWidth: true - } + SimpleResource { + icon: Config.Icons.resource.gpu + text: Services.Resource.gpuUsage } } diff --git a/bar/Memory.qml b/bar/Memory.qml index 130c9ea..30a17e6 100644 --- a/bar/Memory.qml +++ b/bar/Memory.qml @@ -2,26 +2,13 @@ import QtQuick import QtQuick.Layouts import qs.services as Services -import qs.utils +import qs.components import qs.config as Config Item { id: root - RowLayout { - Item { - Layout.fillWidth: true - } - anchors.fill: parent - spacing: Config.Bar.resourceIconTextSpacing - - Icons { - text: Config.Icons.resource.memory - } - Text { - text: Math.round(Services.Resource.memoryUsedPercentage * 100) + "%" - } - Item { - Layout.fillWidth: true - } + SimpleResource { + icon: Config.Icons.resource.memory + text: Math.round(Services.Resource.memoryUsedPercentage * 100) + "%" } } diff --git a/bar/Network.qml b/bar/Network.qml index df70ecd..3559df0 100644 --- a/bar/Network.qml +++ b/bar/Network.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Layouts import qs.services as Services -import qs.utils +import qs.components import qs.config as Config Item { @@ -22,10 +22,10 @@ Item { text: Math.round(Services.Resource.cpuUsage * 100) } Text { - text: NetworkUsage.up + " " + NetworkUsage.upUnit + text: Services.NetworkUsage.up + " " + Services.NetworkUsage.upUnit } Text { - text: NetworkUsage.down + " " + NetworkUsage.downUnit + text: Services.NetworkUsage.down + " " + Services.NetworkUsage.downUnit } Item { Layout.fillWidth: true diff --git a/bar/Power.qml b/bar/Power.qml new file mode 100644 index 0000000..93da141 --- /dev/null +++ b/bar/Power.qml @@ -0,0 +1,27 @@ +import QtQuick +import QtQuick.Layouts + +import qs.services as Services +import qs.utils +import qs.config as Config + +Item { + id: root + RowLayout { + Item { + Layout.fillWidth: true + } + anchors.fill: parent + spacing: Config.Bar.resourceIconTextSpacing + + Icons { + text: Config.Icons.resource.clock + } + Text { + text: Services.TimeDate.time + } + Item { + Layout.fillWidth: true + } + } +} diff --git a/bar/Temp.qml b/bar/Temp.qml index c2c5f1d..fb84e5a 100644 --- a/bar/Temp.qml +++ b/bar/Temp.qml @@ -2,26 +2,13 @@ import QtQuick import QtQuick.Layouts import qs.services as Services -import qs.utils +import qs.components import qs.config as Config Item { id: root - RowLayout { - Item { - Layout.fillWidth: true - } - anchors.fill: parent - spacing: Config.Bar.resourceIconTextSpacing - - Icons { - text: Config.Icons.resource.temp - } - Text { - text: Math.round(Services.Resource.cpuTemp * 100) - } - Item { - Layout.fillWidth: true - } + SimpleResource { + icon: Config.Icons.resource.temp + text: Math.round(Services.Resource.cpuTemp * 100) } } diff --git a/bar/TimeDate.qml b/bar/TimeDate.qml index 93da141..807566a 100644 --- a/bar/TimeDate.qml +++ b/bar/TimeDate.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Layouts import qs.services as Services -import qs.utils +import qs.components import qs.config as Config Item { -- cgit v1.2.3