Warning, /plasma-bigscreen/plasma-remotecontrollers/kcm/ui/DeviceMap.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.kirigami 2.12 as Kirigami 0011 import org.kde.kitemmodels 1.0 as KItemModels 0012 import org.kde.private.kcm.remotecontrollers 1.0 0013 import "delegates" as Delegates 0014 0015 Item { 0016 id: deviceMap 0017 Layout.fillWidth: true 0018 Layout.fillHeight: true 0019 property var deviceType 0020 0021 onFocusChanged: { 0022 if(focus) { 0023 buttonMapRepeater.forceActiveFocus() 0024 } 0025 } 0026 0027 ScrollBar { 0028 id: scrollBarListView 0029 anchors.right: parent.right 0030 anchors.top: parent.top 0031 anchors.bottom: parent.bottom 0032 } 0033 0034 ColumnLayout { 0035 anchors.fill: parent 0036 anchors.leftMargin: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing 0037 anchors.rightMargin: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing 0038 0039 Kirigami.Heading { 0040 Layout.fillWidth: true 0041 horizontalAlignment: Text.AlignHCenter 0042 text: switch(deviceMap.deviceType) { 0043 case 0: 0044 return i18n("Bind TV Remote Keys To Buttons"); 0045 case 1: 0046 return i18n("Bind Wii Remote Keys To Buttons"); 0047 case 2: 0048 return i18n("Bind Gamepad Keys To Buttons"); 0049 } 0050 } 0051 0052 Item { 0053 Layout.preferredHeight: Kirigami.Units.gridUnit 0054 } 0055 0056 Item { 0057 Layout.fillWidth: true 0058 Layout.fillHeight: true 0059 0060 ListView { 0061 id: buttonMapRepeater 0062 anchors.fill: parent 0063 clip: true 0064 model: KItemModels.KSortFilterProxyModel { 0065 sourceModel: kcm.keyMapModel 0066 filterRole: "DeviceTypeRole" 0067 filterRowCallback: function(source_row, source_parent) { 0068 var filter_device = deviceMap.deviceType == 0 ? "CEC" : "GAMEPAD" 0069 return sourceModel.data(sourceModel.index(source_row, 0, source_parent), KeyMapModel.DeviceTypeRole).indexOf(filter_device) !== -1; 0070 } 0071 } 0072 0073 keyNavigationEnabled: true 0074 highlightFollowsCurrentItem: true 0075 spacing: Kirigami.Units.smallSpacing 0076 ScrollBar.vertical: scrollBarListView 0077 delegate: Delegates.MapButtonDelegate { 0078 id: mapButtonType 0079 objectName: model.objectName 0080 } 0081 } 0082 } 0083 } 0084 }