RinUI 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. RinUI/__init__.py +4 -4
  2. RinUI/assets/fonts/FluentSystemIcons-Index.js +5255 -5255
  3. RinUI/components/Base.qml +78 -78
  4. RinUI/components/BasicInput/Button.qml +146 -146
  5. RinUI/components/BasicInput/CheckBox.qml +98 -98
  6. RinUI/components/BasicInput/ComboBox.qml +159 -159
  7. RinUI/components/BasicInput/DropDownButton.qml +20 -20
  8. RinUI/components/BasicInput/Hyperlink.qml +17 -17
  9. RinUI/components/BasicInput/PillButton.qml +10 -10
  10. RinUI/components/BasicInput/RadioButton.qml +94 -94
  11. RinUI/components/BasicInput/RoundButton.qml +26 -26
  12. RinUI/components/BasicInput/Slider.qml +212 -212
  13. RinUI/components/BasicInput/Switch.qml +101 -101
  14. RinUI/components/BasicInput/ToggleButton.qml +10 -10
  15. RinUI/components/BasicInput/ToolButton.qml +30 -30
  16. RinUI/components/ContextMenu.qml +183 -183
  17. RinUI/components/DateAndTime/DatePicker.qml +142 -140
  18. RinUI/components/DateAndTime/PickerView.qml +223 -223
  19. RinUI/components/DateAndTime/TimePicker.qml +114 -114
  20. RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -106
  21. RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -47
  22. RinUI/components/DialogsAndFlyouts/Flyout.qml +87 -87
  23. RinUI/components/DialogsAndFlyouts/Popup.qml +110 -106
  24. RinUI/components/FocusIndicator.qml +33 -33
  25. RinUI/components/IconWidget.qml +52 -52
  26. RinUI/components/Indicator.qml +89 -89
  27. RinUI/components/Layout/Expander.qml +159 -159
  28. RinUI/components/Layout/SettingExpander.qml +66 -66
  29. RinUI/components/Layout/SettingItem.qml +70 -70
  30. RinUI/components/ListAndCollections/Clip.qml +21 -21
  31. RinUI/components/ListAndCollections/Frame.qml +43 -43
  32. RinUI/components/ListAndCollections/ListView.qml +104 -104
  33. RinUI/components/ListAndCollections/ListViewDelegate.qml +82 -82
  34. RinUI/components/ListAndCollections/SettingCard.qml +72 -72
  35. RinUI/components/ListAndCollections/TableView.qml +81 -81
  36. RinUI/components/ListAndCollections/TableViewDelegate.qml +88 -88
  37. RinUI/components/Media/Avatar.qml +82 -82
  38. RinUI/components/MenusAndToolbars/Menu.qml +150 -150
  39. RinUI/components/MenusAndToolbars/MenuBar.qml +42 -42
  40. RinUI/components/MenusAndToolbars/MenuItem.qml +131 -131
  41. RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -43
  42. RinUI/components/MenusAndToolbars/MenuSeparator.qml +13 -13
  43. RinUI/components/MenusAndToolbars/TextInputMenu.qml +37 -37
  44. RinUI/components/MenusAndToolbars/ToolSeparator.qml +16 -16
  45. RinUI/components/Navigation/ErrorPage.qml +48 -48
  46. RinUI/components/Navigation/NavigationBar.qml +179 -179
  47. RinUI/components/Navigation/NavigationItem.qml +193 -193
  48. RinUI/components/Navigation/NavigationSubItem.qml +103 -103
  49. RinUI/components/Navigation/NavigationView.qml +228 -227
  50. RinUI/components/Navigation/Segmented.qml +16 -16
  51. RinUI/components/Navigation/SegmentedItem.qml +107 -107
  52. RinUI/components/Navigation/SelectorBar.qml +12 -12
  53. RinUI/components/Navigation/SelectorBarItem.qml +88 -88
  54. RinUI/components/ScrollBar.qml +204 -204
  55. RinUI/components/ScrollView.qml +12 -12
  56. RinUI/components/Shadow.qml +47 -47
  57. RinUI/components/StatusAndInfo/InfoBadge.qml +77 -77
  58. RinUI/components/StatusAndInfo/InfoBar.qml +256 -251
  59. RinUI/components/StatusAndInfo/ProgressBar.qml +126 -126
  60. RinUI/components/StatusAndInfo/ProgressRing.qml +149 -0
  61. RinUI/components/StatusAndInfo/Toast.qml +236 -236
  62. RinUI/components/StatusAndInfo/ToolTip.qml +93 -93
  63. RinUI/components/Text/SpinBox.qml +150 -133
  64. RinUI/components/Text/Text.qml +44 -44
  65. RinUI/components/Text/TextArea.qml +117 -117
  66. RinUI/components/Text/TextField.qml +113 -113
  67. RinUI/components/Text/TextInput.qml +47 -47
  68. RinUI/components/qmldir +80 -80
  69. RinUI/core/__init__.py +4 -4
  70. RinUI/core/config.py +129 -129
  71. RinUI/core/launcher.py +129 -129
  72. RinUI/core/theme.py +339 -339
  73. RinUI/core/translator.py +25 -25
  74. RinUI/hooks/__init__.py +3 -3
  75. RinUI/hooks/hook-RinUI.py +3 -3
  76. RinUI/qmldir +108 -104
  77. RinUI/themes/Appearance.qml +36 -0
  78. RinUI/themes/Colors.qml +36 -0
  79. RinUI/themes/dark.qml +145 -145
  80. RinUI/themes/light.qml +145 -145
  81. RinUI/themes/qmldir +9 -6
  82. RinUI/themes/theme.qml +151 -149
  83. RinUI/themes/utils.qml +37 -37
  84. RinUI/utils/Animation.qml +12 -12
  85. RinUI/utils/FloatLayer.qml +132 -123
  86. RinUI/utils/FontIconLoader.qml +13 -13
  87. RinUI/utils/Position.qml +19 -19
  88. RinUI/utils/Severity.qml +13 -13
  89. RinUI/utils/Typography.qml +17 -17
  90. RinUI/utils/qmldir +4 -4
  91. RinUI/windows/CtrlBtn.qml +118 -118
  92. RinUI/windows/FluentPage.qml +92 -92
  93. RinUI/windows/FluentWindow.qml +31 -30
  94. RinUI/windows/FluentWindowBase.qml +158 -158
  95. RinUI/windows/TitleBar.qml +135 -135
  96. RinUI/windows/qmldir +7 -7
  97. RinUI/windows/window/ApplicationWindow.qml +8 -8
  98. RinUI/windows/window/Window.qml +118 -118
  99. {rinui-0.1.0.data → rinui-0.1.1.data}/data/LICENSE +21 -21
  100. {rinui-0.1.0.data → rinui-0.1.1.data}/data/README.md +100 -100
  101. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/METADATA +116 -115
  102. rinui-0.1.1.dist-info/RECORD +112 -0
  103. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/WHEEL +1 -1
  104. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info/licenses}/LICENSE +21 -21
  105. RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
  106. RinUI/config/rin_ui.json +0 -8
  107. RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
  108. RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
  109. RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
  110. RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
  111. RinUI/core/__pycache__/translator.cpython-38.pyc +0 -0
  112. rinui-0.1.0.dist-info/RECORD +0 -116
  113. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/entry_points.txt +0 -0
  114. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/top_level.txt +0 -0
@@ -1,78 +1,78 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls.Basic 2.15
3
- import QtQuick.Layouts 2.15
4
- import "../../themes"
5
- import "../../components"
6
-
7
-
8
- Rectangle {
9
- id: root
10
- property int count: -1
11
- property string text: {
12
- if (root.count < 0)
13
- return ""
14
- else if (root.count > maxCount)
15
- return maxCount + "+"
16
- else
17
- return count.toString()
18
- }
19
- property int maxCount: 99
20
- property string icon: {
21
- switch (severity) {
22
- case Severity.Info: return "ic_fluent_text_asterisk_20_filled";
23
- case Severity.Success: return "ic_fluent_checkmark_20_filled";
24
- case Severity.Warning: return "!";
25
- case Severity.Error: return "ic_fluent_dismiss_20_filled";
26
- default: return "";
27
- }
28
- }
29
- property bool dot: false
30
- property int severity: Severity.Info
31
-
32
- property bool solid: true
33
- property color primaryColor: {
34
- switch (severity) {
35
- case Severity.Info: return Theme.currentTheme.colors.systemAttentionColor;
36
- case Severity.Success: return Theme.currentTheme.colors.systemSuccessColor;
37
- case Severity.Warning: return Theme.currentTheme.colors.systemCautionColor;
38
- case Severity.Error: return Theme.currentTheme.colors.systemCriticalColor;
39
- default: return Theme.currentTheme.colors.systemNeutralColor;
40
- }
41
- }
42
-
43
- width: dot ? 4 : Math.max(contents.width + 6, 16) + !solid * 2
44
- height: dot ? 4 : 16 + !solid * 2
45
- radius: height / 2
46
-
47
- RowLayout {
48
- id: contents
49
- anchors.centerIn: parent
50
- spacing: 4
51
- visible: !root.dot
52
-
53
- IconWidget {
54
- icon: root.icon
55
- size: 10
56
- color: solid ? Theme.currentTheme.colors.textOnAccentColor : primaryColor
57
- visible: !root.text
58
- }
59
-
60
- Text {
61
- typography: Typography.Caption
62
- text: root.text
63
- color: solid ? Theme.currentTheme.colors.textOnAccentColor : primaryColor
64
- visible: root.text
65
- }
66
- }
67
-
68
- color: solid ? primaryColor : "transparent"
69
- border.width: Theme.currentTheme.appearance.borderWidth
70
- border.color: solid ? "transparent" : primaryColor
71
-
72
- Behavior on color {
73
- ColorAnimation {
74
- duration: Utils.appearanceSpeed
75
- easing.type: Easing.OutQuint
76
- }
77
- }
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../themes"
5
+ import "../../components"
6
+
7
+
8
+ Rectangle {
9
+ id: root
10
+ property int count: -1
11
+ property string text: {
12
+ if (root.count < 0)
13
+ return ""
14
+ else if (root.count > maxCount)
15
+ return maxCount + "+"
16
+ else
17
+ return count.toString()
18
+ }
19
+ property int maxCount: 99
20
+ property string icon: {
21
+ switch (severity) {
22
+ case Severity.Info: return "ic_fluent_text_asterisk_20_filled";
23
+ case Severity.Success: return "ic_fluent_checkmark_20_filled";
24
+ case Severity.Warning: return "!";
25
+ case Severity.Error: return "ic_fluent_dismiss_20_filled";
26
+ default: return "";
27
+ }
28
+ }
29
+ property bool dot: false
30
+ property int severity: Severity.Info
31
+
32
+ property bool solid: true
33
+ property color primaryColor: {
34
+ switch (severity) {
35
+ case Severity.Info: return Theme.currentTheme.colors.systemAttentionColor;
36
+ case Severity.Success: return Theme.currentTheme.colors.systemSuccessColor;
37
+ case Severity.Warning: return Theme.currentTheme.colors.systemCautionColor;
38
+ case Severity.Error: return Theme.currentTheme.colors.systemCriticalColor;
39
+ default: return Theme.currentTheme.colors.systemNeutralColor;
40
+ }
41
+ }
42
+
43
+ width: dot ? 4 : Math.max(contents.width + 6, 16) + !solid * 2
44
+ height: dot ? 4 : 16 + !solid * 2
45
+ radius: height / 2
46
+
47
+ RowLayout {
48
+ id: contents
49
+ anchors.centerIn: parent
50
+ spacing: 4
51
+ visible: !root.dot
52
+
53
+ IconWidget {
54
+ icon: root.icon
55
+ size: 10
56
+ color: solid ? Theme.currentTheme.colors.textOnAccentColor : primaryColor
57
+ visible: !root.text
58
+ }
59
+
60
+ Text {
61
+ typography: Typography.Caption
62
+ text: root.text
63
+ color: solid ? Theme.currentTheme.colors.textOnAccentColor : primaryColor
64
+ visible: root.text
65
+ }
66
+ }
67
+
68
+ color: solid ? primaryColor : "transparent"
69
+ border.width: Theme.currentTheme.appearance.borderWidth
70
+ border.color: solid ? "transparent" : primaryColor
71
+
72
+ Behavior on color {
73
+ ColorAnimation {
74
+ duration: Utils.appearanceSpeed
75
+ easing.type: Easing.OutQuint
76
+ }
77
+ }
78
78
  }
@@ -1,252 +1,257 @@
1
- import QtQuick 2.15
2
- import QtQuick.Layouts 2.15
3
- import "../../themes"
4
- import "../../components"
5
-
6
-
7
- Frame {
8
- id: infoBar
9
- property string title: ""
10
- property string text: ""
11
- property int severity: Severity.Info
12
- property alias customContent: custom.data
13
- property int timeout: -1
14
- property int position: 0
15
- property bool isDynamic: false // 动态创建
16
- property bool closable: true // 显示关闭按钮
17
- property bool iconVisible: true // 显示图标
18
- property real startPosX: {
19
- switch (position) {
20
- case Position.TopLeft:
21
- case Position.BottomLeft:
22
- return -width / 2;
23
- case Position.TopRight:
24
- case Position.BottomRight:
25
- return width / 2;
26
- default:
27
- return 0;
28
- }
29
- }
30
-
31
- property real startPosY: 0
32
- readonly property real endPosX: x
33
-
34
-
35
- function calculateStartPosY() {
36
- switch (position) {
37
- case Position.Top:
38
- return -height / 2 ;
39
- case Position.Bottom:
40
- return height / 2 ;
41
- default:
42
- return 0;
43
- }
44
- }
45
-
46
- color: {
47
- switch (severity) {
48
- case Severity.Info: return Theme.currentTheme.colors.systemAttentionBackgroundColor;
49
- case Severity.Success: return Theme.currentTheme.colors.systemSuccessBackgroundColor;
50
- case Severity.Warning: return Theme.currentTheme.colors.systemCautionBackgroundColor;
51
- case Severity.Error: return Theme.currentTheme.colors.systemCriticalBackgroundColor;
52
- default: return Theme.currentTheme.colors.systemNeutralBackgroundColor;
53
- }
54
- }
55
-
56
- // width: 200
57
- Layout.fillWidth: true
58
- padding: 5
59
- leftPadding: 15
60
- hoverable: false
61
- opacity: 0
62
-
63
- Timer {
64
- id: autoCloseTimer
65
- interval: timeout
66
- running: timeout >= 0
67
- repeat: false
68
- onTriggered: {
69
- // infoBar.visible = false
70
- // infoBar.destroy()
71
- exitAnimation.start()
72
- }
73
- }
74
-
75
- RowLayout {
76
- id: main
77
- anchors.fill: parent
78
- spacing: 13
79
-
80
- IconWidget {
81
- id: iconWidget
82
- Layout.preferredHeight: 38
83
- Layout.alignment: Qt.AlignTop
84
- size: 18
85
- icon: {
86
- switch (severity) {
87
- case Severity.Info: return "ic_fluent_info_20_filled";
88
- case Severity.Success: return "ic_fluent_checkmark_circle_20_filled";
89
- case Severity.Warning: return "ic_fluent_error_circle_20_filled";
90
- case Severity.Error: return "ic_fluent_dismiss_circle_20_filled";
91
- default: return "ic_fluent_question_circle_20_filled";
92
- }
93
- }
94
- color: {
95
- switch (severity) {
96
- case Severity.Info: return Theme.currentTheme.colors.systemAttentionColor;
97
- case Severity.Success: return Theme.currentTheme.colors.systemSuccessColor;
98
- case Severity.Warning: return Theme.currentTheme.colors.systemCautionColor;
99
- case Severity.Error: return Theme.currentTheme.colors.systemCriticalColor;
100
- default: return Theme.currentTheme.colors.systemNeutralColor;
101
- }
102
- }
103
- visible: iconVisible
104
- }
105
-
106
- Flow {
107
- id: flow
108
- Layout.alignment: Qt.AlignTop
109
- Layout.fillWidth: true
110
- Layout.topMargin: 3
111
- // Layout.bottomMargin: 8
112
- spacing: bodyText.wrap ? 0 :12
113
-
114
- Text {
115
- id: titleText
116
- typography: Typography.BodyStrong
117
- text: infoBar.title
118
- topPadding: 6
119
- }
120
- Text {
121
- id: bodyText
122
- property bool wrap: (
123
- (
124
- infoBar.width - iconWidget.width - rights.width - main.spacing * 2 - infoBar.padding * 2
125
- )
126
- < implicitWidth
127
- )
128
- width: wrap ?
129
- parent.width : implicitWidth
130
- typography: Typography.Body
131
- text: infoBar.text
132
- topPadding: wrap? 0 : 6
133
- }
134
-
135
- Item {
136
- width: parent.width
137
- height: bodyText.wrap && custom.children.length > 0 ? 16 : 0
138
- }
139
- Row {
140
- id: custom
141
- spacing: 6
142
- }
143
- Item {
144
- width: parent.width
145
- height: bodyText.wrap ? 9 : 0
146
- }
147
- }
148
-
149
- RowLayout {
150
- id: rights
151
- Layout.alignment: Qt.AlignTop
152
-
153
- ToolButton {
154
- Layout.alignment: Qt.AlignTop
155
- id: closeButton
156
- flat: true
157
- icon.name: "ic_fluent_dismiss_20_regular"
158
- size: 18
159
- Layout.preferredWidth: 38
160
- Layout.preferredHeight: 38
161
- visible: closable
162
- onClicked: {
163
- exitAnimation.start()
164
- // if (infoBar.isDynamic) {
165
- // infoBar.destroy()
166
- // } else {
167
- // infoBar.visible = false
168
- // }
169
- }
170
- ToolTip {
171
- text: qsTr("Close")
172
- parent: parent
173
- visible: parent.hovered
174
- }
175
- }
176
- }
177
- }
178
-
179
-
180
- // Animations
181
- Component.onCompleted: {
182
- startPosY = calculateStartPosY();
183
- enterAnimation.start()
184
- }
185
-
186
- // Behavior on y { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
187
- transform: Translate {
188
- id: slideTransform
189
- y: 0
190
- }
191
-
192
- ParallelAnimation {
193
- id: enterAnimation
194
-
195
- NumberAnimation{
196
- target: infoBar
197
- property: "x"
198
- from: infoBar.startPosX
199
- to: infoBar.endPosX
200
- easing.type: Easing.OutQuart
201
- duration: Utils.animationSpeed
202
- }
203
- NumberAnimation {
204
- target: slideTransform
205
- property: "y"
206
- from: infoBar.startPosY
207
- to: 0
208
- easing.type: Easing.OutCubic
209
- duration: Utils.animationSpeed
210
- }
211
- NumberAnimation{
212
- target: infoBar
213
- property: "opacity"
214
- from: 0
215
- to: 1
216
- duration: Utils.appearanceSpeed
217
- }
218
- }
219
-
220
- SequentialAnimation{
221
- id: exitAnimation
222
-
223
- ParallelAnimation{
224
- NumberAnimation{
225
- target: infoBar
226
- property: "y"
227
- to: infoBar.startPosY
228
- easing.type: Easing.OutQuart
229
- duration: Utils.animationSpeed
230
- running: false
231
- }
232
- NumberAnimation{
233
- target: infoBar
234
- property: "opacity"
235
- from: 1
236
- to: 0
237
- duration: Utils.appearanceSpeed
238
- }
239
- }
240
- ScriptAction{
241
- script: {
242
- if (infoBar.isDynamic) {
243
- infoBar.destroy()
244
- } else {
245
- infoBar.visible = false
246
- infoBar.opacity = 1
247
- infoBar.y = 0
248
- }
249
- }
250
- }
251
- }
1
+ import QtQuick 2.15
2
+ import QtQuick.Layouts 2.15
3
+ import "../../themes"
4
+ import "../../components"
5
+
6
+
7
+ Frame {
8
+ id: infoBar
9
+ property string title: ""
10
+ property string text: ""
11
+ property int severity: Severity.Info
12
+ property alias customContent: custom.data
13
+ property int timeout: -1
14
+ property int position: 0
15
+ property bool isDynamic: false // 动态创建
16
+ property bool closable: true // 显示关闭按钮
17
+ property bool iconVisible: true // 显示图标
18
+ property real startPosX: {
19
+ switch (position) {
20
+ case Position.TopLeft:
21
+ case Position.BottomLeft:
22
+ return -width / 2;
23
+ case Position.TopRight:
24
+ case Position.BottomRight:
25
+ return width / 2;
26
+ default:
27
+ return 0;
28
+ }
29
+ }
30
+
31
+ property real startPosY: 0
32
+ readonly property real endPosX: x
33
+
34
+
35
+ function _calculateStartPosY() {
36
+ switch (position) {
37
+ case Position.Top:
38
+ return -height / 2 ;
39
+ case Position.Bottom:
40
+ return height / 2 ;
41
+ default:
42
+ return 0;
43
+ }
44
+ }
45
+
46
+ function close() {
47
+ exitAnimation.start()
48
+ }
49
+
50
+ color: {
51
+ switch (severity) {
52
+ case Severity.Info: return Theme.currentTheme.colors.systemAttentionBackgroundColor;
53
+ case Severity.Success: return Theme.currentTheme.colors.systemSuccessBackgroundColor;
54
+ case Severity.Warning: return Theme.currentTheme.colors.systemCautionBackgroundColor;
55
+ case Severity.Error: return Theme.currentTheme.colors.systemCriticalBackgroundColor;
56
+ default: return Theme.currentTheme.colors.systemNeutralBackgroundColor;
57
+ }
58
+ }
59
+
60
+ // width: 200
61
+ Layout.fillWidth: true
62
+ padding: 5
63
+ leftPadding: 15
64
+ hoverable: false
65
+ opacity: 0
66
+
67
+ Timer {
68
+ id: autoCloseTimer
69
+ interval: timeout
70
+ running: timeout >= 0
71
+ repeat: false
72
+ onTriggered: {
73
+ // infoBar.visible = false
74
+ // infoBar.destroy()
75
+ exitAnimation.start()
76
+ }
77
+ }
78
+
79
+ RowLayout {
80
+ id: main
81
+ anchors.fill: parent
82
+ spacing: 13
83
+
84
+ IconWidget {
85
+ id: iconWidget
86
+ Layout.preferredHeight: 38
87
+ Layout.alignment: Qt.AlignTop
88
+ size: 18
89
+ icon: {
90
+ switch (severity) {
91
+ case Severity.Info: return "ic_fluent_info_20_filled";
92
+ case Severity.Success: return "ic_fluent_checkmark_circle_20_filled";
93
+ case Severity.Warning: return "ic_fluent_error_circle_20_filled";
94
+ case Severity.Error: return "ic_fluent_dismiss_circle_20_filled";
95
+ default: return "ic_fluent_question_circle_20_filled";
96
+ }
97
+ }
98
+ color: {
99
+ switch (severity) {
100
+ case Severity.Info: return Theme.currentTheme.colors.systemAttentionColor;
101
+ case Severity.Success: return Theme.currentTheme.colors.systemSuccessColor;
102
+ case Severity.Warning: return Theme.currentTheme.colors.systemCautionColor;
103
+ case Severity.Error: return Theme.currentTheme.colors.systemCriticalColor;
104
+ default: return Theme.currentTheme.colors.systemNeutralColor;
105
+ }
106
+ }
107
+ visible: iconVisible
108
+ }
109
+
110
+ Flow {
111
+ id: flow
112
+ Layout.alignment: Qt.AlignTop
113
+ Layout.fillWidth: true
114
+ Layout.topMargin: 3
115
+ // Layout.bottomMargin: 8
116
+ spacing: bodyText.wrap ? 0 :12
117
+
118
+ Text {
119
+ id: titleText
120
+ typography: Typography.BodyStrong
121
+ text: infoBar.title
122
+ topPadding: 6
123
+ }
124
+ Text {
125
+ id: bodyText
126
+ property bool wrap: (
127
+ (
128
+ infoBar.width - iconWidget.width - titleText.width - rights.width - custom.width
129
+ - main.spacing * 5 - infoBar.padding * 2
130
+ )
131
+ < implicitWidth
132
+ )
133
+ width: wrap ?
134
+ parent.width : implicitWidth
135
+ typography: Typography.Body
136
+ text: infoBar.text
137
+ topPadding: wrap? 0 : 6
138
+ }
139
+
140
+ Item {
141
+ width: parent.width
142
+ height: bodyText.wrap && custom.children.length > 0 ? 16 : 0
143
+ }
144
+ Row {
145
+ id: custom
146
+ spacing: 6
147
+ }
148
+ Item {
149
+ width: parent.width
150
+ height: bodyText.wrap ? 9 : 0
151
+ }
152
+ }
153
+
154
+ RowLayout {
155
+ id: rights
156
+ Layout.alignment: Qt.AlignTop
157
+
158
+ ToolButton {
159
+ Layout.alignment: Qt.AlignTop
160
+ id: closeButton
161
+ flat: true
162
+ icon.name: "ic_fluent_dismiss_20_regular"
163
+ size: 18
164
+ Layout.preferredWidth: 38
165
+ Layout.preferredHeight: 38
166
+ visible: closable
167
+ onClicked: {
168
+ exitAnimation.start()
169
+ // if (infoBar.isDynamic) {
170
+ // infoBar.destroy()
171
+ // } else {
172
+ // infoBar.visible = false
173
+ // }
174
+ }
175
+ ToolTip {
176
+ text: qsTr("Close")
177
+ parent: parent
178
+ visible: parent.hovered
179
+ }
180
+ }
181
+ }
182
+ }
183
+
184
+
185
+ // Animations
186
+ Component.onCompleted: {
187
+ startPosY = _calculateStartPosY();
188
+ enterAnimation.start()
189
+ }
190
+
191
+ // Behavior on y { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
192
+ transform: Translate {
193
+ id: slideTransform
194
+ y: 0
195
+ }
196
+
197
+ ParallelAnimation {
198
+ id: enterAnimation
199
+
200
+ NumberAnimation{
201
+ target: infoBar
202
+ property: "x"
203
+ from: infoBar.startPosX
204
+ to: infoBar.endPosX
205
+ easing.type: Easing.OutQuart
206
+ duration: Utils.animationSpeed
207
+ }
208
+ NumberAnimation {
209
+ target: slideTransform
210
+ property: "y"
211
+ from: infoBar.startPosY
212
+ to: 0
213
+ easing.type: Easing.OutCubic
214
+ duration: Utils.animationSpeed
215
+ }
216
+ NumberAnimation{
217
+ target: infoBar
218
+ property: "opacity"
219
+ from: 0
220
+ to: 1
221
+ duration: Utils.appearanceSpeed
222
+ }
223
+ }
224
+
225
+ SequentialAnimation{
226
+ id: exitAnimation
227
+
228
+ ParallelAnimation{
229
+ NumberAnimation{
230
+ target: infoBar
231
+ property: "y"
232
+ to: infoBar.startPosY
233
+ easing.type: Easing.OutQuart
234
+ duration: Utils.animationSpeed
235
+ running: false
236
+ }
237
+ NumberAnimation{
238
+ target: infoBar
239
+ property: "opacity"
240
+ from: 1
241
+ to: 0
242
+ duration: Utils.appearanceSpeed
243
+ }
244
+ }
245
+ ScriptAction{
246
+ script: {
247
+ if (infoBar.isDynamic) {
248
+ infoBar.destroy()
249
+ } else {
250
+ infoBar.visible = false
251
+ infoBar.opacity = 1
252
+ infoBar.y = 0
253
+ }
254
+ }
255
+ }
256
+ }
252
257
  }