-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.qml
195 lines (139 loc) · 4.58 KB
/
main.qml
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.3
import it.videx.audio_decoder 1.0
Window {
width: 640
height: 480
visible: true
title: qsTr("Audio Converter")
color:"#f7f7f7"
FontLoader {
id: fontLoaderGothamMedium
source: "qrc:/other/fonts/GothamMedium.ttf"
}
FontLoader {
id: fontLoaderGothamBook
source: "qrc:/other/fonts/GothamBook.ttf"
}
FontLoader {
id: fontLoaderGothamLight
source: "qrc:/other/fonts/GothamLight.ttf"
}
Button{
id:loadFileButton
width: 580
text: "Load files"
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 8
font.family: fontLoaderGothamBook.name
font.pointSize: 14
onReleased: {
folder.visible = true;
}
}
Rectangle{
id: list
width: parent.width - 20
height: parent.height - loadFileButton.height - 128
color:"#e9e9e9"
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: loadFileButton.bottom
anchors.topMargin: 16
border.color: "#d2d2d2"
border.width: 1
ListView{
property var files : []
id:listView
anchors.fill: parent
spacing: 10
orientation: Qt.Vertical
model : files
snapMode: ListView.SnapToItem
highlightMoveDuration : 15000//20000
maximumFlickVelocity: 7500//10000
clip: true
delegate: Rectangle{
color: "transparent"
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 4
height: 40
Text{
font.family: fontLoaderGothamBook.name
font.pointSize: 10
anchors.centerIn: parent
text: modelData
}
}
FileDialog {
id:folder
selectMultiple: true
nameFilters: ["Audio Files (*.wav)"]
visible: false
onAccepted: {
var files = [];
for(var i = 0; i < fileUrls.length; i++){
files.push(fileUrls[i].replace(/^file:\/{3}/,""))
}
listView.files = files;
}
}
}
}
Connections{
target: AudioFilesDecoder
onFilesDecoded:{
console.log("FILES DECODED");
}
}
Grid{
anchors.top: list.bottom
anchors.topMargin: 32
anchors.horizontalCenter: parent.horizontalCenter
columns: 3
spacing: 10
Button{
id:startConversion
width: 580/2.5
text: "Convert Files"
font.family: fontLoaderGothamBook.name
font.pointSize: 14
onReleased: {
if(listView.model.length > 0){
AudioFilesDecoder.decode(listView.model, sampleRate.currentText.replace(" Hz", ""), generateAlsoWavFile.checked)
}
}
}
ComboBox{
id: sampleRate
width: 580/4
height: startConversion.height
currentIndex: 1
model: ["8000 Hz", "16000 Hz", "44100 Hz"]
contentItem: Text {
text: parent.displayText
font.family: fontLoaderGothamBook.name
font.pointSize: 10
verticalAlignment: Text.AlignVCenter;
horizontalAlignment: Text.AlignHCenter;
elide: Text.ElideRight
}
delegate: ItemDelegate {
width: parent.width
text: parent.textRole ? (Array.isArray(parent.model) ? modelData[parent.textRole] : model[parent.textRole]) : modelData
font.family: fontLoaderGothamBook.name
font.pointSize: 10
highlighted: parent.highlightedIndex === index
hoverEnabled: parent.hoverEnabled
}
}
CheckBox{
id: generateAlsoWavFile
text: "Generate also wav file"
font.family: fontLoaderGothamBook.name
font.pointSize: 12
}
}
}