Skip to content
Snippets Groups Projects
Commit 8c6f7d97 authored by Burak Hançerli's avatar Burak Hançerli :headphones:
Browse files

Fix log forwarding

parent 2e51af59
No related branches found
No related tags found
1 merge request!66Fix log forwarding
Pipeline #78442 passed
...@@ -29,7 +29,7 @@ Flickable { ...@@ -29,7 +29,7 @@ Flickable {
Layout.fillWidth: true Layout.fillWidth: true
horizontalPadding: 20 horizontalPadding: 20
text: qsTr("Auto-scale") 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 checked: backend.autoScaleProject() ? Qt.Checked : Qt.Unchecked
onToggled: backend.setAutoScaleProject(checked) onToggled: backend.setAutoScaleProject(checked)
} }
......
...@@ -64,7 +64,7 @@ Backend::Backend(QObject *parent) ...@@ -64,7 +64,7 @@ Backend::Backend(QObject *parent)
connect(&Logger::instance(), &Logger::logMessage, this, [this](QtMsgType type, QString &msg) { connect(&Logger::instance(), &Logger::logMessage, this, [this](QtMsgType type, QString &msg) {
// if we have any active project running, then reroute // if we have any active project running, then reroute
// all the logs to the dsmanager with the last project sender id // 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(), QMetaObject::invokeMethod(m_dsManager.get(),
"sendProjectLogs", "sendProjectLogs",
Qt::QueuedConnection, Qt::QueuedConnection,
...@@ -142,8 +142,9 @@ void Backend::initProjectManager() ...@@ -142,8 +142,9 @@ void Backend::initProjectManager()
&ProjectManager::closingProject, &ProjectManager::closingProject,
this, this,
[this](const QString &sessionId) { [this](const QString &sessionId) {
// most likely the project was running from the leftover session // if seesion ids are same, it's most likely the project was running
// (DS connected, project started, DS disconnected without stopping the project) // 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 // so we'll stop the project and do not send any signals to the DS
if (sessionId != m_lastSessionId) if (sessionId != m_lastSessionId)
return; return;
......
...@@ -229,7 +229,7 @@ bool ProjectManager::runProject(const QByteArray &project, ...@@ -229,7 +229,7 @@ bool ProjectManager::runProject(const QByteArray &project,
const QStringList importPaths = getImportPaths(projectPath, qmlProjectFileContent); const QStringList importPaths = getImportPaths(projectPath, qmlProjectFileContent);
if (!isQt6Project(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."; "officially supported.";
} }
...@@ -362,9 +362,8 @@ void ProjectManager::showAppWindow() ...@@ -362,9 +362,8 @@ void ProjectManager::showAppWindow()
connect(m_quickWindow.data(), &QQuickWindow::closing, this, [this, screen]() { connect(m_quickWindow.data(), &QQuickWindow::closing, this, [this, screen]() {
qDebug() << "QML app window is closing"; qDebug() << "QML app window is closing";
disconnect(screen, &QScreen::orientationChanged, this, &ProjectManager::orientateWindow); 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); emit closingProject(m_sessionId);
m_sessionId.clear();
}); });
m_quickWindow->setFlags(Qt::Window | Qt::WindowStaysOnTopHint); m_quickWindow->setFlags(Qt::Window | Qt::WindowStaysOnTopHint);
...@@ -376,12 +375,16 @@ void ProjectManager::stopProject() ...@@ -376,12 +375,16 @@ void ProjectManager::stopProject()
if (!m_quickWindow || !m_quickWindow->isVisible()) if (!m_quickWindow || !m_quickWindow->isVisible())
return; return;
m_sessionId.clear();
qDebug("Stopping the QML app window"); qDebug("Stopping the QML app window");
m_quickWindow->close(); m_quickWindow->close();
} }
bool ProjectManager::isRunning() bool ProjectManager::isRunning()
{ {
return m_quickWindow && m_quickWindow->isVisible(); return !m_sessionId.isEmpty();
}
QString ProjectManager::sessionId() const
{
return m_sessionId;
} }
...@@ -35,6 +35,7 @@ public: ...@@ -35,6 +35,7 @@ public:
~ProjectManager(); ~ProjectManager();
bool isRunning(); bool isRunning();
QString sessionId() const;
public slots: public slots:
bool runProject(const QByteArray &project, bool runProject(const QByteArray &project,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment