21#include "docks/timelinedock.h"
22#include "models/markersmodel.h"
23#include "models/multitrackmodel.h"
24#include "undohelper.h"
26#include <MltProducer.h>
27#include <MltTransition.h>
30#include <QUndoCommand>
38 UndoIdTrimClipIn = 100,
42 UndoIdTrimTransitionIn,
43 UndoIdTrimTransitionOut,
44 UndoIdResizeTransition,
45 UndoIdAddTransitionByTrimIn,
46 UndoIdAddTransitionByTrimOut,
54 ClipPosition(
int track,
int clip)
60 bool operator<(
const ClipPosition &rhs)
const
62 if (trackIndex == rhs.trackIndex) {
63 return clipIndex < rhs.clipIndex;
65 return trackIndex < rhs.trackIndex;
73class AppendCommand :
public QUndoCommand
76 AppendCommand(MultitrackModel &model,
79 bool skipProxy =
false,
81 QUndoCommand *parent = 0);
86 MultitrackModel &m_model;
89 UndoHelper m_undoHelper;
92 QVector<QUuid> m_uuids;
95class InsertCommand :
public QUndoCommand
98 InsertCommand(MultitrackModel &model,
99 MarkersModel &markersModel,
104 QUndoCommand *parent = 0);
109 MultitrackModel &m_model;
110 MarkersModel &m_markersModel;
114 QStringList m_oldTracks;
115 UndoHelper m_undoHelper;
117 bool m_rippleAllTracks;
118 bool m_rippleMarkers;
120 QVector<QUuid> m_uuids;
123class OverwriteCommand :
public QUndoCommand
126 OverwriteCommand(MultitrackModel &model,
131 QUndoCommand *parent = 0);
136 MultitrackModel &m_model;
140 UndoHelper m_undoHelper;
142 QVector<QUuid> m_uuids;
145class LiftCommand :
public QUndoCommand
148 LiftCommand(MultitrackModel &model,
int trackIndex,
int clipIndex, QUndoCommand *parent = 0);
153 MultitrackModel &m_model;
156 UndoHelper m_undoHelper;
159class RemoveCommand :
public QUndoCommand
162 RemoveCommand(MultitrackModel &model,
163 MarkersModel &markersModel,
166 QUndoCommand *parent = 0);
171 MultitrackModel &m_model;
172 MarkersModel &m_markersModel;
175 UndoHelper m_undoHelper;
176 bool m_rippleAllTracks;
177 bool m_rippleMarkers;
178 int m_markerRemoveStart;
179 int m_markerRemoveEnd;
180 QList<Markers::Marker> m_markers;
183class GroupCommand :
public QUndoCommand
186 GroupCommand(MultitrackModel &model, QUndoCommand *parent = 0);
187 void addToGroup(
int trackIndex,
int clipIndex);
192 MultitrackModel &m_model;
193 QList<ClipPosition> m_clips;
194 QMap<ClipPosition, int> m_prevGroups;
197class UngroupCommand :
public QUndoCommand
200 UngroupCommand(MultitrackModel &model, QUndoCommand *parent = 0);
201 void removeFromGroup(
int trackIndex,
int clipIndex);
206 MultitrackModel &m_model;
207 QMap<ClipPosition, int> m_prevGroups;
210class NameTrackCommand :
public QUndoCommand
213 NameTrackCommand(MultitrackModel &model,
216 QUndoCommand *parent = 0);
221 MultitrackModel &m_model;
227class MergeCommand :
public QUndoCommand
230 MergeCommand(MultitrackModel &model,
int trackIndex,
int clipIndex, QUndoCommand *parent = 0);
235 MultitrackModel &m_model;
238 UndoHelper m_undoHelper;
241class MuteTrackCommand :
public QUndoCommand
244 MuteTrackCommand(MultitrackModel &model,
int trackIndex, QUndoCommand *parent = 0);
249 MultitrackModel &m_model;
254class HideTrackCommand :
public QUndoCommand
257 HideTrackCommand(MultitrackModel &model,
int trackIndex, QUndoCommand *parent = 0);
262 MultitrackModel &m_model;
267class CompositeTrackCommand :
public QUndoCommand
270 CompositeTrackCommand(MultitrackModel &model,
273 QUndoCommand *parent = 0);
278 MultitrackModel &m_model;
284class LockTrackCommand :
public QUndoCommand
287 LockTrackCommand(MultitrackModel &model,
int trackIndex,
bool value, QUndoCommand *parent = 0);
292 MultitrackModel &m_model;
298class MoveClipCommand :
public QUndoCommand
301 MoveClipCommand(TimelineDock &timeline,
305 QUndoCommand *parent = 0);
306 void addClip(
int trackIndex,
int clipIndex);
311 int id()
const {
return UndoIdMoveClip; }
312 bool mergeWith(
const QUndoCommand *other);
317 TimelineDock &m_timeline;
318 MultitrackModel &m_model;
319 MarkersModel &m_markersModel;
344 bool m_rippleAllTracks;
345 bool m_rippleMarkers;
346 UndoHelper m_undoHelper;
347 QMultiMap<int, Info> m_clips;
350 QList<Markers::Marker> m_markers;
351 int m_markersModified;
354class TrimCommand :
public QUndoCommand
357 explicit TrimCommand(QUndoCommand *parent = 0)
358 : QUndoCommand(parent)
360 void setUndoHelper(UndoHelper *helper) { m_undoHelper.reset(helper); }
363 QScopedPointer<UndoHelper> m_undoHelper;
366class TrimClipInCommand :
public TrimCommand
369 TrimClipInCommand(MultitrackModel &model,
370 MarkersModel &markersModel,
376 QUndoCommand *parent = 0);
381 int id()
const {
return UndoIdTrimClipIn; }
382 bool mergeWith(
const QUndoCommand *other);
385 MultitrackModel &m_model;
386 MarkersModel &m_markersModel;
391 bool m_rippleAllTracks;
392 bool m_rippleMarkers;
394 int m_markerRemoveStart;
395 int m_markerRemoveEnd;
396 QList<Markers::Marker> m_markers;
399class TrimClipOutCommand :
public TrimCommand
402 TrimClipOutCommand(MultitrackModel &model,
403 MarkersModel &markersModel,
409 QUndoCommand *parent = 0);
414 int id()
const {
return UndoIdTrimClipOut; }
415 bool mergeWith(
const QUndoCommand *other);
418 MultitrackModel &m_model;
419 MarkersModel &m_markersModel;
424 bool m_rippleAllTracks;
425 bool m_rippleMarkers;
427 int m_markerRemoveStart;
428 int m_markerRemoveEnd;
429 QList<Markers::Marker> m_markers;
432class SplitCommand :
public QUndoCommand
435 SplitCommand(MultitrackModel &model,
436 const std::vector<int> &trackIndex,
437 const std::vector<int> &clipIndex,
439 QUndoCommand *parent = 0);
444 MultitrackModel &m_model;
445 std::vector<int> m_trackIndex;
446 std::vector<int> m_clipIndex;
448 UndoHelper m_undoHelper;
451class FadeInCommand :
public QUndoCommand
454 FadeInCommand(MultitrackModel &model,
458 QUndoCommand *parent = 0);
463 int id()
const {
return UndoIdFadeIn; }
464 bool mergeWith(
const QUndoCommand *other);
467 MultitrackModel &m_model;
474class FadeOutCommand :
public QUndoCommand
477 FadeOutCommand(MultitrackModel &model,
481 QUndoCommand *parent = 0);
486 int id()
const {
return UndoIdFadeOut; }
487 bool mergeWith(
const QUndoCommand *other);
490 MultitrackModel &m_model;
497class AddTransitionCommand :
public QUndoCommand
500 AddTransitionCommand(TimelineDock &timeline,
505 QUndoCommand *parent = 0);
508 int getTransitionIndex()
const {
return m_transitionIndex; }
511 TimelineDock &m_timeline;
512 MultitrackModel &m_model;
513 MarkersModel &m_markersModel;
517 int m_transitionIndex;
519 UndoHelper m_undoHelper;
520 bool m_rippleAllTracks;
521 bool m_rippleMarkers;
522 int m_markerOldStart;
523 int m_markerNewStart;
524 QList<Markers::Marker> m_markers;
527class TrimTransitionInCommand :
public TrimCommand
530 TrimTransitionInCommand(MultitrackModel &model,
535 QUndoCommand *parent = 0);
540 int id()
const {
return UndoIdTrimTransitionIn; }
541 bool mergeWith(
const QUndoCommand *other);
544 MultitrackModel &m_model;
552class TrimTransitionOutCommand :
public TrimCommand
555 TrimTransitionOutCommand(MultitrackModel &model,
560 QUndoCommand *parent = 0);
565 int id()
const {
return UndoIdTrimTransitionOut; }
566 bool mergeWith(
const QUndoCommand *other);
569 MultitrackModel &m_model;
577class ResizeTransitionCommand :
public TrimCommand
580 ResizeTransitionCommand(MultitrackModel &model,
585 QUndoCommand *parent = 0);
590 int id()
const {
return UndoIdResizeTransition; }
591 bool mergeWith(
const QUndoCommand *other);
594 MultitrackModel &m_model;
596 int m_transitionIndex;
601class AddTransitionByTrimInCommand :
public TrimCommand
604 AddTransitionByTrimInCommand(TimelineDock &timeline,
610 QUndoCommand *parent = 0);
615 int id()
const {
return UndoIdAddTransitionByTrimIn; }
616 bool mergeWith(
const QUndoCommand *other);
619 TimelineDock &m_timeline;
628class RemoveTransitionByTrimInCommand :
public TrimCommand
631 RemoveTransitionByTrimInCommand(MultitrackModel &model,
637 QUndoCommand *parent = 0);
642 MultitrackModel &m_model;
650class RemoveTransitionByTrimOutCommand :
public TrimCommand
653 RemoveTransitionByTrimOutCommand(MultitrackModel &model,
659 QUndoCommand *parent = 0);
664 MultitrackModel &m_model;
672class AddTransitionByTrimOutCommand :
public TrimCommand
675 AddTransitionByTrimOutCommand(MultitrackModel &model,
681 QUndoCommand *parent = 0);
686 int id()
const {
return UndoIdAddTransitionByTrimOut; }
687 bool mergeWith(
const QUndoCommand *other);
690 MultitrackModel &m_model;
699class AddTrackCommand :
public QUndoCommand
702 AddTrackCommand(MultitrackModel &model,
bool isVideo, QUndoCommand *parent = 0);
707 MultitrackModel &m_model;
713class InsertTrackCommand :
public QUndoCommand
716 InsertTrackCommand(MultitrackModel &model,
718 TrackType trackType = PlaylistTrackType,
719 QUndoCommand *parent = 0);
724 MultitrackModel &m_model;
726 TrackType m_trackType;
730class RemoveTrackCommand :
public QUndoCommand
733 RemoveTrackCommand(MultitrackModel &model,
int trackIndex, QUndoCommand *parent = 0);
738 MultitrackModel &m_model;
740 TrackType m_trackType;
742 UndoHelper m_undoHelper;
743 QScopedPointer<Mlt::Producer> m_filtersProducer;
747class MoveTrackCommand :
public QUndoCommand
750 MoveTrackCommand(MultitrackModel &model,
753 QUndoCommand *parent = 0);
758 MultitrackModel &m_model;
759 int m_fromTrackIndex;
763class ChangeBlendModeCommand :
public QObject,
public QUndoCommand
767 ChangeBlendModeCommand(Mlt::Transition &transition,
768 const QString &propertyName,
770 QUndoCommand *parent = 0);
774 void modeChanged(QString &mode);
777 Mlt::Transition m_transition;
778 QString m_propertyName;
783class UpdateCommand :
public QUndoCommand
786 UpdateCommand(TimelineDock &timeline,
790 QUndoCommand *parent = 0);
791 void setXmlAfter(
const QString &xml);
792 void setPosition(
int trackIndex,
int clipIndex,
int position);
793 void setRippleAllTracks(
bool);
794 int trackIndex()
const {
return m_trackIndex; }
795 int clipIndex()
const {
return m_clipIndex; }
796 int position()
const {
return m_position; }
801 TimelineDock &m_timeline;
807 UndoHelper m_undoHelper;
809 bool m_rippleAllTracks;
812class DetachAudioCommand :
public QUndoCommand
815 DetachAudioCommand(TimelineDock &timeline,
820 QUndoCommand *parent = 0);
825 TimelineDock &m_timeline;
829 int m_targetTrackIndex;
831 UndoHelper m_undoHelper;
836class ReplaceCommand :
public QUndoCommand
839 ReplaceCommand(MultitrackModel &model,
843 QUndoCommand *parent =
nullptr);
848 MultitrackModel &m_model;
853 UndoHelper m_undoHelper;
856class AlignClipsCommand :
public QUndoCommand
859 AlignClipsCommand(MultitrackModel &model, QUndoCommand *parent = 0);
860 void addAlignment(QUuid uuid,
int offset,
double speedCompensation);
865 MultitrackModel &m_model;
866 UndoHelper m_undoHelper;
874 QVector<Alignment> m_alignments;
877class ApplyFiltersCommand :
public QUndoCommand
880 ApplyFiltersCommand(MultitrackModel &model,
881 const QString &filterProducerXml,
882 QUndoCommand *parent = 0);
883 void addClip(
int trackIndex,
int clipIndex);
888 MultitrackModel &m_model;
890 QMap<ClipPosition, QString> m_prevFilters;
893class ChangeGainCommand :
public QUndoCommand
896 ChangeGainCommand(MultitrackModel &model,
900 QUndoCommand *parent = 0);
905 int id()
const {
return UndoIdChangeGain; }
906 bool mergeWith(
const QUndoCommand *other);
909 MultitrackModel &m_model;