Warning, /plasma-bigscreen/plasma-remotecontrollers/kcm/ui/delegates/MapButtonDelegate.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2020 Aditya Mehra <aix.m@outlook.com>
0003
0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006
0007 import QtQuick 2.14
0008 import QtQuick.Layouts 1.14
0009 import QtQuick.Controls 2.14
0010 import org.kde.plasma.components 3.0 as PlasmaComponents
0011 import org.kde.kirigami 2.12 as Kirigami
0012
0013 PlasmaComponents.Button {
0014 id: btnMap
0015 implicitWidth: parent.width
0016 padding: Kirigami.Units.largeSpacing
0017
0018 background: Rectangle {
0019 Kirigami.Theme.inherit: false
0020 Kirigami.Theme.colorSet: Kirigami.Theme.Button
0021 color: btnMap.activeFocus ? Kirigami.Theme.linkColor : Kirigami.Theme.backgroundColor
0022 border.width: 1
0023 border.color: Kirigami.Theme.disabledTextColor
0024 }
0025
0026 contentItem: RowLayout {
0027 id: keyLayout
0028
0029 PlasmaComponents.Label {
0030 id: keyButtonDisplayLabel
0031 Layout.preferredWidth: parent.width / 2
0032 horizontalAlignment: Text.AlignHCenter
0033 text: model.buttonDisplay
0034 elide: Text.ElideLeft
0035 }
0036
0037 Item {
0038 Layout.preferredWidth: Kirigami.Units.iconSizes.large
0039
0040 Kirigami.Icon {
0041 id: keyIcon
0042 source: model.assignedKeyIcon
0043 width: Kirigami.Units.iconSizes.large
0044 height: Kirigami.Units.iconSizes.large
0045 anchors.horizontalCenter: parent.horizontalCenter
0046 anchors.verticalCenter: parent.verticalCenter
0047 visible: model.assignedKeyIcon != "" ? 1 : 0
0048 enabled: model.assignedKeyIcon != "" ? 1 : 0
0049 color: Kirigami.Theme.textColor
0050 }
0051 }
0052
0053 Kirigami.Separator {
0054 id: decorationSeparator
0055 Layout.preferredWidth: 1
0056 Layout.fillHeight: true
0057 visible: keyIcon.visible
0058 enabled: keyIcon.visible
0059 }
0060
0061 PlasmaComponents.Label {
0062 id: keyValue
0063 Layout.leftMargin: keyIcon.visible ? Kirigami.Units.largeSpacing : 0
0064 Layout.preferredWidth: parent.width * 0.25
0065 horizontalAlignment: decorationSeparator.visible ? Text.AlignLeft : Text.AlignHCenter
0066 fontSizeMode: Text.HorizontalFit
0067 minimumPixelSize: 8
0068 elide: Text.ElideRight
0069 font.pixelSize: keyButtonDisplayLabel.font.pixelSize
0070 text: model.assignedKeyDisplay
0071 }
0072 }
0073
0074 Keys.onReturnPressed: clicked()
0075
0076 onClicked: {
0077 if (model.deviceType == "GAMEPAD") {
0078 keySetupGamepadPopUp.keyType = [model.buttonDisplay, model.buttonType]
0079
0080 if(!deviceView.ignoreEvent) {
0081 keySetupGamepadPopUp.open()
0082 }
0083 }
0084 if (model.deviceType == "CEC") {
0085 keySetupPopUp.keyType = [model.buttonDisplay, model.buttonType]
0086 keySetupPopUp.open()
0087 }
0088 }
0089 }