Warning, /plasma/kscreen/kcm/ui/Panel.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 import org.kde.kitemmodels 1.0 0011 0012 import org.kde.kcmutils as KCM 0013 0014 ColumnLayout { 0015 id: root 0016 0017 property KSortFilterProxyModel enabledOutputs 0018 property int selectedOutput 0019 0020 signal reorder() 0021 0022 Kirigami.FormLayout { 0023 twinFormLayouts: globalSettingsLayout 0024 visible: kcm.multipleScreensAvailable 0025 0026 RowLayout { 0027 Kirigami.FormData.label: i18n("Device:") 0028 0029 QQC2.ComboBox { 0030 Layout.maximumWidth: Kirigami.Units.gridUnit * 16 0031 model: kcm.outputModel 0032 textRole: "display" 0033 Component.onCompleted: currentIndex = Qt.binding(() => root.selectedOutput); 0034 onActivated: index => { 0035 root.selectedOutput = index; 0036 currentIndex = Qt.binding(() => root.selectedOutput); 0037 } 0038 } 0039 } 0040 } 0041 0042 StackLayout { 0043 id: panelView 0044 currentIndex: root.selectedOutput 0045 0046 Layout.fillWidth: true 0047 0048 Repeater { 0049 model: kcm.outputModel 0050 OutputPanel { 0051 twinFormLayouts: globalSettingsLayout 0052 enabledOutputs: root.enabledOutputs 0053 onReorder: root.reorder() 0054 } 0055 } 0056 } 0057 0058 Kirigami.FormLayout { 0059 id: globalSettingsLayout 0060 Layout.fillWidth: true 0061 0062 Kirigami.Separator { 0063 Layout.fillWidth: true 0064 Kirigami.FormData.isSection: true 0065 } 0066 0067 RowLayout { 0068 Layout.fillWidth: true 0069 Kirigami.FormData.label: i18n("Global scale:") 0070 0071 visible: !kcm.perOutputScaling 0072 0073 QQC2.Slider { 0074 id: globalScaleSlider 0075 0076 Layout.fillWidth: true 0077 from: 1 0078 to: 3 0079 stepSize: 0.25 0080 live: true 0081 value: kcm.globalScale 0082 onMoved: kcm.globalScale = value; 0083 } 0084 QQC2.SpinBox { 0085 id: spinbox 0086 Layout.minimumWidth: Kirigami.Units.gridUnit * 6 0087 0088 // Because QQC2 SpinBox doesn't natively support decimal step 0089 // sizes: https://bugreports.qt.io/browse/QTBUG-67349 0090 readonly property real factor: 16.0 0091 readonly property real realValue: value / factor 0092 0093 from: 1.0 * factor 0094 to: 3.0 * factor 0095 // On X11 We set the increment to this weird value to compensate 0096 // for inherent difficulties with floating-point math and this 0097 // Qt bug: https://bugreports.qt.io/browse/QTBUG-66036 0098 stepSize: 1 0099 value: kcm.globalScale * factor 0100 validator: DoubleValidator { 0101 bottom: Math.min(spinbox.from, spinbox.to) * spinbox.factor 0102 top: Math.max(spinbox.from, spinbox.to) * spinbox.factor 0103 } 0104 textFromValue: (value, locale) => 0105 i18nc("Global scale factor expressed in percentage form", "%1%", 0106 parseFloat(value * 1.0 / factor * 100.0)) 0107 valueFromText: (text, locale) => 0108 Number.fromLocaleString(locale, text.replace("%", "")) * factor / 100.0 0109 0110 onValueModified: { 0111 kcm.globalScale = realValue; 0112 if (kcm.globalScale % 0.25) { 0113 weirdScaleFactorMsg.visible = true; 0114 } else { 0115 weirdScaleFactorMsg.visible = false; 0116 } 0117 } 0118 } 0119 } 0120 0121 QQC2.ButtonGroup { 0122 id: x11AppsScaling 0123 onClicked: kcm.xwaylandClientsScale = (button === x11ScalingApps) 0124 } 0125 0126 RowLayout { 0127 visible: kcm.xwaylandClientsScaleSupported 0128 0129 Kirigami.FormData.label: i18n("Legacy applications (X11):") 0130 spacing: Kirigami.Units.smallSpacing 0131 0132 QQC2.RadioButton { 0133 id: x11ScalingApps 0134 text: i18nc("The apps themselves should scale to fit the displays", "Apply scaling themselves") 0135 checked: kcm.xwaylandClientsScale 0136 QQC2.ButtonGroup.group: x11AppsScaling 0137 } 0138 KCM.ContextualHelpButton { 0139 toolTipText: i18n("Legacy applications that support scaling will use it and look crisp, however those that don't will not be scaled at all.") 0140 } 0141 } 0142 0143 RowLayout { 0144 visible: kcm.xwaylandClientsScaleSupported 0145 0146 spacing: Kirigami.Units.smallSpacing 0147 0148 QQC2.RadioButton { 0149 Kirigami.FormData.label: i18n("Legacy applications (X11):") 0150 text: i18nc("The system will perform the x11 apps scaling", "Scaled by the system") 0151 checked: !kcm.xwaylandClientsScale 0152 QQC2.ButtonGroup.group: x11AppsScaling 0153 } 0154 KCM.ContextualHelpButton { 0155 toolTipText: i18n("All legacy applications will be scaled by the system to the correct size, however they will always look slightly blurry.") 0156 } 0157 } 0158 0159 RowLayout { 0160 Kirigami.FormData.label: i18nc("@label", "Screen tearing:") 0161 visible: kcm.tearingSupported 0162 QQC2.CheckBox { 0163 text: i18nc("@option:check The thing being allowed in fullscreen windows is screen tearing", "Allow in fullscreen windows") 0164 checked: kcm.tearingAllowed 0165 onToggled: kcm.tearingAllowed = checked 0166 } 0167 KCM.ContextualHelpButton { 0168 toolTipText: i18nc("@info:tooltip", "Screen tearing reduces latency with most displays. Note that not all graphics drivers support this setting.") 0169 } 0170 } 0171 0172 Item { 0173 Kirigami.FormData.isSection: false 0174 visible: kcm.xwaylandClientsScaleSupported 0175 } 0176 0177 Kirigami.InlineMessage { 0178 id: weirdScaleFactorMsg 0179 Kirigami.FormData.isSection: true 0180 Layout.fillWidth: true 0181 type: Kirigami.MessageType.Information 0182 text: i18n("The global scale factor is limited to multiples of 6.25% to minimize visual glitches in applications using the X11 windowing system.") 0183 visible: false 0184 showCloseButton: true 0185 } 0186 } 0187 }