Commit a4f712a5 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Notify when a video could not be moved

CCBUG: 423216
parent 97036769
......@@ -31,6 +31,7 @@
#include <KFormat>
#include <KFileUtils>
#include <KJobWidgets/KJobWidgets>
#include <KLocalizedString>
#include <QFile>
#include <QJsonArray>
#include <QDir>
......@@ -101,8 +102,18 @@ void Kamoso::setRecording(bool recording)
} else {
const QUrl path = fileNameSuggestion(Settings::saveVideos(), "video", "mkv");
KJob *job = KIO::move(QUrl::fromLocalFile(m_webcamControl->stopRecording()), path);
const auto temp = m_webcamControl->stopRecording();
KJob *job = KIO::move(QUrl::fromLocalFile(temp), path);
job->start();
connect(job, &KJob::finished, this, [this, temp, path, job] {
if (job->error() == 0) {
qDebug() << "video saved successfully";
return;
}
qWarning() << "Could not move" << temp << "to" << path;
Q_EMIT error(job->errorString());
});
m_webcamControl->playDevice(DeviceManager::self()->playingDevice());
m_recordingTimer.stop();
......
......@@ -62,6 +62,7 @@ Q_OBJECT
void recordingTimeChanged();
void sampleImageChanged(const QString &sampleImage);
void mirroredChanged(bool mirrored);
void error(const QString &error);
private:
QUrl fileNameSuggestion(const QUrl &saveUrl, const QString &name, const QString& extension) const;
......
......@@ -50,6 +50,11 @@ Kirigami.ApplicationWindow
}
Connections {
target: webcam
onError: showPassiveNotification(error)
}
Image {
id: tada
z: 10
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment