Warning, /graphics/optiimage/src/contents/ui/SettingsPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
0002 // SPDX-License-Identifier: LGPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Controls as QQC2
0006 import org.kde.kirigami as Kirigami
0007 import QtQuick.Layouts
0008 import org.kde.kirigamiaddons.formcard as FormCard
0009 import org.kde.optiimage.private
0010 import org.kde.coreaddons
0011 
0012 FormCard.FormCardPage {
0013     id: root
0014 
0015     title: i18nc("@title:window", "Settings")
0016 
0017     FormCard.FormHeader {
0018         title: i18n("General")
0019     }
0020 
0021     FormCard.FormCard {
0022         FormCard.FormSwitchDelegate {
0023             id: keepMetadataCheck
0024             text: i18n("Keep Metadata")
0025             checked: Config.keepMetadata
0026             onCheckedChanged: {
0027                 Config.keepMetadata = checked;
0028                 Config.save();
0029             }
0030         }
0031 
0032         FormCard.FormDelegateSeparator {
0033             above: safeModeCheck
0034             below: keepMetadataCheck
0035         }
0036 
0037         FormCard.FormSwitchDelegate {
0038             id: safeModeCheck
0039             text: i18n("Safe mode")
0040             description: i18n("Save the compressed image in a new file")
0041             checked: Config.safeMode
0042             onCheckedChanged: {
0043                 Config.safeMode = checked;
0044                 Config.save();
0045             }
0046         }
0047 
0048         FormCard.FormDelegateSeparator {
0049             above: safeModeCheck
0050         }
0051 
0052         FormCard.FormTextFieldDelegate {
0053             enabled: safeModeCheck.checked
0054             label: i18n("Suffix to append at the end of new file")
0055             text: Config.suffix
0056             onTextChanged: {
0057                 Config.suffix = text;
0058                 Config.save();
0059             }
0060         }
0061     }
0062 
0063     FormCard.FormHeader {
0064         title: i18n("JPG")
0065     }
0066 
0067     FormCard.FormCard {
0068         FormCard.FormSwitchDelegate {
0069             id: jpgProgressiveCheck
0070             text: i18n("Progressive Encode")
0071             description: i18n("To enable incremental image rendering: blurry to clear.")
0072             checked: Config.jpgProgressive
0073             onCheckedChanged: {
0074                 Config.jpgProgressive = checked;
0075                 Config.save();
0076             }
0077         }
0078 
0079         FormCard.FormDelegateSeparator {
0080             above: jpgLosslessCheck
0081             below: jpgProgressiveCheck
0082         }
0083 
0084         FormCard.FormSwitchDelegate {
0085             id: jpgLosslessCheck
0086             text: i18nc("@label", "Use lossless compression")
0087             description: i18nc("@info", "Only use compression algorithms which do not reduce image quality.")
0088             checked: Config.jpgLossless
0089             onCheckedChanged: {
0090                 Config.jpgLossless = checked;
0091                 Config.save();
0092             }
0093         }
0094 
0095         FormCard.FormDelegateSeparator {
0096             above: jpgLosslessCheck
0097         }
0098 
0099         FormCard.FormSpinBoxDelegate {
0100             enabled: jpgLosslessCheck.checked
0101             label: i18n("Default optimization level of lossy optimization:")
0102             value: Config.jpgLossyLevel
0103             from: 10
0104             to: 100
0105             onTextChanged: {
0106                 Config.jpgLossyLevel = value;
0107                 Config.save();
0108             }
0109         }
0110     }
0111 
0112     FormCard.FormHeader {
0113         title: i18n("PNG")
0114     }
0115 
0116     FormCard.FormCard {
0117         FormCard.FormSpinBoxDelegate {
0118             label: i18n("Default optimization level of lossless optimization:")
0119             value: Config.pngLossyLevel
0120             from: 1
0121             to: 6
0122             onTextChanged: {
0123                 Config.pngLossyLevel = value;
0124                 Config.save();
0125             }
0126         }
0127     }
0128 
0129     FormCard.FormHeader {
0130         title: i18n("SVG")
0131     }
0132 
0133     FormCard.FormCard {
0134         FormCard.FormSwitchDelegate {
0135             text: i18nc("@label", "Maximum Compression Level")
0136             description: i18nc("@info", "Can be more destructive for the image.")
0137             checked: Config.svgMaximumLevel
0138             onCheckedChanged: {
0139                 Config.svgMaximumLevel = checked;
0140                 Config.save();
0141             }
0142         }
0143     }
0144 
0145     FormCard.FormHeader {
0146         title: i18n("WebP")
0147     }
0148 
0149     FormCard.FormCard {
0150         FormCard.FormSwitchDelegate {
0151             id: webpLosslessCheck
0152             text: i18nc("@label", "Use lossless compression")
0153             description: i18nc("@info", "Only use compression algorithms which do not reduce image quality.")
0154             checked: Config.webpLossless
0155             onCheckedChanged: {
0156                 Config.webpLossless = checked;
0157                 Config.save();
0158             }
0159         }
0160 
0161         FormCard.FormDelegateSeparator {
0162             above: webpLosslessCheck
0163         }
0164 
0165         FormCard.FormSpinBoxDelegate {
0166             enabled: webpLosslessCheck.checked
0167             label: i18n("Default optimization level of lossy optimization:")
0168             value: Config.webpLossyLevel
0169             from: 10
0170             to: 100
0171             onTextChanged: {
0172                 Config.webpLossyLevel = value;
0173                 Config.save();
0174             }
0175         }
0176     }
0177 
0178     FormCard.FormCard {
0179         Layout.topMargin: Kirigami.Units.gridUnit
0180 
0181         FormCard.FormButtonDelegate {
0182             text: i18n("About OptiImage")
0183             icon.name: "org.kde.optiimage"
0184             onClicked: {
0185                 QQC2.ApplicationWindow.window.pageStack.layers.push(aboutPage);
0186             }
0187 
0188             Component {
0189                 id: aboutPage
0190                 FormCard.AboutPage {
0191                     aboutData: AboutData
0192                 }
0193             }
0194         }
0195 
0196         FormCard.FormDelegateSeparator {}
0197 
0198         FormCard.FormButtonDelegate {
0199             text: i18n("About KDE")
0200             icon.name: "kde"
0201             onClicked: {
0202                 QQC2.ApplicationWindow.window.pageStack.layers.push(aboutKDE);
0203             }
0204 
0205             Component {
0206                 id: aboutKDE
0207                 FormCard.AboutKDE {}
0208             }
0209         }
0210     }
0211 }