Warning, /multimedia/rattlesnake/EditPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Mathis BrĂ¼chert <mbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 import QtQuick 2.12
0006 import QtQuick.Window 2.12
0007 import QtQuick.Controls 2.14
0008 import QtQuick.Layouts 1.12
0009 import org.kde.kirigami 2.10 as Kirigami
0010 import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
0011 
0012 import org.kde.rattlesnake 1.0
0013 
0014 import "components"
0015 
0016 Kirigami.ScrollablePage {
0017     id:root
0018     title: qsTr("Edit beat")
0019     Kirigami.Theme.colorSet: Kirigami.Theme.Window
0020     padding: 0
0021 
0022     ActionButton {
0023         parent: overlay
0024         x: root.width - width - margin
0025         y: applicationWindow().height - height - pageStack.globalToolBar.preferredHeight - margin
0026         singleAction:  Kirigami.Action {
0027             icon.name: "list-add"
0028             text: qsTr("Add Beat")
0029             onTriggered: Metronome.addNote(0)
0030         }
0031 
0032     }
0033     ColumnLayout {
0034         MobileForm.FormCard {
0035             Layout.topMargin: Kirigami.Units.largeSpacing
0036             Layout.fillWidth: true
0037             contentItem: ColumnLayout {
0038                 spacing:0
0039                 Repeater {
0040                     model: Metronome.notes
0041                     delegate: ColumnLayout {
0042                         spacing:0
0043                         Layout.margins: 0
0044                         MobileForm.AbstractFormDelegate {
0045                             background: Rectangle {
0046                                 color: index === Metronome.currentIndex ?Kirigami.Theme.highlightColor:"transparent"
0047                                 opacity: 0.2
0048 
0049                             }
0050                             contentItem: ColumnLayout {
0051                                 id: delegateLayout
0052                                 ButtonGroup {
0053                                     buttons: column.children
0054                                 }
0055                                 RowLayout {
0056                                     Layout.fillWidth: true
0057                                     Layout.fillHeight: true
0058                                     Item {
0059                                         width: deleteButton.width
0060                                         visible: index > 0
0061                                     }
0062 
0063                                     Item { Layout.fillWidth: true }
0064                                     RowLayout {
0065                                         Layout.alignment: Qt.AlignHCenter
0066                                         Layout.fillWidth: true
0067                                         Layout.fillHeight: true
0068                                         id: column
0069 
0070                                         InstrumentButton {
0071                                             belongsToIndex: index
0072                                             instrument: Metronome.D
0073                                         }
0074 
0075                                         InstrumentButton {
0076                                             belongsToIndex: index
0077                                             instrument: Metronome.E
0078                                         }
0079 
0080                                         InstrumentButton {
0081                                             belongsToIndex: index
0082                                             instrument: Metronome.F
0083                                         }
0084                                     }
0085                                     Item { Layout.fillWidth: true }
0086 
0087                                     ToolButton {
0088                                         id: deleteButton
0089                                         visible: index > 0
0090                                         icon.name: "delete"
0091                                         onClicked: Metronome.removeNote(index)
0092                                     }
0093                                 }
0094                                 RowLayout {
0095                                     Layout.alignment: Qt.AlignHCenter
0096                                     Layout.fillWidth: true
0097                                     Layout.fillHeight: true
0098                                     ToolButton {
0099                                         icon.name: Metronome.notes[index].volume === 0 ? "audio-volume-muted" : (Metronome.notes[index].volume < 33 ? "audio-volume-low" : (Metronome.notes[index].volume < 66 ? "audio-volume-medium" : "audio-volume-high"))
0100                                         checkable: true
0101                                         checked: Metronome.notes[index].volume === 0
0102                                         onClicked: Metronome.notes[index].volume = 0
0103 
0104                                     }
0105                                     Slider {
0106                                         id:slider
0107                                         Layout.alignment: Qt.AlignHCenter
0108                                         from: 0
0109                                         to: 100
0110                                         snapMode: Slider.SnapAlways
0111                                         stepSize: 10
0112                                         value: Metronome.notes[index].volume
0113                                         onMoved: Metronome.notes[index].volume = value
0114                                     }
0115                                 }
0116                             }
0117                         }
0118                         MobileForm.FormDelegateSeparator { Layout.margins: 0 }
0119 
0120                     }
0121                 }
0122             }
0123         }
0124     }
0125 }