| 1407 | } |
| 1408 | |
| 1409 | void EffectStackModel::setEffectStackEnabled(bool enabled) |
| 1410 | { |
| 1411 | QWriteLocker locker(&m_lock); |
| 1412 | m_effectStackEnabled = enabled; |
| 1413 | |
| 1414 | QList<QModelIndex> indexes; |
| 1415 | bool hasVideo = false; |
| 1416 | bool hasAudio = false; |
| 1417 | // Recursively updates children states |
| 1418 | for (int i = 0; i < rootItem->childCount(); ++i) { |
| 1419 | std::shared_ptr<AbstractEffectItem> item = std::static_pointer_cast<AbstractEffectItem>(rootItem->child(i)); |
| 1420 | item->setEffectStackEnabled(enabled); |
| 1421 | indexes << getIndexFromItem(item); |
| 1422 | if (!hasVideo && !item->isAudio()) { |
| 1423 | hasVideo = true; |
| 1424 | } |
| 1425 | if (!hasAudio && item->isAudio()) { |
| 1426 | hasAudio = true; |
| 1427 | } |
| 1428 | } |
| 1429 | if (indexes.isEmpty()) { |
| 1430 | return; |
| 1431 | } |
| 1432 | if (hasVideo) { |
| 1433 | pCore->refreshProjectItem(m_ownerId); |
| 1434 | pCore->invalidateItem(m_ownerId); |
| 1435 | } |
| 1436 | if (hasAudio) { |
| 1437 | pCore->invalidateAudio(m_ownerId); |
| 1438 | } |
| 1439 | Q_EMIT dataChanged(indexes.first(), indexes.last(), {TimelineModel::EffectsEnabledRole}); |
| 1440 | Q_EMIT enabledStateChanged(); |
| 1441 | } |
| 1442 | |
| 1443 | std::shared_ptr<AbstractEffectItem> EffectStackModel::getEffectStackRow(int row, const std::shared_ptr<TreeItem> &parentItem) |
| 1444 | { |
no test coverage detected