##// END OF EJS Templates
Implementation on time widget for only one selected variable
perrinel -
r830:0f717271fd46
parent child
Show More
@@ -323,19 +323,51 void VariableController::onDateTimeOnSelection(const SqpRange &dateTime)
323 qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
323 qCDebug(LOG_VariableController()) << "VariableController::onDateTimeOnSelection"
324 << QThread::currentThread()->objectName();
324 << QThread::currentThread()->objectName();
325 auto selectedRows = impl->m_VariableSelectionModel->selectedRows();
325 auto selectedRows = impl->m_VariableSelectionModel->selectedRows();
326
327 // NOTE we only permit the time modification for one varai
328 if (selectedRows.size() == 1) {
326 auto variables = QVector<std::shared_ptr<Variable> >{};
329 auto variables = QVector<std::shared_ptr<Variable> >{};
327
330
328 for (const auto &selectedRow : qAsConst(selectedRows)) {
331 // DEPRECATED
329 if (auto selectedVariable = impl->m_VariableModel->variable(selectedRow.row())) {
332 // for (const auto &selectedRow : qAsConst(selectedRows)) {
330 variables << selectedVariable;
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 // notify that rescale operation has to be done
354 // notify that rescale operation has to be done
333 emit rangeChanged(selectedVariable, dateTime);
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
364 else if (selectedRows.size() > 1) {
337 if (!variables.isEmpty()) {
365 qCCritical(LOG_VariableController())
338 this->onRequestDataLoading(variables, dateTime, true);
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
@@ -494,7 +526,7 void VariableController::onRequestDataLoading(QVector<std::shared_ptr<Variable>
494 auto varRequestId = QUuid::createUuid();
526 auto varRequestId = QUuid::createUuid();
495 qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
527 qCDebug(LOG_VariableController()) << "VariableController::onRequestDataLoading"
496 << QThread::currentThread()->objectName() << varRequestId
528 << QThread::currentThread()->objectName() << varRequestId
497 << range;
529 << range << synchronise;
498
530
499 if (!synchronise) {
531 if (!synchronise) {
500 auto varIds = std::list<QUuid>{};
532 auto varIds = std::list<QUuid>{};
General Comments 0
You need to be logged in to leave comments. Login now