Changeset View
Changeset View
Standalone View
Standalone View
applets/colorpicker/package/contents/ui/main.qml
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 58 | if (color != recentColor) { | |||
---|---|---|---|---|---|
59 | addColorToHistory(color) | 59 | addColorToHistory(color) | ||
60 | } | 60 | } | ||
61 | 61 | | |||
62 | if (plasmoid.configuration.autoClipboard) { | 62 | if (plasmoid.configuration.autoClipboard) { | ||
63 | picker.copyToClipboard(Logic.formatColor(color, root.defaultFormat)) | 63 | picker.copyToClipboard(Logic.formatColor(color, root.defaultFormat)) | ||
64 | } | 64 | } | ||
65 | } | 65 | } | ||
66 | 66 | | |||
67 | function pickColor() { | ||||
68 | plasmoid.expanded = false | ||||
69 | picker.pick() | ||||
70 | } | ||||
71 | | ||||
67 | ColorPicker.GrabWidget { | 72 | ColorPicker.GrabWidget { | ||
68 | id: picker | 73 | id: picker | ||
69 | onCurrentColorChanged: colorPicked(currentColor) | 74 | onCurrentColorChanged: colorPicked(currentColor) | ||
70 | } | 75 | } | ||
71 | 76 | | |||
72 | QtDialogs.ColorDialog { | 77 | QtDialogs.ColorDialog { | ||
73 | id: colorDialog | 78 | id: colorDialog | ||
74 | color: recentColor | 79 | color: recentColor | ||
75 | onColorChanged: colorPicked(color) | 80 | onColorChanged: colorPicked(color) | ||
76 | } | 81 | } | ||
77 | 82 | | |||
78 | // prevents the popup from actually opening, needs to be queued | 83 | // prevents the popup from actually opening, needs to be queued | ||
79 | Timer { | 84 | Timer { | ||
80 | id: delayedPickTimer | 85 | id: delayedPickTimer | ||
81 | interval: 0 | 86 | interval: 0 | ||
82 | onTriggered: { | 87 | onTriggered: root.pickColor() | ||
83 | plasmoid.expanded = false | | |||
84 | picker.pick() | | |||
85 | } | | |||
86 | } | 88 | } | ||
87 | 89 | | |||
88 | Plasmoid.onActivated: { | 90 | Plasmoid.onActivated: { | ||
89 | if (plasmoid.configuration.pickOnActivate) { | 91 | if (plasmoid.configuration.pickOnActivate) { | ||
90 | delayedPickTimer.start() | 92 | delayedPickTimer.start() | ||
91 | } | 93 | } | ||
92 | } | 94 | } | ||
93 | 95 | | |||
Show All 18 Lines | 109 | Plasmoid.compactRepresentation: Grid { | |||
112 | 114 | | |||
113 | Layout.minimumWidth: isVertical ? units.iconSizes.small : ((height * 2) + spacer.width) | 115 | Layout.minimumWidth: isVertical ? units.iconSizes.small : ((height * 2) + spacer.width) | ||
114 | Layout.minimumHeight: isVertical ? ((width * 2) + spacer.height) : units.iconSizes.small | 116 | Layout.minimumHeight: isVertical ? ((width * 2) + spacer.height) : units.iconSizes.small | ||
115 | 117 | | |||
116 | PlasmaComponents.ToolButton { | 118 | PlasmaComponents.ToolButton { | ||
117 | width: buttonSize | 119 | width: buttonSize | ||
118 | height: buttonSize | 120 | height: buttonSize | ||
119 | tooltip: i18n("Pick Color") | 121 | tooltip: i18n("Pick Color") | ||
120 | onClicked: picker.pick() | 122 | onClicked: root.pickColor() | ||
121 | 123 | | |||
122 | PlasmaCore.IconItem { | 124 | PlasmaCore.IconItem { | ||
123 | id: pickerIcon | 125 | id: pickerIcon | ||
124 | anchors.centerIn: parent | 126 | anchors.centerIn: parent | ||
125 | width: Math.round(parent.width * 0.9) | 127 | width: Math.round(parent.width * 0.9) | ||
126 | height: width | 128 | height: width | ||
127 | source: "color-picker" | 129 | source: "color-picker" | ||
128 | active: parent.hovered | 130 | active: parent.hovered | ||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Line(s) | 228 | Plasmoid.fullRepresentation: GridView { | |||
241 | 243 | | |||
242 | highlight: PlasmaComponents.Highlight {} | 244 | highlight: PlasmaComponents.Highlight {} | ||
243 | highlightMoveDuration: 0 | 245 | highlightMoveDuration: 0 | ||
244 | 246 | | |||
245 | PlasmaComponents.Button { | 247 | PlasmaComponents.Button { | ||
246 | anchors.centerIn: parent | 248 | anchors.centerIn: parent | ||
247 | text: i18n("Pick Color") | 249 | text: i18n("Pick Color") | ||
248 | visible: fullRoot.count === 0 | 250 | visible: fullRoot.count === 0 | ||
249 | onClicked: picker.pick() | 251 | onClicked: root.pickColor() | ||
250 | } | 252 | } | ||
251 | 253 | | |||
252 | Connections { | 254 | Connections { | ||
253 | target: plasmoid | 255 | target: plasmoid | ||
254 | onExpandedChanged: { | 256 | onExpandedChanged: { | ||
255 | if (plasmoid.expanded) { | 257 | if (plasmoid.expanded) { | ||
256 | fullRoot.forceActiveFocus() | 258 | fullRoot.forceActiveFocus() | ||
257 | } | 259 | } | ||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |