Warning, /plasma/kscreen/kcm/ui/Orientation.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 import org.kde.private.kcm.kscreen 1.0 as KScreen 0012 0013 ColumnLayout { 0014 Kirigami.FormData.label: i18n("Orientation:") 0015 Kirigami.FormData.labelAlignment: autoRotateColumn.visible ? Qt.AlignTop : Qt.AlignVCenter 0016 Kirigami.FormData.buddyFor: autoRotateColumn.visible ? autoRotateColumn : orientation 0017 spacing: Kirigami.Units.smallSpacing 0018 0019 ColumnLayout { 0020 id: autoRotateColumn 0021 0022 enabled: element.internal 0023 visible: kcm.autoRotationSupported && kcm.orientationSensorAvailable 0024 0025 ColumnLayout { 0026 QQC2.RadioButton { 0027 id: autoRotateRadio 0028 text: i18n("Automatic") 0029 checked: autoRotateColumn.enabled && element.autoRotate != KScreen.Output.AutoRotatePolicy.Never 0030 onToggled: { 0031 if (element.autoRotate == KScreen.Output.AutoRotatePolicy.Never) { 0032 element.autoRotate = KScreen.Output.AutoRotatePolicy.InTabletMode 0033 } else { 0034 element.autoRotate = KScreen.Output.AutoRotatePolicy.Never 0035 } 0036 } 0037 } 0038 0039 QQC2.CheckBox { 0040 id: autoRotateOnlyInTabletMode 0041 Layout.leftMargin: Kirigami.Units.gridUnit 0042 0043 text: i18n("Only when in tablet mode") 0044 enabled: autoRotateRadio.checked 0045 checked: enabled && element.autoRotate == KScreen.Output.AutoRotatePolicy.InTabletMode 0046 visible: kcm.tabletModeAvailable 0047 onToggled: { 0048 if (element.autoRotate == KScreen.Output.AutoRotatePolicy.Always) { 0049 element.autoRotate = KScreen.Output.AutoRotatePolicy.InTabletMode 0050 } else { 0051 element.autoRotate = KScreen.Output.AutoRotatePolicy.Always 0052 } 0053 } 0054 } 0055 } 0056 0057 QQC2.RadioButton { 0058 id: manualRotateRadio 0059 text: i18n("Manual") 0060 checked: element.autoRotate == KScreen.Output.AutoRotatePolicy.Never || !autoRotateColumn.enabled 0061 onToggled: element.autoRotate = KScreen.Output.AutoRotatePolicy.Never 0062 } 0063 } 0064 0065 RowLayout { 0066 id: orientation 0067 enabled: !element.autoRotate || !autoRotateColumn.enabled || !autoRotateColumn.visible 0068 0069 QQC2.ButtonGroup { 0070 buttons: orientation.children 0071 } 0072 0073 RotationButton { 0074 value: 0 0075 } 0076 RotationButton { 0077 value: 90 0078 } 0079 RotationButton { 0080 value: 180 0081 } 0082 RotationButton { 0083 value: 270 0084 } 0085 } 0086 }