Warning, /multimedia/kid3/src/qml/app/NumberTracksDialog.qml is written in an unsupported language. File is not indexed.
0001 /**
0002 * \file NumberTracksDialog.qml
0003 * Number tracks dialog.
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.Layouts 1.11
0026 import QtQuick.Controls 2.4
0027 import Kid3 1.1 as Kid3
0028
0029 Dialog {
0030 id: page
0031
0032 title: qsTr("Number Tracks")
0033 standardButtons: Dialog.Ok | Dialog.Cancel
0034 modal: true
0035 x: (parent.width - width) / 2
0036 y: parent.height / 6
0037
0038 ColumnLayout {
0039 Row {
0040 spacing: constants.spacing
0041 CheckBox {
0042 id: numberCheckBox
0043 checked: true
0044 }
0045 Label {
0046 height: totalRow.height
0047 verticalAlignment: Text.AlignVCenter
0048 text: qsTr("Start number:")
0049 }
0050 }
0051 TextField {
0052 id: startNumberEdit
0053 text: "1"
0054 selectByMouse: true
0055 }
0056 Label {
0057 text: qsTr("Destination:")
0058 width: parent.labelWidth
0059 }
0060 ComboBox {
0061 id: destinationComboBox
0062 width: parent.valueWidth
0063 model: [ qsTr("Tag 1"),
0064 qsTr("Tag 2"),
0065 qsTr("Tag 3"),
0066 qsTr("Tag 1 and Tag 2"),
0067 qsTr("All Tags") ]
0068 function getTagVersion() {
0069 return [ Kid3.Frame.TagV1, Kid3.Frame.TagV2, Kid3.Frame.TagV3,
0070 Kid3.Frame.TagV2V1, Kid3.Frame.TagVAll ][currentIndex]
0071 }
0072 }
0073 Row {
0074 spacing: constants.spacing
0075 CheckBox {
0076 id: resetCounterCheckBox
0077 checked: true
0078 }
0079 Label {
0080 height: totalRow.height
0081 verticalAlignment: Text.AlignVCenter
0082 text: qsTr("Reset counter for each folder")
0083 }
0084 }
0085 Row {
0086 id: totalRow
0087 spacing: constants.spacing
0088 CheckBox {
0089 id: totalCheckBox
0090 checked: configs.tagConfig().enableTotalNumberOfTracks
0091 }
0092 Label {
0093 height: totalRow.height
0094 verticalAlignment: Text.AlignVCenter
0095 text: qsTr("Total number of tracks")
0096 }
0097 }
0098 TextField {
0099 id: totalEdit
0100 selectByMouse: true
0101 }
0102 }
0103
0104 onAccepted: {
0105 var startNr = parseInt(startNumberEdit.text)
0106 if (!isNaN(startNr)) {
0107 var total = totalCheckBox.checked ? parseInt(totalEdit.text) : -1
0108 if (isNaN(total)) {
0109 total = -1
0110 }
0111 var options = 0
0112 if (numberCheckBox.checked)
0113 options |= Kid3.Kid3Application.NumberTracksEnabled
0114 if (resetCounterCheckBox.checked)
0115 options |= Kid3.Kid3Application.NumberTracksResetCounterForEachDirectory
0116 app.numberTracks(startNr, total,
0117 script.toTagVersion(destinationComboBox.getTagVersion()),
0118 options)
0119 }
0120 }
0121
0122 onVisibleChanged: if (visible) {
0123 totalEdit.text = app.getTotalNumberOfTracksInDir()
0124 }
0125 }