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

QDS-11882 Add clear feedback when receiving a new project from the Design Studio

parent 426e9ac5
No related branches found
No related tags found
1 merge request!34QDS-11882 Add clear feedback when receiving a new project from the Design Studio
Pipeline #67004 passed
...@@ -288,9 +288,6 @@ void Backend::openCamera() ...@@ -288,9 +288,6 @@ void Backend::openCamera()
void Backend::initializeProjectManager() void Backend::initializeProjectManager()
{ {
if (m_projectManager)
return;
m_projectManager.reset(new ProjectManager(autoScaleProject())); m_projectManager.reset(new ProjectManager(autoScaleProject()));
connect(m_projectManager.data(), &ProjectManager::closingProject, this, [&] { connect(m_projectManager.data(), &ProjectManager::closingProject, this, [&] {
emit popupClose(); emit popupClose();
...@@ -307,6 +304,13 @@ void Backend::initDesignStudioConnector() ...@@ -307,6 +304,13 @@ void Backend::initDesignStudioConnector()
this, this,
&Backend::networkUpdated); &Backend::networkUpdated);
connect(m_designStudioConnector.data(), &DesignStudioConnector::projectIncoming, this, [&] {
qDebug() << "Project incoming from Design Studio";
m_projectManager.reset();
emit popupOpen();
updatePopup("Receiving project...");
});
connect(m_designStudioConnector.data(), connect(m_designStudioConnector.data(),
&DesignStudioConnector::projectReceived, &DesignStudioConnector::projectReceived,
this, this,
...@@ -336,6 +340,7 @@ void Backend::initDesignStudioConnector() ...@@ -336,6 +340,7 @@ void Backend::initDesignStudioConnector()
} }
emit popupClose(); emit popupClose();
m_designStudioConnector->sendProjectReceived();
}); });
qDebug() << "Design Studio Connector is initialized"; qDebug() << "Design Studio Connector is initialized";
......
...@@ -42,6 +42,7 @@ void DesignStudioConnector::receiveProject() ...@@ -42,6 +42,7 @@ void DesignStudioConnector::receiveProject()
m_projectData.clear(); m_projectData.clear();
m_projectData.append(data); m_projectData.append(data);
m_receivingData = true; m_receivingData = true;
emit projectIncoming();
} else if (m_receivingData) { } else if (m_receivingData) {
if (data.contains("::qmlrc-end::")) { if (data.contains("::qmlrc-end::")) {
qDebug() << "TCP:: Received project end delimeter"; qDebug() << "TCP:: Received project end delimeter";
...@@ -111,3 +112,14 @@ void DesignStudioConnector::updateIpv4Addr() ...@@ -111,3 +112,14 @@ void DesignStudioConnector::updateIpv4Addr()
emit networkStatusUpdated("\nLocal IP: " + m_ipv4Addr emit networkStatusUpdated("\nLocal IP: " + m_ipv4Addr
+ "\nWaiting for Design Studio to connect..."); + "\nWaiting for Design Studio to connect...");
} }
void DesignStudioConnector::sendProjectReceived()
{
if (!m_tcpSocket) {
qDebug() << "TCP:: Socket is not connected";
return;
}
m_tcpSocket->write("::qmlrc-received::");
m_tcpSocket->flush();
}
...@@ -38,6 +38,8 @@ class DesignStudioConnector : public QObject ...@@ -38,6 +38,8 @@ class DesignStudioConnector : public QObject
public: public:
explicit DesignStudioConnector(QObject *parent = nullptr); explicit DesignStudioConnector(QObject *parent = nullptr);
void sendProjectReceived();
private: private:
// Tcp connection members // Tcp connection members
QTcpServer m_tcpServer; QTcpServer m_tcpServer;
...@@ -60,6 +62,7 @@ private: ...@@ -60,6 +62,7 @@ private:
signals: signals:
void networkStatusUpdated(QString); void networkStatusUpdated(QString);
void projectReceived(QByteArray); void projectReceived(QByteArray);
void projectIncoming();
}; };
#endif // DSCONNECTOR_H #endif // DSCONNECTOR_H
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