comparison data/model/EditableDenseThreeDimensionalModel.cpp @ 1752:6d09d68165a4 by-id

Further review of ById: make IDs only available when adding a model to the ById store, not by querying the item directly. This means any id encountered in the wild must have been added to the store at some point (even if later released), which simplifies reasoning about lifecycles
author Chris Cannam
date Fri, 05 Jul 2019 15:28:07 +0100
parents 78fe29adfd16
children d484490cdf69
comparison
equal deleted inserted replaced
1751:77543124651b 1752:6d09d68165a4
357 sv_frame_t windowStart = index; 357 sv_frame_t windowStart = index;
358 windowStart *= m_resolution; 358 windowStart *= m_resolution;
359 359
360 if (m_notifyOnAdd) { 360 if (m_notifyOnAdd) {
361 if (allChange) { 361 if (allChange) {
362 emit modelChanged(); 362 emit modelChanged(getId());
363 } else { 363 } else {
364 emit modelChangedWithin(windowStart, windowStart + m_resolution); 364 emit modelChangedWithin(getId(),
365 windowStart, windowStart + m_resolution);
365 } 366 }
366 } else { 367 } else {
367 if (allChange) { 368 if (allChange) {
368 m_sinceLastNotifyMin = -1; 369 m_sinceLastNotifyMin = -1;
369 m_sinceLastNotifyMax = -1; 370 m_sinceLastNotifyMax = -1;
370 emit modelChanged(); 371 emit modelChanged(getId());
371 } else { 372 } else {
372 if (m_sinceLastNotifyMin == -1 || 373 if (m_sinceLastNotifyMin == -1 ||
373 windowStart < m_sinceLastNotifyMin) { 374 windowStart < m_sinceLastNotifyMin) {
374 m_sinceLastNotifyMin = windowStart; 375 m_sinceLastNotifyMin = windowStart;
375 } 376 }
391 void 392 void
392 EditableDenseThreeDimensionalModel::setBinName(int n, QString name) 393 EditableDenseThreeDimensionalModel::setBinName(int n, QString name)
393 { 394 {
394 while ((int)m_binNames.size() <= n) m_binNames.push_back(""); 395 while ((int)m_binNames.size() <= n) m_binNames.push_back("");
395 m_binNames[n] = name; 396 m_binNames[n] = name;
396 emit modelChanged(); 397 emit modelChanged(getId());
397 } 398 }
398 399
399 void 400 void
400 EditableDenseThreeDimensionalModel::setBinNames(std::vector<QString> names) 401 EditableDenseThreeDimensionalModel::setBinNames(std::vector<QString> names)
401 { 402 {
402 m_binNames = names; 403 m_binNames = names;
403 emit modelChanged(); 404 emit modelChanged(getId());
404 } 405 }
405 406
406 bool 407 bool
407 EditableDenseThreeDimensionalModel::hasBinValues() const 408 EditableDenseThreeDimensionalModel::hasBinValues() const
408 { 409 {
472 m_completion = completion; 473 m_completion = completion;
473 474
474 if (completion == 100) { 475 if (completion == 100) {
475 476
476 m_notifyOnAdd = true; // henceforth 477 m_notifyOnAdd = true; // henceforth
477 emit modelChanged(); 478 emit modelChanged(getId());
478 479
479 } else if (!m_notifyOnAdd) { 480 } else if (!m_notifyOnAdd) {
480 481
481 if (update && 482 if (update &&
482 m_sinceLastNotifyMin >= 0 && 483 m_sinceLastNotifyMin >= 0 &&
483 m_sinceLastNotifyMax >= 0) { 484 m_sinceLastNotifyMax >= 0) {
484 emit modelChangedWithin(m_sinceLastNotifyMin, 485 emit modelChangedWithin(getId(),
486 m_sinceLastNotifyMin,
485 m_sinceLastNotifyMax + m_resolution); 487 m_sinceLastNotifyMax + m_resolution);
486 m_sinceLastNotifyMin = m_sinceLastNotifyMax = -1; 488 m_sinceLastNotifyMin = m_sinceLastNotifyMax = -1;
487 } else { 489 } else {
488 emit completionChanged(); 490 emit completionChanged(getId());
489 } 491 }
490 } else { 492 } else {
491 emit completionChanged(); 493 emit completionChanged(getId());
492 } 494 }
493 } 495 }
494 } 496 }
495 497
496 int 498 int