MCPcopy Create free account
hub / github.com/KDE/kdenlive / registerItem

Method registerItem

src/effects/effectstack/model/effectstackmodel.cpp:1335–1388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1333}
1334
1335void EffectStackModel::registerItem(const std::shared_ptr<TreeItem> &item)
1336{
1337 QWriteLocker locker(&m_lock);
1338 if (!item->isRoot()) {
1339 auto effectItem = std::static_pointer_cast<EffectItemModel>(item);
1340 if (effectItem->data(QModelIndex(), AssetParameterModel::RequiresInOut).toBool() == true) {
1341 int in = pCore->getItemIn(m_ownerId);
1342 int out = in + pCore->getItemDuration(m_ownerId) - 1;
1343 effectItem->filter().set_in_and_out(in, out);
1344 }
1345 if (!m_loadingExisting) {
1346 effectItem->plant(m_masterService);
1347 // Check if we have an internal effect that needs to stay on top
1348 if (m_ownerId.type == KdenliveObjectType::Master || m_ownerId.type == KdenliveObjectType::TimelineTrack) {
1349 // check for subtitle effect
1350 auto ms = m_masterService.lock();
1351 QVector<int> ixToMove;
1352 int ct = ms->filter_count();
1353 for (int i = 0; i < ms->filter_count(); i++) {
1354 std::shared_ptr<Mlt::Filter> ft(ms->filter(i));
1355 if (ft->get_int("internal_added") > 0) {
1356 ixToMove << i;
1357 }
1358 }
1359 std::sort(ixToMove.rbegin(), ixToMove.rend());
1360 for (auto &ix : ixToMove) {
1361 if (ix < ct - 1) {
1362 ms->move_filter(ix, ct - 1);
1363 }
1364 }
1365 }
1366 int target = -1;
1367 for (const auto &service : m_childServices) {
1368 effectItem->plantClone(service, target);
1369 }
1370 }
1371 effectItem->setEffectStackEnabled(m_effectStackEnabled);
1372 const QString &effectId = effectItem->getAssetId();
1373 if (effectId.startsWith(QLatin1String("fadein")) || effectId.startsWith(QLatin1String("fade_from_"))) {
1374 m_fadeIns.insert(effectItem->getId());
1375 } else if (effectId.startsWith(QLatin1String("fadeout")) || effectId.startsWith(QLatin1String("fade_to_"))) {
1376 m_fadeOuts.insert(effectItem->getId());
1377 }
1378 if (effectItem->isAssetEnabled() && !m_loadingExisting) {
1379 if (!effectItem->isAudio()) {
1380 pCore->refreshProjectItem(m_ownerId);
1381 pCore->invalidateItem(m_ownerId);
1382 } else {
1383 pCore->invalidateAudio(m_ownerId);
1384 }
1385 }
1386 }
1387 AbstractTreeModel::registerItem(item);
1388}
1389
1390void EffectStackModel::deregisterItem(int id, TreeItem *item)
1391{

Callers

nothing calls this directly

Calls 15

isRootMethod · 0.80
getItemInMethod · 0.80
getItemDurationMethod · 0.80
lockMethod · 0.80
get_intMethod · 0.80
insertMethod · 0.80
isAssetEnabledMethod · 0.80
refreshProjectItemMethod · 0.80
invalidateAudioMethod · 0.80
toBoolMethod · 0.45
dataMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected