diff --git a/src/SettingsPage.qml b/src/SettingsPage.qml index 865b2973ebeb803e5da52478bfbab2016e0b7b7c..5547b696fb5cbdbd21d9fae695ce69786a6a645c 100644 --- a/src/SettingsPage.qml +++ b/src/SettingsPage.qml @@ -29,7 +29,7 @@ Flickable { Layout.fillWidth: true horizontalPadding: 20 text: qsTr("Auto-scale") - subText: qsTr("Scales the project to fit to current display and orientation") + subText: qsTr("Tries to scale the project to fit to current display and orientation. May not work with all projects.") checked: backend.autoScaleProject() ? Qt.Checked : Qt.Unchecked onToggled: backend.setAutoScaleProject(checked) } diff --git a/src/backend/backend.cpp b/src/backend/backend.cpp index 8a5e82c63783715e0b52bd121725da4fc32dacc1..ccf97823c0497081683f577e7b767e26ada0311f 100644 --- a/src/backend/backend.cpp +++ b/src/backend/backend.cpp @@ -64,7 +64,7 @@ Backend::Backend(QObject *parent) connect(&Logger::instance(), &Logger::logMessage, this, [this](QtMsgType type, QString &msg) { // if we have any active project running, then reroute // all the logs to the dsmanager with the last project sender id - if (m_projectManager && m_projectManager->isRunning()) { + if (m_projectManager && m_lastSessionId == m_projectManager->sessionId()) { QMetaObject::invokeMethod(m_dsManager.get(), "sendProjectLogs", Qt::QueuedConnection, @@ -142,8 +142,9 @@ void Backend::initProjectManager() &ProjectManager::closingProject, this, [this](const QString &sessionId) { - // most likely the project was running from the leftover session - // (DS connected, project started, DS disconnected without stopping the project) + // if seesion ids are same, it's most likely the project was running + // from the leftover session (DS connected, project started, + // DS disconnected without stopping the project) // so we'll stop the project and do not send any signals to the DS if (sessionId != m_lastSessionId) return; diff --git a/src/backend/projectmanager.cpp b/src/backend/projectmanager.cpp index 13fed112a687ef42958d97100043417e033db3b7..e1c01e798e650056c0613fabeee45997b52bb524 100644 --- a/src/backend/projectmanager.cpp +++ b/src/backend/projectmanager.cpp @@ -229,7 +229,7 @@ bool ProjectManager::runProject(const QByteArray &project, const QStringList importPaths = getImportPaths(projectPath, qmlProjectFileContent); if (!isQt6Project(qmlProjectFileContent)) { - qWarning() << "This is not a Qt6 project.\nQt5 projects might work, but they are not " + qWarning() << "This is not a Qt6 project. Qt5 projects might work, but they are not " "officially supported."; } @@ -362,9 +362,8 @@ void ProjectManager::showAppWindow() connect(m_quickWindow.data(), &QQuickWindow::closing, this, [this, screen]() { qDebug() << "QML app window is closing"; disconnect(screen, &QScreen::orientationChanged, this, &ProjectManager::orientateWindow); - // this signal is connected to the lambda in the backend - // which will reset the project manager emit closingProject(m_sessionId); + m_sessionId.clear(); }); m_quickWindow->setFlags(Qt::Window | Qt::WindowStaysOnTopHint); @@ -376,12 +375,16 @@ void ProjectManager::stopProject() if (!m_quickWindow || !m_quickWindow->isVisible()) return; - m_sessionId.clear(); qDebug("Stopping the QML app window"); m_quickWindow->close(); } bool ProjectManager::isRunning() { - return m_quickWindow && m_quickWindow->isVisible(); + return !m_sessionId.isEmpty(); +} + +QString ProjectManager::sessionId() const +{ + return m_sessionId; } diff --git a/src/backend/projectmanager.h b/src/backend/projectmanager.h index ef92360900b2e515b83610d3ed2cb952bfe5ed02..f434bbb58afc13fb2f59d7d3478d06b819d750a4 100644 --- a/src/backend/projectmanager.h +++ b/src/backend/projectmanager.h @@ -35,6 +35,7 @@ public: ~ProjectManager(); bool isRunning(); + QString sessionId() const; public slots: bool runProject(const QByteArray &project,