Warning, /multimedia/kid3/src/qml/app/TagCollapsible.qml is written in an unsupported language. File is not indexed.
0001 /** 0002 * \file TagCollapsible.qml 0003 * Collapsible with tag information. 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 Collapsible { 0029 id: collapsible 0030 property int tagNr 0031 property QtObject appTag: app.tag(tagNr) 0032 property QtObject selTag: app.selectionInfo.tag(tagNr) 0033 property bool hasFrameList: tagNr !== Kid3.Frame.Tag_Id3v1 0034 0035 function acceptEdit() { 0036 // Force focus lost to store changes. 0037 frameTable.currentIndex = -1 0038 } 0039 0040 text: qsTr("Tag %1").arg(tagNr + 1) + ": " + collapsible.selTag.tagFormat 0041 visible: tagNr <= Kid3.Frame.Tag_2 || selTag.tagUsed 0042 buttons: [ 0043 IconButton { 0044 iconName: "edit" 0045 color: collapsible.labelColor 0046 width: height 0047 onClicked: { 0048 appTag.frameList.selectByRow(frameTable.currentIndex) 0049 appTag.editFrame() 0050 } 0051 visible: hasFrameList 0052 }, 0053 IconButton { 0054 iconName: "add" 0055 color: collapsible.labelColor 0056 width: height 0057 onClicked: { 0058 appTag.addFrame() 0059 } 0060 visible: hasFrameList 0061 }, 0062 IconButton { 0063 iconName: "remove" 0064 color: collapsible.labelColor 0065 width: height 0066 onClicked: { 0067 appTag.frameList.selectByRow(frameTable.currentIndex) 0068 appTag.deleteFrame() 0069 } 0070 visible: hasFrameList 0071 }, 0072 IconButton { 0073 id: menuButton 0074 iconName: "navigation-menu" 0075 color: collapsible.labelColor 0076 width: height 0077 onClicked: menu.open() 0078 0079 Menu { 0080 id: menu 0081 MenuItem { 0082 id: toFileNameMenu 0083 text: qsTr("To Filename") 0084 onTriggered: collapsible.appTag.getFilenameFromTags() 0085 } 0086 MenuItem { 0087 text: qsTr("From Filename") 0088 onTriggered: collapsible.appTag.getTagsFromFilename() 0089 } 0090 MenuItem { 0091 text: qsTr("To Tag %1").arg(2) 0092 onTriggered: app.copyTag(script.toTagNumber(tagNr), 0093 script.toTagNumber(Kid3.Frame.Tag_2)) 0094 visible: tagNr > Kid3.Frame.Tag_2 0095 height: visible ? toFileNameMenu.height : 0 0096 } 0097 MenuItem { 0098 text: qsTr("From Tag %1").arg(tagNr == Kid3.Frame.Tag_2 ? "1" : "2") 0099 onTriggered: collapsible.appTag.copyToOtherTag() 0100 } 0101 MenuItem { 0102 text: qsTr("Copy") 0103 onTriggered: collapsible.appTag.copyTags() 0104 } 0105 MenuItem { 0106 text: qsTr("Paste") 0107 onTriggered: collapsible.appTag.pasteTags() 0108 } 0109 MenuItem { 0110 text: qsTr("Remove") 0111 onTriggered: collapsible.appTag.removeTags() 0112 } 0113 } 0114 } 0115 ] 0116 0117 content: ListView { 0118 id: frameTable 0119 enabled: collapsible.selTag.tagUsed 0120 clip: true 0121 width: parent.width 0122 height: count ? contentHeight : 0 0123 interactive: false 0124 model: collapsible.appTag.frameModel 0125 delegate: FrameDelegate { 0126 height: constants.controlHeight 0127 width: frameTable.width 0128 tagNr: collapsible.tagNr 0129 } 0130 } 0131 0132 // workaround for QTBUG-31627 0133 // should work with "checked: collapsible.selTag.hasTag" with Qt >= 5.3 0134 Binding { 0135 target: collapsible 0136 property: "checked" 0137 value: collapsible.selTag.hasTag 0138 } 0139 }