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 {
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)
}
......
......@@ -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;
......
......@@ -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;
}
......@@ -35,6 +35,7 @@ public:
~ProjectManager();
bool isRunning();
QString sessionId() const;
public slots:
bool runProject(const QByteArray &project,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment