Fix loading (clip names)

parent 2706ee3b
......@@ -315,6 +315,8 @@ void MainWindow::init()
m_projectBinDock = addDock(i18n("Project Bin"), QStringLiteral("project_bin"), pCore->bin());
m_effectStack = new EffectStackView2(m_projectMonitor, this);
//TODO REFAC: remove, this is just a hack to avoid floating parentless widget
addDock("Properties_old", QStringLiteral("effect_stack2"), m_effectStack);
connect(m_effectStack, &EffectStackView2::startFilterJob, pCore->bin(), &Bin::slotStartFilterJob);
connect(pCore->bin(), &Bin::masterClipSelected, m_effectStack, &EffectStackView2::slotMasterClipItemSelected);
......
......@@ -882,7 +882,7 @@ void ProjectManager::updateTimeline(Mlt::Tractor tractor) {
info.replaceProducer = true;
pCore->bin()->slotProducerReady(info, pCore->binController()->getController(id));
}
m_timelineWidget->buildFromMelt(tractor);
pCore->binController()->setBinPlaylist(m_timelineWidget->tractor());
m_timelineWidget->buildFromMelt(tractor);
m_timelineWidget->setUndoStack(m_project->commandStack());
}
......@@ -115,6 +115,14 @@ bool ClipModel::requestResize(int size, bool right, Fun& undo, Fun& redo)
return false;
}
const QString ClipModel::getProperty(const QString &name) const
{
if (service()->parent().is_valid()) {
return QString::fromUtf8(service()->parent().get(name.toUtf8().constData()));
}
return QString::fromUtf8(service()->get(name.toUtf8().constData()));
}
Mlt::Producer* ClipModel::service() const
{
return m_producer.get();
......
......@@ -59,6 +59,9 @@ public:
*/
static int construct(std::weak_ptr<TimelineModel> parent, std::shared_ptr<Mlt::Producer> prod, int id = -1);
/* @brief returns a property of the clip, or from it's parent if it's a cut
*/
const QString getProperty(const QString &name) const override;
friend class TrackModel;
friend class TimelineModel;
......
......@@ -108,6 +108,11 @@ bool CompositionModel::requestResize(int size, bool right, Fun& undo, Fun& redo)
return false;
}
const QString CompositionModel::getProperty(const QString &name) const
{
return QString::fromUtf8(service()->get(name.toUtf8().constData()));
}
Mlt::Transition* CompositionModel::service() const
{
......
......@@ -68,6 +68,11 @@ public:
/* @brief Sets the id of the second track involved in the composition*/
void setATrack(int trackId);
/* @brief returns a property of the current item
*/
const QString getProperty(const QString &name) const override;
protected:
Mlt::Transition *service() const override;
......
......@@ -58,10 +58,6 @@ public:
*/
int getPosition() const;
/* @brief returns a property of the current item
*/
const QString getProperty(const QString &name) const;
/* @brief returns the in and out times of the item
*/
std::pair<int, int> getInOut() const;
......@@ -78,6 +74,10 @@ public:
*/
bool isValid();
/* @brief returns a property of the current item
*/
virtual const QString getProperty(const QString &name) const = 0;
protected:
/* @brief Returns a pointer to the service. It may be used but do NOT store it*/
......@@ -94,6 +94,7 @@ protected:
*/
virtual bool requestResize(int size, bool right, Fun& undo, Fun& redo) = 0;
/* Updates the stored position of the item
This function is meant to be called by the trackmodel, not directly by the user.
If you whish to actually move the item, use the requestMove slot.
......
......@@ -47,12 +47,6 @@ int MoveableItem<Service>::getPosition() const
return m_position;
}
template<typename Service>
const QString MoveableItem<Service>::getProperty(const QString &name) const
{
return QString::fromUtf8(service()->get(name.toUtf8().constData()));
}
template<typename Service>
std::pair<int, int> MoveableItem<Service>::getInOut() const
{
......
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