Warning, /multimedia/kid3/src/qml/app/FrameSelectDialog.qml is written in an unsupported language. File is not indexed.

0001 /**
0002  * \file FileSelectDialog.qml
0003  * Dialog to select a frame.
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 
0028 Dialog {
0029   id: page
0030 
0031   signal frameSelected(string name);
0032 
0033   modal: true
0034   x: (parent.width - width) / 2
0035   y: parent.height / 6
0036   standardButtons: Dialog.Ok | Dialog.Cancel
0037 
0038   title: qsTr("Add Frame")
0039 
0040   function openFrameNames(frameNames) {
0041     frameSelectList.model = frameNames
0042     page.open()
0043   }
0044 
0045   ColumnLayout {
0046     Label {
0047       text: qsTr("Select the frame ID")
0048     }
0049 
0050     ListView {
0051       id: frameSelectList
0052       width: constants.gu(30)
0053       height: Math.min(constants.gu(35),
0054                     page.parent.height - 3 * constants.rowHeight - 4 * constants.margins)
0055 
0056       clip: true
0057       delegate: Standard {
0058         text: modelData
0059         highlighted: ListView.view.currentIndex === index
0060         onClicked: ListView.view.currentIndex = index
0061         background: Rectangle {
0062           color: highlighted ? constants.highlightColor : "transparent"
0063         }
0064       }
0065     }
0066   }
0067 
0068   onRejected: {
0069     page.close()
0070     page.frameSelected("")
0071   }
0072   onAccepted: {
0073     page.close()
0074     page.frameSelected(frameSelectList.currentItem.text)
0075   }
0076 }