/* * SPDX-FileCopyrightText: 2020 George Florea Bănuș * * SPDX-License-Identifier: GPL-3.0-or-later */ import QtCore import QtQuick import QtQuick.Layouts import QtQuick.Controls import QtQuick.Dialogs import org.kde.kirigami as Kirigami import org.kde.haruna import org.kde.haruna.settings SettingsBasePage { id: root required property MpvVideo m_mpv GridLayout { id: content columns: 2 Label { text: i18nc("@label:listbox", "Default cover") Layout.alignment: Qt.AlignRight } RowLayout { TextField { id: defaultCover text: VideoSettings.defaultCover placeholderText: i18nc("placeholder text", "path to image") Layout.fillWidth: true onEditingFinished: save() Connections { target: root function onSave() { defaultCover.save() } } ToolTip { text: i18nc("@info:tooltip", "Used for music files that don’t have a video track, " + "an embedded cover image or a cover/folder image " + "in the same folder as the played file.") } function save() : void { VideoSettings.defaultCover = defaultCover.text VideoSettings.save() } } Button { icon.name: "folder" onClicked: fileDialog.open() } FileDialog { id: fileDialog currentFolder: StandardPaths.writableLocation(StandardPaths.PicturesLocation) title: i18nc("@title:window", "Select file") fileMode: FileDialog.OpenFile onAccepted: { VideoSettings.defaultCover = fileDialog.selectedFile } onRejected: root.m_mpv.focus = true onVisibleChanged: { HarunaApp.actionsEnabled = !visible } } } SettingsHeader { text: i18nc("@title", "Screenshots") Layout.columnSpan: 2 Layout.fillWidth: true } // ------------------------------------ // Screenshot Format // ------------------------------------ Label { text: i18nc("@label:listbox", "Format") Layout.alignment: Qt.AlignRight } ComboBox { id: screenshotFormat textRole: "key" model: ListModel { ListElement { key: "PNG"; value: "png" } ListElement { key: "JPG"; value: "jpg" } ListElement { key: "WebP"; value: "webp" } ListElement { key: "JPEG XL"; value: "jxl" } } onActivated: function(index) { VideoSettings.screenshotFormat = model.get(index).value VideoSettings.save() } Component.onCompleted: { if (VideoSettings.screenshotFormat === "png") { currentIndex = 0 } if (VideoSettings.screenshotFormat === "jpg") { currentIndex = 1 } if (VideoSettings.screenshotFormat === "webp") { currentIndex = 2 } if (VideoSettings.screenshotFormat === "jxl") { currentIndex = 3 } } } // ------------------------------------ // Screenshot template // ------------------------------------ Label { text: i18nc("@label:textbox", "Template") Layout.alignment: Qt.AlignRight } RowLayout { TextField { id: screenshotTemplate text: VideoSettings.screenshotTemplate Layout.fillWidth: true onEditingFinished: save() Connections { target: root function onSave() { screenshotTemplate.save() } } function save() : void { VideoSettings.screenshotTemplate = text VideoSettings.save() } } ToolTipButton { toolTipWidth: 500 toolTipHeight: 300 toolTipText: i18nc("@info:tooltip", "Specify the filename template used to save screenshots. The template specifies the " + "filename without file extension, and can contain format specifiers, which will be " + "substituted when taking a screenshot. By default, the template is “%F-%n”.
" + "The template can start with a relative or absolute path, in order to specify " + "a directory location where screenshots should be saved.
" + "If the final screenshot filename points to an already existing file, the file " + "will not be overwritten. The screenshot will either not be saved, or if the template " + "contains %n, saved using different, newly generated filename.
" + "For full info checkout https://mpv.io/manual/stable/#options-screenshot-template

" + "Allowed format specifiers:
" + "