| 1 |
/* |
| 2 |
* Audacity: A Digital Audio Editor |
| 3 |
*/ |
| 4 |
import QtQuick 2.15 |
| 5 |
import QtQuick.Controls 2.15 |
| 6 |
import QtQuick.Layouts 1.15 |
| 7 |
|
| 8 |
import Muse.Ui 1.0 |
| 9 |
import Muse.UiComponents 1.0 |
| 10 |
|
| 11 |
import Audacity.Playback 1.0 |
| 12 |
|
| 13 |
RowLayout { |
| 14 |
id: root |
| 15 |
|
| 16 |
property alias value: timecodeModel.value |
| 17 |
|
| 18 |
property alias sampleRate: timecodeModel.sampleRate |
| 19 |
property alias tempo: timecodeModel.tempo |
| 20 |
property alias upperTimeSignature: timecodeModel.upperTimeSignature |
| 21 |
property alias lowerTimeSignature: timecodeModel.lowerTimeSignature |
| 22 |
|
| 23 |
property alias currentFormat: timecodeModel.currentFormat |
| 24 |
|
| 25 |
property bool showMenu: true |
| 26 |
property int backgroundLeftRadius: 3 |
| 27 |
|
| 28 |
signal valueChangeRequested(var newValue) |
| 29 |
|
| 30 |
height: 28 |
| 31 |
|
| 32 |
TimecodeModel { |
| 33 |
id: timecodeModel |
| 34 |
|
| 35 |
visualItem: root |
| 36 |
|
| 37 |
onValueChanged: { |
| 38 |
root.valueChangeRequested(value) |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
spacing: 1 |
| 43 |
|
| 44 |
RoundedRectangle { |
| 45 |
Layout.preferredWidth: childrenRect.width |
| 46 |
Layout.fillHeight: true |
| 47 |
|
| 48 |
topLeftRadius: root.backgroundLeftRadius |
| 49 |
bottomLeftRadius: root.backgroundLeftRadius |
| 50 |
|
| 51 |
color: ui.theme.backgroundQuarternaryColor |
| 52 |
|
| 53 |
Item { |
| 54 |
property int margin: 6 |
| 55 |
|
| 56 |
width: row.width + margin * 2 |
| 57 |
height: row.height |
| 58 |
|
| 59 |
Row { |
| 60 |
id: row |
| 61 |
|
| 62 |
anchors.left: parent.left |
| 63 |
anchors.leftMargin: parent.margin |
| 64 |
anchors.verticalCenter: parent.verticalCenter |
| 65 |
|
| 66 |
spacing: 0 |
| 67 |
|
| 68 |
Repeater { |
| 69 |
model: timecodeModel |
| 70 |
|
| 71 |
delegate: TimecodeField { |
| 72 |
value: symbol |
| 73 |
|
| 74 |
isSelected: model.index === timecodeModel.currentEditedFieldIndex |
| 75 |
isEditable: editable |
| 76 |
|
| 77 |
enabled: root.enabled |
| 78 |
|
| 79 |
onClicked: { |
| 80 |
timecodeModel.currentEditedFieldIndex = model.index |
| 81 |
} |
| 82 |
} |
| 83 |
} |
| 84 |
} |
| 85 |
} |
| 86 |
} |
| 87 |
|
| 88 |
ArrowMenuButton { |
| 89 |
id: menuBtn |
| 90 |
|
| 91 |
Layout.preferredWidth: 16 |
| 92 |
Layout.fillHeight: true |
| 93 |
|
| 94 |
menuModel: timecodeModel.availableFormats |
| 95 |
|
| 96 |
visible: root.showMenu |
| 97 |
|
| 98 |
onHandleMenuItem: function(itemId) { |
| 99 |
timecodeModel.currentFormat = parseInt(itemId) |
| 100 |
} |
| 101 |
} |
| 102 |
} |