| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2023 George Florea Bănuș <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: GPL-3.0-or-later |
| 5 |
*/ |
| 6 |
|
| 7 |
import QtQml |
| 8 |
import QtQuick |
| 9 |
import QtQuick.Layouts |
| 10 |
import QtQuick.Controls |
| 11 |
|
| 12 |
import org.kde.kirigami as Kirigami |
| 13 |
import org.kde.haruna |
| 14 |
import org.kde.haruna.utilities |
| 15 |
import org.kde.haruna.settings |
| 16 |
|
| 17 |
SettingsBasePage { |
| 18 |
id: root |
| 19 |
|
| 20 |
required property MpvVideo m_mpv |
| 21 |
|
| 22 |
ColumnLayout { |
| 23 |
id: content |
| 24 |
|
| 25 |
Label { |
| 26 |
text: i18nc("@label:textbox", "Config file") |
| 27 |
} |
| 28 |
|
| 29 |
ConfigFileField { |
| 30 |
configFile: PathUtils.ConfigFile.Main |
| 31 |
|
| 32 |
Layout.fillWidth: true |
| 33 |
} |
| 34 |
|
| 35 |
Item { Layout.preferredHeight: Kirigami.Units.largeSpacing } |
| 36 |
|
| 37 |
Label { |
| 38 |
text: i18nc("@label:textbox", "Custom commands config file") |
| 39 |
} |
| 40 |
|
| 41 |
ConfigFileField { |
| 42 |
configFile: PathUtils.ConfigFile.CustomCommands |
| 43 |
|
| 44 |
Layout.fillWidth: true |
| 45 |
} |
| 46 |
|
| 47 |
Item { Layout.preferredHeight: Kirigami.Units.largeSpacing } |
| 48 |
|
| 49 |
Label { |
| 50 |
text: i18nc("@label:textbox", "Shortcuts config file") |
| 51 |
} |
| 52 |
|
| 53 |
ConfigFileField { |
| 54 |
configFile: PathUtils.ConfigFile.Shortcuts |
| 55 |
|
| 56 |
Layout.fillWidth: true |
| 57 |
} |
| 58 |
|
| 59 |
Item { Layout.preferredHeight: Kirigami.Units.largeSpacing } |
| 60 |
|
| 61 |
Label { |
| 62 |
text: i18nc("@label:textbox", "Playlists config file") |
| 63 |
} |
| 64 |
|
| 65 |
ConfigFileField { |
| 66 |
configFile: PathUtils.ConfigFile.PlaylistCache |
| 67 |
|
| 68 |
Layout.fillWidth: true |
| 69 |
} |
| 70 |
|
| 71 |
Item { Layout.preferredHeight: Kirigami.Units.largeSpacing } |
| 72 |
|
| 73 |
Label { |
| 74 |
text: i18nc("@info:usagetip", "If fields are empty that means there is no config file/folder (e.g when using the default settings).") |
| 75 |
wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
| 76 |
Layout.fillWidth: true |
| 77 |
} |
| 78 |
|
| 79 |
Item { Layout.preferredHeight: Kirigami.Units.largeSpacing } |
| 80 |
|
| 81 |
CheckBox { |
| 82 |
text: i18nc("@option:check", "Enable mpv logging") |
| 83 |
checked: InformationSettings.mpvLogging |
| 84 |
visible: false |
| 85 |
onClicked: { |
| 86 |
root.m_mpv.setProperty(MpvProperties.Terminal, checked) |
| 87 |
InformationSettings.mpvLogging = checked |
| 88 |
InformationSettings.save() |
| 89 |
} |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
component ConfigFileField: Kirigami.ActionTextField { |
| 95 |
id: configFileField |
| 96 |
|
| 97 |
property int configFile: PathUtils.ConfigFile.Main |
| 98 |
|
| 99 |
text: PathUtils.configFilePath(configFile) |
| 100 |
readOnly: true |
| 101 |
rightActions: [ |
| 102 |
Kirigami.Action { |
| 103 |
icon.name: "document-open" |
| 104 |
visible: configFileField.text !== "" |
| 105 |
text: i18nc("@info:tooltip", "Open file") |
| 106 |
onTriggered: { |
| 107 |
const url = PathUtils.pathToUrl(PathUtils.configFilePath(configFileField.configFile)) |
| 108 |
Qt.openUrlExternally(url) |
| 109 |
} |
| 110 |
}, |
| 111 |
Kirigami.Action { |
| 112 |
icon.name: "document-open-folder" |
| 113 |
visible: configFileField.text !== "" |
| 114 |
text: i18nc("@info:tooltip", "Open containing folder") |
| 115 |
onTriggered: { |
| 116 |
const path = PathUtils.configFilePath(configFileField.configFile) |
| 117 |
PathUtils.highlightInFileManager(path) |
| 118 |
} |
| 119 |
} |
| 120 |
] |
| 121 |
} |
| 122 |
} |