Warning, /maui/pix/src/widgets/views/CollectionView.qml is written in an unsupported language. File is not indexed.
0001 // Copyright 2018-2020 Camilo Higuita <milo.h@aol.com> 0002 // Copyright 2018-2020 Nitrux Latinoamericana S.C. 0003 // 0004 // SPDX-License-Identifier: GPL-3.0-or-later 0005 0006 0007 /*** 0008 Pix Copyright (C) 2018 Camilo Higuita 0009 This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 0010 This is free software, and you are welcome to redistribute it 0011 under certain conditions; type `show c' for details. 0012 0013 This program is free software: you can redistribute it and/or modify 0014 it under the terms of the GNU General Public License as published by 0015 the Free Software Foundation, either version 3 of the License, or 0016 (at your option) any later version. 0017 0018 This program is distributed in the hope that it will be useful, 0019 but WITHOUT ANY WARRANTY; without even the implied warranty of 0020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0021 GNU General Public License for more details. 0022 0023 You should have received a copy of the GNU General Public License 0024 along with this program. If not, see <http://www.gnu.org/licenses/>. 0025 ***/ 0026 0027 import QtQuick 2.14 0028 import QtQuick.Controls 2.14 0029 import QtQuick.Layouts 1.15 0030 0031 import QtQuick.Window 2.13 0032 import Qt.labs.settings 1.0 0033 0034 import org.mauikit.controls 1.3 as Maui 0035 import org.mauikit.filebrowsing 1.3 as FB 0036 import org.mauikit.imagetools 1.3 as IT 0037 import org.maui.pix 1.0 as Pix 0038 0039 import "Folders" 0040 import "Gallery" 0041 import "Tags" 0042 import ".." 0043 0044 Maui.SideBarView 0045 { 0046 id: control 0047 0048 readonly property var mainGalleryList : Pix.Collection.allImagesModel 0049 property alias selectionBox : _selectionBar 0050 property alias currentFolder :_foldersView.currentFolder 0051 0052 Binding 0053 { 0054 target: Pix.Collection.allImagesModel 0055 property: "autoReload" 0056 value: browserSettings.autoReload 0057 delayed: true 0058 } 0059 0060 Binding 0061 { 0062 target: Pix.Collection.allImagesModel 0063 property: "activeGeolocationTags" 0064 value: browserSettings.gpsTags 0065 delayed: true 0066 } 0067 0068 sideBar.resizeable: false 0069 sideBar.preferredWidth: 200 0070 sideBar.content: Sidebar 0071 { 0072 anchors.fill: parent 0073 } 0074 0075 Maui.Page 0076 { 0077 id: swipeView 0078 anchors.fill: parent 0079 0080 altHeader: Maui.Handy.isMobile 0081 floatingFooter: true 0082 flickable: _foldersView.currentItem.flickable 0083 showCSDControls: true 0084 headBar.forceCenterMiddleContent: false 0085 headBar.middleContent: Loader 0086 { 0087 Layout.fillWidth: true 0088 Layout.maximumWidth: 500 0089 Layout.alignment: Qt.AlignCenter 0090 sourceComponent: _foldersView.currentItem && _foldersView.currentItem.hasOwnProperty("searchFieldComponent") ? _foldersView.currentItem.searchFieldComponent : null 0091 } 0092 0093 headBar.leftContent: [ 0094 ToolButton 0095 { 0096 visible: control.sideBar.collapsed 0097 0098 icon.name: sideBar.visible ? "sidebar-collapse" : "sidebar-expand" 0099 onClicked: sideBar.toggle() 0100 checked: sideBar.visible 0101 ToolTip.delay: 1000 0102 ToolTip.timeout: 5000 0103 ToolTip.visible: hovered 0104 ToolTip.text: i18n("Toggle sidebar") 0105 }, 0106 0107 ToolButton 0108 { 0109 icon.name: _foldersView.depth === 1 && _pixViewer.viewer.count > 0 ? "quickview" : "go-previous" 0110 visible: _foldersView.depth > 1 || _pixViewer.viewer.count > 0 0111 onClicked: 0112 { 0113 if(_foldersView.depth > 1) 0114 { 0115 _foldersView.pop() 0116 return; 0117 } 0118 0119 if( _pixViewer.viewer.count > 0) 0120 { 0121 toggleViewer() 0122 return; 0123 } 0124 0125 } 0126 } 0127 ] 0128 0129 headBar.rightContent: Loader 0130 { 0131 asynchronous: true 0132 sourceComponent: Maui.ToolButtonMenu 0133 { 0134 icon.name: "overflow-menu" 0135 0136 MenuItem 0137 { 0138 text: i18n("Open") 0139 icon.name: "folder-open" 0140 onTriggered: openFileDialog() 0141 } 0142 0143 MenuSeparator {} 0144 0145 MenuItem 0146 { 0147 text: i18n("Settings") 0148 icon.name: "settings-configure" 0149 onTriggered: openSettingsDialog() 0150 } 0151 0152 MenuItem 0153 { 0154 text: i18n("About") 0155 icon.name: "documentinfo" 0156 onTriggered: root.about() 0157 } 0158 } 0159 } 0160 0161 FoldersView 0162 { 0163 id: _foldersView 0164 anchors.fill: parent 0165 } 0166 0167 property string pendingFolder : initModule === "folder" ? initData[0] : "" 0168 0169 footer: SelectionBar 0170 { 0171 id: _selectionBar 0172 anchors.horizontalCenter: parent.horizontalCenter 0173 width: Math.min(parent.width-(Maui.Style.space.medium*2), implicitWidth) 0174 0175 maxListHeight: swipeView.height - Maui.Style.space.medium 0176 display: ToolButton.IconOnly 0177 } 0178 } 0179 0180 function openFolder(url, filters) 0181 { 0182 _foldersView.openFolder(url, filters) 0183 } 0184 0185 function filterSelection(url) 0186 { 0187 if(selectionBox.contains(url)) 0188 { 0189 return selectionBox.uris 0190 }else 0191 { 0192 return [url] 0193 } 0194 } 0195 0196 function selectItem(item) 0197 { 0198 if(selectionBox.contains(item.url)) 0199 { 0200 selectionBox.removeAtUri(item.url) 0201 return 0202 } 0203 0204 selectionBox.append(item.url, item) 0205 } 0206 }