Add new timeline action: Remove space from all tracks that works if there are grouped clips

CCBUG: 369123
parent a0ee357c
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="147" translationDomain="kdenlive">
<kpartgui name="kdenlive" version="148" translationDomain="kdenlive">
<MenuBar>
<Menu name="file" >
<Action name="dvd_wizard" />
......@@ -129,6 +129,7 @@
<Menu name="space_menu" ><text>Space</text>
<Action name="insert_space" />
<Action name="delete_space" />
<Action name="delete_space_all_tracks" />
</Menu>
<Action name="group_clip" />
<Action name="ungroup_clip" />
......
......@@ -525,6 +525,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
m_timelineContextMenu->addAction(actionCollection()->action(QStringLiteral("insert_space")));
m_timelineContextMenu->addAction(actionCollection()->action(QStringLiteral("delete_space")));
m_timelineContextMenu->addAction(actionCollection()->action(QStringLiteral("delete_space_all_tracks")));
m_timelineContextMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Paste)));
m_timelineContextClipMenu->addAction(actionCollection()->action(QStringLiteral("clip_in_project_tree")));
......@@ -1380,6 +1381,7 @@ void MainWindow::setupActions()
addAction(QStringLiteral("insert_space"), i18n("Insert Space"), this, SLOT(slotInsertSpace()));
addAction(QStringLiteral("delete_space"), i18n("Remove Space"), this, SLOT(slotRemoveSpace()));
addAction(QStringLiteral("delete_space_all_tracks"), i18n("Remove Space In All Tracks"), this, SLOT(slotRemoveAllSpace()));
KActionCategory *timelineActions = new KActionCategory(i18n("Tracks"), actionCollection());
QAction *insertTrack = new QAction(QIcon(), i18n("Insert Track"), this);
......@@ -2314,6 +2316,12 @@ void MainWindow::slotRemoveSpace()
pCore->projectManager()->currentTimeline()->projectView()->slotRemoveSpace();
}
void MainWindow::slotRemoveAllSpace()
{
if (pCore->projectManager()->currentTimeline())
pCore->projectManager()->currentTimeline()->projectView()->slotRemoveSpace(true);
}
void MainWindow::slotInsertTrack()
{
pCore->monitorManager()->activateMonitor(Kdenlive::ProjectMonitor);
......
......@@ -359,6 +359,7 @@ private slots:
void slotInsertSpace();
void slotRemoveSpace();
void slotRemoveAllSpace();
void slotAddGuide();
void slotEditGuide(int pos = -1, QString text = QString());
void slotDeleteGuide();
......
This diff is collapsed.
......@@ -133,7 +133,7 @@ public:
* Shows a dialog to configure length and track. */
void slotInsertSpace();
/** @brief Prepares removing space. */
void slotRemoveSpace();
void slotRemoveSpace(bool multiTrack = false);
void insertSpace(QList<ItemInfo> clipsToMove, QList<ItemInfo> transToMove, int track, const GenTime &duration, const GenTime &offset);
ClipItem *getActiveClipUnderCursor(bool allowOutsideCursor = false) const;
void deleteTimelineTrack(int ix, TrackInfo trackinfo);
......@@ -181,7 +181,7 @@ public:
int selectedTrack() const;
QStringList selectedClips() const;
/** @brief Checks whether an item can be inserted (make sure it does not overlap another item) */
bool canBePastedTo(ItemInfo info, int type) const;
bool canBePastedTo(ItemInfo info, int type, QList<AbstractClipItem *>excluded = QList<AbstractClipItem *>()) const;
/** @brief Selects a clip.
* @param add Whether to select or deselect
......@@ -223,11 +223,11 @@ public:
/** @brief Returns frame number of current mouse position. */
int getMousePos() const;
void completeSpaceOperation(int track, GenTime &timeOffset);
/** @brief Insert space in timeline after clips were moved. if fromstart is true, we assume clips have not yet been moved manually. */
void completeSpaceOperation(int track, GenTime &timeOffset, bool fromStart = false);
void spaceToolMoveToSnapPos(double snappedPos);
void createRectangleSelection(Qt::KeyboardModifiers modifiers);
int spaceToolSelectTrackOnly(int track, QList<QGraphicsItem *> &selection);
int spaceToolSelectTrackOnly(int track, QList<QGraphicsItem *> &selection, GenTime pos = GenTime(-1));
QList<QGraphicsItem *> selectAllItemsToTheRight(int x);
GenTime createGroupForSelectedItems(QList<QGraphicsItem *> &selection);
void resetSelectionGroup(bool selectItems = true);
......@@ -527,7 +527,6 @@ private:
bool insertDropClips(const QMimeData *data, const QPoint &pos);
bool canBePastedTo(QList <ItemInfo> infoList, int type) const;
bool canBePasted(QList<AbstractClipItem *> items, GenTime offset, int trackOffset) const;
bool canBeMoved(QList<AbstractClipItem *> items, GenTime offset, int trackOffset) const;
ClipItem *getClipUnderCursor() const;
AbstractClipItem *getMainActiveClip() const;
/** Get available space for clip move (min and max free positions) */
......
......@@ -38,22 +38,13 @@ SpacerDialog::SpacerDialog(const GenTime &duration, const Timecode &tc, int trac
inputLayout->addWidget(&m_in);
m_in.setValue(duration);
/*QStringList trackItems;
trackItems << i18n("All tracks");
for (int i = tracks.count() - 1; i > 0; --i) {
if (!tracks.at(i).trackName.isEmpty())
trackItems << tracks.at(i).trackName;
else
trackItems << QString::number(i);
}
track_number->addItems(trackItems);*/
QIcon videoIcon = QIcon::fromTheme(QStringLiteral("kdenlive-show-video"));
QIcon audioIcon = QIcon::fromTheme(QStringLiteral("kdenlive-show-audio"));
track_number->addItem(i18n("All tracks"));
track_number->addItem(i18n("All tracks"), -1);
for (int i = tracks.count() - 1; i > 0 ; i--) {
TrackInfo info = tracks.at(i);
track_number->addItem(info.type == VideoTrack ? videoIcon : audioIcon,
info.trackName.isEmpty() ? QString::number(i) : info.trackName);
info.trackName.isEmpty() ? QString::number(i) : info.trackName, i);
}
track_number->setCurrentIndex(track == 0 ? 0 : tracks.count() - track);
......@@ -67,7 +58,7 @@ GenTime SpacerDialog::selectedDuration() const
int SpacerDialog::selectedTrack() const
{
return track_number->count() - track_number->currentIndex();
return track_number->currentData().toInt();
}
......
......@@ -6,14 +6,37 @@
<rect>
<x>0</x>
<y>0</y>
<width>184</width>
<height>94</height>
<width>226</width>
<height>174</height>
</rect>
</property>
<property name="windowTitle">
<string>Add space</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="clip_filesize_3">
<property name="text">
<string>Track:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="track_number"/>
</item>
<item row="3" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
......@@ -31,32 +54,9 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="clip_filesize_3">
<property name="text">
<string>Track:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="track_number"/>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="inputLayout"/>
</item>
<item row="2" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
......
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