blob: 7bfc2255de4706773fe5fb3375988371cbf00a00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtMultimedia
pragma ComponentBehavior: Bound
ColumnLayout {
id: root
required property MediaRecorder recorder
Text {
text: "Metadata settings"
color: palette.text
}
ListModel { id: metaDataModel }
Connections {
target: root.recorder
function onMetaDataChanged() {
metaDataModel.clear()
for (var key of root.recorder.metaData.keys()) {
if (recorder.metaData.stringValue(key))
metaDataModel.append(
{ text: recorder.metaData.metaDataKeyToString(key)
, value: key })
}
}
}
Row {
id: metaDataAdd
spacing: Style.intraSpacing
ComboBox {
id: metaDataType
width: Style.widthMedium
height: Style.height
font.pointSize: Style.fontSize
model: ListModel {
ListElement { text: "Title"; value: MediaMetaData.Title }
ListElement { text: "Author"; value: MediaMetaData.Author }
ListElement { text: "Comment"; value: MediaMetaData.Comment }
ListElement { text: "Description"; value: MediaMetaData.Description }
ListElement { text: "Genre"; value: MediaMetaData.Genre }
ListElement { text: "Publisher"; value: MediaMetaData.Publisher }
ListElement { text: "Copyright"; value: MediaMetaData.Copyright }
ListElement { text: "Date"; value: MediaMetaData.Date }
ListElement { text: "Url"; value: MediaMetaData.Url }
ListElement { text: "MediaType"; value: MediaMetaData.MediaType }
ListElement { text: "AlbumTitle"; value: MediaMetaData.AlbumTitle }
ListElement { text: "AlbumArtist"; value: MediaMetaData.AlbumArtist }
ListElement { text: "ContributingArtist"; value: MediaMetaData.ContributingArtist }
ListElement { text: "Composer"; value: MediaMetaData.Composer }
ListElement { text: "LeadPerformer"; value: MediaMetaData.LeadPerformer }
}
textRole: "text"
valueRole: "value"
background: StyleRectangle { anchors.fill: parent; width: metaDataType.width }
}
Item {
width: Style.widthMedium
height: Style.height
StyleRectangle { anchors.fill: parent }
TextInput {
id: textInput
anchors.fill: parent
anchors.bottom: parent.bottom
anchors.margins: 4
font.pointSize: Style.fontSize
clip: true
onAccepted: {
root.recorder.metaData.insert(metaDataType.currentValue, text)
recorder.metaDataChanged()
text = ""
textInput.deselect()
}
}
}
Button {
width: Style.widthShort
height: Style.height
text: "add"
font.pointSize: Style.fontSize
background: StyleRectangle { anchors.fill: parent }
onClicked: textInput.accepted()
}
}
ListView {
id: listView
Layout.fillHeight: true
Layout.minimumWidth: metaDataAdd.width
spacing: Style.intraSpacing
clip: true
model: metaDataModel
delegate: Row {
id: r
height: Style.height
spacing: Style.intraSpacing
required property string text
required property string value
Text {
width: Style.widthShort
height: Style.height
text: r.text
font.pointSize: Style.fontSize
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
Item {
width: Style.widthMedium
height: Style.height
StyleRectangle { anchors.fill: parent }
TextInput {
anchors.fill: parent
anchors.margins: 4
anchors.bottom: parent.bottom
font.pointSize: Style.fontSize
clip: true
text: root.recorder.metaData.stringValue(r.value)
onAccepted: root.recorder.metaData.insert(r.value, text)
}
}
Button {
width: Style.widthShort
height: Style.height
text: "del"
font.pointSize: Style.fontSize
background: StyleRectangle { anchors.fill: parent }
onClicked: { root.recorder.metaData.remove(r.value); recorder.metaDataChanged() }
}
}
}
}
|