DoViGUI/Main.qml

100 lines
2.5 KiB
QML

import QtQuick
import QtQuick.Window
import QtQuick.Dialogs
import QtQuick.Controls
Window {
width: 640
height: 480
visible: true
title: qsTr("DoViGUI")
color: "darkgrey"
Button {
id: btnVideoFile
anchors.topMargin: 25
anchors.leftMargin: 25
anchors.top: parent.top
anchors.left: parent.left
text: "Video File"
font.pixelSize: 14
onClicked: videoFileDialog.open()
flat: false
height: font.pixelSize + 10
width: 100
}
Rectangle {
anchors.top: btnVideoFile.bottom
anchors.left: btnVideoFile.left
anchors.right: parent.right
anchors.rightMargin: 25
color: "lightgrey"
height: txtVideoFile.font.pixelSize + 10
id: txtBackground
TextEdit {
id: txtVideoFile
text: ""
verticalAlignment: TextEdit.AlignVCenter
anchors.fill: parent
readOnly: false
selectByMouse: true
font.pixelSize: 14
anchors.leftMargin: 15
anchors.rightMargin: 15
}
}
Text {
//TODO Need to scroll and clip long text
id: hdrType
anchors.left: btnVideoFile.left
anchors.top: txtBackground.bottom
width: 200
text: "None"
wrapMode: TextEdit.Wrap
}
Button {
id: btnStartEncode
anchors.topMargin: 25
anchors.leftMargin: 25
anchors.top: hdrType.bottom
anchors.left: parent.left
text: "Start Encode"
font.pixelSize: 14
onClicked: handbrake.startEncode()
flat: false
height: font.pixelSize + 10
width: 100
}
FileDialog {
id: videoFileDialog
fileMode: FileDialog.OpenFile
nameFilters: ["Video files (*.mkv *.mp4)", "All files (*)"]
onAccepted: {
//Remove "file:/// at start of URL
var fileName = mediaInfo.fixFileName(videoFileDialog.selectedFile.toString());
txtVideoFile.text = fileName;
switch (mediaInfo.getHDRType(fileName)) {
case 0:
hdrType.text = "SDR"
break
case 1:
hdrType.text = "HDR"
break
case 2:
hdrType.text = "Dolby Vision"
break
default:
hdrType.text = "Error"
}
}
}
}