mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-18 16:32:33 +02:00
Add ImageSelector placeholder text
Fix skip conversion on webm
This commit is contained in:
parent
c846564206
commit
5feb7715d6
@ -30,7 +30,7 @@ Item {
|
|||||||
state: "nothingSelected"
|
state: "nothingSelected"
|
||||||
|
|
||||||
property string imageSource
|
property string imageSource
|
||||||
|
property alias placeHolderText: txtPlaceholder.text
|
||||||
|
|
||||||
onImageSourceChanged: {
|
onImageSourceChanged: {
|
||||||
if (imageSource === "") {
|
if (imageSource === "") {
|
||||||
@ -98,6 +98,24 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: txtPlaceholder
|
||||||
|
clip: true
|
||||||
|
font.pointSize: 12
|
||||||
|
font.family: "Roboto"
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
color: Material.color(Material.Grey)
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: imgWrapper.right
|
||||||
|
right: btnClear.left
|
||||||
|
bottom: parent.bottom
|
||||||
|
margins: 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: txtName
|
id: txtName
|
||||||
clip: true
|
clip: true
|
||||||
@ -147,7 +165,7 @@ Item {
|
|||||||
id: fileDialog
|
id: fileDialog
|
||||||
title: "Please choose a file"
|
title: "Please choose a file"
|
||||||
fileMode: FileDialog.OpenFile
|
fileMode: FileDialog.OpenFile
|
||||||
nameFilters: []
|
nameFilters: ["Images (*.png *.jpg)"]
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
imageSource = fileDialog.file
|
imageSource = fileDialog.file
|
||||||
txtName.text = fileDialog.file.toString().replace(/^.*[\\\/]/,
|
txtName.text = fileDialog.file.toString().replace(/^.*[\\\/]/,
|
||||||
@ -164,6 +182,10 @@ Item {
|
|||||||
opacity: 1
|
opacity: 1
|
||||||
anchors.topMargin: 5
|
anchors.topMargin: 5
|
||||||
}
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: txtPlaceholder
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "nothingSelected"
|
name: "nothingSelected"
|
||||||
@ -186,6 +208,12 @@ Item {
|
|||||||
duration: 300
|
duration: 300
|
||||||
easing.type: Easing.OutQuart
|
easing.type: Easing.OutQuart
|
||||||
}
|
}
|
||||||
|
PropertyAnimation {
|
||||||
|
target: txtPlaceholder
|
||||||
|
property: "opacity"
|
||||||
|
duration: 300
|
||||||
|
easing.type: Easing.OutQuart
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ Item {
|
|||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case CreateImportVideo.ConvertingPreviewImageFinished:
|
case CreateImportVideo.ConvertingPreviewImageFinished:
|
||||||
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.png"
|
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.jpg"
|
||||||
imgPreview.visible = true
|
imgPreview.visible = true
|
||||||
txtConvert.text = qsTr("Converting Video preview mp4")
|
txtConvert.text = qsTr("Converting Video preview mp4")
|
||||||
break
|
break
|
||||||
@ -44,15 +44,16 @@ Item {
|
|||||||
txtConvert.text = qsTr("Generating preview gif...")
|
txtConvert.text = qsTr("Generating preview gif...")
|
||||||
break
|
break
|
||||||
case CreateImportVideo.ConvertingPreviewGifFinished:
|
case CreateImportVideo.ConvertingPreviewGifFinished:
|
||||||
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.gif"
|
gifPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.gif"
|
||||||
imgPreview.visible = true
|
imgPreview.visible = false
|
||||||
imgPreview.playing = true
|
gifPreview.visible = true
|
||||||
|
gifPreview.playing = true
|
||||||
break
|
break
|
||||||
case CreateImportVideo.ConvertingAudio:
|
case CreateImportVideo.ConvertingAudio:
|
||||||
txtConvert.text = qsTr("Converting Audio...")
|
txtConvert.text = qsTr("Converting Audio...")
|
||||||
break
|
break
|
||||||
case CreateImportVideo.ConvertingVideo:
|
case CreateImportVideo.ConvertingVideo:
|
||||||
txtConvert.text = qsTr("Converting Video...")
|
txtConvert.text = qsTr("Converting Video... This can take some time!")
|
||||||
break
|
break
|
||||||
case CreateImportVideo.ConvertingVideoError:
|
case CreateImportVideo.ConvertingVideoError:
|
||||||
txtConvert.text = qsTr("Converting Video ERROR!")
|
txtConvert.text = qsTr("Converting Video ERROR!")
|
||||||
@ -110,9 +111,16 @@ Item {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedImage {
|
Image {
|
||||||
id: imgPreview
|
id: imgPreview
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
visible: false
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimatedImage {
|
||||||
|
id: gifPreview
|
||||||
|
asynchronous: true
|
||||||
playing: true
|
playing: true
|
||||||
visible: false
|
visible: false
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -150,7 +158,7 @@ Item {
|
|||||||
}
|
}
|
||||||
ImageSelector {
|
ImageSelector {
|
||||||
id: previewSelector
|
id: previewSelector
|
||||||
|
placeHolderText: qsTr("You can set your own preview image here!")
|
||||||
anchors {
|
anchors {
|
||||||
top: imgWrapper.bottom
|
top: imgWrapper.bottom
|
||||||
topMargin: 20
|
topMargin: 20
|
||||||
|
@ -96,7 +96,13 @@ void Create::saveWallpaper(QString title, QString description, QString filePath,
|
|||||||
obj.insert("description", description);
|
obj.insert("description", description);
|
||||||
obj.insert("title", title);
|
obj.insert("title", title);
|
||||||
obj.insert("youtube", youtube);
|
obj.insert("youtube", youtube);
|
||||||
obj.insert("file", filePathFile.fileName());
|
|
||||||
|
// If the input file is a webm we don't need to convert it
|
||||||
|
if (filePath.endsWith(".webm")) {
|
||||||
|
obj.insert("file", filePathFile.fileName());
|
||||||
|
} else {
|
||||||
|
obj.insert("file", filePathFile.baseName() + ".webm");
|
||||||
|
}
|
||||||
obj.insert("previewGIF", "preview.gif");
|
obj.insert("previewGIF", "preview.gif");
|
||||||
obj.insert("previewWEBM", "preview.webm");
|
obj.insert("previewWEBM", "preview.webm");
|
||||||
if (previewImageFile.exists()) {
|
if (previewImageFile.exists()) {
|
||||||
|
@ -35,10 +35,10 @@ void CreateImportVideo::process()
|
|||||||
if (!createWallpaperVideoPreview())
|
if (!createWallpaperVideoPreview())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!createWallpaperGifPreview())
|
if (!createWallpaperImagePreview())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!createWallpaperImagePreview())
|
if (!createWallpaperGifPreview())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!createWallpaperVideo())
|
if (!createWallpaperVideo())
|
||||||
@ -352,7 +352,10 @@ bool CreateImportVideo::createWallpaperVideo()
|
|||||||
args.append("yuv420p");
|
args.append("yuv420p");
|
||||||
args.append("-b:v");
|
args.append("-b:v");
|
||||||
args.append("0");
|
args.append("0");
|
||||||
args.append(m_exportPath + "/video.webm");
|
|
||||||
|
QFileInfo file(m_videoPath);
|
||||||
|
QString convertedFileAbsolutePath {m_exportPath +"/"+ file.baseName() +".webm"};
|
||||||
|
args.append(convertedFileAbsolutePath);
|
||||||
|
|
||||||
QScopedPointer<QProcess> proConvertVideo(new QProcess());
|
QScopedPointer<QProcess> proConvertVideo(new QProcess());
|
||||||
proConvertVideo.data()->setArguments(args);
|
proConvertVideo.data()->setArguments(args);
|
||||||
@ -379,15 +382,14 @@ bool CreateImportVideo::createWallpaperVideo()
|
|||||||
}
|
}
|
||||||
QString tmpErrImg = proConvertVideo.data()->readAllStandardError();
|
QString tmpErrImg = proConvertVideo.data()->readAllStandardError();
|
||||||
if (!tmpErrImg.isEmpty()) {
|
if (!tmpErrImg.isEmpty()) {
|
||||||
QFile video(m_exportPath + "/video.webm");
|
QFile video(convertedFileAbsolutePath);
|
||||||
if (!video.exists() && !(video.size() > 0)) {
|
if (!video.exists() && !(video.size() > 0)) {
|
||||||
qDebug() << video.fileName() << proConvertVideo.data()->readAll();
|
qDebug() << convertedFileAbsolutePath << proConvertVideo.data()->readAll();
|
||||||
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoError);
|
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//this->processOutput(proConvertImage.data()->readAll());
|
|
||||||
proConvertVideo.data()->close();
|
proConvertVideo.data()->close();
|
||||||
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoFinished);
|
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoFinished);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user