Warning, /maui/arca/src/controls/previewer/FilePreviewer.qml is written in an unsupported language. File is not indexed.
0001 import QtQuick 2.14 0002 import QtQuick.Controls 2.14 0003 import QtQuick.Layouts 1.3 0004 0005 import org.mauikit.controls 1.3 as Maui 0006 0007 import org.mauikit.filebrowsing 1.3 as FB 0008 0009 Maui.PopupPage 0010 { 0011 id: control 0012 implicitHeight: 1000 0013 property url currentUrl: "" 0014 property var iteminfo: FB.FM.getFileInfo(control.currentUrl) 0015 0016 ListModel { id: infoModel } 0017 0018 0019 hint: 1 0020 maxWidth: 800 0021 maxHeight: implicitHeight 0022 0023 title: iteminfo.path 0024 0025 headBar.rightContent: ToolButton 0026 { 0027 icon.name: "documentinfo" 0028 checkable: true 0029 checked: _stackView.depth === 2 0030 onClicked: 0031 { 0032 if(_stackView.depth === 2) 0033 { 0034 _stackView.pop() 0035 }else 0036 { 0037 _stackView.push(_infoComponent) 0038 } 0039 0040 } 0041 } 0042 0043 stack: StackView 0044 { 0045 id: _stackView 0046 Layout.fillHeight: true 0047 Layout.fillWidth: true 0048 0049 initialItem: Loader 0050 { 0051 id: previewLoader 0052 asynchronous: true 0053 active: control.visible 0054 source: show() 0055 } 0056 0057 Component 0058 { 0059 id: _infoComponent 0060 0061 ScrollView 0062 { 0063 contentHeight: _layout.implicitHeight 0064 contentWidth: availableWidth 0065 clip: true 0066 padding: Maui.Style.space.big 0067 background: null 0068 0069 Component.onCompleted: 0070 { 0071 initModel() 0072 } 0073 0074 Flickable 0075 { 0076 boundsBehavior: Flickable.StopAtBounds 0077 boundsMovement: Flickable.StopAtBounds 0078 0079 ColumnLayout 0080 { 0081 id: _layout 0082 width: parent.width 0083 spacing: Maui.Style.space.huge 0084 0085 Item 0086 { 0087 Layout.fillWidth: true 0088 Layout.preferredHeight: 150 0089 0090 Maui.IconItem 0091 { 0092 height: parent.height * 0.9 0093 width: height 0094 anchors.centerIn: parent 0095 iconSource: iteminfo.icon 0096 imageSource: iteminfo.thumbnail 0097 iconSizeHint: Maui.Style.iconSizes.large 0098 } 0099 } 0100 0101 Maui.SectionGroup 0102 { 0103 Layout.fillWidth: true 0104 0105 title: i18n("Details") 0106 description: i18n("File information") 0107 Repeater 0108 { 0109 model: infoModel 0110 delegate: Maui.SectionItem 0111 { 0112 visible: model.value ? true : false 0113 Layout.fillWidth: true 0114 label1.text: model.key 0115 label2.text: model.value 0116 label2.wrapMode: Text.Wrap 0117 } 0118 } 0119 } 0120 } 0121 } 0122 } 0123 } 0124 0125 } 0126 0127 0128 footBar.rightContent: Button 0129 { 0130 text: i18n("Open") 0131 icon.name: "document-open" 0132 // flat: true 0133 onClicked: 0134 { 0135 currentBrowser.openFile(control.currentUrl) 0136 } 0137 } 0138 0139 function show() 0140 { 0141 var source = "DefaultPreview.qml" 0142 if(FB.FM.checkFileType(FB.FMList.AUDIO, iteminfo.mime)) 0143 { 0144 source = "AudioPreview.qml" 0145 }else if(FB.FM.checkFileType(FB.FMList.VIDEO, iteminfo.mime)) 0146 { 0147 source = "VideoPreview.qml" 0148 }else if(FB.FM.checkFileType(FB.FMList.TEXT, iteminfo.mime)) 0149 { 0150 source = "TextPreview.qml" 0151 }else if(FB.FM.checkFileType(FB.FMList.IMAGE, iteminfo.mime)) 0152 { 0153 source = "ImagePreview.qml" 0154 }else if(FB.FM.checkFileType(FB.FMList.DOCUMENT, iteminfo.mime)) 0155 { 0156 source = "DocumentPreview.qml" 0157 }else if(FB.FM.checkFileType(FB.FMList.FONT, iteminfo.mime)) 0158 { 0159 source = "FontPreviewer.qml" 0160 }else 0161 { 0162 source = "DefaultPreview.qml" 0163 } 0164 0165 return source; 0166 } 0167 0168 0169 function initModel() 0170 { 0171 infoModel.clear() 0172 infoModel.append({key: "Name", value: iteminfo.label}) 0173 infoModel.append({key: "Type", value: iteminfo.mime}) 0174 infoModel.append({key: "Date", value: Qt.formatDateTime(new Date(model.date), "d MMM yyyy")}) 0175 infoModel.append({key: "Modified", value: Qt.formatDateTime(new Date(model.modified), "d MMM yyyy")}) 0176 infoModel.append({key: "Last Read", value: Qt.formatDateTime(new Date(model.lastread), "d MMM yyyy")}) 0177 infoModel.append({key: "Owner", value: iteminfo.owner}) 0178 infoModel.append({key: "Group", value: iteminfo.group}) 0179 infoModel.append({key: "Size", value: Maui.Handy.formatSize(iteminfo.size)}) 0180 infoModel.append({key: "Symbolic Link", value: iteminfo.symlink}) 0181 infoModel.append({key: "Path", value: iteminfo.path}) 0182 infoModel.append({key: "Thumbnail", value: iteminfo.thumbnail}) 0183 infoModel.append({key: "Icon Name", value: iteminfo.icon}) 0184 } 0185 0186 0187 }