Warning, /maui/index-fm/src/widgets/views/home/SystemInfo.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 Slike Latinoamericana S.C.
0003 //
0004 // SPDX-License-Identifier: GPL-3.0-or-later
0005 
0006 
0007 import QtQuick 2.14
0008 import QtQuick.Controls 2.14
0009 import QtQuick.Layouts 1.3
0010 
0011 import Qt.labs.platform 1.1
0012 import QtGraphicalEffects 1.0
0013 
0014 import org.mauikit.controls 1.3 as Maui
0015 
0016 import org.mauikit.filebrowsing 1.0 as FB
0017 
0018 import org.maui.index 1.0 as Index
0019 
0020 Maui.ListBrowser
0021 {
0022     id: control
0023 
0024     signal itemClicked(url url)
0025 
0026     orientation: ListView.Horizontal
0027     implicitHeight: 220
0028 //    verticalScrollBarPolicy: ScrollBar.AlwaysOff
0029 //    horizontalScrollBarPolicy: ScrollBar.AlwaysOff
0030 
0031     model: [StandardPaths.writableLocation(StandardPaths.MusicLocation), StandardPaths.writableLocation(StandardPaths.DownloadLocation), StandardPaths.writableLocation(StandardPaths.MoviesLocation), StandardPaths.writableLocation(StandardPaths.DocumentsLocation)]
0032 
0033     delegate: Maui.ItemDelegate
0034     {
0035         id: _delegate
0036         property bool isCurrentItem : ListView.isCurrentItem
0037         anchors.verticalCenter: parent.verticalCenter
0038         width: 320
0039         height: 180
0040 //        color: Maui.Theme.backgroundColor
0041 //        radius: Maui.Style.radiusV
0042 
0043         property var info : FB.FM.getFileInfo(modelData)
0044 
0045         background: Item {}
0046 
0047         onClicked:
0048         {
0049             control.currentIndex = index
0050             control.itemClicked(modelData)
0051         }
0052 
0053 //        Index.DirInfo
0054 //        {
0055 //            id: _dirInfo
0056 //            url: modelData
0057 //        }
0058 
0059         Rectangle
0060         {
0061             id: _iconRec
0062             opacity: 0.3
0063             anchors.fill: parent
0064             color: Maui.Theme.backgroundColor
0065             clip: true
0066 
0067             FastBlur
0068             {
0069                 id: fastBlur
0070                 height: parent.height * 2
0071                 width: parent.width * 2
0072                 anchors.centerIn: parent
0073                 source: _icon
0074                 radius: 64
0075                 transparentBorder: true
0076                 cached: true
0077             }
0078 
0079             Rectangle
0080             {
0081                 anchors.fill: parent
0082                 opacity: 0.5
0083                 color: Qt.tint(control.Maui.Theme.textColor, Qt.rgba(control.Maui.Theme.backgroundColor.r, control.Maui.Theme.backgroundColor.g, control.Maui.Theme.backgroundColor.b, 0.9))
0084             }
0085         }
0086 
0087         OpacityMask
0088         {
0089             source: mask
0090             maskSource: _iconRec
0091         }
0092 
0093         LinearGradient
0094         {
0095             id: mask
0096             anchors.fill: parent
0097             gradient: Gradient {
0098                 GradientStop { position: 0.2; color: "transparent"}
0099                 GradientStop { position: 0.5; color: _iconRec.color}
0100             }
0101 
0102             start: Qt.point(0, 0)
0103             end: Qt.point(_iconRec.width, _iconRec.height)
0104         }
0105 
0106         ColumnLayout
0107         {
0108             anchors.fill: parent
0109             anchors.margins: Maui.Style.space.big
0110             id: _layout
0111 
0112             Maui.Icon
0113             {
0114                 id: _icon
0115                 Layout.leftMargin: Maui.Style.space.medium
0116                 implicitHeight: Maui.Style.iconSizes.large
0117                 implicitWidth: height
0118                 source: info.icon
0119             }
0120 
0121             Maui.FlexListItem
0122             {
0123                 Layout.fillWidth: true
0124                 label1.font.pointSize: Maui.Style.fontSizes.huge
0125                 label1.font.weight: Font.Bold
0126                 label1.font.bold: true
0127                 label1.text: info.label
0128 //                label2.text: i18n("%1 Directories - %2 Files", _dirInfo.dirCount, _dirInfo.filesCount)
0129 
0130                 onClicked:
0131                 {
0132                     control.currentIndex = index
0133                     control.itemClicked(modelData)
0134                 }
0135 
0136                 Rectangle
0137                 {
0138                     radius: Maui.Style.radiusV
0139                     color: "#333"
0140                     Layout.preferredWidth: _sizeLabel.implicitWidth + Maui.Style.space.big
0141                     implicitHeight: 36
0142 
0143                     Label
0144                     {
0145                         id: _sizeLabel
0146                         font.pointSize: Maui.Style.fontSizes.huge
0147                         font.bold: true
0148                         font.weight: Font.Bold
0149                         anchors.centerIn: parent
0150 //                        text:  _dirInfo.sizeString
0151                         color: "#fafafa"
0152                     }
0153                 }
0154             }
0155 
0156             ProgressBar
0157             {
0158                 Layout.fillWidth: true
0159                 Layout.margins: Maui.Style.space.medium
0160 //                value:  Math.round((_dirInfo.size * 100) / _dirInfo.totalSpace)
0161                 from: 0
0162                 to : 100
0163             }
0164         }
0165 
0166         layer.enabled: true
0167         layer.effect: OpacityMask
0168         {
0169             maskSource: Item
0170             {
0171                 width: _delegate.width
0172                 height: _delegate.height
0173 
0174                 Rectangle
0175                 {
0176                     anchors.fill: parent
0177                     radius: Maui.Style.radiusV
0178                 }
0179             }
0180         }
0181     }
0182 }