Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/package/contents/ui/ConfigOverlay.qml
Show All 29 Lines | 29 | ContainmentLayoutManager.ConfigOverlayWithHandles { | |||
---|---|---|---|---|---|
30 | id: overlay | 30 | id: overlay | ||
31 | 31 | | |||
32 | readonly property int iconSize: touchInteraction ? units.iconSizes.medium : units.iconSizes.small | 32 | readonly property int iconSize: touchInteraction ? units.iconSizes.medium : units.iconSizes.small | ||
33 | PlasmaCore.Svg { | 33 | PlasmaCore.Svg { | ||
34 | id: configIconsSvg | 34 | id: configIconsSvg | ||
35 | imagePath: "widgets/configuration-icons" | 35 | imagePath: "widgets/configuration-icons" | ||
36 | } | 36 | } | ||
37 | 37 | | |||
38 | PlasmaComponents.Label { | | |||
39 | id: toolTipDelegate | | |||
40 | | ||||
41 | width: contentWidth | | |||
42 | height: undefined | | |||
43 | | ||||
44 | property Item toolTip | | |||
45 | | ||||
46 | text: (toolTip != null) ? toolTip.mainText : "" | | |||
47 | } | | |||
48 | | ||||
49 | SequentialAnimation { | 38 | SequentialAnimation { | ||
50 | id: removeAnim | 39 | id: removeAnim | ||
51 | NumberAnimation { | 40 | NumberAnimation { | ||
52 | target: overlay.itemContainer | 41 | target: overlay.itemContainer | ||
53 | property: "scale" | 42 | property: "scale" | ||
54 | from: 1 | 43 | from: 1 | ||
55 | to: 0 | 44 | to: 0 | ||
56 | duration: units.longDuration | 45 | duration: units.longDuration | ||
Show All 36 Lines | 78 | anchors { | |||
93 | bottomMargin: parent.margins.bottom | 82 | bottomMargin: parent.margins.bottom | ||
94 | rightMargin: parent.margins.right | 83 | rightMargin: parent.margins.right | ||
95 | } | 84 | } | ||
96 | 85 | | |||
97 | ActionButton { | 86 | ActionButton { | ||
98 | id: rotateButton | 87 | id: rotateButton | ||
99 | svg: configIconsSvg | 88 | svg: configIconsSvg | ||
100 | elementId: "rotate" | 89 | elementId: "rotate" | ||
101 | mainText: i18n("Rotate") | 90 | toolTip: i18n("Rotate") | ||
102 | iconSize: overlay.iconSize | 91 | iconSize: overlay.iconSize | ||
103 | action: (applet) ? applet.action("rotate") : null | 92 | action: (applet) ? applet.action("rotate") : null | ||
104 | active: !rotateHandle.pressed | 93 | down: !rotateHandle.pressed | ||
105 | Component.onCompleted: { | 94 | Component.onCompleted: { | ||
106 | if (action && typeof(action) != "undefined") { | 95 | if (action && typeof(action) != "undefined") { | ||
107 | action.enabled = true | 96 | action.enabled = true | ||
108 | } | 97 | } | ||
109 | } | 98 | } | ||
110 | MouseArea { | 99 | MouseArea { | ||
111 | id: rotateHandle | 100 | id: rotateHandle | ||
112 | anchors.fill: parent | 101 | anchors.fill: parent | ||
Show All 17 Lines | 117 | function centerRelativePos(x, y) { | |||
130 | var centerPos = overlay.itemContainer.parent.mapFromItem(overlay.itemContainer, overlay.itemContainer.width/2, overlay.itemContainer.height/2); | 119 | var centerPos = overlay.itemContainer.parent.mapFromItem(overlay.itemContainer, overlay.itemContainer.width/2, overlay.itemContainer.height/2); | ||
131 | 120 | | |||
132 | mousePos.x -= centerPos.x; | 121 | mousePos.x -= centerPos.x; | ||
133 | mousePos.y -= centerPos.y; | 122 | mousePos.y -= centerPos.y; | ||
134 | return mousePos; | 123 | return mousePos; | ||
135 | } | 124 | } | ||
136 | 125 | | |||
137 | onPressed: { | 126 | onPressed: { | ||
138 | parent.hideToolTip(); | | |||
139 | mouse.accepted = true | 127 | mouse.accepted = true | ||
140 | startRotation = overlay.itemContainer.rotation; | 128 | startRotation = overlay.itemContainer.rotation; | ||
141 | startCenterRelativeAngle = pointAngle(centerRelativePos(mouse.x, mouse.y)); | 129 | startCenterRelativeAngle = pointAngle(centerRelativePos(mouse.x, mouse.y)); | ||
142 | } | 130 | } | ||
143 | onPositionChanged: { | 131 | onPositionChanged: { | ||
144 | 132 | | |||
145 | var rot = startRotation%360; | 133 | var rot = startRotation%360; | ||
146 | var snap = 4; | 134 | var snap = 4; | ||
Show All 25 Lines | 158 | // print("saving..."); | |||
172 | } | 160 | } | ||
173 | } | 161 | } | ||
174 | } | 162 | } | ||
175 | 163 | | |||
176 | ActionButton { | 164 | ActionButton { | ||
177 | svg: configIconsSvg | 165 | svg: configIconsSvg | ||
178 | elementId: "configure" | 166 | elementId: "configure" | ||
179 | iconSize: overlay.iconSize | 167 | iconSize: overlay.iconSize | ||
180 | visible: (action && typeof(action) != "undefined") ? action.enabled : false | 168 | visible: (qAction && typeof(qAction) != "undefined") ? qAction.enabled : false | ||
181 | action: (applet) ? applet.action("configure") : null | 169 | qAction: (applet) ? applet.action("configure") : null | ||
182 | Component.onCompleted: { | 170 | Component.onCompleted: { | ||
183 | if (action && typeof(action) != "undefined") { | 171 | if (qAction && typeof(qAction) != "undefined") { | ||
184 | action.enabled = true | 172 | qAction.enabled = true | ||
185 | } | 173 | } | ||
186 | } | 174 | } | ||
187 | } | 175 | } | ||
188 | 176 | | |||
189 | ActionButton { | 177 | ActionButton { | ||
190 | svg: configIconsSvg | 178 | svg: configIconsSvg | ||
191 | elementId: "maximize" | 179 | elementId: "maximize" | ||
192 | iconSize: overlay.iconSize | 180 | iconSize: overlay.iconSize | ||
193 | visible: (action && typeof(action) != "undefined") ? action.enabled : false | 181 | toolTip: i18n("Open Externally") | ||
194 | action: (applet) ? applet.action("run associated application") : null | 182 | visible: (qAction && typeof(qAction) != "undefined") ? qAction.enabled : false | ||
183 | qAction: (applet) ? applet.action("run associated application") : null | ||||
195 | Component.onCompleted: { | 184 | Component.onCompleted: { | ||
196 | if (action && typeof(action) != "undefined") { | 185 | if (qAction && typeof(qAction) != "undefined") { | ||
197 | action.enabled = true | 186 | qAction.enabled = true | ||
187 | } | ||||
188 | } | ||||
189 | } | ||||
190 | ActionButton { | ||||
191 | svg: configIconsSvg | ||||
192 | elementId: "showbackground" | ||||
193 | //mainText: i18n("Show Background") | ||||
194 | toolTip: i18n("Show Background") | ||||
195 | iconSize: overlay.iconSize | ||||
196 | visible: (applet.backgroundHints & PlasmaCore.Types.ConfigurableBackground) | ||||
197 | checked: applet.effectiveBackgroundHints & PlasmaCore.Types.StandardBackground || applet.effectiveBackgroundHints & PlasmaCore.Types.TranslucentBackground | ||||
198 | checkable: true | ||||
199 | onClicked: { | ||||
200 | if (checked) { | ||||
201 | if (applet.backgroundHints & PlasmaCore.Types.StandardBackground || applet.backgroundHints & PlasmaCore.Types.TranslucentBackground) { | ||||
202 | applet.userBackgroundHints = applet.backgroundHints; | ||||
203 | } else { | ||||
204 | applet.userBackgroundHints = PlasmaCore.Types.StandardBackground; | ||||
205 | } | ||||
206 | } else { | ||||
207 | if (applet.backgroundHints & PlasmaCore.Types.ShadowBackground || applet.backgroundHints & PlasmaCore.Types.NoBackground) { | ||||
208 | applet.userBackgroundHints = applet.backgroundHints; | ||||
209 | } else { | ||||
210 | applet.userBackgroundHints = PlasmaCore.Types.ShadowBackground; | ||||
211 | } | ||||
198 | } | 212 | } | ||
199 | } | 213 | } | ||
200 | } | 214 | } | ||
201 | 215 | | |||
202 | MouseArea { | 216 | MouseArea { | ||
203 | drag.target: overlay.itemContainer | 217 | drag.target: overlay.itemContainer | ||
204 | Layout.minimumHeight: units.gridUnit * 3 | 218 | Layout.minimumHeight: units.gridUnit * 3 | ||
205 | Layout.fillHeight: true | 219 | Layout.fillHeight: true | ||
Show All 14 Lines | 232 | onReleased: { | |||
220 | appletsLayout.positionItem(overlay.itemContainer); | 234 | appletsLayout.positionItem(overlay.itemContainer); | ||
221 | } | 235 | } | ||
222 | } | 236 | } | ||
223 | 237 | | |||
224 | ActionButton { | 238 | ActionButton { | ||
225 | id: closeButton | 239 | id: closeButton | ||
226 | svg: configIconsSvg | 240 | svg: configIconsSvg | ||
227 | elementId: "delete" | 241 | elementId: "delete" | ||
228 | mainText: i18n("Remove") | 242 | toolTip: i18n("Remove") | ||
229 | iconSize: overlay.iconSize | 243 | iconSize: overlay.iconSize | ||
230 | visible: { | 244 | visible: { | ||
231 | if (!applet) { | 245 | if (!applet) { | ||
232 | return false; | 246 | return false; | ||
233 | } | 247 | } | ||
234 | var a = applet.action("remove"); | 248 | var a = applet.action("remove"); | ||
235 | return (a && typeof(a) != "undefined") ? a.enabled : false; | 249 | return (a && typeof(a) != "undefined") ? a.enabled : false; | ||
236 | } | 250 | } | ||
Show All 19 Lines |