diff --git a/src/backend/backend.cpp b/src/backend/backend.cpp index cd9ccce1dba0ab0f4bf64355503be41a7161330d..7a33911284ba05d5511449d31d210b615f4a3a74 100644 --- a/src/backend/backend.cpp +++ b/src/backend/backend.cpp @@ -197,11 +197,20 @@ void Backend::runProject(const QString &id, const QByteArray &projectData) Qt::QueuedConnection, Q_ARG(QString, id)); + bool retVal; QMetaObject::invokeMethod(m_projectManager.get(), "runProject", Qt::QueuedConnection, Q_ARG(QByteArray, projectData), - Q_ARG(bool, autoScaleProject())); + Q_ARG(bool, autoScaleProject()), + Q_RETURN_ARG(bool, retVal)); + + if (!retVal) { + QMetaObject::invokeMethod(m_dsManager.get(), + "sendProjectStopped", + Qt::QueuedConnection, + Q_ARG(QString, id)); + } emit popupClose(); } diff --git a/src/backend/settings.cpp b/src/backend/settings.cpp index 0ff2f5b3a7f6b7ad97019c306cb3f6d4d81ab2d3..b192fc7508e94c00a328945463ce5a823d5469fe 100644 --- a/src/backend/settings.cpp +++ b/src/backend/settings.cpp @@ -3,6 +3,7 @@ #include "settings.h" +#include <QDir> #include <QFile> #include <QJsonDocument> #include <QStandardPaths> @@ -20,6 +21,13 @@ Settings::Settings() QStandardPaths::writableLocation(QStandardPaths::ConfigLocation).append("/settings.json")) { qDebug() << "Settings path:" << m_settingsPath; + const QDir dir(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)); + + if (!dir.exists()) { + qWarning() << "Settings directory does not exist. Creating one."; + dir.mkpath(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)); + } + if (!loadSettings()) { qDebug() << "Failed to load settings. Applying default ones."; applyDefaultSettings();