several conversions to smart pointers
This commit is contained in:
+18
-24
@@ -34,11 +34,7 @@
|
||||
#include "undo.h"
|
||||
#include "debug.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
Clip::Clip(Sequence* s) :
|
||||
Clip::Clip(SequencePtr s) :
|
||||
sequence(s),
|
||||
enabled(true),
|
||||
clip_in(0),
|
||||
@@ -64,8 +60,8 @@ Clip::Clip(Sequence* s) :
|
||||
reset();
|
||||
}
|
||||
|
||||
Clip* Clip::copy(Sequence* s, bool duplicate_transitions) {
|
||||
Clip* copy = new Clip(s);
|
||||
ClipPtr Clip::copy(SequencePtr s, bool duplicate_transitions) {
|
||||
ClipPtr copy(new Clip(s));
|
||||
|
||||
copy->enabled = enabled;
|
||||
copy->name = QString(name);
|
||||
@@ -122,9 +118,9 @@ void Clip::reset_audio() {
|
||||
frame_sample_index = -1;
|
||||
audio_buffer_write = 0;
|
||||
} else if (media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* nested_sequence = media->to_sequence();
|
||||
SequencePtr nested_sequence = media->to_sequence();
|
||||
for (int i=0;i<nested_sequence->clips.size();i++) {
|
||||
Clip* c = nested_sequence->clips.at(i);
|
||||
ClipPtr c = nested_sequence->clips.at(i);
|
||||
if (c != nullptr) c->reset_audio();
|
||||
}
|
||||
}
|
||||
@@ -133,7 +129,7 @@ void Clip::reset_audio() {
|
||||
void Clip::refresh() {
|
||||
// validates media if it was replaced
|
||||
if (replaced && media != nullptr && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = media->to_footage();
|
||||
FootagePtr m = media->to_footage();
|
||||
|
||||
if (track < 0 && m->video_tracks.size() > 0) {
|
||||
media_stream = m->video_tracks.at(0).file_index;
|
||||
@@ -177,7 +173,7 @@ QVector<Marker> &Clip::get_markers() {
|
||||
return markers;
|
||||
}
|
||||
|
||||
Transition* Clip::get_opening_transition() {
|
||||
TransitionPtr Clip::get_opening_transition() {
|
||||
if (opening_transition > -1) {
|
||||
if (this->sequence == nullptr) {
|
||||
return clipboard_transitions.at(opening_transition);
|
||||
@@ -188,7 +184,7 @@ Transition* Clip::get_opening_transition() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Transition* Clip::get_closing_transition() {
|
||||
TransitionPtr Clip::get_closing_transition() {
|
||||
if (closing_transition > -1) {
|
||||
if (this->sequence == nullptr) {
|
||||
return clipboard_transitions.at(closing_transition);
|
||||
@@ -201,15 +197,13 @@ Transition* Clip::get_closing_transition() {
|
||||
|
||||
Clip::~Clip() {
|
||||
if (open) {
|
||||
close_clip(this, true);
|
||||
close_clip(ClipPtr(this), true);
|
||||
}
|
||||
|
||||
if (opening_transition != -1) this->sequence->hard_delete_transition(this, TA_OPENING_TRANSITION);
|
||||
if (closing_transition != -1) this->sequence->hard_delete_transition(this, TA_CLOSING_TRANSITION);
|
||||
if (opening_transition != -1) this->sequence->hard_delete_transition(ClipPtr(this), TA_OPENING_TRANSITION);
|
||||
if (closing_transition != -1) this->sequence->hard_delete_transition(ClipPtr(this), TA_CLOSING_TRANSITION);
|
||||
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
delete effects.at(i);
|
||||
}
|
||||
effects.clear();
|
||||
av_packet_free(&pkt);
|
||||
}
|
||||
|
||||
@@ -265,7 +259,7 @@ void Clip::recalculateMaxLength() {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* m = media->to_footage();
|
||||
FootagePtr m = media->to_footage();
|
||||
const FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
|
||||
if (ms != nullptr && ms->infinite_length) {
|
||||
calculated_length = LONG_MAX;
|
||||
@@ -276,7 +270,7 @@ void Clip::recalculateMaxLength() {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
SequencePtr s = media->to_sequence();
|
||||
calculated_length = refactor_frame_number(s->getEndFrame(), s->frame_rate, fr);
|
||||
}
|
||||
break;
|
||||
@@ -301,7 +295,7 @@ int Clip::getWidth() {
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
SequencePtr s = media->to_sequence();
|
||||
return s->width;
|
||||
break;
|
||||
}
|
||||
@@ -320,7 +314,7 @@ int Clip::getHeight() {
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
SequencePtr s = media->to_sequence();
|
||||
return s->height;
|
||||
}
|
||||
}
|
||||
@@ -329,7 +323,7 @@ int Clip::getHeight() {
|
||||
|
||||
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
|
||||
if (change_timeline_points) {
|
||||
move_clip(ca, this,
|
||||
move_clip(ca, ClipPtr(this),
|
||||
qRound((double) timeline_in * multiplier),
|
||||
qRound((double) timeline_out * multiplier),
|
||||
qRound((double) clip_in * multiplier),
|
||||
@@ -338,7 +332,7 @@ void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_t
|
||||
|
||||
// move keyframes
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
Effect* e = effects.at(i);
|
||||
EffectPtr e = effects.at(i);
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
EffectRow* r = e->row(j);
|
||||
for (int l=0;l<r->fieldCount();l++) {
|
||||
|
||||
+25
-28
@@ -24,37 +24,34 @@
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
#include <QVector>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QOpenGLTexture>
|
||||
|
||||
#include "playback/cacher.h"
|
||||
|
||||
#include "project/effect.h"
|
||||
#include "project/transition.h"
|
||||
#include "project/comboaction.h"
|
||||
#include "project/media.h"
|
||||
#include "footage.h"
|
||||
|
||||
#include "marker.h"
|
||||
|
||||
class Cacher;
|
||||
class Effect;
|
||||
class Transition;
|
||||
class QOpenGLFramebufferObject;
|
||||
class ComboAction;
|
||||
class Media;
|
||||
struct Sequence;
|
||||
struct Footage;
|
||||
struct FootageStream;
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavfilter/avfilter.h>
|
||||
}
|
||||
|
||||
struct AVFormatContext;
|
||||
struct AVStream;
|
||||
struct AVCodec;
|
||||
struct AVCodecContext;
|
||||
struct AVFrame;
|
||||
struct AVPacket;
|
||||
struct SwsContext;
|
||||
struct SwrContext;
|
||||
struct AVFilterGraph;
|
||||
struct AVFilterContext;
|
||||
struct AVDictionary;
|
||||
class QOpenGLTexture;
|
||||
using ClipPtr = std::shared_ptr<Clip>;
|
||||
|
||||
class Sequence;
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
class Clip {
|
||||
public:
|
||||
Clip(Sequence* s);
|
||||
Clip(SequencePtr s);
|
||||
~Clip();
|
||||
Clip* copy(Sequence* s, bool duplicate_transitions = true);
|
||||
ClipPtr copy(SequencePtr s, bool duplicate_transitions = true);
|
||||
void reset_audio();
|
||||
void reset();
|
||||
void refresh();
|
||||
@@ -68,7 +65,7 @@ public:
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
void refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points);
|
||||
Sequence* sequence;
|
||||
SequencePtr sequence;
|
||||
|
||||
// queue functions
|
||||
void queue_clear();
|
||||
@@ -84,7 +81,7 @@ public:
|
||||
quint8 color_r;
|
||||
quint8 color_g;
|
||||
quint8 color_b;
|
||||
Media* media;
|
||||
Media* media;
|
||||
int media_stream;
|
||||
double speed;
|
||||
double cached_fr;
|
||||
@@ -96,12 +93,12 @@ public:
|
||||
QVector<Marker>& get_markers();
|
||||
|
||||
// other variables (should be deep copied/duplicated in copy())
|
||||
QList<Effect*> effects;
|
||||
QList<EffectPtr> effects;
|
||||
QVector<int> linked;
|
||||
int opening_transition;
|
||||
Transition* get_opening_transition();
|
||||
TransitionPtr get_opening_transition();
|
||||
int closing_transition;
|
||||
Transition* get_closing_transition();
|
||||
TransitionPtr get_closing_transition();
|
||||
|
||||
// media handling
|
||||
AVFormatContext* formatCtx;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "comboaction.h"
|
||||
|
||||
ComboAction::ComboAction() {}
|
||||
|
||||
ComboAction::~ComboAction() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
delete commands.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::undo() {
|
||||
for (int i=commands.size()-1;i>=0;i--) {
|
||||
commands.at(i)->undo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->undo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::redo() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
commands.at(i)->redo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->redo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::append(QUndoCommand* u) {
|
||||
commands.append(u);
|
||||
}
|
||||
|
||||
void ComboAction::appendPost(QUndoCommand* u) {
|
||||
post_commands.append(u);
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#ifndef COMBOACTION_H
|
||||
#define COMBOACTION_H
|
||||
|
||||
#include <QUndoCommand>
|
||||
#include <QVector>
|
||||
|
||||
/**
|
||||
* @brief The ComboAction class
|
||||
*
|
||||
* The Undo/Redo system works by stacking an action that knows how to "do" and also "undo" itself. As Olive is
|
||||
* a very complex program, there are many actions that can in one "user action". For example, moving a clip over
|
||||
* another will delete the clip under it, which is at least two actions that need to be undone if the user clicks
|
||||
* undo, however the user only (knowingly) did one thing and would find it confusing if this one user action required
|
||||
* to undos to complete undo.
|
||||
*
|
||||
* To address this, ComboAction is an undo action that simply compiles several possible actions into one, doing them
|
||||
* all on every redo, and undoing them all on every undo.
|
||||
*/
|
||||
class ComboAction : public QUndoCommand {
|
||||
public:
|
||||
/**
|
||||
* @brief ComboAction Constructor. Currently empty.
|
||||
*/
|
||||
ComboAction();
|
||||
|
||||
/**
|
||||
* @brief ~ComboAction Destructor. Cleans up all QUndoCommand classes that have been added to it.
|
||||
*/
|
||||
virtual ~ComboAction() override;
|
||||
|
||||
/**
|
||||
* @brief Undo Function
|
||||
*
|
||||
* Called by the QUndoStack to undo.
|
||||
*
|
||||
* Calls QUndoCommand::undo() on all QUndoCommand objects added by append()
|
||||
* in REVERSE order to how they were added. Then calls QUndoCommand::redo() on every action added by appendPost()
|
||||
* in the order they were added (not in reverse).
|
||||
*/
|
||||
virtual void undo() override;
|
||||
|
||||
/**
|
||||
* @brief Redo Function
|
||||
*
|
||||
* Called by the QUndoStack to redo.
|
||||
*
|
||||
* Calls QUndoCommand::redo() on all QUndoCommand objects added by append()
|
||||
* in the order they were added. Then calls QUndoCommand::redo() on every action added by appendPost() in
|
||||
* the order they were added.
|
||||
*/
|
||||
virtual void redo() override;
|
||||
|
||||
/**
|
||||
* @brief Add an undo action
|
||||
*
|
||||
* Add an action to be done/undone. ComboAction takes ownership of this QUndoCommand and will delete it when
|
||||
* it is deleted.
|
||||
*
|
||||
* @param u
|
||||
*
|
||||
* The QUndoCommand to add.
|
||||
*/
|
||||
void append(QUndoCommand* u);
|
||||
|
||||
/**
|
||||
* @brief Add a post-undo PostAction
|
||||
*
|
||||
* Sometimes the results of all the actions require another function to be called (e.g. repainting the Viewer).
|
||||
* QUndoCommand objects added by appendPost() will run after EVERY QUndoCommand added by append() has been run.
|
||||
*
|
||||
* @param u
|
||||
*
|
||||
* The PostAction to add
|
||||
*/
|
||||
void appendPost(QUndoCommand* u);
|
||||
private:
|
||||
/**
|
||||
* @brief Internal array of QUndoCommand objects
|
||||
*/
|
||||
QVector<QUndoCommand*> commands;
|
||||
|
||||
/**
|
||||
* @brief Internal array of PostAction objects
|
||||
*/
|
||||
QVector<QUndoCommand*> post_commands;
|
||||
};
|
||||
|
||||
#endif // COMBOACTION_H
|
||||
+21
-21
@@ -69,31 +69,31 @@
|
||||
|
||||
QVector<EffectMeta> effects;
|
||||
|
||||
Effect* create_effect(Clip* c, const EffectMeta* em) {
|
||||
EffectPtr create_effect(ClipPtr c, const EffectMeta* em) {
|
||||
if (em->internal >= 0 && em->internal < EFFECT_INTERNAL_COUNT) {
|
||||
// must be an internal effect
|
||||
switch (em->internal) {
|
||||
case EFFECT_INTERNAL_TRANSFORM: return new TransformEffect(c, em);
|
||||
case EFFECT_INTERNAL_TEXT: return new TextEffect(c, em);
|
||||
case EFFECT_INTERNAL_TIMECODE: return new TimecodeEffect(c, em);
|
||||
case EFFECT_INTERNAL_SOLID: return new SolidEffect(c, em);
|
||||
case EFFECT_INTERNAL_NOISE: return new AudioNoiseEffect(c, em);
|
||||
case EFFECT_INTERNAL_VOLUME: return new VolumeEffect(c, em);
|
||||
case EFFECT_INTERNAL_PAN: return new PanEffect(c, em);
|
||||
case EFFECT_INTERNAL_TONE: return new ToneEffect(c, em);
|
||||
case EFFECT_INTERNAL_SHAKE: return new ShakeEffect(c, em);
|
||||
case EFFECT_INTERNAL_CORNERPIN: return new CornerPinEffect(c, em);
|
||||
case EFFECT_INTERNAL_FILLLEFTRIGHT: return new FillLeftRightEffect(c, em);
|
||||
case EFFECT_INTERNAL_TRANSFORM: return EffectPtr(new TransformEffect(c, em));
|
||||
case EFFECT_INTERNAL_TEXT: return EffectPtr(new TextEffect(c, em));
|
||||
case EFFECT_INTERNAL_TIMECODE: return EffectPtr(new TimecodeEffect(c, em));
|
||||
case EFFECT_INTERNAL_SOLID: return EffectPtr(new SolidEffect(c, em));
|
||||
case EFFECT_INTERNAL_NOISE: return EffectPtr(new AudioNoiseEffect(c, em));
|
||||
case EFFECT_INTERNAL_VOLUME: return EffectPtr(new VolumeEffect(c, em));
|
||||
case EFFECT_INTERNAL_PAN: return EffectPtr(new PanEffect(c, em));
|
||||
case EFFECT_INTERNAL_TONE: return EffectPtr(new ToneEffect(c, em));
|
||||
case EFFECT_INTERNAL_SHAKE: return EffectPtr(new ShakeEffect(c, em));
|
||||
case EFFECT_INTERNAL_CORNERPIN: return EffectPtr(new CornerPinEffect(c, em));
|
||||
case EFFECT_INTERNAL_FILLLEFTRIGHT: return EffectPtr(new FillLeftRightEffect(c, em));
|
||||
#ifndef NOVST
|
||||
case EFFECT_INTERNAL_VST: return new VSTHost(c, em);
|
||||
case EFFECT_INTERNAL_VST: return EffectPtr(new VSTHost(c, em));
|
||||
#endif
|
||||
#ifndef NOFREI0R
|
||||
case EFFECT_INTERNAL_FREI0R: return new Frei0rEffect(c, em);
|
||||
case EFFECT_INTERNAL_FREI0R: return EffectPtr(new Frei0rEffect(c, em));
|
||||
#endif
|
||||
}
|
||||
} else if (!em->filename.isEmpty()) {
|
||||
// load effect from file
|
||||
return new Effect(c, em);
|
||||
return EffectPtr(new Effect(c, em));
|
||||
} else {
|
||||
qCritical() << "Invalid effect data";
|
||||
QMessageBox::critical(olive::MainWindow,
|
||||
@@ -112,7 +112,7 @@ const EffectMeta* get_internal_meta(int internal_id, int type) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
Effect::Effect(ClipPtr c, const EffectMeta *em) :
|
||||
parent_clip(c),
|
||||
meta(em),
|
||||
enable_shader(false),
|
||||
@@ -344,7 +344,7 @@ Effect::~Effect() {
|
||||
}
|
||||
}
|
||||
|
||||
void Effect::copy_field_keyframes(Effect* e) {
|
||||
void Effect::copy_field_keyframes(EffectPtr e) {
|
||||
for (int i=0;i<rows.size();i++) {
|
||||
EffectRow* row = rows.at(i);
|
||||
EffectRow* copy_row = e->rows.at(i);
|
||||
@@ -498,7 +498,7 @@ void Effect::load_from_file() {
|
||||
QFile file_handle(file);
|
||||
if (file_handle.open(QFile::ReadOnly)) {
|
||||
|
||||
olive::UndoStack.push(new SetEffectData(this, file_handle.readAll()));
|
||||
olive::UndoStack.push(new SetEffectData(EffectPtr(this), file_handle.readAll()));
|
||||
|
||||
file_handle.close();
|
||||
|
||||
@@ -515,7 +515,7 @@ void Effect::load_from_file() {
|
||||
int Effect::get_index_in_clip() {
|
||||
if (parent_clip != nullptr) {
|
||||
for (int i=0;i<parent_clip->effects.size();i++) {
|
||||
if (parent_clip->effects.at(i) == this) {
|
||||
if (parent_clip->effects.at(i).get() == this) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -854,8 +854,8 @@ void Effect::setIterations(int i) {
|
||||
|
||||
void Effect::process_image(double, uint8_t *, uint8_t *, int){}
|
||||
|
||||
Effect* Effect::copy(Clip* c) {
|
||||
Effect* copy = create_effect(c, meta);
|
||||
EffectPtr Effect::copy(ClipPtr c) {
|
||||
EffectPtr copy = create_effect(c, meta);
|
||||
copy->set_enabled(is_enabled());
|
||||
copy_field_keyframes(copy);
|
||||
return copy;
|
||||
|
||||
+18
-15
@@ -30,19 +30,22 @@
|
||||
#include <QOpenGLTexture>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
class QLabel;
|
||||
class QWidget;
|
||||
class CollapsibleWidget;
|
||||
class QGridLayout;
|
||||
class QPushButton;
|
||||
class QMouseEvent;
|
||||
#include <QLabel>
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
#include <QMouseEvent>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "ui/checkboxex.h"
|
||||
|
||||
class Clip;
|
||||
class QXmlStreamReader;
|
||||
class QXmlStreamWriter;
|
||||
using ClipPtr = std::shared_ptr<Clip>;
|
||||
|
||||
class Effect;
|
||||
class EffectRow;
|
||||
class CheckboxEx;
|
||||
using EffectPtr = std::shared_ptr<Effect>;
|
||||
|
||||
struct EffectMeta {
|
||||
QString name;
|
||||
@@ -57,7 +60,7 @@ struct EffectMeta {
|
||||
extern QVector<EffectMeta> effects;
|
||||
|
||||
double log_volume(double linear);
|
||||
Effect* create_effect(Clip* c, const EffectMeta *em);
|
||||
EffectPtr create_effect(ClipPtr c, const EffectMeta *em);
|
||||
const EffectMeta* get_internal_meta(int internal_id, int type);
|
||||
|
||||
enum EffectType {
|
||||
@@ -166,9 +169,9 @@ qint16 mix_audio_sample(qint16 a, qint16 b);
|
||||
class Effect : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Effect(Clip* c, const EffectMeta* em);
|
||||
Effect(ClipPtr c, const EffectMeta* em);
|
||||
~Effect();
|
||||
Clip* parent_clip;
|
||||
ClipPtr parent_clip;
|
||||
const EffectMeta* meta;
|
||||
int id;
|
||||
QString name;
|
||||
@@ -187,8 +190,8 @@ public:
|
||||
|
||||
virtual void refresh();
|
||||
|
||||
virtual Effect* copy(Clip* c);
|
||||
void copy_field_keyframes(Effect *e);
|
||||
virtual EffectPtr copy(ClipPtr c);
|
||||
void copy_field_keyframes(EffectPtr e);
|
||||
|
||||
virtual void load(QXmlStreamReader& stream);
|
||||
virtual void custom_load(QXmlStreamReader& stream);
|
||||
|
||||
@@ -116,7 +116,7 @@ void EffectRow::set_keyframe_enabled(bool enabled) {
|
||||
|
||||
void EffectRow::goto_previous_key() {
|
||||
long key = LONG_MIN;
|
||||
Clip* c = parent_effect->parent_clip;
|
||||
ClipPtr c = parent_effect->parent_clip;
|
||||
for (int i=0;i<fieldCount();i++) {
|
||||
EffectField* f = field(i);
|
||||
for (int j=0;j<f->keyframes.size();j++) {
|
||||
@@ -132,7 +132,7 @@ void EffectRow::goto_previous_key() {
|
||||
void EffectRow::toggle_key() {
|
||||
QVector<EffectField*> key_fields;
|
||||
QVector<int> key_field_index;
|
||||
Clip* c = parent_effect->parent_clip;
|
||||
ClipPtr c = parent_effect->parent_clip;
|
||||
for (int j=0;j<fieldCount();j++) {
|
||||
EffectField* f = field(j);
|
||||
for (int i=0;i<f->keyframes.size();i++) {
|
||||
@@ -159,7 +159,7 @@ void EffectRow::toggle_key() {
|
||||
|
||||
void EffectRow::goto_next_key() {
|
||||
long key = LONG_MAX;
|
||||
Clip* c = parent_effect->parent_clip;
|
||||
ClipPtr c = parent_effect->parent_clip;
|
||||
for (int i=0;i<fieldCount();i++) {
|
||||
EffectField* f = field(i);
|
||||
for (int j=0;j<f->keyframes.size();j++) {
|
||||
|
||||
+3
-1
@@ -37,7 +37,7 @@ enum VideoInterlacingMode {
|
||||
VIDEO_BOTTOM_FIELD_FIRST
|
||||
};
|
||||
|
||||
struct Sequence;
|
||||
class Sequence;
|
||||
class Clip;
|
||||
class PreviewGenerator;
|
||||
class MediaThrobber;
|
||||
@@ -101,4 +101,6 @@ struct Footage {
|
||||
void reset();
|
||||
};
|
||||
|
||||
using FootagePtr = std::shared_ptr<Footage>;
|
||||
|
||||
#endif // FOOTAGE_H
|
||||
|
||||
+3
-3
@@ -48,7 +48,7 @@ void draw_marker(QPainter &p, int x, int y, int bottom, bool selected) {
|
||||
p.drawPolygon(points, 5);
|
||||
}
|
||||
|
||||
void set_marker_internal(Sequence* seq, const QVector<int>& clips) {
|
||||
void set_marker_internal(SequencePtr seq, const QVector<int>& clips) {
|
||||
// if clips is empty, the marker is being added to the sequence
|
||||
|
||||
// add_marker is used to determine whether we're adding a marker, depending on whether the user input a marker name
|
||||
@@ -78,7 +78,7 @@ void set_marker_internal(Sequence* seq, const QVector<int>& clips) {
|
||||
|
||||
// add a marker action for each clip
|
||||
foreach (int i, clips) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
ClipPtr c = seq->clips.at(i);
|
||||
ca->append(new AddMarkerAction(&c->get_markers(),
|
||||
seq->playhead - c->timeline_in + c->clip_in,
|
||||
marker_name));
|
||||
@@ -119,7 +119,7 @@ void set_marker_internal(Sequence* seq, const QVector<int>& clips) {
|
||||
}
|
||||
}
|
||||
|
||||
void set_marker_internal(Sequence* seq) {
|
||||
void set_marker_internal(SequencePtr seq) {
|
||||
// create empty clip array
|
||||
QVector<int> clips;
|
||||
|
||||
|
||||
+4
-3
@@ -26,7 +26,8 @@
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
|
||||
struct Sequence;
|
||||
class Sequence;
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
struct Marker {
|
||||
long frame;
|
||||
@@ -35,7 +36,7 @@ struct Marker {
|
||||
|
||||
void draw_marker(QPainter& p, int x, int y, int bottom, bool selected);
|
||||
|
||||
void set_marker_internal(Sequence* seq, const QVector<int>& clips);
|
||||
void set_marker_internal(Sequence* seq);
|
||||
void set_marker_internal(SequencePtr seq, const QVector<int>& clips);
|
||||
void set_marker_internal(SequencePtr seq);
|
||||
|
||||
#endif // MARKER_H
|
||||
|
||||
+20
-21
@@ -68,30 +68,29 @@ Media::Media(Media* iparent) :
|
||||
{}
|
||||
|
||||
Media::~Media() {
|
||||
switch (get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE: delete to_footage(); break;
|
||||
case MEDIA_TYPE_SEQUENCE: if (object != nullptr) delete to_sequence(); break;
|
||||
}
|
||||
for (int i=0;i<children.size();i++) {
|
||||
delete children.at(i);
|
||||
}
|
||||
delete throbber;
|
||||
}
|
||||
|
||||
Footage *Media::to_footage() {
|
||||
return static_cast<Footage*>(object);
|
||||
FootagePtr Media::to_footage() {
|
||||
return std::static_pointer_cast<Footage>(object);
|
||||
}
|
||||
|
||||
Sequence *Media::to_sequence() {
|
||||
return static_cast<Sequence*>(object);
|
||||
SequencePtr Media::to_sequence() {
|
||||
return std::static_pointer_cast<Sequence>(object);
|
||||
}
|
||||
|
||||
void Media::set_footage(Footage *f) {
|
||||
void Media::set_footage(FootagePtr f) {
|
||||
type = MEDIA_TYPE_FOOTAGE;
|
||||
object = f;
|
||||
object = VoidPtr(f);
|
||||
}
|
||||
|
||||
void Media::set_sequence(Sequence *s) {
|
||||
void Media::set_sequence(SequencePtr s) {
|
||||
set_icon(QIcon(":/icons/sequence.png"));
|
||||
type = MEDIA_TYPE_SEQUENCE;
|
||||
object = s;
|
||||
object = VoidPtr(s);
|
||||
if (s != nullptr) update_tooltip();
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
switch (type) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
tooltip = QCoreApplication::translate("Media", "Name:") + " " + f->name + "\n" + QCoreApplication::translate("Media", "Filename:") + " " + f->url + "\n";
|
||||
|
||||
if (error.isEmpty()) {
|
||||
@@ -185,7 +184,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = to_sequence();
|
||||
SequencePtr s = to_sequence();
|
||||
|
||||
tooltip = QCoreApplication::translate("Media", "Name: %1"
|
||||
"\nVideo Dimensions: %2x%3"
|
||||
@@ -205,7 +204,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
|
||||
}
|
||||
|
||||
void *Media::to_object() {
|
||||
VoidPtr Media::to_object() {
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -233,7 +232,7 @@ double Media::get_frame_rate(int stream) {
|
||||
switch (get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
if (stream < 0) return f->video_tracks.at(0).video_frame_rate * f->speed;
|
||||
return f->get_stream_from_file_index(true, stream)->video_frame_rate * f->speed;
|
||||
}
|
||||
@@ -246,7 +245,7 @@ int Media::get_sampling_rate(int stream) {
|
||||
switch (get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
if (stream < 0) return f->audio_tracks.at(0).audio_frequency * f->speed;
|
||||
return to_footage()->get_stream_from_file_index(false, stream)->audio_frequency * f->speed;
|
||||
}
|
||||
@@ -288,7 +287,7 @@ QVariant Media::data(int column, int role) {
|
||||
case Qt::DecorationRole:
|
||||
if (column == 0) {
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
if (f->video_tracks.size() > 0
|
||||
&& f->video_tracks.at(0).preview_done) {
|
||||
return f->video_tracks.at(0).video_preview_square;
|
||||
@@ -304,11 +303,11 @@ QVariant Media::data(int column, int role) {
|
||||
case 1:
|
||||
if (root) return QCoreApplication::translate("Media", "Duration");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence();
|
||||
SequencePtr s = to_sequence();
|
||||
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
|
||||
}
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
double r = 30;
|
||||
|
||||
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
|
||||
@@ -322,7 +321,7 @@ QVariant Media::data(int column, int role) {
|
||||
if (root) return QCoreApplication::translate("Media", "Rate");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) return QString::number(get_frame_rate()) + " FPS";
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
FootagePtr f = to_footage();
|
||||
double r;
|
||||
if (f->video_tracks.size() > 0 && !qIsNull(r = get_frame_rate())) {
|
||||
return QString::number(get_frame_rate()) + " FPS";
|
||||
|
||||
+13
-9
@@ -23,8 +23,10 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QIcon>
|
||||
|
||||
#include "project/marker.h"
|
||||
#include "project/footage.h"
|
||||
|
||||
enum MediaType {
|
||||
MEDIA_TYPE_FOOTAGE,
|
||||
@@ -32,25 +34,27 @@ enum MediaType {
|
||||
MEDIA_TYPE_FOLDER
|
||||
};
|
||||
|
||||
struct Footage;
|
||||
class Sequence;
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
using VoidPtr = std::shared_ptr<void>;
|
||||
|
||||
class MediaThrobber;
|
||||
struct Sequence;
|
||||
#include <QIcon>
|
||||
|
||||
class Media
|
||||
{
|
||||
public:
|
||||
Media(Media* iparent);
|
||||
~Media();
|
||||
Footage *to_footage();
|
||||
Sequence* to_sequence();
|
||||
void set_footage(Footage* f);
|
||||
void set_sequence(Sequence* s);
|
||||
FootagePtr to_footage();
|
||||
SequencePtr to_sequence();
|
||||
void set_footage(FootagePtr f);
|
||||
void set_sequence(SequencePtr s);
|
||||
void set_folder();
|
||||
void set_icon(const QIcon &ico);
|
||||
void set_parent(Media* p);
|
||||
void update_tooltip(const QString& error = 0);
|
||||
void *to_object();
|
||||
VoidPtr to_object();
|
||||
int get_type();
|
||||
const QString& get_name();
|
||||
void set_name(const QString& n);
|
||||
@@ -78,7 +82,7 @@ public:
|
||||
int temp_id2;
|
||||
private:
|
||||
int type;
|
||||
void* object;
|
||||
VoidPtr object;
|
||||
|
||||
// item functions
|
||||
QList<Media*> children;
|
||||
|
||||
@@ -99,8 +99,8 @@ QModelIndex ProjectModel::index(int row, int column, const QModelIndex &parent)
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QModelIndex ProjectModel::create_index(int arow, int acolumn, void* aid) {
|
||||
return createIndex(arow, acolumn, aid);
|
||||
QModelIndex ProjectModel::create_index(int arow, int acolumn, void* adata) {
|
||||
return createIndex(arow, acolumn, adata);
|
||||
}
|
||||
|
||||
QModelIndex ProjectModel::parent(const QModelIndex &index) const {
|
||||
|
||||
+11
-11
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
class Media;
|
||||
#include "project/media.h"
|
||||
|
||||
class ProjectModel : public QAbstractItemModel
|
||||
{
|
||||
@@ -35,29 +35,29 @@ public:
|
||||
void make_root();
|
||||
void destroy_root();
|
||||
void clear();
|
||||
Media* get_root();
|
||||
Media* get_root();
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex create_index(int arow, int acolumn, void *aid);
|
||||
QModelIndex create_index(int arow, int acolumn, void *adata);
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
Media *getItem(const QModelIndex &index) const;
|
||||
Media* getItem(const QModelIndex &index) const;
|
||||
|
||||
void appendChild(Media* parent, Media* child);
|
||||
void moveChild(Media *child, Media *to);
|
||||
void removeChild(Media *parent, Media* m);
|
||||
Media *child(int i, Media* parent = nullptr);
|
||||
int childCount(Media* parent = nullptr);
|
||||
void set_icon(Media* m, const QIcon &ico);
|
||||
void appendChild(Media* parent, Media* child);
|
||||
void moveChild(Media* child, Media* to);
|
||||
void removeChild(Media* parent, Media* m);
|
||||
Media* child(int i, Media* parent = nullptr);
|
||||
int childCount(Media* parent = nullptr);
|
||||
void set_icon(Media* m, const QIcon &ico);
|
||||
|
||||
private:
|
||||
Media* root_item;
|
||||
Media* root_item;
|
||||
};
|
||||
|
||||
#endif // PROJECTMODEL_H
|
||||
|
||||
+13
-22
@@ -20,9 +20,6 @@
|
||||
|
||||
#include "sequence.h"
|
||||
|
||||
#include "clip.h"
|
||||
#include "transition.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "debug.h"
|
||||
@@ -36,15 +33,10 @@ Sequence::Sequence() :
|
||||
{
|
||||
}
|
||||
|
||||
Sequence::~Sequence() {
|
||||
// dealloc all clips
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
delete clips.at(i);
|
||||
}
|
||||
}
|
||||
Sequence::~Sequence() {}
|
||||
|
||||
Sequence* Sequence::copy() {
|
||||
Sequence* s = new Sequence();
|
||||
SequencePtr Sequence::copy() {
|
||||
SequencePtr s(new Sequence());
|
||||
s->name = QCoreApplication::translate("Sequence", "%1 (copy)").arg(name);
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
@@ -53,11 +45,11 @@ Sequence* Sequence::copy() {
|
||||
s->audio_layout = audio_layout;
|
||||
s->clips.resize(clips.size());
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
if (c == nullptr) {
|
||||
s->clips[i] = nullptr;
|
||||
} else {
|
||||
Clip* copy = c->copy(s);
|
||||
ClipPtr copy = c->copy(s);
|
||||
copy->linked = c->linked;
|
||||
s->clips[i] = copy;
|
||||
}
|
||||
@@ -68,7 +60,7 @@ Sequence* Sequence::copy() {
|
||||
long Sequence::getEndFrame() {
|
||||
long end = 0;
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
ClipPtr c = clips.at(j);
|
||||
if (c != nullptr && c->timeline_out > end) {
|
||||
end = c->timeline_out;
|
||||
}
|
||||
@@ -76,15 +68,15 @@ long Sequence::getEndFrame() {
|
||||
return end;
|
||||
}
|
||||
|
||||
void Sequence::hard_delete_transition(Clip *c, int type) {
|
||||
void Sequence::hard_delete_transition(ClipPtr c, int type) {
|
||||
int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition;
|
||||
if (transition_index > -1) {
|
||||
bool del = true;
|
||||
|
||||
Transition* t = transitions.at(transition_index);
|
||||
TransitionPtr t = transitions.at(transition_index);
|
||||
if (t->secondary_clip != nullptr) {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* comp = clips.at(i);
|
||||
ClipPtr comp = clips.at(i);
|
||||
if (comp != nullptr
|
||||
&& c != comp
|
||||
&& (c->opening_transition == transition_index
|
||||
@@ -100,9 +92,8 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
|
||||
}
|
||||
}
|
||||
|
||||
if (del) {
|
||||
delete transitions.at(transition_index);
|
||||
transitions[transition_index] = nullptr;
|
||||
if (del) {
|
||||
transitions[transition_index].reset();
|
||||
}
|
||||
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
@@ -117,7 +108,7 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||
int vt = 0;
|
||||
int at = 0;
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
ClipPtr c = clips.at(j);
|
||||
if (c != nullptr) {
|
||||
if (c->track < 0 && c->track < vt) { // video clip
|
||||
vt = c->track;
|
||||
@@ -131,4 +122,4 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||
}
|
||||
|
||||
// static variable for the currently active sequence
|
||||
Sequence* olive::ActiveSequence = nullptr;
|
||||
SequencePtr olive::ActiveSequence = nullptr;
|
||||
|
||||
+11
-10
@@ -23,21 +23,20 @@
|
||||
|
||||
#include <QVector>
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "project/marker.h"
|
||||
#include "project/transition.h"
|
||||
#include "project/selection.h"
|
||||
|
||||
class Clip;
|
||||
class Transition;
|
||||
class Media;
|
||||
|
||||
struct Sequence {
|
||||
class Sequence {
|
||||
public:
|
||||
Sequence();
|
||||
~Sequence();
|
||||
Sequence* copy();
|
||||
SequencePtr copy();
|
||||
QString name;
|
||||
void getTrackLimits(int* video_tracks, int* audio_tracks);
|
||||
long getEndFrame();
|
||||
void hard_delete_transition(Clip *c, int type);
|
||||
void hard_delete_transition(ClipPtr c, int type);
|
||||
int width;
|
||||
int height;
|
||||
double frame_rate;
|
||||
@@ -56,13 +55,15 @@ struct Sequence {
|
||||
int save_id;
|
||||
|
||||
QVector<Marker> markers;
|
||||
QVector<Clip*> clips;
|
||||
QVector<Transition*> transitions;
|
||||
QVector<ClipPtr> clips;
|
||||
QVector<TransitionPtr> transitions;
|
||||
};
|
||||
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
// static variable for the currently active sequence
|
||||
namespace olive {
|
||||
extern Sequence* ActiveSequence;
|
||||
extern SequencePtr ActiveSequence;
|
||||
}
|
||||
|
||||
#endif // SEQUENCE_H
|
||||
|
||||
@@ -62,7 +62,7 @@ void SourcesCommon::create_seq_from_selected() {
|
||||
}
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
Sequence* s = create_sequence_from_media(media_list);
|
||||
SequencePtr s = create_sequence_from_media(media_list);
|
||||
|
||||
// add clips to it
|
||||
panel_timeline->create_ghosts_from_media(s, 0, media_list);
|
||||
@@ -334,7 +334,7 @@ void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIn
|
||||
|
||||
void SourcesCommon::reveal_in_browser() {
|
||||
Media* media = project_parent->item_to_media(selected_items.at(0));
|
||||
Footage* m = media->to_footage();
|
||||
FootagePtr m = media->to_footage();
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QStringList args;
|
||||
@@ -385,7 +385,7 @@ void SourcesCommon::clear_proxies_from_selected() {
|
||||
QList<QString> delete_list;
|
||||
|
||||
for (int i=0;i<cached_selected_footage.size();i++) {
|
||||
Footage* f = cached_selected_footage.at(i);
|
||||
FootagePtr f = cached_selected_footage.at(i);
|
||||
|
||||
if (f->proxy && !f->proxy_path.isEmpty()) {
|
||||
if (QFileInfo::exists(f->proxy_path)) {
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
||||
#include "project/footage.h"
|
||||
|
||||
class Project;
|
||||
class QMouseEvent;
|
||||
class Media;
|
||||
@@ -63,7 +65,7 @@ private:
|
||||
QTimer rename_timer;
|
||||
|
||||
// we cache the selected footage items for open_create_proxy_dialog()
|
||||
QVector<Footage*> cached_selected_footage;
|
||||
QVector<FootagePtr> cached_selected_footage;
|
||||
};
|
||||
|
||||
#endif // SOURCESCOMMON_H
|
||||
|
||||
+12
-12
@@ -41,7 +41,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCoreApplication>
|
||||
|
||||
Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) :
|
||||
Transition::Transition(ClipPtr c, ClipPtr s, const EffectMeta* em) :
|
||||
Effect(c, em), secondary_clip(s),
|
||||
length(30)
|
||||
{
|
||||
@@ -55,7 +55,7 @@ Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) :
|
||||
length_ui_ele->set_frame_rate(parent_clip->sequence == nullptr ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
|
||||
}
|
||||
|
||||
int Transition::copy(Clip *c, Clip* s) {
|
||||
int Transition::copy(ClipPtr c, ClipPtr s) {
|
||||
return create_transition(c, s, meta, length);
|
||||
}
|
||||
|
||||
@@ -80,18 +80,18 @@ void Transition::set_length_from_slider() {
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
|
||||
TransitionPtr get_transition_from_meta(ClipPtr c, ClipPtr s, const EffectMeta* em) {
|
||||
if (!em->filename.isEmpty()) {
|
||||
// load effect from file
|
||||
return new Transition(c, s, em);
|
||||
return TransitionPtr(new Transition(c, s, em));
|
||||
} else if (em->internal >= 0 && em->internal < TRANSITION_INTERNAL_COUNT) {
|
||||
// must be an internal effect
|
||||
switch (em->internal) {
|
||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return new CrossDissolveTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_CUBE: return new CubeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return TransitionPtr(new CrossDissolveTransition(c, s, em));
|
||||
case TRANSITION_INTERNAL_LINEARFADE: return TransitionPtr(new LinearFadeTransition(c, s, em));
|
||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return TransitionPtr(new ExponentialFadeTransition(c, s, em));
|
||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return TransitionPtr(new LogarithmicFadeTransition(c, s, em));
|
||||
case TRANSITION_INTERNAL_CUBE: return TransitionPtr(new CubeTransition(c, s, em));
|
||||
}
|
||||
} else {
|
||||
qCritical() << "Invalid transition data";
|
||||
@@ -103,11 +103,11 @@ Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em, long length) {
|
||||
Transition* t = get_transition_from_meta(c, s, em);
|
||||
int create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length) {
|
||||
TransitionPtr t(get_transition_from_meta(c, s, em));
|
||||
if (t != nullptr) {
|
||||
if (length >= 0) t->set_length(length);
|
||||
QVector<Transition*>& transition_list = (c->sequence == nullptr) ? clipboard_transitions : c->sequence->transitions;
|
||||
QVector<TransitionPtr>& transition_list = (c->sequence == nullptr) ? clipboard_transitions : c->sequence->transitions;
|
||||
transition_list.append(t);
|
||||
return transition_list.size() - 1;
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@
|
||||
#define TRANSITION_INTERNAL_CUBE 4
|
||||
#define TRANSITION_INTERNAL_COUNT 5
|
||||
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em, long length = -1);
|
||||
int create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length = -1);
|
||||
|
||||
class Transition : public Effect {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Transition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
int copy(Clip* c, Clip* s);
|
||||
Clip* secondary_clip;
|
||||
Transition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||
int copy(ClipPtr c, ClipPtr s);
|
||||
ClipPtr secondary_clip;
|
||||
void set_length(long l);
|
||||
long get_true_length();
|
||||
long get_length();
|
||||
@@ -52,4 +52,6 @@ private:
|
||||
EffectField* length_field;
|
||||
};
|
||||
|
||||
using TransitionPtr = std::shared_ptr<Transition>;
|
||||
|
||||
#endif // TRANSITION_H
|
||||
|
||||
+45
-104
@@ -48,41 +48,7 @@
|
||||
|
||||
QUndoStack olive::UndoStack;
|
||||
|
||||
ComboAction::ComboAction() {}
|
||||
|
||||
ComboAction::~ComboAction() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
delete commands.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::undo() {
|
||||
for (int i=commands.size()-1;i>=0;i--) {
|
||||
commands.at(i)->undo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->undo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::redo() {
|
||||
for (int i=0;i<commands.size();i++) {
|
||||
commands.at(i)->redo();
|
||||
}
|
||||
for (int i=0;i<post_commands.size();i++) {
|
||||
post_commands.at(i)->redo();
|
||||
}
|
||||
}
|
||||
|
||||
void ComboAction::append(QUndoCommand* u) {
|
||||
commands.append(u);
|
||||
}
|
||||
|
||||
void ComboAction::appendPost(QUndoCommand* u) {
|
||||
post_commands.append(u);
|
||||
}
|
||||
|
||||
MoveClipAction::MoveClipAction(Clip *c, long iin, long iout, long iclip_in, int itrack, bool irelative) {
|
||||
MoveClipAction::MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative) {
|
||||
clip = c;
|
||||
|
||||
old_in = c->timeline_in;
|
||||
@@ -126,16 +92,14 @@ void MoveClipAction::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
DeleteClipAction::DeleteClipAction(Sequence* s, int clip) {
|
||||
DeleteClipAction::DeleteClipAction(SequencePtr s, int clip) {
|
||||
seq = s;
|
||||
index = clip;
|
||||
opening_transition = -1;
|
||||
closing_transition = -1;
|
||||
}
|
||||
|
||||
DeleteClipAction::~DeleteClipAction() {
|
||||
if (ref != nullptr) delete ref;
|
||||
}
|
||||
DeleteClipAction::~DeleteClipAction() {}
|
||||
|
||||
void DeleteClipAction::doUndo() {
|
||||
// restore ref to clip
|
||||
@@ -187,7 +151,7 @@ void DeleteClipAction::doRedo() {
|
||||
linkClipIndex.clear();
|
||||
linkLinkIndex.clear();
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
ClipPtr c = seq->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<c->linked.size();j++) {
|
||||
if (c->linked.at(j) == index) {
|
||||
@@ -200,7 +164,7 @@ void DeleteClipAction::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
ChangeSequenceAction::ChangeSequenceAction(Sequence* s) {
|
||||
ChangeSequenceAction::ChangeSequenceAction(SequencePtr s) {
|
||||
new_sequence = s;
|
||||
}
|
||||
|
||||
@@ -213,7 +177,7 @@ void ChangeSequenceAction::doRedo() {
|
||||
set_sequence(new_sequence);
|
||||
}
|
||||
|
||||
SetTimelineInOutCommand::SetTimelineInOutCommand(Sequence *s, bool enabled, long in, long out) {
|
||||
SetTimelineInOutCommand::SetTimelineInOutCommand(SequencePtr s, bool enabled, long in, long out) {
|
||||
seq = s;
|
||||
new_enabled = enabled;
|
||||
new_in = in;
|
||||
@@ -227,7 +191,7 @@ void SetTimelineInOutCommand::doUndo() {
|
||||
|
||||
// footage viewer functions
|
||||
if (seq->wrapper_sequence) {
|
||||
Footage* m = seq->clips.at(0)->media->to_footage();
|
||||
FootagePtr m = seq->clips.at(0)->media->to_footage();
|
||||
m->using_inout = old_enabled;
|
||||
m->in = old_in;
|
||||
m->out = old_out;
|
||||
@@ -245,14 +209,14 @@ void SetTimelineInOutCommand::doRedo() {
|
||||
|
||||
// footage viewer functions
|
||||
if (seq->wrapper_sequence) {
|
||||
Footage* m = seq->clips.at(0)->media->to_footage();
|
||||
FootagePtr m = seq->clips.at(0)->media->to_footage();
|
||||
m->using_inout = new_enabled;
|
||||
m->in = new_in;
|
||||
m->out = new_out;
|
||||
}
|
||||
}
|
||||
|
||||
AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m, int insert_pos) {
|
||||
AddEffectCommand::AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta *m, int insert_pos) {
|
||||
clip = c;
|
||||
ref = e;
|
||||
meta = m;
|
||||
@@ -260,10 +224,6 @@ AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m, int
|
||||
done = false;
|
||||
}
|
||||
|
||||
AddEffectCommand::~AddEffectCommand() {
|
||||
if (!done && ref != nullptr) delete ref;
|
||||
}
|
||||
|
||||
void AddEffectCommand::doUndo() {
|
||||
clip->effects.last()->close();
|
||||
if (pos < 0) {
|
||||
@@ -286,9 +246,9 @@ void AddEffectCommand::doRedo() {
|
||||
done = true;
|
||||
}
|
||||
|
||||
AddTransitionCommand::AddTransitionCommand(Clip* c,
|
||||
Clip *s,
|
||||
Transition* copy,
|
||||
AddTransitionCommand::AddTransitionCommand(ClipPtr c,
|
||||
ClipPtr s,
|
||||
TransitionPtr copy,
|
||||
const EffectMeta *itransition,
|
||||
int itype,
|
||||
int ilength) {
|
||||
@@ -337,24 +297,24 @@ void AddTransitionCommand::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
ModifyTransitionCommand::ModifyTransitionCommand(Clip* c, int itype, long ilength) {
|
||||
ModifyTransitionCommand::ModifyTransitionCommand(ClipPtr c, int itype, long ilength) {
|
||||
clip = c;
|
||||
type = itype;
|
||||
new_length = ilength;
|
||||
}
|
||||
|
||||
void ModifyTransitionCommand::doUndo() {
|
||||
Transition* t = (type == TA_OPENING_TRANSITION) ? clip->get_opening_transition() : clip->get_closing_transition();
|
||||
TransitionPtr t = (type == TA_OPENING_TRANSITION) ? clip->get_opening_transition() : clip->get_closing_transition();
|
||||
t->set_length(old_length);
|
||||
}
|
||||
|
||||
void ModifyTransitionCommand::doRedo() {
|
||||
Transition* t = (type == TA_OPENING_TRANSITION) ? clip->get_opening_transition() : clip->get_closing_transition();
|
||||
TransitionPtr t = (type == TA_OPENING_TRANSITION) ? clip->get_opening_transition() : clip->get_closing_transition();
|
||||
old_length = t->get_true_length();
|
||||
t->set_length(new_length);
|
||||
}
|
||||
|
||||
DeleteTransitionCommand::DeleteTransitionCommand(Sequence* s, int transition_index) {
|
||||
DeleteTransitionCommand::DeleteTransitionCommand(SequencePtr s, int transition_index) {
|
||||
seq = s;
|
||||
index = transition_index;
|
||||
transition = nullptr;
|
||||
@@ -362,9 +322,7 @@ DeleteTransitionCommand::DeleteTransitionCommand(Sequence* s, int transition_ind
|
||||
ctc = nullptr;
|
||||
}
|
||||
|
||||
DeleteTransitionCommand::~DeleteTransitionCommand() {
|
||||
if (transition != nullptr) delete transition;
|
||||
}
|
||||
DeleteTransitionCommand::~DeleteTransitionCommand() {}
|
||||
|
||||
void DeleteTransitionCommand::doUndo() {
|
||||
seq->transitions[index] = transition;
|
||||
@@ -377,7 +335,7 @@ void DeleteTransitionCommand::doUndo() {
|
||||
|
||||
void DeleteTransitionCommand::doRedo() {
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
ClipPtr c = seq->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (c->opening_transition == index) {
|
||||
otc = c;
|
||||
@@ -466,24 +424,17 @@ void DeleteMediaCommand::doRedo() {
|
||||
done = true;
|
||||
}
|
||||
|
||||
AddClipCommand::AddClipCommand(Sequence* s, QVector<Clip*>& add) {
|
||||
AddClipCommand::AddClipCommand(SequencePtr s, QVector<ClipPtr>& add) {
|
||||
seq = s;
|
||||
clips = add;
|
||||
}
|
||||
|
||||
AddClipCommand::~AddClipCommand() {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
delete clips.at(i);
|
||||
}
|
||||
for (int i=0;i<undone_clips.size();i++) {
|
||||
delete undone_clips.at(i);
|
||||
}
|
||||
}
|
||||
AddClipCommand::~AddClipCommand() {}
|
||||
|
||||
void AddClipCommand::doUndo() {
|
||||
panel_effect_controls->clear_effects(true);
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = seq->clips.last();
|
||||
ClipPtr c = seq->clips.last();
|
||||
panel_timeline->deselect_area(c->timeline_in, c->timeline_out, c->track);
|
||||
undone_clips.prepend(c);
|
||||
if (c->open) close_clip(c, true);
|
||||
@@ -501,9 +452,9 @@ void AddClipCommand::doRedo() {
|
||||
} else {
|
||||
int linkOffset = seq->clips.size();
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* original = clips.at(i);
|
||||
ClipPtr original = clips.at(i);
|
||||
if (original != nullptr) {
|
||||
Clip* copy = original->copy(seq);
|
||||
ClipPtr copy = original->copy(seq);
|
||||
copy->linked.resize(original->linked.size());
|
||||
for (int j=0;j<original->linked.size();j++) {
|
||||
copy->linked[j] = original->linked.at(j) + linkOffset;
|
||||
@@ -524,7 +475,7 @@ LinkCommand::LinkCommand() {
|
||||
|
||||
void LinkCommand::doUndo() {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = s->clips.at(clips.at(i));
|
||||
ClipPtr c = s->clips.at(clips.at(i));
|
||||
if (link) {
|
||||
c->linked.clear();
|
||||
} else {
|
||||
@@ -538,7 +489,7 @@ void LinkCommand::doRedo() {
|
||||
old_links.clear();
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
dout << clips.at(i);
|
||||
Clip* c = s->clips.at(clips.at(i));
|
||||
ClipPtr c = s->clips.at(clips.at(i));
|
||||
if (link) {
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
if (i != j) {
|
||||
@@ -580,11 +531,11 @@ ReplaceMediaCommand::ReplaceMediaCommand(Media* i, QString s) {
|
||||
|
||||
void ReplaceMediaCommand::replace(QString& filename) {
|
||||
// close any clips currently using this media
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
for (int i=0;i<all_sequences.size();i++) {
|
||||
Sequence* s = all_sequences.at(i)->to_sequence();
|
||||
SequencePtr s = all_sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
ClipPtr c = s->clips.at(j);
|
||||
if (c != nullptr && c->media == item && c->open) {
|
||||
close_clip(c, true);
|
||||
c->replaced = true;
|
||||
@@ -621,7 +572,7 @@ void ReplaceClipMediaCommand::replace(bool undo) {
|
||||
}
|
||||
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
if (c->open) {
|
||||
close_clip(c, true);
|
||||
}
|
||||
@@ -660,17 +611,11 @@ EffectDeleteCommand::EffectDeleteCommand() {
|
||||
done = false;
|
||||
}
|
||||
|
||||
EffectDeleteCommand::~EffectDeleteCommand() {
|
||||
if (done) {
|
||||
for (int i=0;i<deleted_objects.size();i++) {
|
||||
delete deleted_objects.at(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
EffectDeleteCommand::~EffectDeleteCommand() {}
|
||||
|
||||
void EffectDeleteCommand::doUndo() {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
c->effects.insert(fx.at(i), deleted_objects.at(i));
|
||||
}
|
||||
panel_effect_controls->reload_clips();
|
||||
@@ -681,9 +626,9 @@ void EffectDeleteCommand::doUndo() {
|
||||
void EffectDeleteCommand::doRedo() {
|
||||
deleted_objects.clear();
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
ClipPtr c = clips.at(i);
|
||||
int fx_id = fx.at(i) - i;
|
||||
Effect* e = c->effects.at(fx_id);
|
||||
EffectPtr e = c->effects.at(fx_id);
|
||||
e->close();
|
||||
deleted_objects.append(e);
|
||||
c->effects.removeAt(fx_id);
|
||||
@@ -705,7 +650,7 @@ void MediaMove::doRedo() {
|
||||
if (to == nullptr) to = project_model.get_root();
|
||||
froms.resize(items.size());
|
||||
for (int i=0;i<items.size();i++) {
|
||||
Media* parent = items.at(i)->parentItem();
|
||||
Media* parent = items.at(i)->parentItem();
|
||||
froms[i] = parent;
|
||||
project_model.moveChild(items.at(i), to);
|
||||
}
|
||||
@@ -855,7 +800,7 @@ void DeleteMarkerAction::doRedo() {
|
||||
sorted = true;
|
||||
}
|
||||
|
||||
SetSpeedAction::SetSpeedAction(Clip* c, double speed) {
|
||||
SetSpeedAction::SetSpeedAction(ClipPtr c, double speed) {
|
||||
clip = c;
|
||||
old_speed = c->speed;
|
||||
new_speed = speed;
|
||||
@@ -886,7 +831,7 @@ void SetBool::doRedo() {
|
||||
*boolean = new_setting;
|
||||
}
|
||||
|
||||
SetSelectionsCommand::SetSelectionsCommand(Sequence* s) {
|
||||
SetSelectionsCommand::SetSelectionsCommand(SequencePtr s) {
|
||||
seq = s;
|
||||
done = true;
|
||||
}
|
||||
@@ -903,7 +848,7 @@ void SetSelectionsCommand::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
EditSequenceCommand::EditSequenceCommand(Media* i, Sequence *s) {
|
||||
EditSequenceCommand::EditSequenceCommand(Media* i, SequencePtr s) {
|
||||
item = i;
|
||||
seq = s;
|
||||
old_name = s->name;
|
||||
@@ -1013,11 +958,7 @@ RemoveClipsFromClipboard::RemoveClipsFromClipboard(int index) {
|
||||
done = false;
|
||||
}
|
||||
|
||||
RemoveClipsFromClipboard::~RemoveClipsFromClipboard() {
|
||||
if (done) {
|
||||
delete clip;
|
||||
}
|
||||
}
|
||||
RemoveClipsFromClipboard::~RemoveClipsFromClipboard() {}
|
||||
|
||||
void RemoveClipsFromClipboard::doUndo() {
|
||||
clipboard.insert(pos, clip);
|
||||
@@ -1025,7 +966,7 @@ void RemoveClipsFromClipboard::doUndo() {
|
||||
}
|
||||
|
||||
void RemoveClipsFromClipboard::doRedo() {
|
||||
clip = static_cast<Clip*>(clipboard.at(pos));
|
||||
clip = std::static_pointer_cast<Clip>(clipboard.at(pos));
|
||||
clipboard.removeAt(pos);
|
||||
done = true;
|
||||
}
|
||||
@@ -1068,7 +1009,7 @@ void ReloadEffectsCommand::doRedo() {
|
||||
panel_effect_controls->reload_clips();
|
||||
}
|
||||
|
||||
RippleAction::RippleAction(Sequence *is, long ipoint, long ilength, const QVector<int> &iignore) {
|
||||
RippleAction::RippleAction(SequencePtr is, long ipoint, long ilength, const QVector<int> &iignore) {
|
||||
s = is;
|
||||
point = ipoint;
|
||||
length = ilength;
|
||||
@@ -1084,7 +1025,7 @@ void RippleAction::doRedo() {
|
||||
ca = new ComboAction();
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
if (!ignore.contains(i)) {
|
||||
Clip* c = s->clips.at(i);
|
||||
ClipPtr c = s->clips.at(i);
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_in >= point) {
|
||||
move_clip(ca, c, length, length, 0, 0, true, true);
|
||||
@@ -1182,11 +1123,11 @@ void RefreshClips::doUndo() {
|
||||
|
||||
void RefreshClips::doRedo() {
|
||||
// close any clips currently using this media
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
for (int i=0;i<all_sequences.size();i++) {
|
||||
Sequence* s = all_sequences.at(i)->to_sequence();
|
||||
SequencePtr s = all_sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
ClipPtr c = s->clips.at(j);
|
||||
if (c != nullptr && c->media == media) {
|
||||
c->replaced = true;
|
||||
c->refresh();
|
||||
@@ -1203,7 +1144,7 @@ void UpdateViewer::doRedo() {
|
||||
panel_sequence_viewer->viewer_widget->frame_update();
|
||||
}
|
||||
|
||||
SetEffectData::SetEffectData(Effect *e, const QByteArray &s) {
|
||||
SetEffectData::SetEffectData(EffectPtr e, const QByteArray &s) {
|
||||
effect = e;
|
||||
data = s;
|
||||
}
|
||||
|
||||
+70
-94
@@ -21,24 +21,14 @@
|
||||
#ifndef UNDO_H
|
||||
#define UNDO_H
|
||||
|
||||
class Media;
|
||||
class QCheckBox;
|
||||
class LabelSlider;
|
||||
class Effect;
|
||||
class SourceTable;
|
||||
class EffectRow;
|
||||
class EffectField;
|
||||
class Transition;
|
||||
class EffectGizmo;
|
||||
class Clip;
|
||||
struct Sequence;
|
||||
struct Footage;
|
||||
struct EffectMeta;
|
||||
|
||||
#include "project/marker.h"
|
||||
#include "project/projectelements.h"
|
||||
#include "project/selection.h"
|
||||
#include "project/effectfield.h"
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/sourcetable.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QUndoStack>
|
||||
#include <QUndoCommand>
|
||||
#include <QVector>
|
||||
@@ -49,19 +39,6 @@ namespace olive {
|
||||
extern QUndoStack UndoStack;
|
||||
}
|
||||
|
||||
class ComboAction : public QUndoCommand {
|
||||
public:
|
||||
ComboAction();
|
||||
virtual ~ComboAction() override;
|
||||
virtual void undo() override;
|
||||
virtual void redo() override;
|
||||
void append(QUndoCommand* u);
|
||||
void appendPost(QUndoCommand* u);
|
||||
private:
|
||||
QVector<QUndoCommand*> commands;
|
||||
QVector<QUndoCommand*> post_commands;
|
||||
};
|
||||
|
||||
class OliveAction : public QUndoCommand {
|
||||
public:
|
||||
OliveAction(bool iset_window_modified = true);
|
||||
@@ -86,11 +63,11 @@ private:
|
||||
|
||||
class MoveClipAction : public OliveAction {
|
||||
public:
|
||||
MoveClipAction(Clip* c, long iin, long iout, long iclip_in, int itrack, bool irelative);
|
||||
MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
|
||||
long old_in;
|
||||
long old_out;
|
||||
@@ -107,11 +84,11 @@ private:
|
||||
|
||||
class RippleAction : public OliveAction {
|
||||
public:
|
||||
RippleAction(Sequence *is, long ipoint, long ilength, const QVector<int>& iignore);
|
||||
RippleAction(SequencePtr is, long ipoint, long ilength, const QVector<int>& iignore);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence *s;
|
||||
SequencePtr s;
|
||||
long point;
|
||||
long length;
|
||||
QVector<int> ignore;
|
||||
@@ -120,13 +97,13 @@ private:
|
||||
|
||||
class DeleteClipAction : public OliveAction {
|
||||
public:
|
||||
DeleteClipAction(Sequence* s, int clip);
|
||||
DeleteClipAction(SequencePtr s, int clip);
|
||||
virtual ~DeleteClipAction() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* seq;
|
||||
Clip* ref;
|
||||
SequencePtr seq;
|
||||
ClipPtr ref;
|
||||
int index;
|
||||
|
||||
int opening_transition;
|
||||
@@ -138,37 +115,36 @@ private:
|
||||
|
||||
class ChangeSequenceAction : public OliveAction {
|
||||
public:
|
||||
ChangeSequenceAction(Sequence* s);
|
||||
ChangeSequenceAction(SequencePtr s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* old_sequence;
|
||||
Sequence* new_sequence;
|
||||
SequencePtr old_sequence;
|
||||
SequencePtr new_sequence;
|
||||
};
|
||||
|
||||
class AddEffectCommand : public OliveAction {
|
||||
public:
|
||||
AddEffectCommand(Clip* c, Effect *e, const EffectMeta* m, int insert_pos = -1);
|
||||
virtual ~AddEffectCommand() override;
|
||||
AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta* m, int insert_pos = -1);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
const EffectMeta* meta;
|
||||
Effect* ref;
|
||||
EffectPtr ref;
|
||||
int pos;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class AddTransitionCommand : public OliveAction {
|
||||
public:
|
||||
AddTransitionCommand(Clip* c, Clip* s, Transition *copy, const EffectMeta* itransition, int itype, int ilength);
|
||||
AddTransitionCommand(ClipPtr c, ClipPtr s, TransitionPtr copy, const EffectMeta* itransition, int itype, int ilength);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
Clip* secondary;
|
||||
Transition* transition_to_copy;
|
||||
ClipPtr clip;
|
||||
ClipPtr secondary;
|
||||
TransitionPtr transition_to_copy;
|
||||
const EffectMeta* transition;
|
||||
int type;
|
||||
int length;
|
||||
@@ -178,11 +154,11 @@ private:
|
||||
|
||||
class ModifyTransitionCommand : public OliveAction {
|
||||
public:
|
||||
ModifyTransitionCommand(Clip* c, int itype, long ilength);
|
||||
ModifyTransitionCommand(ClipPtr c, int itype, long ilength);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
int type;
|
||||
long new_length;
|
||||
long old_length;
|
||||
@@ -190,25 +166,25 @@ private:
|
||||
|
||||
class DeleteTransitionCommand : public OliveAction {
|
||||
public:
|
||||
DeleteTransitionCommand(Sequence* s, int transition_index);
|
||||
DeleteTransitionCommand(SequencePtr s, int transition_index);
|
||||
virtual ~DeleteTransitionCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
int index;
|
||||
Transition* transition;
|
||||
Clip* otc;
|
||||
Clip* ctc;
|
||||
TransitionPtr transition;
|
||||
ClipPtr otc;
|
||||
ClipPtr ctc;
|
||||
};
|
||||
|
||||
class SetTimelineInOutCommand : public OliveAction {
|
||||
public:
|
||||
SetTimelineInOutCommand(Sequence* s, bool enabled, long in, long out);
|
||||
SetTimelineInOutCommand(SequencePtr s, bool enabled, long in, long out);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
|
||||
bool old_enabled;
|
||||
long old_in;
|
||||
@@ -221,25 +197,25 @@ private:
|
||||
|
||||
class NewSequenceCommand : public OliveAction {
|
||||
public:
|
||||
NewSequenceCommand(Media *s, Media* iparent);
|
||||
NewSequenceCommand(Media* s, Media* iparent);
|
||||
virtual ~NewSequenceCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* seq;
|
||||
Media* parent;
|
||||
Media* seq;
|
||||
Media* parent;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class AddMediaCommand : public OliveAction {
|
||||
public:
|
||||
AddMediaCommand(Media* iitem, Media* iparent);
|
||||
AddMediaCommand(Media* iitem, Media* iparent);
|
||||
virtual ~AddMediaCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* item;
|
||||
Media* parent;
|
||||
Media* item;
|
||||
Media* parent;
|
||||
bool done;
|
||||
};
|
||||
|
||||
@@ -250,21 +226,21 @@ public:
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* item;
|
||||
Media* item;
|
||||
Media* parent;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class AddClipCommand : public OliveAction {
|
||||
public:
|
||||
AddClipCommand(Sequence* s, QVector<Clip*>& add);
|
||||
AddClipCommand(SequencePtr s, QVector<ClipPtr>& add);
|
||||
virtual ~AddClipCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* seq;
|
||||
QVector<Clip*> clips;
|
||||
QVector<Clip*> undone_clips;
|
||||
SequencePtr seq;
|
||||
QVector<ClipPtr> clips;
|
||||
QVector<ClipPtr> undone_clips;
|
||||
};
|
||||
|
||||
class LinkCommand : public OliveAction {
|
||||
@@ -272,7 +248,7 @@ public:
|
||||
LinkCommand();
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
Sequence* s;
|
||||
SequencePtr s;
|
||||
QVector<int> clips;
|
||||
bool link;
|
||||
private:
|
||||
@@ -293,7 +269,7 @@ private:
|
||||
|
||||
class ReplaceMediaCommand : public OliveAction {
|
||||
public:
|
||||
ReplaceMediaCommand(Media*, QString);
|
||||
ReplaceMediaCommand(Media*, QString);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
@@ -308,10 +284,10 @@ public:
|
||||
ReplaceClipMediaCommand(Media *, Media *, bool);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
private:
|
||||
Media* old_media;
|
||||
Media* new_media;
|
||||
Media* old_media;
|
||||
Media* new_media;
|
||||
bool preserve_clip_ins;
|
||||
QVector<int> old_clip_ins;
|
||||
void replace(bool undo);
|
||||
@@ -323,18 +299,18 @@ public:
|
||||
virtual ~EffectDeleteCommand() override;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
QVector<int> fx;
|
||||
private:
|
||||
bool done;
|
||||
QVector<Effect*> deleted_objects;
|
||||
QVector<EffectPtr> deleted_objects;
|
||||
};
|
||||
|
||||
class MediaMove : public OliveAction {
|
||||
public:
|
||||
MediaMove();
|
||||
QVector<Media*> items;
|
||||
Media* to;
|
||||
QVector<Media*> items;
|
||||
Media* to;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
@@ -343,11 +319,11 @@ private:
|
||||
|
||||
class MediaRename : public OliveAction {
|
||||
public:
|
||||
MediaRename(Media* iitem, QString to);
|
||||
MediaRename(Media* iitem, QString to);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* item;
|
||||
Media* item;
|
||||
QString from;
|
||||
QString to;
|
||||
};
|
||||
@@ -395,7 +371,7 @@ public:
|
||||
SetAutoscaleAction();
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
};
|
||||
|
||||
class AddMarkerAction : public OliveAction {
|
||||
@@ -436,11 +412,11 @@ private:
|
||||
|
||||
class SetSpeedAction : public OliveAction {
|
||||
public:
|
||||
SetSpeedAction(Clip* c, double speed);
|
||||
SetSpeedAction(ClipPtr c, double speed);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
double old_speed;
|
||||
double new_speed;
|
||||
};
|
||||
@@ -458,19 +434,19 @@ private:
|
||||
|
||||
class SetSelectionsCommand : public OliveAction {
|
||||
public:
|
||||
SetSelectionsCommand(Sequence *s);
|
||||
SetSelectionsCommand(SequencePtr s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
QVector<Selection> old_data;
|
||||
QVector<Selection> new_data;
|
||||
private:
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class EditSequenceCommand : public OliveAction {
|
||||
public:
|
||||
EditSequenceCommand(Media *i, Sequence* s);
|
||||
EditSequenceCommand(Media *i, SequencePtr s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
void update();
|
||||
@@ -482,8 +458,8 @@ public:
|
||||
int audio_frequency;
|
||||
int audio_layout;
|
||||
private:
|
||||
Media* item;
|
||||
Sequence* seq;
|
||||
Media* item;
|
||||
SequencePtr seq;
|
||||
|
||||
QString old_name;
|
||||
int old_width;
|
||||
@@ -545,11 +521,11 @@ public:
|
||||
|
||||
class UpdateFootageTooltip : public OliveAction {
|
||||
public:
|
||||
UpdateFootageTooltip(Media* i);
|
||||
UpdateFootageTooltip(Media* i);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* item;
|
||||
Media* item;
|
||||
};
|
||||
|
||||
class MoveEffectCommand : public OliveAction {
|
||||
@@ -557,7 +533,7 @@ public:
|
||||
MoveEffectCommand();
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
int from;
|
||||
int to;
|
||||
};
|
||||
@@ -570,14 +546,14 @@ public:
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
int pos;
|
||||
Clip* clip;
|
||||
ClipPtr clip;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class RenameClipCommand : public OliveAction {
|
||||
public:
|
||||
RenameClipCommand();
|
||||
QVector<Clip*> clips;
|
||||
QVector<ClipPtr> clips;
|
||||
QString new_name;
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
@@ -626,11 +602,11 @@ private:
|
||||
|
||||
class RefreshClips : public OliveAction {
|
||||
public:
|
||||
RefreshClips(Media* m);
|
||||
RefreshClips(Media* m);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Media* media;
|
||||
Media* media;
|
||||
};
|
||||
|
||||
class UpdateViewer : public OliveAction {
|
||||
@@ -641,11 +617,11 @@ public:
|
||||
|
||||
class SetEffectData : public OliveAction {
|
||||
public:
|
||||
SetEffectData(Effect* e, const QByteArray &s);
|
||||
SetEffectData(EffectPtr e, const QByteArray &s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Effect* effect;
|
||||
EffectPtr effect;
|
||||
QByteArray data;
|
||||
QByteArray old_data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user