use Qt API, not STL, for map operation
This commit is contained in:
parent
01c569ffa4
commit
3f78a9de01
|
@ -238,27 +238,26 @@ void QSacnUniverse::setValue (const uint16_t addr, const uint16_t size,
|
|||
*/
|
||||
void QSacnUniverse::syncSources()
|
||||
{
|
||||
// create a new list of sources
|
||||
QMap<sACN::DATA::data_header, QSacnUniverse*> newSources;
|
||||
|
||||
auto headers = universe_->sources();
|
||||
for (const auto & metadata : headers)
|
||||
{
|
||||
auto it = sources_.find(metadata);
|
||||
if (it == sources_.end())
|
||||
{ // not found
|
||||
if (sources_.contains(metadata))
|
||||
// move the QSacnUniverse to the new list
|
||||
newSources.insert(metadata, sources_.take(metadata));
|
||||
else
|
||||
{ // make a new QSacnUniverse to add to the new list
|
||||
auto universe = universe_->sourceUniverse(metadata);
|
||||
newSources.insert(metadata, new QSacnUniverse(this, universe));
|
||||
}
|
||||
else
|
||||
{ // found
|
||||
auto universe = sources_.take(metadata);
|
||||
newSources.insert(metadata, universe);
|
||||
}
|
||||
}
|
||||
|
||||
// delete any remaining QSacnUniverse, ie. not moved to the new list
|
||||
// delete any remaining sources, ie. not moved to the new list
|
||||
qDeleteAll(sources_);
|
||||
|
||||
// accept the new list
|
||||
sources_ = newSources;
|
||||
emit sourceListChanged();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue