Warning, /multimedia/haruna/src/qml/Settings/VideoSettings.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 QtQuick 0008 import QtQuick.Layouts 0009 import QtQuick.Controls 0010 import Qt.labs.platform as Platform 0011 0012 import org.kde.kirigami as Kirigami 0013 import org.kde.haruna 0014 import org.kde.haruna.mpvproperties 0015 import org.kde.haruna.settings 0016 0017 SettingsBasePage { 0018 id: root 0019 0020 hasHelp: true 0021 helpFile: ":/VideoSettings.html" 0022 docPage: "help:/haruna/VideoSettings.html" 0023 0024 GridLayout { 0025 id: content 0026 0027 columns: 2 0028 0029 Label { 0030 text: i18nc("@label:listbox", "Default cover") 0031 Layout.alignment: Qt.AlignRight 0032 } 0033 0034 RowLayout { 0035 TextField { 0036 id: defaultCover 0037 0038 text: VideoSettings.defaultCover 0039 placeholderText: i18nc("placeholder text", "path to image") 0040 Layout.fillWidth: true 0041 onEditingFinished: save() 0042 0043 Connections { 0044 target: root 0045 function onSave() { 0046 defaultCover.save() 0047 } 0048 } 0049 0050 ToolTip { 0051 text: i18nc("@info:tooltip", "Used for music files that don't have a video track, " 0052 + "an embedded cover image or a cover/folder image " 0053 + "in the same folder as the played file.") 0054 } 0055 0056 function save() { 0057 VideoSettings.defaultCover = defaultCover.text 0058 VideoSettings.save() 0059 } 0060 } 0061 0062 Button { 0063 icon.name: "folder" 0064 onClicked: fileDialog.open() 0065 } 0066 0067 Platform.FileDialog { 0068 id: fileDialog 0069 0070 folder: Platform.StandardPaths.writableLocation(Platform.StandardPaths.PicturesLocation) 0071 title: i18nc("@title:window", "Select file") 0072 fileMode: Platform.FileDialog.OpenFile 0073 0074 onAccepted: { 0075 VideoSettings.defaultCover = fileDialog.file 0076 } 0077 onRejected: mpv.focus = true 0078 } 0079 } 0080 0081 SettingsHeader { 0082 text: i18nc("@title", "Screenshots") 0083 topMargin: 0 0084 Layout.columnSpan: 2 0085 Layout.fillWidth: true 0086 } 0087 0088 // ------------------------------------ 0089 // Screenshot Format 0090 // ------------------------------------ 0091 Label { 0092 text: i18nc("@label:listbox", "Format") 0093 Layout.alignment: Qt.AlignRight 0094 } 0095 0096 ComboBox { 0097 id: screenshotFormat 0098 textRole: "key" 0099 model: ListModel { 0100 ListElement { key: "PNG"; value: "png" } 0101 ListElement { key: "JPG"; value: "jpg" } 0102 ListElement { key: "WebP"; value: "webp" } 0103 ListElement { key: "JPEG XL"; value: "jxl" } 0104 } 0105 0106 onActivated: function(index) { 0107 VideoSettings.screenshotFormat = model.get(index).value 0108 VideoSettings.save() 0109 mpv.setProperty(MpvProperties.ScreenshotFormat, VideoSettings.screenshotFormat) 0110 } 0111 0112 Component.onCompleted: { 0113 if (VideoSettings.screenshotFormat === "png") { 0114 currentIndex = 0 0115 } 0116 if (VideoSettings.screenshotFormat === "jpg") { 0117 currentIndex = 1 0118 } 0119 if (VideoSettings.screenshotFormat === "webp") { 0120 currentIndex = 2 0121 } 0122 if (VideoSettings.screenshotFormat === "jxl") { 0123 currentIndex = 3 0124 } 0125 } 0126 } 0127 0128 // ------------------------------------ 0129 // Screenshot template 0130 // ------------------------------------ 0131 Label { 0132 text: i18nc("@label:textbox", "Template") 0133 Layout.alignment: Qt.AlignRight 0134 } 0135 0136 TextField { 0137 id: screenshotTemplate 0138 0139 text: VideoSettings.screenshotTemplate 0140 Layout.fillWidth: true 0141 onEditingFinished: save() 0142 0143 Connections { 0144 target: root 0145 function onSave() { 0146 screenshotTemplate.save() 0147 } 0148 } 0149 0150 function save() { 0151 VideoSettings.screenshotTemplate = text 0152 VideoSettings.save() 0153 mpv.setProperty(MpvProperties.ScreenshotTemplate, VideoSettings.screenshotTemplate) 0154 } 0155 } 0156 0157 SettingsHeader { 0158 text: i18nc("@title", "Image adjustments") 0159 Layout.columnSpan: 2 0160 Layout.fillWidth: true 0161 } 0162 0163 0164 // ------------------------------------ 0165 // CONTRAST 0166 // ------------------------------------ 0167 Label { 0168 text: i18nc("@label:slider", "Contrast") 0169 Layout.alignment: Qt.AlignRight 0170 } 0171 0172 ImageAdjustmentSlider { 0173 id: contrastSlider 0174 0175 value: mpv.getProperty(MpvProperties.Contrast) 0176 onSliderValueChanged: function(value) { 0177 mpv.setProperty(MpvProperties.Contrast, value.toFixed(0)) 0178 } 0179 0180 Layout.topMargin: Kirigami.Units.largeSpacing 0181 } 0182 0183 // ------------------------------------ 0184 // BRIGHTNESS 0185 // ------------------------------------ 0186 Label { 0187 text: i18nc("@label:slider", "Brightness") 0188 Layout.alignment: Qt.AlignRight 0189 } 0190 0191 ImageAdjustmentSlider { 0192 id: brightnessSlider 0193 0194 value: mpv.getProperty(MpvProperties.Brightness) 0195 onSliderValueChanged: function(value) { 0196 mpv.setProperty(MpvProperties.Brightness, value.toFixed(0)) 0197 } 0198 0199 Layout.topMargin: Kirigami.Units.largeSpacing 0200 } 0201 0202 // ------------------------------------ 0203 // GAMMA 0204 // ------------------------------------ 0205 Label { 0206 text: i18nc("@label:slider", "Gamma") 0207 Layout.alignment: Qt.AlignRight 0208 } 0209 0210 ImageAdjustmentSlider { 0211 id: gammaSlider 0212 0213 value: mpv.getProperty(MpvProperties.Gamma) 0214 onSliderValueChanged: function(value) { 0215 mpv.setProperty(MpvProperties.Gamma, value.toFixed(0)) 0216 } 0217 0218 Layout.topMargin: Kirigami.Units.largeSpacing 0219 } 0220 0221 // ------------------------------------ 0222 // SATURATION 0223 // ------------------------------------ 0224 Label { 0225 text: i18nc("@label:slider", "Saturation") 0226 Layout.alignment: Qt.AlignRight 0227 } 0228 0229 ImageAdjustmentSlider { 0230 id: saturationSlider 0231 0232 value: mpv.getProperty(MpvProperties.Saturation) 0233 onSliderValueChanged: function(value) { 0234 mpv.setProperty(MpvProperties.Saturation, value.toFixed(0)) 0235 } 0236 0237 Layout.topMargin: Kirigami.Units.largeSpacing 0238 } 0239 0240 Label { 0241 text: i18nc("@info", "Middle click on the sliders to reset them") 0242 Layout.columnSpan: 2 0243 Layout.topMargin: Kirigami.Units.largeSpacing 0244 } 0245 0246 } 0247 }