Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/package/contents/ui/DashboardRepresentation.qml
Show All 19 Lines | |||||
20 | import QtQuick 2.4 | 20 | import QtQuick 2.4 | ||
21 | import QtGraphicalEffects 1.0 | 21 | import QtGraphicalEffects 1.0 | ||
22 | 22 | | |||
23 | import org.kde.plasma.core 2.1 as PlasmaCore | 23 | import org.kde.plasma.core 2.1 as PlasmaCore | ||
24 | import org.kde.plasma.components 2.0 as PlasmaComponents | 24 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
25 | import org.kde.plasma.extras 2.0 as PlasmaExtras | 25 | import org.kde.plasma.extras 2.0 as PlasmaExtras | ||
26 | import org.kde.kquickcontrolsaddons 2.0 | 26 | import org.kde.kquickcontrolsaddons 2.0 | ||
27 | import org.kde.kwindowsystem 1.0 | 27 | import org.kde.kwindowsystem 1.0 | ||
28 | import org.kde.kirigami 2.8 as Kirigami | ||||
29 | | ||||
28 | 30 | | |||
29 | import org.kde.plasma.private.shell 2.0 | 31 | import org.kde.plasma.private.shell 2.0 | ||
30 | 32 | | |||
31 | import org.kde.plasma.private.kicker 0.1 as Kicker | 33 | import org.kde.plasma.private.kicker 0.1 as Kicker | ||
32 | 34 | | |||
33 | import "code/tools.js" as Tools | 35 | import "code/tools.js" as Tools | ||
34 | 36 | | |||
35 | /* TODO | 37 | /* TODO | ||
36 | * Reverse middleRow layout + keyboard nav + filter list text alignment in rtl locales. | 38 | * Reverse middleRow layout + keyboard nav + filter list text alignment in rtl locales. | ||
37 | * Keep cursor column when arrow'ing down past non-full trailing rows into a lower grid. | 39 | * Keep cursor column when arrow'ing down past non-full trailing rows into a lower grid. | ||
38 | * Make DND transitions cleaner by performing an item swap instead of index reinsertion. | 40 | * Make DND transitions cleaner by performing an item swap instead of index reinsertion. | ||
39 | */ | 41 | */ | ||
40 | 42 | | |||
41 | Kicker.DashboardWindow { | 43 | Kicker.DashboardWindow { | ||
42 | id: root | 44 | id: root | ||
45 | flags: Qt.WA_TranslucentBackground | ||||
43 | 46 | | |||
44 | property bool smallScreen: ((Math.floor(width / units.iconSizes.huge) <= 22) || (Math.floor(height / units.iconSizes.huge) <= 14)) | 47 | property bool smallScreen: ((Math.floor(width / units.iconSizes.huge) <= 22) || (Math.floor(height / units.iconSizes.huge) <= 14)) | ||
45 | 48 | | |||
46 | property int iconSize: smallScreen ? units.iconSizes.large : units.iconSizes.huge | 49 | property int iconSize: smallScreen ? units.iconSizes.large : units.iconSizes.huge | ||
47 | property int cellSize: iconSize + theme.mSize(theme.defaultFont).height | 50 | property int cellSize: iconSize + theme.mSize(theme.defaultFont).height | ||
48 | + (2 * units.smallSpacing) | 51 | + (2 * units.smallSpacing) | ||
49 | + (2 * Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, | 52 | + (2 * Math.max(highlightItemSvg.margins.top + highlightItemSvg.margins.bottom, | ||
50 | highlightItemSvg.margins.left + highlightItemSvg.margins.right)) | 53 | highlightItemSvg.margins.left + highlightItemSvg.margins.right)) | ||
51 | property int columns: Math.floor(((smallScreen ? 85 : 80)/100) * Math.ceil(width / cellSize)) | 54 | property int columns: Math.floor(((smallScreen ? 85 : 80)/100) * Math.ceil(width / cellSize)) | ||
52 | property bool searching: (searchField.text != "") | 55 | property bool searching: (searchField.text != "") | ||
53 | property var widgetExplorer: null | 56 | property var widgetExplorer: null | ||
54 | | ||||
55 | keyEventProxy: searchField | 57 | keyEventProxy: searchField | ||
56 | backgroundColor: Qt.rgba(0, 0, 0, 0.737) | 58 | backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.737) | ||
57 | 59 | | |||
58 | onKeyEscapePressed: { | 60 | onKeyEscapePressed: { | ||
59 | if (searching) { | 61 | if (searching) { | ||
60 | searchField.clear(); | 62 | searchField.clear(); | ||
61 | } else { | 63 | } else { | ||
62 | root.toggle(); | 64 | root.toggle(); | ||
63 | } | 65 | } | ||
64 | } | 66 | } | ||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Line(s) | 242 | DashboardTabBar { | |||
253 | 255 | | |||
254 | onHoveredTabChanged: updateWidgetExplorer() | 256 | onHoveredTabChanged: updateWidgetExplorer() | ||
255 | 257 | | |||
256 | Keys.onDownPressed: { | 258 | Keys.onDownPressed: { | ||
257 | mainColumn.tryActivate(0, 0); | 259 | mainColumn.tryActivate(0, 0); | ||
258 | } | 260 | } | ||
259 | } | 261 | } | ||
260 | 262 | | |||
261 | TextEdit { | 263 | Kirigami.SearchField { | ||
262 | id: searchField | 264 | id: searchField | ||
263 | 265 | y: (middleRow.anchors.topMargin / 2) - (smallScreen ? (height/10) : 0) | |||
264 | width: 0 | 266 | anchors { | ||
265 | height: 0 | 267 | horizontalCenter: parent.horizontalCenter | ||
266 | 268 | } | |||
267 | visible: false | | |||
268 | | ||||
269 | persistentSelection: true | | |||
270 | | ||||
271 | onTextChanged: { | 269 | onTextChanged: { | ||
272 | if (tabBar.activeTab == 0) { | 270 | if (tabBar.activeTab == 0) { | ||
273 | runnerModel.query = searchField.text; | 271 | runnerModel.query = searchField.text; | ||
274 | } else { | 272 | } else { | ||
275 | widgetExplorer.widgetsModel.searchTerm = searchField.text; | 273 | widgetExplorer.widgetsModel.searchTerm = searchField.text; | ||
276 | } | 274 | } | ||
277 | } | 275 | } | ||
278 | | ||||
279 | function clear() { | | |||
280 | text = ""; | | |||
281 | } | | |||
282 | | ||||
283 | onSelectionStartChanged: Qt.callLater(searchHeading.updateSelection) | | |||
284 | onSelectionEndChanged: Qt.callLater(searchHeading.updateSelection) | | |||
285 | } | | |||
286 | | ||||
287 | TextEdit { | | |||
288 | id: searchHeading | | |||
289 | | ||||
290 | anchors { | | |||
291 | horizontalCenter: parent.horizontalCenter | | |||
292 | } | | |||
293 | | ||||
294 | y: (middleRow.anchors.topMargin / 2) - (smallScreen ? (height/10) : 0) | | |||
295 | | ||||
296 | font.pointSize: dummyHeading.font.pointSize * 1.5 | | |||
297 | wrapMode: Text.NoWrap | | |||
298 | opacity: 1.0 | | |||
299 | | ||||
300 | selectByMouse: false | | |||
301 | cursorVisible: false | | |||
302 | | ||||
303 | color: "white" | | |||
304 | | ||||
305 | text: searching ? i18n("Searching for '%1'", searchField.text) : i18n("Type to search...") | | |||
306 | | ||||
307 | function updateSelection() { | | |||
308 | if (!searchField.selectedText) { | | |||
309 | return; | | |||
310 | } | | |||
311 | | ||||
312 | var delta = text.lastIndexOf(searchField.text, text.length - 2); | | |||
313 | searchHeading.select(searchField.selectionStart + delta, searchField.selectionEnd + delta); | | |||
314 | } | | |||
315 | } | | |||
316 | | ||||
317 | PlasmaComponents.ToolButton { | | |||
318 | id: cancelSearchButton | | |||
319 | | ||||
320 | anchors { | | |||
321 | left: searchHeading.right | | |||
322 | leftMargin: units.largeSpacing | | |||
323 | verticalCenter: searchHeading.verticalCenter | | |||
324 | } | | |||
325 | | ||||
326 | width: units.iconSizes.large | | |||
327 | height: width | | |||
328 | | ||||
329 | visible: (searchField.text != "") | | |||
330 | | ||||
331 | iconName: "dialog-close" | | |||
332 | flat: false | | |||
333 | | ||||
334 | onClicked: searchField.clear(); | | |||
335 | | ||||
336 | Keys.onPressed: { | | |||
337 | if (event.key === Qt.Key_Tab) { | | |||
338 | event.accepted = true; | | |||
339 | | ||||
340 | if (runnerModel.count) { | | |||
341 | mainColumn.tryActivate(0, 0); | | |||
342 | } else { | | |||
343 | systemFavoritesGrid.tryActivate(0, 0); | | |||
344 | } | | |||
345 | } else if (event.key === Qt.Key_Backtab) { | | |||
346 | event.accepted = true; | | |||
347 | | ||||
348 | if (tabBar.visible) { | | |||
349 | tabBar.focus = true; | | |||
350 | } else if (globalFavoritesGrid.enabled) { | | |||
351 | globalFavoritesGrid.tryActivate(0, 0); | | |||
352 | } else { | | |||
353 | systemFavoritesGrid.tryActivate(0, 0); | | |||
354 | } | | |||
355 | } | | |||
356 | } | | |||
357 | } | 276 | } | ||
358 | 277 | | |||
359 | Row { | 278 | Row { | ||
360 | id: middleRow | 279 | id: middleRow | ||
361 | 280 | | |||
362 | anchors { | 281 | anchors { | ||
363 | top: parent.top | 282 | top: parent.top | ||
364 | topMargin: units.gridUnit * (smallScreen ? 8 : 10) | 283 | topMargin: units.gridUnit * (smallScreen ? 8 : 10) | ||
Show All 28 Lines | 305 | PlasmaExtras.Heading { | |||
393 | } | 312 | } | ||
394 | 313 | | |||
395 | x: units.smallSpacing | 314 | x: units.smallSpacing | ||
396 | width: parent.width - x | 315 | width: parent.width - x | ||
397 | 316 | | |||
398 | elide: Text.ElideRight | 317 | elide: Text.ElideRight | ||
399 | wrapMode: Text.NoWrap | 318 | wrapMode: Text.NoWrap | ||
400 | 319 | | |||
401 | color: "white" | | |||
402 | | ||||
403 | level: 1 | 320 | level: 1 | ||
404 | 321 | | |||
405 | text: i18n("Favorites") | 322 | text: i18n("Favorites") | ||
406 | 323 | | |||
407 | opacity: (enabled ? 1.0 : 0.3) | 324 | opacity: (enabled ? 1.0 : 0.3) | ||
408 | 325 | | |||
409 | Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } | 326 | Behavior on opacity { SmoothedAnimation { duration: units.longDuration; velocity: 0.01 } } | ||
410 | } | 327 | } | ||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Line(s) | 521 | PlasmaExtras.Heading { | |||
610 | 527 | | |||
611 | x: units.smallSpacing | 528 | x: units.smallSpacing | ||
612 | width: parent.width - x | 529 | width: parent.width - x | ||
613 | 530 | | |||
614 | elide: Text.ElideRight | 531 | elide: Text.ElideRight | ||
615 | wrapMode: Text.NoWrap | 532 | wrapMode: Text.NoWrap | ||
616 | opacity: 1.0 | 533 | opacity: 1.0 | ||
617 | 534 | | |||
618 | color: "white" | | |||
619 | | ||||
620 | level: 1 | 535 | level: 1 | ||
621 | 536 | | |||
622 | text: (tabBar.activeTab == 0) ? funnelModel.description : i18n("Widgets") | 537 | text: (tabBar.activeTab == 0) ? funnelModel.description : i18n("Widgets") | ||
623 | } | 538 | } | ||
624 | 539 | | |||
625 | PlasmaCore.SvgItem { | 540 | PlasmaCore.SvgItem { | ||
626 | id: mainColumnLabelUnderline | 541 | id: mainColumnLabelUnderline | ||
627 | 542 | | |||
▲ Show 20 Lines • Show All 337 Lines • ▼ Show 20 Line(s) | 878 | anchors { | |||
965 | leftMargin: highlightItemSvg.margins.left | 880 | leftMargin: highlightItemSvg.margins.left | ||
966 | rightMargin: highlightItemSvg.margins.right | 881 | rightMargin: highlightItemSvg.margins.right | ||
967 | } | 882 | } | ||
968 | 883 | | |||
969 | elide: Text.ElideRight | 884 | elide: Text.ElideRight | ||
970 | wrapMode: Text.NoWrap | 885 | wrapMode: Text.NoWrap | ||
971 | opacity: 1.0 | 886 | opacity: 1.0 | ||
972 | 887 | | |||
973 | color: "white" | | |||
974 | | ||||
975 | level: 1 | 888 | level: 1 | ||
976 | 889 | | |||
977 | text: model.display | 890 | text: model.display | ||
978 | } | 891 | } | ||
979 | } | 892 | } | ||
980 | 893 | | |||
981 | highlight: PlasmaComponents.Highlight { | 894 | highlight: PlasmaComponents.Highlight { | ||
982 | anchors { | 895 | anchors { | ||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |