Warning, /maui/clip/src/views/settings/SettingsDialog.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.14
0002 import QtQml 2.14
0003 
0004 import QtQuick.Controls 2.14
0005 import QtQuick.Layouts 1.3
0006 
0007 import org.mauikit.controls 1.3 as Maui
0008 
0009 import org.maui.clip 1.0 as Clip
0010 
0011 Maui.SettingsDialog
0012 {
0013     id: control
0014 
0015     Maui.SectionGroup
0016     {
0017         title: i18n("General")
0018 //        description: i18n("Configure the app behavior.")
0019 
0020         Maui.SectionItem
0021         {
0022             label1.text: i18n("Volume Step")
0023 
0024             SpinBox
0025             {
0026                 value: settings.volumeStep
0027                 from: 0
0028                 to: 20
0029                 onValueChanged: settings.volumeStep = value
0030             }
0031         }
0032 
0033         Maui.SectionItem
0034         {
0035             label1.text: i18n("Dark Mode")
0036             label2.text: i18n("Switch between light and dark colorscheme")
0037 
0038             Switch
0039             {
0040                 Layout.fillHeight: true
0041                 checked: settings.darkMode
0042                 onToggled:
0043                 {
0044                      settings.darkMode = !settings.darkMode
0045                     setAndroidStatusBarColor()
0046                 }
0047             }
0048         }
0049     }
0050 
0051     Maui.SectionGroup
0052     {
0053         title: i18n("Collection")
0054 //        description: i18n("Sorting order and behavior.")
0055 
0056         Maui.SectionItem
0057         {
0058             label1.text: i18n("Sorting by")
0059             label2.text: i18n("Change the sorting key.")
0060 
0061             Maui.ToolActions
0062             {
0063                 expanded: true
0064                 autoExclusive: true
0065                 display: ToolButton.Text
0066 
0067                 Action
0068                 {
0069                     text: i18n("Title")
0070                     onTriggered: settings.sortBy =  "label"
0071                     checked: settings.sortBy ===  "label"
0072                 }
0073 
0074                 Action
0075                 {
0076                     text: i18n("Date")
0077                     onTriggered: settings.sortBy = "modified"
0078                     checked: settings.sortBy ===  "modified"
0079                 }
0080 
0081                 Action
0082                 {
0083                     text: i18n("Size")
0084                     onTriggered: settings.sortBy = "size"
0085                     checked: settings.sortBy ===  "size"
0086                 }
0087 
0088                 Action
0089                 {
0090                     text: i18n("Type")
0091                     onTriggered: settings.sortBy = "type"
0092                     checked: settings.sortBy ===  "type"
0093                 }
0094             }
0095         }
0096 
0097         Maui.SectionItem
0098         {
0099             label1.text: i18n("Sort order")
0100             label2.text: i18n("Change the sorting order.")
0101 
0102             Maui.ToolActions
0103             {
0104                 expanded: true
0105                 autoExclusive: true
0106                 display: ToolButton.IconOnly
0107 
0108                 Action
0109                 {
0110                     text: i18n("Ascending")
0111                     icon.name: "view-sort-ascending"
0112                     onTriggered: settings.sortOrder = Qt.AscendingOrder
0113                     checked: settings.sortOrder === Qt.AscendingOrder
0114                 }
0115 
0116                 Action
0117                 {
0118                     text: i18n("Descending")
0119                     icon.name: "view-sort-descending"
0120                     onTriggered: settings.sortOrder = Qt.DescendingOrder
0121                     checked: settings.sortOrder === Qt.DescendingOrder
0122                 }
0123             }
0124         }
0125     }
0126 
0127     Maui.SectionGroup
0128     {
0129         title: i18n("Playback")
0130 //        description: i18n("Configure the player settings.")
0131         enabled: Clip.Clip.mpvAvailable
0132         Maui.SectionItem
0133         {
0134             label1.text: i18n("Hardware Decoding")
0135             label2.text: i18n("Use the sorting preferences globally for all the tabs and splits.")
0136 
0137             Switch
0138             {
0139                 checkable: true
0140                 checked:  settings.hardwareDecoding
0141                 onToggled: settings.hardwareDecoding = !settings.hardwareDecoding
0142             }
0143         }
0144     }
0145 
0146     Maui.SectionGroup
0147     {
0148         title: i18n("Audio")
0149 //        description: i18n("Configure the player audio behaviour.")
0150         enabled: Clip.Clip.mpvAvailable
0151 
0152         Maui.SectionItem
0153         {
0154             label1.text: i18n("Preferred Language")
0155             label2.text: i18n("Preferred language if available.")
0156             wide: false
0157 
0158             TextField
0159             {
0160                 Layout.fillWidth: true
0161                 text: settings.preferredLanguage
0162                 onAccepted: settings.preferredLanguage = text
0163             }
0164         }
0165     }
0166 
0167 //    Maui.SectionGroup
0168 //    {
0169 //        title: i18n("Subtitles")
0170 //        description: i18n("Configure the app UI.")
0171 //        enabled: Clip.Clip.mpvAvailable
0172 
0173 //        Maui.SectionItem
0174 //        {
0175 //            label1.text: i18n("Directory")
0176 //            label2.text: i18n("Folder path containing the subtitle files.")
0177 //            wide: false
0178 
0179 //            Maui.TextField
0180 //            {
0181 //                Layout.fillWidth: true
0182 //                text: settings.subtitlesPath
0183 //                onAccepted: settins.subtitlesPath = text
0184 
0185 //                Action
0186 //                {
0187 //                    icon.name: "folder-open"
0188 //                    onTriggered:
0189 //                    {
0190 //                        dialogLoader.sourceComponent = fmDialogComponent
0191 //                        dialog.mode = dialog.modes.OPEN
0192 //                        dialog.settings.onlyDirs = true
0193 //                        dialog.callback = function(paths)
0194 //                        {
0195 //                            settings.subtitlesPath = paths[0]
0196 //                        }
0197 
0198 //                        dialog.open()
0199 //                    }
0200 //                }
0201 //            }
0202 //        }
0203 
0204 //        Maui.SectionItem
0205 //        {
0206 //            label1.text: i18n("Font Family")
0207 
0208 //            Maui.ComboBox
0209 //            {
0210 //                Layout.fillWidth: true
0211 //                model: Qt.fontFamilies()
0212 //                Component.onCompleted: currentIndex = find(settings.font.family, Qt.MatchExactly)
0213 //                onActivated: settings.font.family = currentText
0214 //            }
0215 //        }
0216 
0217 //        Maui.SectionItem
0218 //        {
0219 //            label1.text: i18n("Font Size")
0220 
0221 //            SpinBox
0222 //            {
0223 //                from: 0; to : 500
0224 //                value: settings.font.pointSize
0225 //                onValueChanged: settings.font.pointSize = value
0226 //            }
0227 //        }
0228 //    }
0229 
0230 //    Maui.SectionGroup
0231 //    {
0232 //        title: i18n("YouTube")
0233 //        description: i18n("Configure YouTube details.")
0234 
0235 //        Maui.SectionItem
0236 //        {
0237 //            label1.text: i18n("Key")
0238 //            label2.text: i18n("Personal key for limitless browsing.")
0239 //            wide: false
0240 
0241 //            Maui.TextField
0242 //            {
0243 //                Layout.fillWidth: true
0244 //                text: settings.youtubeKey
0245 //                onAccepted: settings.youtubeKey = text
0246 //            }
0247 
0248 //            template.leftLabels.data: Label
0249 //            {
0250 //                Layout.fillWidth: true
0251 //                text: i18n("<a href='https://console.developers.google.com/apis/credentials'>Get your personal key.</a>")
0252 
0253 //                onLinkActivated: Qt.openUrlExternally(link)
0254 //            }
0255 //        }
0256 //    }
0257 
0258     Maui.SectionGroup
0259     {
0260         title: i18n("Sources")
0261 //        description: i18n("Add new sources to manage and browse your video collection")
0262 
0263         ColumnLayout
0264         {
0265             Layout.fillWidth: true
0266             spacing: Maui.Style.space.medium
0267 
0268             Repeater
0269             {
0270                 id: _sourcesList
0271 
0272                 model: Clip.Clip.sourcesModel
0273                 delegate: Maui.ListDelegate
0274                 {
0275                     Layout.fillWidth: true
0276                     template.iconSource: modelData.icon
0277                     template.iconSizeHint: Maui.Style.iconSizes.small
0278                     template.label1.text: modelData.label
0279                     template.label2.text: modelData.path
0280                     onClicked: _sourcesList.currentIndex = index
0281 
0282                     template.content: ToolButton
0283                     {
0284                         icon.name: "edit-clear"
0285                         flat: true
0286                         onClicked:
0287                         {
0288                             confirmationDialog.url = modelData.url
0289                             confirmationDialog.open()
0290                         }
0291                     }
0292                 }
0293             }
0294 
0295             Button
0296             {
0297                 Layout.fillWidth: true
0298                 text: i18n("Add")
0299 
0300                 onClicked:
0301                 {
0302                     dialogLoader.sourceComponent = fmDialogComponent
0303                     dialog.settings.onlyDirs = true
0304                     dialog.mode = dialog.modes.OPEN
0305                     dialog.callback = function(urls)
0306                     {
0307                         Clip.Clip.addSources(urls)
0308                     }
0309                     dialog.open()
0310                 }
0311             }
0312         }
0313     }
0314 
0315     Maui.InfoDialog
0316     {
0317         id: confirmationDialog
0318         property string url : ""
0319 
0320         title : i18n("Remove source")
0321         message : i18n("Are you sure you want to remove the source: \n %1", url)
0322         template.iconSource: "emblem-warning"
0323 
0324         standardButtons: Dialog.Ok | Dialog.Cancel
0325 
0326         onAccepted:
0327         {
0328             if(url.length>0)
0329                 Clip.Clip.removeSources(url)
0330             confirmationDialog.close()
0331         }
0332         onRejected: confirmationDialog.close()
0333     }
0334 }