From feac825a443ede9af6b9bff325de4249d5c40bb7 2017-12-19 14:14:51 From: Alexandre Leroux Date: 2017-12-19 14:14:51 Subject: [PATCH] Wait for the end of an acquisition to validate an operation (2) Creates signal in VariableController emitted when there is no pending acquisition --- diff --git a/core/include/Variable/VariableController.h b/core/include/Variable/VariableController.h index 66aab49..9c02286 100644 --- a/core/include/Variable/VariableController.h +++ b/core/include/Variable/VariableController.h @@ -85,6 +85,10 @@ signals: /// Signal emitted when a sub range of the cacheRange of the variable can be displayed void updateVarDisplaying(std::shared_ptr variable, const SqpRange &range); + /// Signal emitted when all acquisitions related to the variables have been completed (whether + /// validated, canceled, or failed) + void acquisitionFinished(); + public slots: /// Request the data loading of the variable whithin range void onRequestDataLoading(QVector > variables, const SqpRange &range, diff --git a/core/src/Variable/VariableController.cpp b/core/src/Variable/VariableController.cpp index e76989b..7e1e4b0 100644 --- a/core/src/Variable/VariableController.cpp +++ b/core/src/Variable/VariableController.cpp @@ -890,6 +890,9 @@ void VariableController::VariableControllerPrivate::updateVariables(QUuid varReq // cleaning varRequestId qCDebug(LOG_VariableController()) << tr("m_VarGroupIdToVarIds erase") << varRequestId; m_VarGroupIdToVarIds.erase(varRequestId); + if (m_VarGroupIdToVarIds.empty()) { + emit q->acquisitionFinished(); + } } } @@ -1019,6 +1022,9 @@ void VariableController::VariableControllerPrivate::cancelVariableRequest(QUuid } qCDebug(LOG_VariableController()) << tr("cancelVariableRequest: erase") << varRequestId; m_VarGroupIdToVarIds.erase(varRequestId); + if (m_VarGroupIdToVarIds.empty()) { + emit q->acquisitionFinished(); + } } void VariableController::VariableControllerPrivate::executeVarRequest(std::shared_ptr var,