blob: cf7a4500c018cba09e035a435f40b39483456c38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
import QtQuick
import QtQuick.Layouts
import qs.services as Services
import qs.components
import qs.config
Item {
id: root
property bool isAlt: false
implicitWidth: container.implicitWidth
implicitHeight: container.implicitHeight - General.rectMargin
Rectangle {
id: container
anchors {
fill: parent
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
}
implicitWidth: !isAlt ? nonAlt.implicitWidth + General.rectMargin * 2 : alt.implicitWidth + 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 {
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
}
}
Item {
Layout.fillWidth: true
}
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
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
}
}
}
}
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onPressed: {
root.isAlt = !root.isAlt;
}
}
}
|