diff --git a/src/ui/mark.cpp b/src/ui/mark.cpp index a22fc7f3743cda8c16afdddface631043ce3b7ac..366638a1851a9d1ba8976bf0c712341f5d9c0cfb 100644 --- a/src/ui/mark.cpp +++ b/src/ui/mark.cpp @@ -35,8 +35,10 @@ #include #include #include +#include #include +#include static QDir markTempDirectory() { @@ -457,7 +459,23 @@ void marK::autoSave() if (m_autoSaveType == Serializer::OutputType::None) return; - Serializer::write(m_filepath, m_ui->containerWidget->savedObjects(), m_autoSaveType); + auto *watcher = new QFutureWatcher(); + connect(watcher, &QFutureWatcher::finished, this, [watcher]() { + bool success = watcher->result(); + delete watcher; + + if (!success) { + QMessageBox msgBox; + msgBox.setText("Failed to auto-save annotation."); + msgBox.setIcon(QMessageBox::Warning); + msgBox.exec(); + } + }); + + QFuture future = QtConcurrent::run( + Serializer::write, m_filepath, m_ui->containerWidget->savedObjects(), m_autoSaveType + ); + watcher->setFuture(future); } marK::~marK()