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 @@ ...@@ -31,6 +31,7 @@
#include <KFormat> #include <KFormat>
#include <KFileUtils> #include <KFileUtils>
#include <KJobWidgets/KJobWidgets> #include <KJobWidgets/KJobWidgets>
#include <KLocalizedString>
#include <QFile> #include <QFile>
#include <QJsonArray> #include <QJsonArray>
#include <QDir> #include <QDir>
...@@ -101,8 +102,18 @@ void Kamoso::setRecording(bool recording) ...@@ -101,8 +102,18 @@ void Kamoso::setRecording(bool recording)
} else { } else {
const QUrl path = fileNameSuggestion(Settings::saveVideos(), "video", "mkv"); 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(); 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_webcamControl->playDevice(DeviceManager::self()->playingDevice());
m_recordingTimer.stop(); m_recordingTimer.stop();
......
...@@ -62,6 +62,7 @@ Q_OBJECT ...@@ -62,6 +62,7 @@ Q_OBJECT
void recordingTimeChanged(); void recordingTimeChanged();
void sampleImageChanged(const QString &sampleImage); void sampleImageChanged(const QString &sampleImage);
void mirroredChanged(bool mirrored); void mirroredChanged(bool mirrored);
void error(const QString &error);
private: private:
QUrl fileNameSuggestion(const QUrl &saveUrl, const QString &name, const QString& extension) const; QUrl fileNameSuggestion(const QUrl &saveUrl, const QString &name, const QString& extension) const;
......
...@@ -50,6 +50,11 @@ Kirigami.ApplicationWindow ...@@ -50,6 +50,11 @@ Kirigami.ApplicationWindow
} }
Connections {
target: webcam
onError: showPassiveNotification(error)
}
Image { Image {
id: tada id: tada
z: 10 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