Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/NotificationItem.qml
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 33 | ColumnLayout { | |||
---|---|---|---|---|---|
66 | 66 | | |||
67 | property QtObject jobDetails | 67 | property QtObject jobDetails | ||
68 | property bool showDetails | 68 | property bool showDetails | ||
69 | 69 | | |||
70 | property alias configureActionLabel: notificationHeading.configureActionLabel | 70 | property alias configureActionLabel: notificationHeading.configureActionLabel | ||
71 | property var actionNames: [] | 71 | property var actionNames: [] | ||
72 | property var actionLabels: [] | 72 | property var actionLabels: [] | ||
73 | 73 | | |||
74 | property int headingLeftPadding: 0 | 74 | property int headingLeftPadding: units.smallSpacing | ||
cfeck: Does this take into account layouts for RTL languages? | |||||
75 | property int headingRightPadding: 0 | 75 | property int headingRightPadding: 0 | ||
76 | property int headingTopPadding: 0 | ||||
77 | | ||||
78 | property int bodyLeftPadding: units.smallSpacing | ||||
79 | property int bodyRightPadding: units.smallSpacing | ||||
76 | 80 | | |||
77 | property int thumbnailLeftPadding: 0 | 81 | property int thumbnailLeftPadding: 0 | ||
78 | property int thumbnailRightPadding: 0 | 82 | property int thumbnailRightPadding: 0 | ||
79 | property int thumbnailTopPadding: 0 | 83 | property int thumbnailTopPadding: -units.smallSpacing | ||
80 | property int thumbnailBottomPadding: 0 | 84 | property int thumbnailBottomPadding: 0 | ||
81 | 85 | | |||
82 | readonly property bool menuOpen: bodyLabel.contextMenu !== null | 86 | readonly property bool menuOpen: bodyLabel.contextMenu !== null | ||
83 | || (thumbnailStripLoader.item && thumbnailStripLoader.item.menuOpen) | 87 | || (thumbnailStripLoader.item && thumbnailStripLoader.item.menuOpen) | ||
84 | || (jobLoader.item && jobLoader.item.menuOpen) | 88 | || (jobLoader.item && jobLoader.item.menuOpen) | ||
85 | readonly property bool dragging: thumbnailStripLoader.item && thumbnailStripLoader.item.dragging | 89 | readonly property bool dragging: thumbnailStripLoader.item && thumbnailStripLoader.item.dragging | ||
86 | 90 | | |||
87 | signal bodyClicked(var mouse) | 91 | signal bodyClicked(var mouse) | ||
88 | signal closeClicked | 92 | signal closeClicked | ||
89 | signal configureClicked | 93 | signal configureClicked | ||
90 | signal dismissClicked | 94 | signal dismissClicked | ||
91 | signal actionInvoked(string actionName) | 95 | signal actionInvoked(string actionName) | ||
92 | signal openUrl(string url) | 96 | signal openUrl(string url) | ||
93 | signal fileActionInvoked | 97 | signal fileActionInvoked | ||
94 | 98 | | |||
95 | signal suspendJobClicked | 99 | signal suspendJobClicked | ||
96 | signal resumeJobClicked | 100 | signal resumeJobClicked | ||
97 | signal killJobClicked | 101 | signal killJobClicked | ||
98 | 102 | | |||
99 | spacing: units.smallSpacing | 103 | spacing: units.smallSpacing * 2 | ||
100 | 104 | | |||
101 | NotificationHeader { | 105 | NotificationHeader { | ||
102 | id: notificationHeading | 106 | id: notificationHeading | ||
103 | Layout.fillWidth: true | 107 | Layout.fillWidth: true | ||
104 | Layout.leftMargin: notificationItem.headingLeftPadding | 108 | Layout.leftMargin: notificationItem.headingLeftPadding | ||
105 | Layout.rightMargin: notificationItem.headingRightPadding | 109 | Layout.rightMargin: notificationItem.headingRightPadding | ||
110 | Layout.topMargin: notificationItem.headingTopPadding | ||||
106 | 111 | | |||
107 | inGroup: notificationItem.inGroup | 112 | inGroup: notificationItem.inGroup | ||
108 | 113 | | |||
109 | notificationType: notificationItem.notificationType | 114 | notificationType: notificationItem.notificationType | ||
110 | jobState: notificationItem.jobState | 115 | jobState: notificationItem.jobState | ||
111 | jobDetails: notificationItem.jobDetails | 116 | jobDetails: notificationItem.jobDetails | ||
112 | 117 | | |||
113 | onConfigureClicked: notificationItem.configureClicked() | 118 | onConfigureClicked: notificationItem.configureClicked() | ||
114 | onDismissClicked: notificationItem.dismissClicked() | 119 | onDismissClicked: notificationItem.dismissClicked() | ||
115 | onCloseClicked: notificationItem.closeClicked() | 120 | onCloseClicked: notificationItem.closeClicked() | ||
116 | } | 121 | } | ||
117 | 122 | | |||
118 | RowLayout { | 123 | RowLayout { | ||
119 | id: defaultHeaderContainer | 124 | id: defaultHeaderContainer | ||
120 | Layout.fillWidth: true | 125 | Layout.fillWidth: true | ||
121 | } | 126 | } | ||
122 | 127 | | |||
123 | // Notification body | 128 | // Notification body | ||
124 | RowLayout { | 129 | RowLayout { | ||
125 | id: bodyRow | 130 | id: bodyRow | ||
126 | Layout.fillWidth: true | 131 | Layout.fillWidth: true | ||
132 | Layout.leftMargin: notificationItem.bodyLeftPadding | ||||
133 | Layout.rightMargin: notificationItem.bodyRightPadding | ||||
134 | Layout.bottomMargin: units.smallSpacing | ||||
127 | spacing: units.smallSpacing | 135 | spacing: units.smallSpacing | ||
128 | 136 | | |||
129 | ColumnLayout { | 137 | ColumnLayout { | ||
130 | Layout.fillWidth: true | 138 | Layout.fillWidth: true | ||
131 | spacing: 0 | 139 | spacing: 0 | ||
132 | 140 | | |||
133 | RowLayout { | 141 | RowLayout { | ||
134 | id: summaryRow | 142 | id: summaryRow | ||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | 215 | Item { | |||
246 | } | 254 | } | ||
247 | } | 255 | } | ||
248 | } | 256 | } | ||
249 | 257 | | |||
250 | // Job progress reporting | 258 | // Job progress reporting | ||
251 | Loader { | 259 | Loader { | ||
252 | id: jobLoader | 260 | id: jobLoader | ||
253 | Layout.fillWidth: true | 261 | Layout.fillWidth: true | ||
262 | Layout.leftMargin: notificationItem.bodyLeftPadding | ||||
broulik: Why is this not `bodyLeftPadding`? | |||||
254 | active: notificationItem.notificationType === NotificationManager.Notifications.JobType | 263 | active: notificationItem.notificationType === NotificationManager.Notifications.JobType | ||
255 | visible: active | 264 | visible: active | ||
Can't you just increase the overall spacing of the ColumnLayout rather than setting this bottomMargin all over the place? broulik: Can't you just increase the overall `spacing` of the `ColumnLayout` rather than setting this… | |||||
256 | sourceComponent: JobItem { | 265 | sourceComponent: JobItem { | ||
257 | jobState: notificationItem.jobState | 266 | jobState: notificationItem.jobState | ||
258 | jobError: notificationItem.jobError | 267 | jobError: notificationItem.jobError | ||
259 | percentage: notificationItem.percentage | 268 | percentage: notificationItem.percentage | ||
260 | suspendable: notificationItem.suspendable | 269 | suspendable: notificationItem.suspendable | ||
261 | killable: notificationItem.killable | 270 | killable: notificationItem.killable | ||
262 | 271 | | |||
263 | jobDetails: notificationItem.jobDetails | 272 | jobDetails: notificationItem.jobDetails | ||
264 | showDetails: notificationItem.showDetails | 273 | showDetails: notificationItem.showDetails | ||
265 | 274 | | |||
266 | onSuspendJobClicked: notificationItem.suspendJobClicked() | 275 | onSuspendJobClicked: notificationItem.suspendJobClicked() | ||
267 | onResumeJobClicked: notificationItem.resumeJobClicked() | 276 | onResumeJobClicked: notificationItem.resumeJobClicked() | ||
268 | onKillJobClicked: notificationItem.killJobClicked() | 277 | onKillJobClicked: notificationItem.killJobClicked() | ||
269 | 278 | | |||
270 | onOpenUrl: notificationItem.openUrl(url) | 279 | onOpenUrl: notificationItem.openUrl(url) | ||
271 | onFileActionInvoked: notificationItem.fileActionInvoked() | 280 | onFileActionInvoked: notificationItem.fileActionInvoked() | ||
272 | 281 | | |||
273 | hovered: notificationItem.hovered | 282 | hovered: notificationItem.hovered | ||
274 | } | 283 | } | ||
275 | } | 284 | } | ||
276 | 285 | | |||
277 | RowLayout { | 286 | RowLayout { | ||
278 | Layout.fillWidth: true | 287 | Layout.fillWidth: true | ||
288 | Layout.leftMargin: units.smallSpacing | ||||
289 | Layout.rightMargin: units.smallSpacing | ||||
290 | Layout.bottomMargin: units.smallSpacing | ||||
279 | visible: actionRepeater.count > 0 | 291 | visible: actionRepeater.count > 0 | ||
280 | 292 | | |||
281 | // Notification actions | 293 | // Notification actions | ||
282 | Flow { // it's a Flow so it can wrap if too long | 294 | Flow { // it's a Flow so it can wrap if too long | ||
283 | Layout.fillWidth: true | 295 | Layout.fillWidth: true | ||
284 | spacing: units.smallSpacing | 296 | spacing: units.smallSpacing | ||
285 | layoutDirection: Qt.RightToLeft | 297 | layoutDirection: Qt.RightToLeft | ||
286 | 298 | | |||
Show All 26 Lines | |||||
313 | } | 325 | } | ||
314 | 326 | | |||
315 | // thumbnails | 327 | // thumbnails | ||
316 | Loader { | 328 | Loader { | ||
317 | id: thumbnailStripLoader | 329 | id: thumbnailStripLoader | ||
318 | Layout.leftMargin: notificationItem.thumbnailLeftPadding | 330 | Layout.leftMargin: notificationItem.thumbnailLeftPadding | ||
319 | Layout.rightMargin: notificationItem.thumbnailRightPadding | 331 | Layout.rightMargin: notificationItem.thumbnailRightPadding | ||
320 | // no change in Layout.topMargin to keep spacing to notification text consistent | 332 | // no change in Layout.topMargin to keep spacing to notification text consistent | ||
321 | Layout.topMargin: 0 | 333 | Layout.topMargin: notificationItem.thumbnailTopPadding | ||
322 | Layout.bottomMargin: notificationItem.thumbnailBottomPadding | 334 | Layout.bottomMargin: notificationItem.thumbnailBottomPadding | ||
323 | Layout.fillWidth: true | 335 | Layout.fillWidth: true | ||
324 | active: notificationItem.urls.length > 0 | 336 | active: notificationItem.urls.length > 0 | ||
325 | visible: active | 337 | visible: active | ||
326 | sourceComponent: ThumbnailStrip { | 338 | sourceComponent: ThumbnailStrip { | ||
327 | leftPadding: -thumbnailStripLoader.Layout.leftMargin | 339 | leftPadding: -thumbnailStripLoader.Layout.leftMargin | ||
328 | rightPadding: -thumbnailStripLoader.Layout.rightMargin | 340 | rightPadding: -thumbnailStripLoader.Layout.rightMargin | ||
329 | topPadding: -notificationItem.thumbnailTopPadding | 341 | topPadding: -notificationItem.thumbnailTopPadding | ||
Show All 36 Lines |
Does this take into account layouts for RTL languages?