Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/CompactRepresentation.qml
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.8 | 21 | import QtQuick 2.8 | ||
22 | import QtQuick.Layouts 1.1 | 22 | import QtQuick.Layouts 1.1 | ||
23 | 23 | | |||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
25 | import org.kde.plasma.components 2.0 as PlasmaComponents | 25 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
26 | 26 | | |||
27 | import org.kde.quickcharts 1.0 as Charts | ||||
28 | | ||||
27 | MouseArea { | 29 | MouseArea { | ||
28 | id: compactRoot | 30 | id: compactRoot | ||
29 | 31 | | |||
30 | readonly property bool inPanel: (plasmoid.location === PlasmaCore.Types.TopEdge | 32 | readonly property bool inPanel: (plasmoid.location === PlasmaCore.Types.TopEdge | ||
31 | || plasmoid.location === PlasmaCore.Types.RightEdge | 33 | || plasmoid.location === PlasmaCore.Types.RightEdge | ||
32 | || plasmoid.location === PlasmaCore.Types.BottomEdge | 34 | || plasmoid.location === PlasmaCore.Types.BottomEdge | ||
33 | || plasmoid.location === PlasmaCore.Types.LeftEdge) | 35 | || plasmoid.location === PlasmaCore.Types.LeftEdge) | ||
34 | 36 | | |||
Show All 26 Lines | 61 | PlasmaCore.SvgItem { | |||
61 | anchors.centerIn: parent | 63 | anchors.centerIn: parent | ||
62 | width: units.roundToIconSize(Math.min(parent.width, parent.height)) | 64 | width: units.roundToIconSize(Math.min(parent.width, parent.height)) | ||
63 | height: width | 65 | height: width | ||
64 | svg: notificationSvg | 66 | svg: notificationSvg | ||
65 | visible: opacity > 0 | 67 | visible: opacity > 0 | ||
66 | 68 | | |||
67 | elementId: "notification-inactive" | 69 | elementId: "notification-inactive" | ||
68 | 70 | | |||
69 | Item { | 71 | Charts.PieChart { | ||
70 | id: jobProgressItem | 72 | id: chart | ||
71 | anchors { | 73 | | ||
72 | left: parent.left | 74 | anchors.fill: parent | ||
73 | top: parent.top | | |||
74 | bottom: parent.bottom | | |||
75 | } | | |||
76 | width: notificationIcon.width * (jobsPercentage / 100) | | |||
77 | 75 | | |||
78 | clip: true | | |||
79 | visible: false | 76 | visible: false | ||
80 | 77 | | |||
81 | PlasmaCore.SvgItem { | 78 | range { from: 0; to: 100; automatic: false } | ||
82 | anchors { | | |||
83 | left: parent.left | | |||
84 | top: parent.top | | |||
85 | bottom: parent.bottom | | |||
86 | } | | |||
87 | width: notificationIcon.width | | |||
88 | 79 | | |||
89 | svg: notificationSvg | 80 | valueSources: Charts.SingleValueSource { value: compactRoot.jobsPercentage } | ||
90 | elementId: "notification-progress-active" | 81 | colorSource: Charts.SingleValueSource { value: theme.highlightColor } | ||
91 | } | 82 | | ||
83 | thickness: units.devicePixelRatio * 5 | ||||
92 | } | 84 | } | ||
93 | 85 | | |||
94 | PlasmaComponents.Label { | 86 | PlasmaComponents.Label { | ||
95 | id: countLabel | 87 | id: countLabel | ||
96 | anchors.centerIn: parent | 88 | anchors.centerIn: parent | ||
97 | width: Math.round(Math.min(parent.width, parent.height) * (text.length > 1 ? 0.67 : 0.75)) | 89 | width: Math.round(Math.min(parent.width, parent.height) * (text.length > 1 ? 0.67 : 0.75)) | ||
98 | height: width | 90 | height: width | ||
99 | fontSizeMode: Text.Fit | 91 | fontSizeMode: Text.Fit | ||
100 | font.pointSize: 1024 | 92 | font.pointSize: 1024 | ||
101 | font.pixelSize: -1 | 93 | font.pixelSize: -1 | ||
102 | minimumPointSize: 5//theme.smallestFont.pointSize | 94 | minimumPointSize: 5//theme.smallestFont.pointSize | ||
103 | horizontalAlignment: Text.AlignHCenter | 95 | horizontalAlignment: Text.AlignHCenter | ||
104 | verticalAlignment: Text.AlignVCenter | 96 | verticalAlignment: Text.AlignVCenter | ||
105 | text: compactRoot.unreadCount || "" | 97 | text: compactRoot.unreadCount || "" | ||
106 | renderType: Text.QtRendering | 98 | renderType: Text.QtRendering | ||
107 | visible: false | 99 | visible: false | ||
108 | } | 100 | } | ||
109 | 101 | | |||
110 | PlasmaComponents.BusyIndicator { | 102 | PlasmaComponents.BusyIndicator { | ||
111 | id: busyIndicator | 103 | id: busyIndicator | ||
112 | anchors.fill: parent | 104 | anchors.fill: parent | ||
113 | visible: false | 105 | visible: false | ||
114 | running: visible | 106 | running: visible | ||
115 | } | 107 | } | ||
broulik: You might want to stop and hide the `BusyIndicator` altogether (cf. the `State` below) rather… | |||||
116 | } | 108 | } | ||
117 | 109 | | |||
118 | PlasmaCore.IconItem { | 110 | PlasmaCore.IconItem { | ||
119 | id: dndIcon | 111 | id: dndIcon | ||
120 | anchors.fill: parent | 112 | anchors.fill: parent | ||
121 | source: "notifications-disabled" | 113 | source: "notifications-disabled" | ||
122 | opacity: 0 | 114 | opacity: 0 | ||
123 | scale: 2 | 115 | scale: 2 | ||
Show All 9 Lines | 120 | State { // active process | |||
133 | } | 125 | } | ||
134 | PropertyChanges { | 126 | PropertyChanges { | ||
135 | target: countLabel | 127 | target: countLabel | ||
136 | text: compactRoot.jobsCount | 128 | text: compactRoot.jobsCount | ||
137 | visible: true | 129 | visible: true | ||
138 | } | 130 | } | ||
139 | PropertyChanges { | 131 | PropertyChanges { | ||
140 | target: busyIndicator | 132 | target: busyIndicator | ||
141 | visible: true | 133 | visible: compactRoot.jobsPercentage == 0 | ||
142 | } | 134 | } | ||
143 | PropertyChanges { | 135 | PropertyChanges { | ||
144 | target: jobProgressItem | 136 | target: jobProgressItem | ||
145 | visible: true | 137 | visible: true | ||
146 | } | 138 | } | ||
139 | PropertyChanges { | ||||
140 | target: chart | ||||
141 | visible: true | ||||
142 | } | ||||
147 | }, | 143 | }, | ||
148 | State { // do not disturb | 144 | State { // do not disturb | ||
149 | when: compactRoot.inhibited | 145 | when: compactRoot.inhibited | ||
150 | PropertyChanges { | 146 | PropertyChanges { | ||
151 | target: dndIcon | 147 | target: dndIcon | ||
152 | scale: 1 | 148 | scale: 1 | ||
153 | opacity: 1 | 149 | opacity: 1 | ||
154 | } | 150 | } | ||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |
You might want to stop and hide the BusyIndicator altogether (cf. the State below) rather than just making it fully transparent