Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/main.qml
Show All 35 Lines | 29 | MouseArea { | |||
---|---|---|---|---|---|
36 | Layout.preferredHeight: Layout.minimumHeight | 36 | Layout.preferredHeight: Layout.minimumHeight | ||
37 | LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft | 37 | LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft | ||
38 | LayoutMirroring.childrenInherit: true | 38 | LayoutMirroring.childrenInherit: true | ||
39 | 39 | | |||
40 | property var iconSizes: ["small", "smallMedium", "medium", "large", "huge", "enormous"]; | 40 | property var iconSizes: ["small", "smallMedium", "medium", "large", "huge", "enormous"]; | ||
41 | property int iconSize: plasmoid.configuration.iconSize + (Kirigami.Settings.tabletMode ? 1 : 0) | 41 | property int iconSize: plasmoid.configuration.iconSize + (Kirigami.Settings.tabletMode ? 1 : 0) | ||
42 | 42 | | |||
43 | property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical | 43 | property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical | ||
44 | readonly property int itemSize: units.roundToIconSize(Math.min(Math.min(width, height), units.iconSizes[iconSizes[Math.min(iconSizes.length-1, iconSize)]])) | 44 | // If Kirigami.Settings.tabletMode is true, double the amount of space added around the tray icons to make them easier to tap on | ||
45 | readonly property int itemSize: units.roundToIconSize(Math.min(Math.min(width, height), units.iconSizes[iconSizes[Math.min(iconSizes.length-1, iconSize)]])) + (Kirigami.Settings.tabletMode ? Math.round(units.smallSpacing) : Math.round(units.smallSpacing/2)) | ||||
ngraham: This should probably be rewritten as an inline function as it's now very difficult to read. e.g. | |||||
45 | property int hiddenItemSize: units.iconSizes.smallMedium | 46 | property int hiddenItemSize: units.iconSizes.smallMedium | ||
46 | property alias expanded: dialog.visible | 47 | property alias expanded: dialog.visible | ||
47 | property Item activeApplet | 48 | property Item activeApplet | ||
48 | property int status: dialog.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus | 49 | property int status: dialog.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus | ||
49 | 50 | | |||
50 | property alias visibleLayout: tasksRow | 51 | property alias visibleLayout: tasksRow | ||
51 | property alias hiddenLayout: expandedRepresentation.hiddenLayout | 52 | property alias hiddenLayout: expandedRepresentation.hiddenLayout | ||
52 | 53 | | |||
▲ Show 20 Lines • Show All 229 Lines • ▼ Show 20 Line(s) | 280 | if (plasmoid.configuration.extraItems.indexOf(plasmoidId) < 0) { | |||
282 | plasmoid.configuration.extraItems = extraItems; | 283 | plasmoid.configuration.extraItems = extraItems; | ||
283 | } | 284 | } | ||
284 | } | 285 | } | ||
285 | } | 286 | } | ||
286 | 287 | | |||
287 | //Main Layout | 288 | //Main Layout | ||
288 | Flow { | 289 | Flow { | ||
289 | id: tasksRow | 290 | id: tasksRow | ||
290 | spacing: 0 | 291 | spacing: 0 | ||
Don't use magic values. How about units.smallSpacing would be more semantically appropriate. That maps to 2, BTW. If 2 is still too cramped, you could do units.smallSpacing * 1.5 but using default spacing values is probably preferred. ngraham: Don't use magic values. How about `units.smallSpacing` would be more semantically appropriate. | |||||
291 | height: parent.height - (vertical && expander.visible ? expander.height : 0) | 292 | height: parent.height - (vertical && expander.visible ? expander.height : 0) | ||
292 | width: parent.width - (vertical || !expander.visible ? 0 : expander.width) | 293 | width: parent.width - (vertical || !expander.visible ? 0 : expander.width) | ||
293 | property string skipItems | 294 | property string skipItems | ||
294 | flow: vertical ? Flow.LeftToRight : Flow.TopToBottom | 295 | flow: vertical ? Flow.LeftToRight : Flow.TopToBottom | ||
295 | //To make it look centered | 296 | //To make it look centered | ||
296 | y: Math.round(height/2 - childrenRect.height/2) | 297 | y: Math.round(height/2 - childrenRect.height/2) | ||
297 | x: (expander.visible && LayoutMirroring.enabled ? expander.width : 0) + Math.round(width/2 - childrenRect.width/2) | 298 | x: (expander.visible && LayoutMirroring.enabled ? expander.width : 0) + Math.round(width/2 - childrenRect.width/2) | ||
298 | 299 | | |||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |
This should probably be rewritten as an inline function as it's now very difficult to read. e.g.: