DoViGUI/Main.qml

146 lines
3.6 KiB
QML
Raw Normal View History

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
title: qsTr("DoViGUI")
2023-09-19 20:20:19 -05:00
color: "darkgrey"
Button {
id: btnVideoFile
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"
font.pixelSize: 14
2023-09-19 20:20:19 -05:00
onClicked: videoFileDialog.open()
flat: false
height: font.pixelSize + 10
width: 100
2023-09-19 20:20:19 -05:00
}
Rectangle {
2023-09-19 20:20:19 -05:00
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
}
2023-09-19 20:20:19 -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
}
Text {
id: searchResult
anchors.left: btnVideoFile.left
anchors.top: hdrType.bottom
width: 200
text: "No Results"
wrapMode: TextEdit.Wrap
}
Button {
id: btnStartEncode
anchors.topMargin: 25
anchors.leftMargin: 25
anchors.top: searchResult.bottom
anchors.left: parent.left
text: "Start Encode"
font.pixelSize: 14
onClicked: handbrake.startEncode()
flat: false
height: font.pixelSize + 10
width: 100
}
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
}
Text {
id: handbrakeStatus
anchors.left: btnVideoFile.left
anchors.bottom: parent.bottom
width: 600
text: "Encode not started."
wrapMode: TextEdit.Wrap
}
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;
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"
}
movieDB.searchMovieTitleFile(fileName);
}
}
Connections {
target: movieDB
function onSearchResultReturned(result) {
searchResult.text = "First Result: " + result;
}
}
Connections {
target: handbrake
function onStatusChanged(status) {
handbrakeStatus.text = status;
}
2023-09-19 20:20:19 -05:00
}
2023-09-17 18:14:09 -05:00
}