Reimplement clip in project bin from timeline context menu

parent 7f275e9b
......@@ -1353,18 +1353,10 @@ void Bin::selectClipById(const QString &clipId, int frame, const QPoint &zone)
}
return;
}
QModelIndex ix = getIndexForId(clipId, false);
if (ix.isValid()) {
m_proxyModel->selectionModel()->clearSelection();
int row = ix.row();
const QModelIndex id = m_itemModel->index(row, 0, ix.parent());
const QModelIndex id2 = m_itemModel->index(row, m_itemModel->columnCount() - 1, ix.parent());
if (id.isValid() && id2.isValid()) {
m_proxyModel->selectionModel()->select(QItemSelection(m_proxyModel->mapFromSource(id), m_proxyModel->mapFromSource(id2)),
QItemSelectionModel::Select);
}
selectProxyModel(m_proxyModel->mapFromSource(ix));
m_itemView->scrollTo(m_proxyModel->mapFromSource(ix));
m_proxyModel->selectionModel()->clearSelection();
std::shared_ptr<ProjectClip> clip = getBinClip(clipId);
if (clip) {
selectClip(clip);
if (frame > -1) {
m_monitor->slotSeek(frame);
}
......
......@@ -2910,18 +2910,16 @@ void MainWindow::slotClipInTimeline(const QString &clipId)
void MainWindow::slotClipInProjectTree()
{
if (pCore->projectManager()->currentTimeline()) {
int pos = -1;
QPoint zone;
const QString selectedId = pCore->projectManager()->currentTimeline()->projectView()->getClipUnderCursor(&pos, &zone);
if (selectedId.isEmpty()) {
return;
}
QList <int> ids = getMainTimeline()->controller()->selection();
if (!ids.isEmpty()) {
m_projectBinDock->raise();
pCore->bin()->selectClipById(selectedId, pos, zone);
ObjectId id(ObjectType::TimelineClip, ids.constFirst());
int start = pCore->getItemIn(id);
QPoint zone(start, start + pCore->getItemDuration(id));
if (m_projectMonitor->isActive()) {
slotSwitchMonitors();
}
pCore->bin()->selectClipById(getMainTimeline()->controller()->getClipBinId(ids.constFirst()), -1, zone);
}
}
......
......@@ -688,6 +688,10 @@ Rectangle {
MenuSeparator {
visible: true
}
MenuItem {
text: i18n('Clip in Project Bin')
onTriggered: timeline.triggerAction('clip_in_project_tree')
}
MenuItem {
visible: true
text: i18n('Split At Playhead (S)')
......
......@@ -241,7 +241,6 @@ int TimelineController::insertComposition(int tid, int position, const QString &
void TimelineController::deleteSelectedClips()
{
if (m_selection.selectedClips.isEmpty()) {
qDebug() << " * * *NO selection, aborting";
return;
}
for (int cid : m_selection.selectedClips) {
......@@ -626,3 +625,7 @@ void TimelineController::setCompositionATrack(int cid, int aTrack)
m_model->dataChanged(modelIndex, modelIndex, roles);
}
const QString TimelineController::getClipBinId(int clipId) const
{
return m_model->getClipBinId(clipId);
}
......@@ -231,6 +231,7 @@ public:
*/
int getCompositionATrack(int cid) const;
void setCompositionATrack(int cid, int aTrack);
const QString getClipBinId(int clipId) const;
public slots:
void selectMultitrack();
......
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