Warning, /plasma/kdeplasma-addons/kwin/windowswitchers/sidebar/contents/ui/main.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2011 Martin Gräßlin <mgraesslin@kde.org>
0003 SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
0004 SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de>
0005
0006 SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 import QtQuick 2.0
0009 import QtQuick.Layouts 1.1
0010 import org.kde.plasma.components 3.0 as PlasmaComponents
0011 import org.kde.plasma.core as PlasmaCore
0012 import org.kde.kirigami 2.20 as Kirigami
0013 import org.kde.plasma.extras 2.0 as PlasmaExtras
0014 import org.kde.kwin 3.0 as KWin
0015
0016 KWin.TabBoxSwitcher {
0017 id: tabBox
0018
0019 readonly property real screenFactor: screenGeometry.width / screenGeometry.height
0020
0021 currentIndex: thumbnailListView.currentIndex
0022
0023 PlasmaCore.Dialog {
0024 id: dialog
0025 location: Qt.application.layoutDirection === Qt.RightToLeft ? PlasmaCore.Types.RightEdge : PlasmaCore.Types.LeftEdge
0026 visible: tabBox.visible
0027 flags: Qt.X11BypassWindowManagerHint
0028 x: screenGeometry.x + (Qt.application.layoutDirection === Qt.RightToLeft ? screenGeometry.width - width : 0)
0029 y: screenGeometry.y
0030
0031 mainItem: PlasmaComponents.ScrollView {
0032 id: dialogMainItem
0033
0034 focus: true
0035
0036 contentWidth: tabBox.screenGeometry.width * 0.15
0037 height: tabBox.screenGeometry.height - dialog.margins.top - dialog.margins.bottom
0038
0039 LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
0040 LayoutMirroring.childrenInherit: true
0041
0042 ListView {
0043 id: thumbnailListView
0044 focus: true
0045 model: tabBox.model
0046 spacing: Kirigami.Units.smallSpacing
0047 highlightMoveDuration: Kirigami.Units.longDuration
0048 highlightResizeDuration: 0
0049
0050 Connections {
0051 target: tabBox
0052 function onCurrentIndexChanged() {
0053 thumbnailListView.currentIndex = tabBox.currentIndex;
0054 thumbnailListView.positionViewAtIndex(thumbnailListView.currentIndex, ListView.Contain)
0055 }
0056 }
0057
0058 delegate: MouseArea {
0059 width: thumbnailListView.width
0060 height: delegateColumn.height + 2 * delegateColumn.y
0061 focus: ListView.isCurrentItem
0062
0063 Accessible.name: model.caption
0064 Accessible.role: Accessible.ListItem
0065
0066 onClicked: {
0067 if (tabBox.noModifierGrab) {
0068 tabBox.model.activate(index);
0069 } else {
0070 thumbnailListView.currentIndex = index;
0071 }
0072 }
0073
0074 ColumnLayout {
0075 id: delegateColumn
0076 anchors.horizontalCenter: parent.horizontalCenter
0077 // anchors.centerIn causes layouting glitches
0078 y: Kirigami.Units.smallSpacing
0079 width: parent.width - 2 * Kirigami.Units.smallSpacing
0080 spacing: Kirigami.Units.smallSpacing
0081
0082 Item {
0083 Layout.fillWidth: true
0084 implicitHeight: Math.round(delegateColumn.width / tabBox.screenFactor)
0085
0086 KWin.WindowThumbnail {
0087 anchors.fill: parent
0088 wId: windowId
0089 }
0090 }
0091
0092 RowLayout {
0093 spacing: Kirigami.Units.smallSpacing
0094 Layout.fillWidth: true
0095
0096 Kirigami.Icon {
0097 Layout.preferredHeight: Kirigami.Units.iconSizes.medium
0098 Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0099 source: model.icon
0100 }
0101
0102 Kirigami.Heading {
0103 Layout.fillWidth: true
0104 height: undefined
0105 level: 4
0106 text: model.caption
0107 elide: Text.ElideRight
0108 wrapMode: Text.WrapAtWordBoundaryOrAnywhere
0109 maximumLineCount: 2
0110 lineHeight: 0.95
0111 textFormat: Text.PlainText
0112 }
0113 }
0114 }
0115 }
0116
0117 highlight: PlasmaExtras.Highlight {}
0118 }
0119 }
0120 }
0121 }
0122