Warning, /multimedia/kid3/src/qml/app/FileList.qml is written in an unsupported language. File is not indexed.
0001 /** 0002 * \file FileList.qml 0003 * List of files in current directory. 0004 * 0005 * \b Project: Kid3 0006 * \author Urs Fleisch 0007 * \date 16 Feb 2015 0008 * 0009 * Copyright (C) 2015-2018 Urs Fleisch 0010 * 0011 * This program is free software; you can redistribute it and/or modify 0012 * it under the terms of the GNU Lesser General Public License as published by 0013 * the Free Software Foundation; version 3. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU Lesser General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU Lesser General Public License 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 */ 0023 0024 import QtQuick 2.11 0025 import QtQuick.Controls 2.4 0026 import Kid3 1.1 as Kid3 0027 0028 Rectangle { 0029 id: fileList 0030 property alias actionButtons: fileButtonRow.control 0031 0032 signal fileActivated 0033 0034 function currentFilePath() { 0035 return fileModel.getDataValue(fileModel.currentRow, 0036 "filePath") 0037 } 0038 0039 function parentFilePath() { 0040 return script.getIndexRoleData(fileModel.parentModelIndex(), 0041 "filePath") 0042 } 0043 0044 Item { 0045 id: fileButtonRow 0046 property Item control 0047 width: control ? control.width : undefined 0048 height: control ? control.height : undefined 0049 anchors.left: parent.left 0050 anchors.top: parent.top 0051 anchors.topMargin: constants.margins 0052 anchors.leftMargin: constants.margins 0053 onControlChanged: { 0054 if (control) control.parent = fileButtonRow 0055 } 0056 } 0057 0058 ListView { 0059 id: fileListView 0060 0061 anchors.left: parent.left 0062 anchors.top: fileButtonRow.control ? fileButtonRow.bottom : parent.top 0063 anchors.bottom: parent.bottom 0064 anchors.right: parent.right 0065 anchors.margins: constants.margins 0066 clip: true 0067 0068 model: Kid3.CheckableListModel { 0069 id: fileModel 0070 sourceModel: app.fileProxyModel 0071 selectionModel: app.fileSelectionModel 0072 rootIndex: app.fileRootIndex 0073 onCurrentRowChanged: { 0074 fileListView.currentIndex = row 0075 } 0076 } 0077 0078 delegate: Standard { 0079 id: fileDelegate 0080 progression: isDir 0081 onClicked: { 0082 if (!isDir) { 0083 ListView.view.currentIndex = index 0084 fileModel.currentRow = index 0085 fileList.fileActivated() 0086 } else { 0087 confirmedOpenDirectory(filePath) 0088 } 0089 } 0090 highlighted: ListView.isCurrentItem 0091 background: Rectangle { 0092 color: highlighted ? constants.highlightColor : "transparent" 0093 } 0094 0095 Row { 0096 anchors.fill: parent 0097 0098 CheckBox { 0099 id: checkField 0100 anchors.verticalCenter: parent.verticalCenter 0101 onClicked: { 0102 // QTBUG-7932, assigning is not possible 0103 fileModel.setDataValue(index, "checkState", 0104 checked ? Qt.Checked : Qt.Unchecked) 0105 } 0106 } 0107 Binding { 0108 // workaround for QTBUG-31627 0109 // should work with "checked: checkState === Qt.Checked" 0110 target: checkField 0111 property: "checked" 0112 value: checkState === Qt.Checked 0113 } 0114 Rectangle { 0115 id: fileImage 0116 anchors.verticalCenter: parent.verticalCenter 0117 color: truncated ? constants.errorColor : "transparent" 0118 width: constants.gu(2) 0119 height: constants.gu(2) 0120 Image { 0121 source: "image://kid3/fileicon/" + 0122 (iconId && iconId != "modified" ? iconId : "null") 0123 sourceSize.width: parent.width 0124 sourceSize.height: parent.height 0125 visible: iconId != "modified" 0126 } 0127 Text { 0128 anchors.fill: parent 0129 font.family: materialFont.name 0130 font.pixelSize: 16 0131 text: "M" 0132 color: fileText.color 0133 visible: iconId == "modified" 0134 } 0135 } 0136 Label { 0137 id: fileText 0138 anchors.verticalCenter: parent.verticalCenter 0139 text: fileName 0140 color: fileDelegate.highlighted 0141 ? constants.highlightedTextColor : constants.textColor 0142 } 0143 } 0144 } 0145 } 0146 }