Get ready to add effect to a clip (still needs real implementation)

parent 9e741be2
......@@ -73,10 +73,10 @@ QVariantMap AssetListWidget::getMimeData(const QString &assetId) const
return mimeData;
}
void AssetListWidget::activate(const QModelIndex &ix) const
void AssetListWidget::activate(const QModelIndex &ix)
{
const QString assetId = m_model->data(m_proxyModel->mapToSource(ix), AssetTreeModel::IdRole).toString();
qDebug()<<" * * *ACTIVATED: "<<getMimeData(assetId);
//emit applyAsset(getMimeData(assetId));
const QVariantMap data = getMimeData(assetId);
emit activateAsset(data);
}
......@@ -54,7 +54,7 @@ public:
Q_INVOKABLE QVariantMap getMimeData(const QString &assetId) const;
Q_INVOKABLE void activate(const QModelIndex &ix) const;
Q_INVOKABLE void activate(const QModelIndex &ix);
protected:
void setup();
......@@ -63,6 +63,7 @@ protected:
std::unique_ptr<AssetIconProvider> m_assetIconProvider;
signals:
void activateAsset(const QVariantMap data);
};
#endif
......@@ -324,6 +324,7 @@ void MainWindow::init()
// m_effectListDock = addDock(i18n("Effects"), QStringLiteral("effect_list"), m_effectList);
auto effectList = new EffectListWidget(this);
connect(effectList, &EffectListWidget::activateAsset, pCore->projectManager(), &ProjectManager::activateAsset);
m_effectListDock = addDock(i18n("Effects"), QStringLiteral("effect_list"), effectList);
m_transitionList = new EffectsListView(EffectsListView::TransitionMode);
......
......@@ -892,3 +892,8 @@ void ProjectManager::updateTimeline(Mlt::Tractor tractor)
pCore->window()->getMainTimeline()->setModel(m_mainTimelineModel);
m_mainTimelineModel->setUndoStack(m_project->commandStack());
}
void ProjectManager::activateAsset(const QVariantMap data)
{
pCore->window()->getMainTimeline()->addAsset(data);
}
......@@ -130,6 +130,8 @@ public slots:
/** @brief Project's duration changed, adjust monitor, etc. */
void adjustProjectDuration();
/** @brief Add an asset in timeline (effect, transition). */
void activateAsset(const QVariantMap data);
private slots:
void slotRevert();
/** @brief Open the project's backupdialog. */
......
......@@ -416,3 +416,14 @@ void TimelineWidget::editMarker(const QString &cid, int frame)
clip->addMarkers(markers);
}
}
void TimelineWidget::addAsset(const QVariantMap data)
{
QString effect = data.value(QStringLiteral("kdenlive/effect")).toString();
if (!m_selection.selectedClips.isEmpty()) {
for (int id : m_selection.selectedClips) {
//TODO: manage effects in model
//m_model->addEffect(id, effect);
}
}
}
......@@ -165,6 +165,9 @@ public:
/* @brief Return the project's tractor
*/
Mlt::Tractor *tractor();
/* @brief Add an asset (effect, composition)
*/
void addAsset(const QVariantMap data);
protected:
void mousePressEvent(QMouseEvent *event) override;
......
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