DoViGUI/Main.qml
Adam Bissen eff090af47 Add ability to lower cpu affinity (Linux only for the moment).
Start work on paths to save file and different args based on format.
2024-01-13 16:36:56 +00:00

173 lines
4.3 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
}
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(txtVideoFile.text, searchResult.text)
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
}
Button {
id: btnLowerAffinity
anchors.topMargin: 25
anchors.leftMargin: 25
anchors.top: btnStartEncode.bottom
anchors.left: parent.left
text: "Lower Affinity"
font.pixelSize: 14
onClicked: handbrake.setCoreUsage(18)
flat: false
height: font.pixelSize + 10
width: 100
}
Button {
id: btnRaiseAffinity
anchors.topMargin: 25
anchors.leftMargin: 25
anchors.top: btnStartEncode.bottom
anchors.left: btnLowerAffinity.right
text: "Raise Affinity"
font.pixelSize: 14
onClicked: handbrake.setCoreUsage(24)
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
}
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"
}
movieDB.searchMovieTitleFile(fileName);
}
}
Connections {
target: movieDB
function onSearchResultReturned(result) {
searchResult.text = "First Result: " + result;
}
}
Connections {
target: handbrake
function onStatusChanged(status) {
handbrakeStatus.text = status;
}
}
}