2023-09-17 18:14:09 -05:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Window
|
2023-09-19 20:20:19 -05:00
|
|
|
import QtQuick.Dialogs
|
|
|
|
import QtQuick.Controls
|
2023-09-17 18:14:09 -05:00
|
|
|
|
|
|
|
Window {
|
|
|
|
width: 640
|
|
|
|
height: 480
|
|
|
|
visible: true
|
2023-10-07 09:01:19 -05:00
|
|
|
title: qsTr("DoViGUI")
|
2023-09-19 20:20:19 -05:00
|
|
|
color: "darkgrey"
|
|
|
|
|
|
|
|
Button {
|
|
|
|
id: btnVideoFile
|
2023-10-07 09:01:19 -05:00
|
|
|
anchors.topMargin: 25
|
|
|
|
anchors.leftMargin: 25
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
2023-09-19 20:20:19 -05:00
|
|
|
text: "Video File"
|
2023-10-07 09:01:19 -05:00
|
|
|
font.pixelSize: 14
|
2023-09-19 20:20:19 -05:00
|
|
|
onClicked: videoFileDialog.open()
|
2023-10-07 09:01:19 -05:00
|
|
|
flat: false
|
|
|
|
height: font.pixelSize + 10
|
|
|
|
width: 100
|
2023-09-19 20:20:19 -05:00
|
|
|
}
|
|
|
|
|
2023-10-07 09:01:19 -05:00
|
|
|
Rectangle {
|
2023-09-19 20:20:19 -05:00
|
|
|
anchors.top: btnVideoFile.bottom
|
2023-10-07 09:01:19 -05:00
|
|
|
anchors.left: btnVideoFile.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 25
|
|
|
|
color: "lightgrey"
|
|
|
|
height: txtVideoFile.font.pixelSize + 10
|
2023-10-28 16:17:30 -05:00
|
|
|
id: txtBackground
|
|
|
|
|
2023-10-07 09:01:19 -05:00
|
|
|
TextEdit {
|
|
|
|
id: txtVideoFile
|
|
|
|
text: ""
|
|
|
|
verticalAlignment: TextEdit.AlignVCenter
|
2023-10-28 16:17:30 -05:00
|
|
|
anchors.fill: parent
|
2023-10-07 09:01:19 -05:00
|
|
|
readOnly: false
|
|
|
|
selectByMouse: true
|
|
|
|
font.pixelSize: 14
|
2023-10-28 16:17:30 -05:00
|
|
|
anchors.leftMargin: 15
|
|
|
|
anchors.rightMargin: 15
|
2023-10-07 09:01:19 -05:00
|
|
|
}
|
2023-09-19 20:20:19 -05:00
|
|
|
}
|
|
|
|
|
2023-10-28 16:17:30 -05:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2024-01-13 04:56:24 -06:00
|
|
|
Text {
|
|
|
|
id: searchResult
|
|
|
|
anchors.left: btnVideoFile.left
|
|
|
|
anchors.top: hdrType.bottom
|
|
|
|
width: 200
|
|
|
|
text: "No Results"
|
|
|
|
wrapMode: TextEdit.Wrap
|
|
|
|
}
|
|
|
|
|
2023-10-29 13:42:40 -05:00
|
|
|
Button {
|
|
|
|
id: btnStartEncode
|
|
|
|
anchors.topMargin: 25
|
|
|
|
anchors.leftMargin: 25
|
2024-01-13 04:56:24 -06:00
|
|
|
anchors.top: searchResult.bottom
|
2023-10-29 13:42:40 -05:00
|
|
|
anchors.left: parent.left
|
|
|
|
text: "Start Encode"
|
|
|
|
font.pixelSize: 14
|
|
|
|
onClicked: handbrake.startEncode()
|
|
|
|
flat: false
|
|
|
|
height: font.pixelSize + 10
|
|
|
|
width: 100
|
|
|
|
}
|
|
|
|
|
2024-01-13 04:56:24 -06:00
|
|
|
Button {
|
|
|
|
id: btnStopEncode
|
|
|
|
anchors.topMargin: 25
|
|
|
|
anchors.leftMargin: 25
|
|
|
|
anchors.top: searchResult.bottom
|
|
|
|
anchors.left: btnStartEncode.right
|
|
|
|
text: "Stop Encode"
|
|
|
|
font.pixelSize: 14
|
|
|
|
onClicked: handbrake.stopEncode()
|
|
|
|
flat: false
|
|
|
|
height: font.pixelSize + 10
|
|
|
|
width: 100
|
|
|
|
}
|
2023-10-07 09:01:19 -05:00
|
|
|
|
2024-01-13 04:56:24 -06:00
|
|
|
Text {
|
|
|
|
id: handbrakeStatus
|
|
|
|
anchors.left: btnVideoFile.left
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
width: 600
|
|
|
|
text: "Encode not started."
|
|
|
|
wrapMode: TextEdit.Wrap
|
|
|
|
}
|
2023-10-07 09:01:19 -05:00
|
|
|
|
2023-09-19 20:20:19 -05:00
|
|
|
FileDialog {
|
|
|
|
id: videoFileDialog
|
|
|
|
fileMode: FileDialog.OpenFile
|
|
|
|
nameFilters: ["Video files (*.mkv *.mp4)", "All files (*)"]
|
2023-12-23 05:29:36 -06:00
|
|
|
onAccepted: {
|
|
|
|
//Remove "file:/// at start of URL
|
|
|
|
var fileName = mediaInfo.fixFileName(videoFileDialog.selectedFile.toString());
|
|
|
|
txtVideoFile.text = fileName;
|
2023-10-28 16:17:30 -05:00
|
|
|
|
|
|
|
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"
|
|
|
|
}
|
2024-01-13 04:56:24 -06:00
|
|
|
|
|
|
|
movieDB.searchMovieTitleFile(fileName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: movieDB
|
|
|
|
function onSearchResultReturned(result) {
|
|
|
|
searchResult.text = "First Result: " + result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: handbrake
|
|
|
|
function onStatusChanged(status) {
|
|
|
|
handbrakeStatus.text = status;
|
2023-10-28 16:17:30 -05:00
|
|
|
}
|
2023-09-19 20:20:19 -05:00
|
|
|
}
|
2023-09-17 18:14:09 -05:00
|
|
|
}
|