Warning, /maui/vvave/src/widgets/SettingsView/SettingsDialog.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   Copyright 2020 Camilo Higuita <milo.h@aol.com>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2, or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 import QtQuick 2.14
0021 import QtQuick.Controls 2.14
0022 import QtQuick.Layouts 1.3
0023 
0024 import org.mauikit.controls 1.3 as Maui
0025 
0026 import org.maui.vvave 1.0
0027 
0028 Maui.SettingsDialog
0029 {
0030     id: control
0031 
0032     Maui.InfoDialog
0033     {
0034         id: confirmationDialog
0035         property string url : ""
0036 
0037         title : i18n("Remove source")
0038         message : i18n("Are you sure you want to remove the source: \n%1", url)
0039         template.iconSource: "emblem-warning"
0040 
0041         standardButtons: Dialog.Ok | Dialog.Cancel
0042 
0043         onAccepted:
0044         {
0045             if(url.length>0)
0046                 Vvave.removeSource(url)
0047             confirmationDialog.close()
0048         }
0049         onRejected: confirmationDialog.close()
0050     }
0051 
0052     Maui.SectionGroup
0053     {
0054         title: i18n("Playback")
0055 //        description: i18n("Configure the playback behavior.")
0056 
0057         Maui.SectionItem
0058         {
0059             label1.text: i18n("Auto Resume")
0060             label2.text: i18n("Resume the last session playlist.")
0061 
0062             Switch
0063             {
0064                 checkable: true
0065                 checked: playlist.autoResume
0066                 onToggled: playlist.autoResume = !playlist.autoResume
0067             }
0068         }
0069 
0070         Maui.SectionItem
0071         {
0072             label1.text: i18n("Volume")
0073             label2.text: i18n("Show volume controls.")
0074 
0075             Switch
0076             {
0077                 checkable: true
0078                 checked: settings.volumeControl
0079                 onToggled: settings.volumeControl = !settings.volumeControl
0080             }
0081         }
0082     }
0083 
0084     Maui.SectionGroup
0085     {
0086         title: i18n("Collection")
0087 //        description: i18n("Configure the app plugins and collection behavior.")
0088 
0089         Maui.SectionItem
0090         {
0091             label1.text: i18n("Fetch Artwork")
0092             label2.text: i18n("Gathers album and artists artworks from online services: LastFM, Spotify, MusicBrainz, iTunes, Genius, and others.")
0093 
0094             Switch
0095             {
0096                 checkable: true
0097                 checked: settings.fetchArtwork
0098                 onToggled:  settings.fetchArtwork = !settings.fetchArtwork
0099             }
0100         }
0101 
0102         Maui.SectionItem
0103         {
0104             label1.text: i18n("Auto Scan")
0105             label2.text: i18n("Scan all the music sources on startup to keep your collection up to date.")
0106 
0107             Switch
0108             {
0109                 checkable: true
0110                 checked: settings.autoScan
0111                 onToggled: settings.autoScan = !settings.autoScan
0112             }
0113         }
0114     }
0115 
0116     Maui.SectionGroup
0117     {
0118         title: i18n("General")
0119 //        description: i18n("Configure the app plugins and collection behavior.")
0120 
0121         Maui.SectionItem
0122         {
0123             label1.text: i18n("Focus View")
0124             label2.text: i18n("Make the focus view the default.")
0125 
0126             Switch
0127             {
0128                 Layout.fillHeight: true
0129                 checked: settings.focusViewDefault
0130                 onToggled:
0131                 {
0132                      settings.focusViewDefault = !settings.focusViewDefault
0133                 }
0134             }
0135         }
0136 
0137         Maui.SectionItem
0138         {
0139             visible: Maui.Handy.isAndroid
0140             label1.text: i18n("Dark Mode")
0141             label2.text: i18n("Switch between light and dark colorscheme.")
0142 
0143             Switch
0144             {
0145                 Layout.fillHeight: true
0146                 checked: Maui.Style.styleType === Maui.Style.Dark
0147                 onToggled:
0148                 {
0149                      settings.darkMode = !settings.darkMode
0150                     setAndroidStatusBarColor()
0151                 }
0152             }
0153         }
0154 
0155         Maui.SectionItem
0156         {
0157             label1.text: i18n("Artwork")
0158             label2.text: i18n("Show the cover artwork for the tracks.")
0159 
0160             Switch
0161             {
0162                 Layout.fillHeight: true
0163                 checked: settings.showArtwork
0164                 onToggled:
0165                 {
0166                     settings.showArtwork = !settings.showArtwork
0167                 }
0168             }
0169         }
0170 
0171         Maui.SectionItem
0172         {
0173             label1.text: i18n("Titles")
0174             label2.text: i18n("Show the title of albums and artists in the grid view.")
0175 
0176             Switch
0177             {
0178                 Layout.fillHeight: true
0179                 checked: settings.showTitles
0180                 onToggled:
0181                 {
0182                     settings.showTitles = !settings.showTitles
0183                 }
0184             }
0185         }
0186     }
0187 
0188     Maui.SectionGroup
0189     {
0190         title: i18n("Sources")
0191 //        description: i18n("Add or remove sources")
0192 
0193         ColumnLayout
0194         {
0195             Layout.fillWidth: true
0196             spacing: Maui.Style.space.medium
0197 
0198             Repeater
0199             {
0200                 Layout.minimumHeight: Math.min(500, contentHeight)
0201                 model: Vvave.sources
0202 
0203                 delegate: Maui.ListDelegate
0204                 {
0205                     Layout.fillWidth: true
0206 
0207                     template.iconSource: modelData.icon
0208                     template.iconSizeHint: Maui.Style.iconSizes.small
0209                     template.label1.text: modelData.label
0210                     template.label2.text: modelData.path
0211 
0212                     template.content: ToolButton
0213                     {
0214                         icon.name: "edit-clear"
0215                         flat: true
0216                         onClicked:
0217                         {
0218                             confirmationDialog.url = modelData.path
0219                             confirmationDialog.open()
0220                         }
0221                     }
0222                 }
0223             }
0224 
0225             Button
0226             {
0227                 Layout.fillWidth: true
0228                 text: i18n("Add")
0229                 //                flat: true
0230                 onClicked:
0231                 {
0232                     _dialogLoader.sourceComponent = _fileDialogComponent
0233                     dialog.settings.onlyDirs = true
0234                     dialog.callback = function(urls)
0235                     {
0236                         Vvave.addSources(urls)
0237                     }
0238                     dialog.open()
0239                 }
0240             }
0241 
0242             Button
0243             {
0244                 Layout.fillWidth: true
0245                 text: i18n("Scan now")
0246                 onClicked: Vvave.rescan()
0247             }
0248         }
0249     }
0250 
0251 }