speeddurationdialog: implemented rippling trailing clips
This commit is contained in:
@@ -145,17 +145,11 @@ SpeedDurationDialog::SpeedDurationDialog(const QVector<ClipBlock *> &clips, cons
|
||||
|
||||
void SpeedDurationDialog::accept()
|
||||
{
|
||||
// We haven't implemented rippling yet, so warn the user
|
||||
if (ripple_box_->isChecked()) {
|
||||
// FIXME: Stub
|
||||
if (QMessageBox::information(this, QString(), tr("Rippling is a stub and will not do anything. Do you wish to continue?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
// Set duration values
|
||||
TimelineRippleDeleteGapsAtRegionsCommand::RangeList ripple_ranges;
|
||||
|
||||
foreach (ClipBlock *c, clips_) {
|
||||
rational proposed_length = c->length();
|
||||
|
||||
@@ -179,10 +173,15 @@ void SpeedDurationDialog::accept()
|
||||
|
||||
if (proposed_length != c->length()) {
|
||||
command->add_child(new BlockTrimCommand(c->track(), c, proposed_length, Timeline::kTrimOut));
|
||||
ripple_ranges.append({c->track(), TimeRange(c->in() + proposed_length, c->out())});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ripple_box_->isChecked()) {
|
||||
command->add_child(new TimelineRippleDeleteGapsAtRegionsCommand(clips_.first()->track()->sequence(), ripple_ranges));
|
||||
}
|
||||
|
||||
// Set speed values
|
||||
if (speed_slider_->IsTristate()) {
|
||||
if (link_box_->isChecked() && !dur_slider_->IsTristate()) {
|
||||
|
||||
@@ -487,7 +487,7 @@ void TimelineWidget::DeleteSelected(bool ripple)
|
||||
TimelineRippleDeleteGapsAtRegionsCommand *ripple_command = nullptr;
|
||||
rational new_playhead = RATIONAL_MAX;
|
||||
if (ripple) {
|
||||
QVector<QPair<Track*, TimeRange> > range_list;
|
||||
TimelineRippleDeleteGapsAtRegionsCommand::RangeList range_list;
|
||||
|
||||
foreach (Block* b, blocks_to_delete) {
|
||||
range_list.append({b->track(), b->range()});
|
||||
|
||||
@@ -207,7 +207,9 @@ private:
|
||||
class TimelineRippleDeleteGapsAtRegionsCommand : public UndoCommand
|
||||
{
|
||||
public:
|
||||
TimelineRippleDeleteGapsAtRegionsCommand(Sequence* vo, const QVector<QPair<Track*, TimeRange> >& regions) :
|
||||
using RangeList = QVector<QPair<Track*, TimeRange> >;
|
||||
|
||||
TimelineRippleDeleteGapsAtRegionsCommand(Sequence* vo, const RangeList& regions) :
|
||||
timeline_(vo),
|
||||
regions_(regions)
|
||||
{
|
||||
@@ -237,7 +239,7 @@ protected:
|
||||
|
||||
private:
|
||||
Sequence* timeline_;
|
||||
QVector<QPair<Track*, TimeRange> > regions_;
|
||||
RangeList regions_;
|
||||
|
||||
QVector<UndoCommand*> commands_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user