From 7dfa9848e17197c21c8300c350757879d73aa92f 2017-07-18 15:07:21 From: mperrinel Date: 2017-07-18 15:07:21 Subject: [PATCH] Merge branch 'feature/DownloadProgressRefactoring' into develop --- diff --git a/core/include/Data/IDataProvider.h b/core/include/Data/IDataProvider.h index b5cfce0..3f8296e 100644 --- a/core/include/Data/IDataProvider.h +++ b/core/include/Data/IDataProvider.h @@ -47,6 +47,12 @@ signals: void dataProvided(QUuid identifier, std::shared_ptr dateSerie, const SqpDateTime &dateTime); + /** + * @brief dataProvided send dataSeries under dateTime and that corresponds of the data + * identified by identifier + */ + void dataProvidedProgress(QUuid identifier, double progress); + /** * @brief requestConstructed send a request for the data identified by identifier diff --git a/core/src/Network/NetworkController.cpp b/core/src/Network/NetworkController.cpp index 64f3d82..ddf4654 100644 --- a/core/src/Network/NetworkController.cpp +++ b/core/src/Network/NetworkController.cpp @@ -32,9 +32,9 @@ NetworkController::NetworkController(QObject *parent) void NetworkController::onProcessRequested(const QNetworkRequest &request, QUuid identifier, std::function callback) { - auto reply = impl->m_AccessManager->get(request); qCDebug(LOG_NetworkController()) << tr("NetworkController registered") - << QThread::currentThread() << reply; + << QThread::currentThread()->objectName(); + auto reply = impl->m_AccessManager->get(request); // Store the couple reply id impl->lockWrite(); @@ -81,6 +81,8 @@ void NetworkController::onProcessRequested(const QNetworkRequest &request, QUuid connect(reply, &QNetworkReply::finished, this, onReplyFinished); connect(reply, &QNetworkReply::downloadProgress, this, onReplyProgress); + qCDebug(LOG_NetworkController()) << tr("NetworkController registered END") + << QThread::currentThread()->objectName() << reply; } void NetworkController::initialize() @@ -88,6 +90,17 @@ void NetworkController::initialize() qCDebug(LOG_NetworkController()) << tr("NetworkController init") << QThread::currentThread(); impl->m_WorkingMutex.lock(); impl->m_AccessManager = std::make_unique(); + + + auto onReplyErrors = [this](QNetworkReply *reply, const QList &errors) { + + qCCritical(LOG_NetworkController()) << tr("NetworkAcessManager errors: ") << errors; + + }; + + + connect(impl->m_AccessManager.get(), &QNetworkAccessManager::sslErrors, this, onReplyErrors); + qCDebug(LOG_NetworkController()) << tr("NetworkController init END"); } diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index 0f96d50..3dca80d 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -144,6 +144,8 @@ void VariableController::createVariable(const QString &name, const QVariantHash }; connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); + connect(provider.get(), &IDataProvider::dataProvidedProgress, this, + &VariableController::onVariableRetrieveDataInProgress); this->onRequestDataLoading(newVariable, dateTime); } } diff --git a/gui/src/SqpApplication.cpp b/gui/src/SqpApplication.cpp index 04d8858..d926b28 100644 --- a/gui/src/SqpApplication.cpp +++ b/gui/src/SqpApplication.cpp @@ -106,11 +106,6 @@ SqpApplication::SqpApplication(int &argc, char **argv) impl->m_NetworkControllerThread.start(); impl->m_VariableControllerThread.start(); impl->m_VisualizationControllerThread.start(); - - // Core connections: - // NetworkController <-> VariableController - connect(&sqpApp->networkController(), &NetworkController::replyDownloadProgress, - &sqpApp->variableController(), &VariableController::onVariableRetrieveDataInProgress); } SqpApplication::~SqpApplication() diff --git a/plugins/amda/src/AmdaProvider.cpp b/plugins/amda/src/AmdaProvider.cpp index ea7a004..4ae61f4 100644 --- a/plugins/amda/src/AmdaProvider.cpp +++ b/plugins/amda/src/AmdaProvider.cpp @@ -48,6 +48,10 @@ AmdaProvider::AmdaProvider() &networkController, SLOT(onProcessRequested(QNetworkRequest, QUuid, std::function))); + + + connect(&sqpApp->networkController(), SIGNAL(replyDownloadProgress(QUuid, double)), this, + SIGNAL(dataProvidedProgress(QUuid, double))); } }