mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-18 16:32:33 +02:00
Add basic error check
This commit is contained in:
parent
989dc77046
commit
51ab2b6006
@ -18,6 +18,17 @@ Item {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: screenPlayCreate
|
||||
onCreateWallpaperStateChanged: {
|
||||
print(state)
|
||||
if (state === Create.State.ConvertingPreviewGifError ||
|
||||
state === Create.State.ConvertingPreviewVideoError) {
|
||||
createNew.state = "error"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 1000
|
||||
triggeredOnStart: false
|
||||
@ -63,6 +74,10 @@ Item {
|
||||
radius: 4
|
||||
height: 560
|
||||
|
||||
Item {
|
||||
id: wrapperSteps
|
||||
anchors.fill: parent
|
||||
|
||||
Text {
|
||||
id: txtHeadline
|
||||
text: qsTr("Convert a video to a wallpaper")
|
||||
@ -167,6 +182,10 @@ Item {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
|
||||
if (!page_0.canNext || !page_0.gifCreated)
|
||||
return
|
||||
|
||||
view.setCurrentIndex(index)
|
||||
}
|
||||
|
||||
@ -249,6 +268,7 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
@ -274,6 +294,22 @@ Item {
|
||||
target: effect
|
||||
opacity: .4
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "error"
|
||||
PropertyChanges {
|
||||
target: wrapper
|
||||
anchors.topMargin: 40
|
||||
opacity: 1
|
||||
}
|
||||
PropertyChanges {
|
||||
target: effect
|
||||
opacity: .4
|
||||
}
|
||||
PropertyChanges {
|
||||
target: wrapperSteps
|
||||
opacity: 0
|
||||
}
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
@ -345,6 +381,16 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "in"
|
||||
to: "error"
|
||||
PropertyAnimation {
|
||||
target: wrapperSteps
|
||||
duration: 600
|
||||
property: "opacity"
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ void Create::createWallpaperStart(QString videoPath)
|
||||
videoPath.remove("file:///");
|
||||
|
||||
QtConcurrent::run([=]() {
|
||||
|
||||
QDir dir;
|
||||
dir.cd(this->m_settings->localStoragePath().toString());
|
||||
|
||||
@ -189,15 +188,20 @@ bool Create::createWallpaperVideoPreview(CreateWallpaperData& createWallpaperDat
|
||||
|
||||
QScopedPointer<QTimer> processOutputTimer(new QTimer());
|
||||
|
||||
connect(processOutputTimer.data(), &QTimer::timeout, [&]() {
|
||||
qDebug() << "### " << proConvertPreviewMP4.data()->readAll();
|
||||
this->processOutput(proConvertPreviewMP4.data()->readAll());
|
||||
});
|
||||
// connect(processOutputTimer.data(), &QTimer::timeout, [&]() {
|
||||
// qDebug() << "### " << proConvertPreviewMP4.data()->readAll();
|
||||
// this->processOutput(proConvertPreviewMP4.data()->readAll());
|
||||
// });
|
||||
processOutputTimer.data()->start(100);
|
||||
proConvertPreviewMP4.data()->waitForFinished(-1);
|
||||
if (!proConvertPreviewMP4.data()->readAllStandardError().isEmpty()) {
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideoError);
|
||||
return false;
|
||||
}
|
||||
// qDebug() << proConvertPreviewMP4.data()->program() << proConvertPreviewMP4.data()->arguments();
|
||||
// qDebug() << "Done converting video to preview" << proConvertPreviewMP4.data()->readAll() << "\n"
|
||||
// << proConvertPreviewMP4.data()->readAllStandardError();
|
||||
this->processOutput(proConvertPreviewMP4.data()->readAll());
|
||||
proConvertPreviewMP4.data()->close();
|
||||
processOutputTimer.data()->stop();
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewVideoFinished);
|
||||
@ -226,9 +230,15 @@ bool Create::createWallpaperVideoPreview(CreateWallpaperData& createWallpaperDat
|
||||
#endif
|
||||
proConvertGif.data()->start();
|
||||
proConvertGif.data()->waitForFinished(-1);
|
||||
if (!proConvertGif.data()->readAllStandardError().isEmpty()) {
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewGifError);
|
||||
return false;
|
||||
}
|
||||
|
||||
// qDebug() << proConvertGif.data()->program() << proConvertGif.data()->arguments();
|
||||
// qDebug() << "Done converting video to preview" << proConvertGif.data()->readAll() << "\n"
|
||||
// << proConvertGif.data()->readAllStandardError();
|
||||
this->processOutput(proConvertPreviewMP4.data()->readAll());
|
||||
proConvertGif.data()->close();
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingPreviewGifFinished);
|
||||
|
||||
|
@ -45,17 +45,14 @@ public:
|
||||
Started,
|
||||
ConvertingPreviewImage,
|
||||
ConvertingPreviewImageFinished,
|
||||
ConvertingPreviewImageError,
|
||||
ConvertingPreviewVideo,
|
||||
ConvertingPreviewVideoFinished,
|
||||
ConvertingPreviewVideoError,
|
||||
ConvertingPreviewGif,
|
||||
ConvertingPreviewGifFinished,
|
||||
ConvertingPreviewGifError,
|
||||
Finished,
|
||||
ErrorFolder,
|
||||
ErrorFolderCreation,
|
||||
ErrorDiskSpace,
|
||||
ErrorCopyVideo,
|
||||
ErrorCopyImage,
|
||||
ErrorCopyConfig,
|
||||
ErrorUnknown,
|
||||
};
|
||||
Q_ENUM(State)
|
||||
@ -69,8 +66,6 @@ public:
|
||||
signals:
|
||||
void createWallpaperStateChanged(Create::State state);
|
||||
void processOutput(QString text);
|
||||
|
||||
|
||||
void workingDirChanged(QString workingDir);
|
||||
|
||||
public slots:
|
||||
|
Loading…
Reference in New Issue
Block a user