Warning, /maui/shelf/src/main.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.15
0002 import QtQuick.Controls 2.15
0003 import Qt.labs.settings 1.0
0004 
0005 import org.mauikit.controls 1.3 as Maui
0006 import org.mauikit.filebrowsing 1.3 as FB
0007 
0008 import org.maui.shelf 1.0 as Shelf
0009 
0010 import "views"
0011 import "views/library/"
0012 import "views/Viewer/"
0013 
0014 Maui.ApplicationWindow
0015 {
0016     id: root
0017     title: viewerView.title
0018     Maui.Style.styleType: Maui.Handy.isAndroid ? (viewerSettings.darkMode ? Maui.Style.Dark : Maui.Style.Light) : undefined
0019 
0020     property bool selectionMode: false
0021     property alias dialog :_dialogLoader.item
0022 
0023     Settings
0024     {
0025         id: viewerSettings
0026         property bool autoScan : true
0027         property bool darkMode: true
0028         property bool showThumbnails: true
0029         property int viewType : Maui.AltBrowser.ViewType.Grid
0030     }
0031 
0032     Component
0033     {
0034         id: _settingsDialogComponent
0035 
0036         SettingsDialog {}
0037     }
0038 
0039     Component
0040     {
0041         id: _fileDialog
0042         FB.FileDialog
0043         {
0044             mode: modes.OPEN
0045             settings.filterType: FB.FMList.DOCUMENT
0046             settings.filters: [".cbz", ".cbr"]
0047             callback: function(paths)
0048             {
0049                 console.log(paths)
0050                 Shelf.Library.openFiles(paths)
0051             }
0052         }
0053     }
0054 
0055     FB.OpenWithDialog
0056     {
0057         id: _openWithDialog
0058     }
0059 
0060     Component
0061     {
0062         id: tagsDialogComponent
0063         FB.TagsDialog
0064         {
0065             onTagsReady: (tags) => composerList.updateToUrls(tags)
0066             composerList.strict: false
0067         }
0068     }
0069 
0070     Loader
0071     {
0072         id: _dialogLoader
0073     }
0074 
0075     StackView
0076     {
0077         id: _stackView
0078         anchors.fill: parent
0079 
0080         initialItem: initModule === "viewer" ? viewerView : libraryView
0081 
0082         Viewer
0083         {
0084             id: viewerView
0085             visible: StackView.status === StackView.Active
0086         }
0087 
0088         Component
0089         {
0090             id: libraryView
0091 
0092             LibraryView
0093             {
0094                 showCSDControls: initModule === "collection"
0095             }
0096         }
0097     }
0098 
0099     Connections
0100     {
0101         target: Shelf.Library
0102 
0103         ignoreUnknownSignals: true
0104 
0105         function onRequestedFiles(files)
0106         {
0107             for(var file of files)
0108             {
0109                 console.log("OPEN FILES<<<<<<<<<<<<<<", file)
0110                 viewerView.open(file)
0111             }
0112         }
0113     }
0114 
0115     Component.onCompleted:
0116     {
0117         setAndroidStatusBarColor()
0118     }
0119 
0120     function toggleViewer()
0121     {
0122         if(viewerView.visible)
0123         {
0124             if(_stackView.depth === 1)
0125             {
0126                 _stackView.replace(viewerView, libraryView)
0127 
0128             }else
0129             {
0130                 _stackView.pop()
0131             }
0132 
0133         }else
0134         {
0135             _stackView.push(viewerView)
0136         }
0137 
0138         _stackView.currentItem.forceActiveFocus()
0139     }
0140 
0141     function setAndroidStatusBarColor()
0142     {
0143         if(Maui.Handy.isAndroid)
0144         {
0145             Maui.Android.statusbarColor( Maui.Theme.backgroundColor, !viewerSettings.darkMode)
0146             Maui.Android.navBarColor(Maui.Theme.backgroundColor,  !viewerSettings.darkMode)
0147         }
0148     }
0149 }