Warning, /plasma/kscreen/kcm/ui/ScreenView.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 import QtQuick 2.15 0007 import QtQuick.Layouts 1.15 0008 import QtQuick.Controls 2.15 as QQC2 0009 import org.kde.kirigami 2.20 as Kirigami 0010 0011 QQC2.ScrollView { 0012 property var outputs 0013 property size totalSize 0014 0015 function resetTotalSize() { 0016 totalSize = kcm.normalizeScreen(); 0017 } 0018 0019 onWidthChanged: resetTotalSize() 0020 onHeightChanged: resetTotalSize() 0021 0022 readonly property real relativeFactor: { 0023 var relativeSize = Qt.size(totalSize.width / (0.6 * width), 0024 totalSize.height / (0.6 * height)); 0025 if (relativeSize.width > relativeSize.height) { 0026 // Available width smaller than height, optimize for width (we have 0027 // '>' because the available width, height is in the denominator). 0028 return relativeSize.width; 0029 } else { 0030 return relativeSize.height; 0031 } 0032 } 0033 0034 readonly property int xOffset: (width - totalSize.width / relativeFactor) / 2; 0035 readonly property int yOffset: (height - totalSize.height / relativeFactor) / 2; 0036 0037 Kirigami.Heading { 0038 z: 90 0039 anchors { 0040 top: parent.top 0041 left: parent.left 0042 right: parent.right 0043 margins: Kirigami.Units.smallSpacing 0044 } 0045 level: 4 0046 opacity: 0.6 0047 horizontalAlignment: Text.AlignHCenter 0048 text: i18n("Drag screens to re-arrange them") 0049 visible: kcm.multipleScreensAvailable 0050 } 0051 0052 QQC2.Button { 0053 anchors { 0054 bottom: parent.bottom 0055 horizontalCenter: parent.horizontalCenter 0056 margins: Kirigami.Units.smallSpacing 0057 } 0058 z: 90 0059 0060 onClicked: kcm.identifyOutputs() 0061 text: i18n("Identify") 0062 icon.name: "documentinfo" 0063 focusPolicy: Qt.NoFocus 0064 visible: kcm.multipleScreensAvailable 0065 } 0066 0067 Repeater { 0068 model: kcm.outputModel 0069 delegate: Output {} 0070 0071 onCountChanged: resetTotalSize() 0072 } 0073 }