Warning, /multimedia/haruna/src/qml/Settings/MouseSettings.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2020 George Florea Bănuș <georgefb899@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 import QtQml 0008 import QtQuick 0009 import QtQuick.Layouts 0010 import QtQuick.Controls 0011 0012 import org.kde.kirigami as Kirigami 0013 import org.kde.haruna 0014 import org.kde.haruna.settings 0015 0016 SettingsBasePage { 0017 id: root 0018 0019 hasHelp: false 0020 helpFile: "" 0021 0022 ColumnLayout { 0023 id: content 0024 0025 anchors.fill: parent 0026 spacing: Kirigami.Units.largeSpacing 0027 0028 ListModel { 0029 id: mouseActionsModel 0030 0031 ListElement { 0032 label: "Left" 0033 key: "left" 0034 } 0035 ListElement { 0036 label: "Left double click" 0037 key: "leftx2" 0038 } 0039 ListElement { 0040 label: "Right" 0041 key: "right" 0042 } 0043 ListElement { 0044 label: "Right double click" 0045 key: "rightx2" 0046 } 0047 ListElement { 0048 label: "Middle" 0049 key: "middle" 0050 } 0051 ListElement { 0052 label: "Middle double click" 0053 key: "middlex2" 0054 } 0055 ListElement { 0056 label: "Scroll up" 0057 key: "scrollUp" 0058 } 0059 ListElement { 0060 label: "Scroll down" 0061 key: "scrollDown" 0062 } 0063 } 0064 0065 ListView { 0066 id: mouseButtonsListView 0067 0068 property int delegateHeight 0069 0070 model: mouseActionsModel 0071 delegate: ItemDelegate { 0072 id: delegate 0073 0074 width: content.width 0075 highlighted: false 0076 0077 contentItem: RowLayout { 0078 Kirigami.IconTitleSubtitle { 0079 title: model.label 0080 subtitle: MouseSettings[model.key] 0081 ? appActions[MouseSettings[model.key]].text 0082 : i18nc("@label", "No action set") 0083 icon.name: MouseSettings[model.key] ? "checkmark" : "" 0084 0085 Layout.fillWidth: true 0086 } 0087 ToolButton { 0088 visible: MouseSettings[model.key] 0089 icon.name: "edit-clear-all" 0090 onClicked: { 0091 MouseSettings[model.key] = "" 0092 MouseSettings.save() 0093 } 0094 0095 ToolTip { 0096 text: i18nc("@info:tooltip", "Clear action") 0097 } 0098 } 0099 } 0100 0101 onClicked: openSelectActionPopup() 0102 Component.onCompleted: mouseButtonsListView.delegateHeight = height 0103 0104 Connections { 0105 target: selectActionPopup 0106 function onActionSelected(actionName) { 0107 if (selectActionPopup.buttonIndex === model.index) { 0108 MouseSettings[model.key] = actionName 0109 MouseSettings.save() 0110 } 0111 } 0112 } 0113 0114 function openSelectActionPopup() { 0115 selectActionPopup.buttonIndex = model.index 0116 selectActionPopup.title = model.label 0117 selectActionPopup.open() 0118 } 0119 } 0120 0121 Layout.fillWidth: true 0122 Layout.fillHeight: true 0123 } 0124 0125 Item { 0126 width: Kirigami.Units.gridUnit 0127 height: Kirigami.Units.gridUnit 0128 } 0129 0130 SelectActionPopup { 0131 id: selectActionPopup 0132 0133 subtitle: i18nc("@title", "Double click to set action") 0134 } 0135 } 0136 }