Warning, /plasma/kscreen/plasmoid/package/contents/ui/ScreenLayoutSelection.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 Work sponsored by the LiMux project of the city of Munich: 0003 SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@broulik.de> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 import QtQuick 2.15 0009 import QtQuick.Layouts 1.15 0010 0011 import org.kde.plasma.plasmoid 2.0 0012 import org.kde.plasma.components 3.0 as PlasmaComponents3 0013 import org.kde.plasma.extras 2.0 as PlasmaExtras 0014 import org.kde.kirigami 2.20 as Kirigami 0015 0016 ColumnLayout { 0017 id: root 0018 0019 // Screen layouts model. 0020 // 0021 // type: [{ 0022 // iconName: string, 0023 // label: string, 0024 // action: enum<OsdAction::Action>, 0025 // }] 0026 property var screenLayouts 0027 0028 spacing: Kirigami.Units.smallSpacing * 2 0029 0030 states: [ 0031 State { 0032 // only makes sense to offer screen layout setup if there's more than one screen connected 0033 when: Plasmoid.connectedOutputCount < 2 0034 0035 PropertyChanges { 0036 target: screenLayoutRow 0037 enabled: false 0038 } 0039 PropertyChanges { 0040 target: noScreenLabel 0041 visible: true 0042 } 0043 } 0044 ] 0045 0046 Kirigami.Heading { 0047 Layout.fillWidth: true 0048 level: 3 0049 text: i18n("Screen Layout") 0050 } 0051 0052 // Screen layout selector section 0053 Row { 0054 id: screenLayoutRow 0055 readonly property int buttonSize: Math.floor((width - spacing * (screenLayoutRepeater.count - 1)) / screenLayoutRepeater.count) 0056 Layout.fillWidth: true 0057 spacing: Kirigami.Units.smallSpacing 0058 0059 Repeater { 0060 id: screenLayoutRepeater 0061 model: root.screenLayouts 0062 0063 PlasmaComponents3.Button { 0064 width: screenLayoutRow.buttonSize 0065 height: width 0066 onClicked: Plasmoid.applyLayoutPreset(modelData.action) 0067 0068 Accessible.name: modelData.label 0069 PlasmaComponents3.ToolTip { text: modelData.label } 0070 0071 // HACK otherwise the icon won't expand to full button size 0072 Kirigami.Icon { 0073 anchors.centerIn: parent 0074 width: height 0075 // FIXME use proper FrameSvg margins and stuff 0076 height: parent.height - Kirigami.Units.smallSpacing 0077 source: modelData.iconName 0078 active: parent.hovered 0079 } 0080 } 0081 } 0082 } 0083 0084 PlasmaExtras.DescriptiveLabel { 0085 id: noScreenLabel 0086 Layout.fillWidth: true 0087 Layout.maximumWidth: Math.min(Kirigami.Units.gridUnit * 20, implicitWidth) 0088 wrapMode: Text.Wrap 0089 text: i18n("You can only apply a different screen layout when there is more than one display device plugged in.") 0090 font: Kirigami.Theme.smallFont 0091 visible: false 0092 } 0093 }