Commit ff7e7868 authored by Nicolas Carion's avatar Nicolas Carion
Browse files

Fix bug on projectClip creation

parent 9008ea46
......@@ -114,7 +114,7 @@ void TreeItem::removeChild(const std::shared_ptr<TreeItem> &child)
}
}
void TreeItem::changeParent(const std::shared_ptr<TreeItem> &newParent)
void TreeItem::changeParent(std::shared_ptr<TreeItem> newParent)
{
if (auto ptr = m_parentItem.lock()) {
ptr->removeChild(shared_from_this());
......
......@@ -70,7 +70,7 @@ public:
/* @brief Change the parent of the current item. Structures are modified accordingly
*/
void changeParent(const std::shared_ptr<TreeItem> &newParent);
void changeParent(std::shared_ptr<TreeItem> newParent);
/* @brief Retrieves a child of the current item
@param row is the index of the child to retrieve
......
......@@ -74,9 +74,7 @@ ProjectClip::ProjectClip(const QString &id, const QIcon &thumb, std::shared_ptr<
// Make sure we have a hash for this clip
hash();
connect(this, &ProjectClip::updateJobStatus, this, &ProjectClip::setJobStatus);
model->loadSubClips(id, getPropertiesFromPrefix(QStringLiteral("kdenlive:clipzone.")));
connect(this, &ProjectClip::updateThumbProgress, model.get(), &ProjectItemModel::updateThumbProgress);
createAudioThumbs();
}
// static
......@@ -84,8 +82,10 @@ std::shared_ptr<ProjectClip> ProjectClip::construct(const QString &id, const QIc
std::shared_ptr<Mlt::Producer> producer, std::shared_ptr<ProjectFolder> parent)
{
std::shared_ptr<ProjectClip> self(new ProjectClip(id, thumb, model, producer, parent));
baseFinishConstruct(self);
parent->appendChild(self);
model->loadSubClips(id, self->getPropertiesFromPrefix(QStringLiteral("kdenlive:clipzone.")));
self->createAudioThumbs();
return self;
}
......@@ -124,6 +124,7 @@ std::shared_ptr<ProjectClip> ProjectClip::construct(const QDomElement &descripti
{
std::shared_ptr<ProjectClip> self(new ProjectClip(description, thumb, model, parent));
baseFinishConstruct(self);
parent->appendChild(self);
return self;
}
......
......@@ -257,8 +257,12 @@ QMimeData *ProjectItemModel::mimeData(const QModelIndexList &indices) const
void ProjectItemModel::onItemUpdated(std::shared_ptr<AbstractProjectItem> item)
{
auto index = getIndexFromItem(std::static_pointer_cast<TreeItem>(item));
emit dataChanged(index, index);
auto tItem = std::static_pointer_cast<TreeItem>(item);
auto ptr = tItem->parentItem().lock();
if (ptr) {
auto index = getIndexFromItem(tItem);
emit dataChanged(index, index);
}
}
std::shared_ptr<ProjectClip> ProjectItemModel::getClipByBinID(const QString &binId)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment