summaryrefslogtreecommitdiff
path: root/bar/TimeDate.qml
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-07-16 21:57:53 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-07-16 21:57:53 +0800
commit0470a7627f1579f1b7c54f0e234a251eae7141ba (patch)
treeb7f30d8059845088c0668ea284130648f83250b6 /bar/TimeDate.qml
parent127b9bcecdc3fe40e2113067bcbdb80e9d34d5bd (diff)
network: alt text signal
Diffstat (limited to 'bar/TimeDate.qml')
-rw-r--r--bar/TimeDate.qml167
1 files changed, 87 insertions, 80 deletions
diff --git a/bar/TimeDate.qml b/bar/TimeDate.qml
index cf7a450..b02cafb 100644
--- a/bar/TimeDate.qml
+++ b/bar/TimeDate.qml
@@ -7,7 +7,9 @@ import qs.config
Item {
id: root
+
property bool isAlt: false
+ property bool isCollapsed: false
implicitWidth: container.implicitWidth
implicitHeight: container.implicitHeight - General.rectMargin
@@ -15,103 +17,108 @@ Item {
id: container
anchors {
fill: parent
- verticalCenter: parent.verticalCenter
- horizontalCenter: parent.horizontalCenter
+ centerIn: parent
}
- implicitWidth: !isAlt ? nonAlt.implicitWidth + General.rectMargin * 2 : alt.implicitWidth + General.rectMargin * 2
+ // implicitWidth: !isAlt ? nonAlt.implicitWidth + General.rectMargin * 2 : alt.implicitWidth + General.rectMargin * 2
+ implicitWidth: layout.width + General.rectMargin * 2
implicitHeight: Bar.height
color: WallustColors.color4
radius: Style.rounding.large
- Loader {
- id: nonAlt
- anchors.fill: parent
- active: !root.isAlt
- sourceComponent: Component {
- RowLayout {
- Item {
- Layout.fillWidth: true
- }
- anchors.fill: parent
- spacing: Bar.resourceIconTextSpacing
-
- Icon {
- text: Icons.resource.clock
- font.pixelSize: Style.font.size.larger
- }
+ RowLayout {
+ id: layout
+ anchors.centerIn: parent
+ spacing: Bar.resourceIconTextSpacing
+ Loader {
+ id: nonAlt
+ active: !root.isAlt
+ visible: !root.isAlt
+ sourceComponent: Component {
RowLayout {
- property int h: Services.TimeDate.hours
- property int m: Services.TimeDate.minutes
- property int s: Services.TimeDate.seconds
- spacing: 0
- IText {
- animate: true
- text: (parent.h >= 10 ? "" : "0") + parent.h
- }
- IText {
- text: ":"
+ Item {
+ Layout.fillWidth: true
}
- IText {
- animate: true
- text: (parent.m >= 10 ? "" : "0") + parent.m
+ anchors.centerIn: parent
+ spacing: Bar.resourceIconTextSpacing
+
+ Icon {
+ text: Icons.resource.clock
+ font.pixelSize: Style.font.size.larger
}
- IText {
- text: ":"
+ RowLayout {
+ property int h: Services.TimeDate.hours
+ property int m: Services.TimeDate.minutes
+ property int s: Services.TimeDate.seconds
+ spacing: 0
+ IText {
+ animate: true
+ text: (parent.h >= 10 ? "" : "0") + parent.h
+ }
+ IText {
+ text: ":"
+ }
+ IText {
+ animate: true
+ text: (parent.m >= 10 ? "" : "0") + parent.m
+ }
+ IText {
+ text: ":"
+ }
+ IText {
+ animate: true
+ text: (parent.s >= 10 ? "" : "0") + parent.s
+ }
}
- IText {
- animate: true
- text: (parent.s >= 10 ? "" : "0") + parent.s
+ Item {
+ Layout.fillWidth: true
}
- }
- Item {
- Layout.fillWidth: true
- }
- SequentialAnimation {
- running: true
- NumberAnimation {
- target: parent
- property: "opacity"
- from: 0
- to: 1
- duration: General.animateDuration / 2
+ SequentialAnimation {
+ running: true
+ NumberAnimation {
+ target: parent
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: General.animateDuration / 2
+ }
}
}
}
}
- }
- Loader {
- id: alt
- anchors.fill: parent
- active: root.isAlt
- sourceComponent: Component {
- RowLayout {
- Item {
- Layout.fillWidth: true
- }
- anchors.fill: parent
- spacing: Bar.resourceIconTextSpacing
+ Loader {
+ id: alt
+ active: root.isAlt
+ visible: root.isAlt
+ sourceComponent: Component {
+ RowLayout {
+ Item {
+ Layout.fillWidth: true
+ }
+ anchors.centerIn: parent
+ spacing: Bar.resourceIconTextSpacing
- Icon {
- text: Icons.resource.calendar
- font.pixelSize: Style.font.size.larger
- }
- IText {
- animate: true
- text: Services.TimeDate.date
- }
- Item {
- Layout.fillWidth: true
- }
- SequentialAnimation {
- running: true
- NumberAnimation {
- target: parent
- property: "opacity"
- from: 0
- to: 1
- duration: General.animateDuration / 2
+ Icon {
+ text: Icons.resource.calendar
+ font.pixelSize: Style.font.size.larger
+ }
+ IText {
+ animate: true
+ text: Services.TimeDate.date
+ }
+ Item {
+ Layout.fillWidth: true
+ }
+ SequentialAnimation {
+ running: true
+ NumberAnimation {
+ target: parent
+ property: "opacity"
+ from: 0
+ to: 1
+ duration: General.animateDuration / 2
+ }
}
}
}