trying to fix undo bug

This commit is contained in:
itsmattkc
2018-06-14 00:51:14 -07:00
parent 124b76d58c
commit f8ce6c08f8
14 changed files with 38 additions and 39 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ Clip::Clip() {
Clip* Clip::copy() {
Clip* copy = new Clip();
copy->name = name;
copy->name = QString(name);
copy->clip_in = clip_in;
copy->timeline_in = timeline_in;
copy->timeline_out = timeline_out;
@@ -31,7 +31,7 @@ Clip* Clip::copy() {
copy->media_stream = media_stream;
for (int i=0;i<effects.size();i++) {
copy->effects.append(effects.at(i)->copy());
copy->effects.append(effects.at(i)->copy(copy));
}
return copy;
+1 -2
View File
@@ -20,7 +20,6 @@ struct AVPacket;
struct SwsContext;
struct SwrContext;
class QOpenGLTexture;
class QPixmap;
struct ClipCache {
AVFrame** frames;
@@ -50,7 +49,7 @@ struct Clip
uint8_t color_b;
long getLength();
// inherited information (should be copied in copy())
// inherited information (should be set to the same references in copy())
Media* media; // attached media
MediaStream* media_stream;
Sequence* sequence;
+3 -3
View File
@@ -28,9 +28,9 @@ void Effect::field_changed() {
panel_viewer->viewer_widget->update();
}
Effect* Effect::copy() {return NULL;}
void Effect::load(QXmlStreamReader* stream) {}
void Effect::save(QXmlStreamWriter *stream) {}
Effect* Effect::copy(Clip*) {return NULL;}
void Effect::load(QXmlStreamReader*) {}
void Effect::save(QXmlStreamWriter*) {}
void Effect::process_gl(int*, int*) {}
void Effect::process_audio(uint8_t*, int) {}
+1 -1
View File
@@ -24,7 +24,7 @@ public:
QWidget* ui;
Clip* parent_clip;
virtual Effect* copy();
virtual Effect* copy(Clip* c);
virtual void load(QXmlStreamReader* stream);
virtual void save(QXmlStreamWriter* stream);
+4 -4
View File
@@ -95,8 +95,8 @@ void Sequence::undo_add_current() {
undo_stack.removeFirst();
} else {
undo_pointer++;
for (int i=undo_stack.size()-1;i>undo_pointer;i--) {
delete undo_stack[i];
while (undo_stack.size() > undo_pointer+1) {
delete undo_stack.last();
undo_stack.removeLast();
}
}
@@ -115,9 +115,9 @@ void Sequence::set_undo(int i) {
}
clips.clear();
QVector<Clip*>* copy_from_list = undo_stack[undo_pointer];
QVector<Clip*>* copy_from_list = undo_stack.at(undo_pointer);
for (int i=0;i<copy_from_list->size();i++) {
add_clip(copy_from_list->at(i));
add_clip(copy_from_list->at(i)->copy());
}
}