mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01: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"
|
||||
|
||||
property string imageSource
|
||||
|
||||
property alias placeHolderText: txtPlaceholder.text
|
||||
|
||||
onImageSourceChanged: {
|
||||
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 {
|
||||
id: txtName
|
||||
clip: true
|
||||
@ -147,7 +165,7 @@ Item {
|
||||
id: fileDialog
|
||||
title: "Please choose a file"
|
||||
fileMode: FileDialog.OpenFile
|
||||
nameFilters: []
|
||||
nameFilters: ["Images (*.png *.jpg)"]
|
||||
onAccepted: {
|
||||
imageSource = fileDialog.file
|
||||
txtName.text = fileDialog.file.toString().replace(/^.*[\\\/]/,
|
||||
@ -164,6 +182,10 @@ Item {
|
||||
opacity: 1
|
||||
anchors.topMargin: 5
|
||||
}
|
||||
PropertyChanges {
|
||||
target: txtPlaceholder
|
||||
opacity: 0
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "nothingSelected"
|
||||
@ -186,6 +208,12 @@ Item {
|
||||
duration: 300
|
||||
easing.type: Easing.OutQuart
|
||||
}
|
||||
PropertyAnimation {
|
||||
target: txtPlaceholder
|
||||
property: "opacity"
|
||||
duration: 300
|
||||
easing.type: Easing.OutQuart
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ Item {
|
||||
|
||||
switch (state) {
|
||||
case CreateImportVideo.ConvertingPreviewImageFinished:
|
||||
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.png"
|
||||
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.jpg"
|
||||
imgPreview.visible = true
|
||||
txtConvert.text = qsTr("Converting Video preview mp4")
|
||||
break
|
||||
@ -44,15 +44,16 @@ Item {
|
||||
txtConvert.text = qsTr("Generating preview gif...")
|
||||
break
|
||||
case CreateImportVideo.ConvertingPreviewGifFinished:
|
||||
imgPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.gif"
|
||||
imgPreview.visible = true
|
||||
imgPreview.playing = true
|
||||
gifPreview.source = "file:///" + screenPlayCreate.workingDir + "/preview.gif"
|
||||
imgPreview.visible = false
|
||||
gifPreview.visible = true
|
||||
gifPreview.playing = true
|
||||
break
|
||||
case CreateImportVideo.ConvertingAudio:
|
||||
txtConvert.text = qsTr("Converting Audio...")
|
||||
break
|
||||
case CreateImportVideo.ConvertingVideo:
|
||||
txtConvert.text = qsTr("Converting Video...")
|
||||
txtConvert.text = qsTr("Converting Video... This can take some time!")
|
||||
break
|
||||
case CreateImportVideo.ConvertingVideoError:
|
||||
txtConvert.text = qsTr("Converting Video ERROR!")
|
||||
@ -110,9 +111,16 @@ Item {
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
AnimatedImage {
|
||||
Image {
|
||||
id: imgPreview
|
||||
asynchronous: true
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
AnimatedImage {
|
||||
id: gifPreview
|
||||
asynchronous: true
|
||||
playing: true
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
@ -150,7 +158,7 @@ Item {
|
||||
}
|
||||
ImageSelector {
|
||||
id: previewSelector
|
||||
|
||||
placeHolderText: qsTr("You can set your own preview image here!")
|
||||
anchors {
|
||||
top: imgWrapper.bottom
|
||||
topMargin: 20
|
||||
|
@ -96,7 +96,13 @@ void Create::saveWallpaper(QString title, QString description, QString filePath,
|
||||
obj.insert("description", description);
|
||||
obj.insert("title", title);
|
||||
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("previewWEBM", "preview.webm");
|
||||
if (previewImageFile.exists()) {
|
||||
|
@ -35,10 +35,10 @@ void CreateImportVideo::process()
|
||||
if (!createWallpaperVideoPreview())
|
||||
return;
|
||||
|
||||
if (!createWallpaperGifPreview())
|
||||
if (!createWallpaperImagePreview())
|
||||
return;
|
||||
|
||||
if (!createWallpaperImagePreview())
|
||||
if (!createWallpaperGifPreview())
|
||||
return;
|
||||
|
||||
if (!createWallpaperVideo())
|
||||
@ -352,7 +352,10 @@ bool CreateImportVideo::createWallpaperVideo()
|
||||
args.append("yuv420p");
|
||||
args.append("-b:v");
|
||||
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());
|
||||
proConvertVideo.data()->setArguments(args);
|
||||
@ -379,15 +382,14 @@ bool CreateImportVideo::createWallpaperVideo()
|
||||
}
|
||||
QString tmpErrImg = proConvertVideo.data()->readAllStandardError();
|
||||
if (!tmpErrImg.isEmpty()) {
|
||||
QFile video(m_exportPath + "/video.webm");
|
||||
QFile video(convertedFileAbsolutePath);
|
||||
if (!video.exists() && !(video.size() > 0)) {
|
||||
qDebug() << video.fileName() << proConvertVideo.data()->readAll();
|
||||
qDebug() << convertedFileAbsolutePath << proConvertVideo.data()->readAll();
|
||||
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoError);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//this->processOutput(proConvertImage.data()->readAll());
|
||||
proConvertVideo.data()->close();
|
||||
emit createWallpaperStateChanged(ImportVideoState::ConvertingVideoFinished);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user