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

chore: get rid of sitringified function invokations

parent 84f10312
No related branches found
No related tags found
1 merge request!80chore: get rid of sitringified function invokations
Pipeline #79854 passed
...@@ -67,10 +67,10 @@ Backend::Backend(QObject *parent) ...@@ -67,10 +67,10 @@ Backend::Backend(QObject *parent)
if (m_projectManager && !m_lastSessionId.isEmpty() if (m_projectManager && !m_lastSessionId.isEmpty()
&& m_lastSessionId == m_projectManager->sessionId()) { && m_lastSessionId == m_projectManager->sessionId()) {
QMetaObject::invokeMethod(m_dsManager.get(), QMetaObject::invokeMethod(m_dsManager.get(),
"sendProjectLogs", &DesignStudioManager::sendProjectLogs,
Qt::QueuedConnection, Qt::QueuedConnection,
Q_ARG(QString, m_lastProjectSenderId), m_lastProjectSenderId,
Q_ARG(QString, msg)); msg);
} }
}); });
...@@ -81,7 +81,8 @@ Backend::Backend(QObject *parent) ...@@ -81,7 +81,8 @@ Backend::Backend(QObject *parent)
qDebug() << "Application state changed to" << state; qDebug() << "Application state changed to" << state;
if (state == Qt::ApplicationState::ApplicationSuspended) { if (state == Qt::ApplicationState::ApplicationSuspended) {
if (m_projectManager && !m_projectManager->sessionId().isEmpty()) if (m_projectManager && !m_projectManager->sessionId().isEmpty())
QMetaObject::invokeMethod(m_projectManager.get(), "stopProject"); QMetaObject::invokeMethod(m_projectManager.get(),
&ProjectManager::stopProject);
m_dsManager->disconnectAllDesignStudios(); m_dsManager->disconnectAllDesignStudios();
popupClose(); popupClose();
} }
...@@ -164,9 +165,9 @@ void Backend::initProjectManager() ...@@ -164,9 +165,9 @@ void Backend::initProjectManager()
return; return;
QMetaObject::invokeMethod(m_dsManager.get(), QMetaObject::invokeMethod(m_dsManager.get(),
"sendProjectStopped", &DesignStudioManager::sendProjectStopped,
Qt::QueuedConnection, Qt::QueuedConnection,
Q_ARG(QString, m_lastProjectSenderId)); m_lastProjectSenderId);
}); });
} }
...@@ -186,7 +187,7 @@ void Backend::initDsManager() ...@@ -186,7 +187,7 @@ void Backend::initDsManager()
this, this,
[this](const QString &id, const QString &ipAddr) { [this](const QString &id, const QString &ipAddr) {
if (id == m_lastProjectSenderId) { if (id == m_lastProjectSenderId) {
QMetaObject::invokeMethod(m_projectManager.get(), "stopProject"); QMetaObject::invokeMethod(m_projectManager.get(), &ProjectManager::stopProject);
} }
emit popupClose(); emit popupClose();
}); });
...@@ -206,7 +207,7 @@ void Backend::initDsManager() ...@@ -206,7 +207,7 @@ void Backend::initDsManager()
m_lastProjectSenderId = id; m_lastProjectSenderId = id;
m_lastSessionId = QUuid::createUuid().toString(QUuid::WithoutBraces); m_lastSessionId = QUuid::createUuid().toString(QUuid::WithoutBraces);
QMetaObject::invokeMethod(m_projectManager.get(), QMetaObject::invokeMethod(m_projectManager.get(),
"stopProject", &ProjectManager::stopProject,
Qt::QueuedConnection); Qt::QueuedConnection);
}); });
...@@ -223,27 +224,18 @@ void Backend::initDsManager() ...@@ -223,27 +224,18 @@ void Backend::initDsManager()
qDebug() << "Project stop requested"; qDebug() << "Project stop requested";
emit popupClose(); emit popupClose();
QMetaObject::invokeMethod(m_projectManager.get(), QMetaObject::invokeMethod(m_projectManager.get(),
"stopProject", &ProjectManager::stopProject,
Qt::QueuedConnection); Qt::QueuedConnection);
QMetaObject::invokeMethod(m_dsManager.get(), QMetaObject::invokeMethod(m_dsManager.get(),
"sendProjectStopped", &DesignStudioManager::sendProjectStopped,
Qt::QueuedConnection, Qt::QueuedConnection,
Q_ARG(QString, m_lastProjectSenderId)); m_lastProjectSenderId);
}); });
m_dsManager->init(); m_dsManager->init();
qDebug() << "Design Studio Manager initialized"; qDebug() << "Design Studio Manager initialized";
} }
void Backend::connectDesignStudio(const QString &ipAddr)
{
QMetaObject::invokeMethod(m_dsManager.get(),
"initDesignStudio",
Q_ARG(QString, ipAddr),
Q_ARG(QString, ""));
emit updatePopupText("Connecting in the background...", 1500);
}
void Backend::runProject(const QString &id, const QByteArray &projectData) void Backend::runProject(const QString &id, const QByteArray &projectData)
{ {
emit updatePopupText("Running project..."); emit updatePopupText("Running project...");
...@@ -251,17 +243,21 @@ void Backend::runProject(const QString &id, const QByteArray &projectData) ...@@ -251,17 +243,21 @@ void Backend::runProject(const QString &id, const QByteArray &projectData)
QTimer::singleShot(1000, [this, id, projectData] { QTimer::singleShot(1000, [this, id, projectData] {
bool retVal; bool retVal;
QMetaObject::invokeMethod(m_projectManager.get(), QMetaObject::invokeMethod(m_projectManager.get(),
"runProject", &ProjectManager::runProject,
Q_RETURN_ARG(bool, retVal), Q_RETURN_ARG(bool, retVal),
Q_ARG(QByteArray, projectData), projectData,
Q_ARG(bool, autoScaleProject()), autoScaleProject(),
Q_ARG(QString, m_lastSessionId)); m_lastSessionId);
if (!retVal) if (!retVal)
QMetaObject::invokeMethod(m_dsManager.get(), "sendProjectStopped", Q_ARG(QString, id)); QMetaObject::invokeMethod(m_dsManager.get(),
&DesignStudioManager::sendProjectStopped,
id);
else { else {
QMetaObject::invokeMethod(m_projectManager.get(), "showAppWindow"); QMetaObject::invokeMethod(m_projectManager.get(), &ProjectManager::showAppWindow);
QMetaObject::invokeMethod(m_dsManager.get(), "sendProjectStarted", Q_ARG(QString, id)); QMetaObject::invokeMethod(m_dsManager.get(),
&DesignStudioManager::sendProjectStarted,
id);
} }
emit popupClose(); emit popupClose();
...@@ -295,7 +291,7 @@ void Backend::parseDesignViewerUrl(const QUrl &url) ...@@ -295,7 +291,7 @@ void Backend::parseDesignViewerUrl(const QUrl &url)
return; return;
} }
connectDesignStudio(url.host()); // connectDesignStudio(url.host());
} }
void Backend::popupInterrupted() void Backend::popupInterrupted()
......
...@@ -83,7 +83,6 @@ signals: ...@@ -83,7 +83,6 @@ signals:
public slots: public slots:
QString buildInfo() const; QString buildInfo() const;
void scanQrCode(); void scanQrCode();
void connectDesignStudio(const QString &ipAddr);
void parseDesignViewerUrl(const QUrl &url); void parseDesignViewerUrl(const QUrl &url);
void popupInterrupted(); void popupInterrupted();
QJsonArray getIpAddresses() const; QJsonArray getIpAddresses() const;
......
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