connect group/ungroup with shortcuts

parent fcefbc43
......@@ -2592,16 +2592,12 @@ void MainWindow::slotSelectAddTimelineTransition()
void MainWindow::slotGroupClips()
{
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->groupClips();
}
getCurrentTimeline()->controller()->groupSelection();
}
void MainWindow::slotUnGroupClips()
{
if (pCore->projectManager()->currentTimeline()) {
pCore->projectManager()->currentTimeline()->projectView()->groupClips(false);
}
getCurrentTimeline()->controller()->unGroupSelection();
}
void MainWindow::slotEditItemDuration()
......
......@@ -63,9 +63,6 @@ protected:
/* @brief this constructor should not be called. Call the static construct instead
*/
TimelineItemModel(Mlt::Profile *profile, std::weak_ptr<DocUndoStack> undo_stack);
/* @brief returns true if clip is in temporary selection group.
*/
bool isInSelection(int cid) const;
public:
~TimelineItemModel();
......@@ -90,6 +87,9 @@ public:
static const QString getCompositingTransition();
const QString groupsData();
bool loadGroups(const QString &groupsData);
/* @brief returns true if clip is in temporary selection group.
*/
bool isInSelection(int cid) const;
virtual void _beginRemoveRows(const QModelIndex &, int, int) override;
virtual void _beginInsertRows(const QModelIndex &, int, int) override;
......
......@@ -667,7 +667,7 @@ Rectangle {
MenuItem {
visible: !grouped && trackRoot.selection.length > 1
text: i18n('Group')
onTriggered: timeline.groupSelection()
onTriggered: timeline.triggerAction('group_clip')
}
MenuItem {
visible: grouped
......
......@@ -328,7 +328,22 @@ void TimelineController::groupSelection()
void TimelineController::unGroupSelection(int cid)
{
m_model->requestClipUngroup(cid);
if (cid == -1 && m_selection.selectedClips.isEmpty()) {
return;
}
if (cid == -1) {
for (int id : m_selection.selectedClips) {
if (m_model->m_groups->isInGroup(id) && !m_model->isInSelection(id)) {
cid = id;
break;
}
}
}
if (cid > -1) {
m_model->requestClipUngroup(cid);
m_selection.selectedClips.clear();
emit selectionChanged();
}
}
void TimelineController::setInPoint()
......
......@@ -140,7 +140,7 @@ public:
Q_INVOKABLE void groupSelection();
/* @brief Ungroup selected items in timeline
*/
Q_INVOKABLE void unGroupSelection(int cid);
Q_INVOKABLE void unGroupSelection(int cid = -1);
/* @brief Ask for edit marker dialog
*/
Q_INVOKABLE void editMarker(const QString &cid, int frame);
......
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