##// END OF EJS Templates
Merge branch 'feature/DownloadProgressRefactoring' into develop
perrinel -
r427:7dfa9848e171 merge
parent child
Show More
@@ -47,6 +47,12 signals:
47 void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie,
47 void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie,
48 const SqpDateTime &dateTime);
48 const SqpDateTime &dateTime);
49
49
50 /**
51 * @brief dataProvided send dataSeries under dateTime and that corresponds of the data
52 * identified by identifier
53 */
54 void dataProvidedProgress(QUuid identifier, double progress);
55
50
56
51 /**
57 /**
52 * @brief requestConstructed send a request for the data identified by identifier
58 * @brief requestConstructed send a request for the data identified by identifier
@@ -32,9 +32,9 NetworkController::NetworkController(QObject *parent)
32 void NetworkController::onProcessRequested(const QNetworkRequest &request, QUuid identifier,
32 void NetworkController::onProcessRequested(const QNetworkRequest &request, QUuid identifier,
33 std::function<void(QNetworkReply *, QUuid)> callback)
33 std::function<void(QNetworkReply *, QUuid)> callback)
34 {
34 {
35 auto reply = impl->m_AccessManager->get(request);
36 qCDebug(LOG_NetworkController()) << tr("NetworkController registered")
35 qCDebug(LOG_NetworkController()) << tr("NetworkController registered")
37 << QThread::currentThread() << reply;
36 << QThread::currentThread()->objectName();
37 auto reply = impl->m_AccessManager->get(request);
38
38
39 // Store the couple reply id
39 // Store the couple reply id
40 impl->lockWrite();
40 impl->lockWrite();
@@ -81,6 +81,8 void NetworkController::onProcessRequested(const QNetworkRequest &request, QUuid
81
81
82 connect(reply, &QNetworkReply::finished, this, onReplyFinished);
82 connect(reply, &QNetworkReply::finished, this, onReplyFinished);
83 connect(reply, &QNetworkReply::downloadProgress, this, onReplyProgress);
83 connect(reply, &QNetworkReply::downloadProgress, this, onReplyProgress);
84 qCDebug(LOG_NetworkController()) << tr("NetworkController registered END")
85 << QThread::currentThread()->objectName() << reply;
84 }
86 }
85
87
86 void NetworkController::initialize()
88 void NetworkController::initialize()
@@ -88,6 +90,17 void NetworkController::initialize()
88 qCDebug(LOG_NetworkController()) << tr("NetworkController init") << QThread::currentThread();
90 qCDebug(LOG_NetworkController()) << tr("NetworkController init") << QThread::currentThread();
89 impl->m_WorkingMutex.lock();
91 impl->m_WorkingMutex.lock();
90 impl->m_AccessManager = std::make_unique<QNetworkAccessManager>();
92 impl->m_AccessManager = std::make_unique<QNetworkAccessManager>();
93
94
95 auto onReplyErrors = [this](QNetworkReply *reply, const QList<QSslError> &errors) {
96
97 qCCritical(LOG_NetworkController()) << tr("NetworkAcessManager errors: ") << errors;
98
99 };
100
101
102 connect(impl->m_AccessManager.get(), &QNetworkAccessManager::sslErrors, this, onReplyErrors);
103
91 qCDebug(LOG_NetworkController()) << tr("NetworkController init END");
104 qCDebug(LOG_NetworkController()) << tr("NetworkController init END");
92 }
105 }
93
106
@@ -144,6 +144,8 void VariableController::createVariable(const QString &name, const QVariantHash
144 };
144 };
145
145
146 connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired);
146 connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired);
147 connect(provider.get(), &IDataProvider::dataProvidedProgress, this,
148 &VariableController::onVariableRetrieveDataInProgress);
147 this->onRequestDataLoading(newVariable, dateTime);
149 this->onRequestDataLoading(newVariable, dateTime);
148 }
150 }
149 }
151 }
@@ -106,11 +106,6 SqpApplication::SqpApplication(int &argc, char **argv)
106 impl->m_NetworkControllerThread.start();
106 impl->m_NetworkControllerThread.start();
107 impl->m_VariableControllerThread.start();
107 impl->m_VariableControllerThread.start();
108 impl->m_VisualizationControllerThread.start();
108 impl->m_VisualizationControllerThread.start();
109
110 // Core connections:
111 // NetworkController <-> VariableController
112 connect(&sqpApp->networkController(), &NetworkController::replyDownloadProgress,
113 &sqpApp->variableController(), &VariableController::onVariableRetrieveDataInProgress);
114 }
109 }
115
110
116 SqpApplication::~SqpApplication()
111 SqpApplication::~SqpApplication()
@@ -48,6 +48,10 AmdaProvider::AmdaProvider()
48 &networkController,
48 &networkController,
49 SLOT(onProcessRequested(QNetworkRequest, QUuid,
49 SLOT(onProcessRequested(QNetworkRequest, QUuid,
50 std::function<void(QNetworkReply *, QUuid)>)));
50 std::function<void(QNetworkReply *, QUuid)>)));
51
52
53 connect(&sqpApp->networkController(), SIGNAL(replyDownloadProgress(QUuid, double)), this,
54 SIGNAL(dataProvidedProgress(QUuid, double)));
51 }
55 }
52 }
56 }
53
57
General Comments 0
You need to be logged in to leave comments. Login now