##// END OF EJS Templates
Implementation on time widget for only one selected variable
perrinel -
r834:0f717271fd46
parent child
Show More
@@ -323,19 +323,51 void VariableController::onDateTimeOnSelection(const SqpRange &dateTime)
323 323 qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
324 324 << QThread::currentThread()->objectName();
325 325 auto selectedRows = impl->m_VariableSelectionModel->selectedRows();
326 auto variables = QVector<std::shared_ptr<Variable> >{};
327 326
328 for (const auto &selectedRow : qAsConst(selectedRows)) {
329 if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) {
330 variables << selectedVariable;
327 // NOTE we only permit the time modification for one varai
328 if (selectedRows.size() == 1) {
329 auto variables = QVector<std::shared_ptr<Variable> >{};
330
331 // DEPRECATED
332 // for (const auto &selectedRow : qAsConst(selectedRows)) {
333 // if (auto selectedVariable =
334 // impl->m_VariableModel->variable(selectedRow.row())) {
335 // variables << selectedVariable;
336
337 // // notify that rescale operation has to be done
338 // emit rangeChanged(selectedVariable, dateTime);
339 // }
340 // }
341 // if (!variables.isEmpty()) {
342 // this->onRequestDataLoading(variables, dateTime, synchro);
343 // }
344 if (auto selectedVariable
345 = impl->m_VariableModel->variable(qAsConst(selectedRows).first().row())) {
346
347 auto itVar = impl->m_VariableToIdentifierMap.find(selectedVariable);
348 if (itVar == impl->m_VariableToIdentifierMap.cend()) {
349 qCCritical(LOG_VariableController())
350 << tr("Impossible to onDateTimeOnSelection request for unknown variable");
351 return;
352 }
331 353
332 354 // notify that rescale operation has to be done
333 355 emit rangeChanged(selectedVariable, dateTime);
356
357 auto synchro = impl->m_VariableIdGroupIdMap.find(itVar->second)
358 != impl->m_VariableIdGroupIdMap.cend();
359
360 this->onRequestDataLoading(QVector<std::shared_ptr<Variable> >{selectedVariable},
361 dateTime, synchro);
334 362 }
335 363 }
336
337 if (!variables.isEmpty()) {
338 this->onRequestDataLoading(variables, dateTime, true);
364 else if (selectedRows.size() > 1) {
365 qCCritical(LOG_VariableController())
366 << tr("Impossible to set time for more than 1 variable in the same time");
367 }
368 else {
369 qCWarning(LOG_VariableController())
370 << tr("There is no variable selected to set the time one");
339 371 }
340 372 }
341 373
@@ -493,8 +525,8 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable>
493 525
494 526 auto varRequestId = QUuid::createUuid();
495 527 qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
496 << QThread::currentThread()->objectName() << varRequestId
497 << range;
528 << QThread::currentThread()->objectName() << varRequestId
529 << range << synchronise;
498 530
499 531 if (!synchronise) {
500 532 auto varIds = std::list<QUuid>{};
General Comments 3
Under Review
author

Auto status change to "Under Review"

Approved
author

Merge lasted acquisition developpement on main Sciqlop branch

You need to be logged in to leave comments. Login now