diff --git a/effects/effects.h b/effects/effects.h index aae488b71..fbd8f51e7 100644 --- a/effects/effects.h +++ b/effects/effects.h @@ -29,7 +29,7 @@ class TransformEffect : public Effect { public: TransformEffect(Clip* c); void process_gl(int* anchor_x, int* anchor_y); - Effect* copy(); + Effect* copy(Clip* c); QSpinBox* position_x; QSpinBox* position_y; @@ -52,7 +52,7 @@ class VolumeEffect : public Effect { public: VolumeEffect(Clip* c); void process_audio(uint8_t* samples, int nb_bytes); - Effect* copy(); + Effect* copy(Clip* c); void load(QXmlStreamReader* stream); void save(QXmlStreamWriter* stream); @@ -63,7 +63,7 @@ class PanEffect : public Effect { public: PanEffect(Clip* c); void process_audio(uint8_t* samples, int nb_bytes); - Effect* copy(); + Effect* copy(Clip* c); void load(QXmlStreamReader* stream); void save(QXmlStreamWriter* stream); diff --git a/effects/paneffect.cpp b/effects/paneffect.cpp index d99a8c1e8..3d957a2f3 100644 --- a/effects/paneffect.cpp +++ b/effects/paneffect.cpp @@ -25,8 +25,8 @@ PanEffect::PanEffect(Clip* c) : Effect(c) { pan_val->setValue(0); } -Effect* PanEffect::copy() { - PanEffect* p = new PanEffect(parent_clip); +Effect* PanEffect::copy(Clip* c) { + PanEffect* p = new PanEffect(c); p->pan_val->setValue(pan_val->value()); return p; } diff --git a/effects/transformeffect.cpp b/effects/transformeffect.cpp index 6023e8d40..d9a724e24 100644 --- a/effects/transformeffect.cpp +++ b/effects/transformeffect.cpp @@ -93,8 +93,8 @@ TransformEffect::TransformEffect(Clip* c) : Effect(c) { connect(uniform_scale_box, SIGNAL(toggled(bool)), this, SLOT(field_changed())); } -Effect* TransformEffect::copy() { - TransformEffect* t = new TransformEffect(parent_clip); +Effect* TransformEffect::copy(Clip* c) { + TransformEffect* t = new TransformEffect(c); t->position_x->setValue(position_x->value()); t->position_y->setValue(position_y->value()); t->scale_x->setValue(scale_x->value()); diff --git a/effects/volumeeffect.cpp b/effects/volumeeffect.cpp index 08a0e8da9..6826eb0f3 100644 --- a/effects/volumeeffect.cpp +++ b/effects/volumeeffect.cpp @@ -25,8 +25,8 @@ VolumeEffect::VolumeEffect(Clip* c) : Effect(c) { volume_val->setValue(100); } -Effect* VolumeEffect::copy() { - VolumeEffect* v = new VolumeEffect(parent_clip); +Effect* VolumeEffect::copy(Clip* c) { + VolumeEffect* v = new VolumeEffect(c); v->volume_val->setValue(volume_val->value()); return v; } diff --git a/io/previewgenerator.cpp b/io/previewgenerator.cpp index 843196fbb..c8fe936c0 100644 --- a/io/previewgenerator.cpp +++ b/io/previewgenerator.cpp @@ -1,6 +1,6 @@ #include "previewgenerator.h" -PreviewGenerator::PreviewGenerator(QWidget* parent) : QThread(parent) +PreviewGenerator::PreviewGenerator(QObject* parent) : QThread(parent) { } diff --git a/io/previewgenerator.h b/io/previewgenerator.h index e3c256a15..e13447443 100644 --- a/io/previewgenerator.h +++ b/io/previewgenerator.h @@ -6,7 +6,7 @@ class PreviewGenerator : public QThread { public: - PreviewGenerator(QWidget* parent = 0); + PreviewGenerator(QObject* parent = 0); void run() override; }; diff --git a/olive.pro.user b/olive.pro.user index 25e111309..d57c157b8 100644 --- a/olive.pro.user +++ b/olive.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId diff --git a/panels/timeline.cpp b/panels/timeline.cpp index c7c3415c4..5d4fe19c7 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -164,8 +164,8 @@ void Timeline::redraw_all_clips() { sequence->undo_add_current(); project_changed = true; - ui->video_area->redraw_clips(); - ui->audio_area->redraw_clips(); + ui->video_area->redraw_clips(); + ui->audio_area->redraw_clips(); } void Timeline::select_all() { diff --git a/project/clip.cpp b/project/clip.cpp index de4404704..6797fec71 100644 --- a/project/clip.cpp +++ b/project/clip.cpp @@ -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;ieffects.append(effects.at(i)->copy()); + copy->effects.append(effects.at(i)->copy(copy)); } return copy; diff --git a/project/clip.h b/project/clip.h index f8418333e..932cd580b 100644 --- a/project/clip.h +++ b/project/clip.h @@ -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; diff --git a/project/effect.cpp b/project/effect.cpp index 68a928772..8c6caa2f5 100644 --- a/project/effect.cpp +++ b/project/effect.cpp @@ -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) {} diff --git a/project/effect.h b/project/effect.h index c7e67b80a..c29488862 100644 --- a/project/effect.h +++ b/project/effect.h @@ -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); diff --git a/project/sequence.cpp b/project/sequence.cpp index 32b76c1aa..813f01a73 100644 --- a/project/sequence.cpp +++ b/project/sequence.cpp @@ -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* copy_from_list = undo_stack[undo_pointer]; + QVector* copy_from_list = undo_stack.at(undo_pointer); for (int i=0;isize();i++) { - add_clip(copy_from_list->at(i)); + add_clip(copy_from_list->at(i)->copy()); } } diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index 02332f606..ff04129f7 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -761,26 +761,26 @@ void TimelineWidget::redraw_clips() { video_track_limit = clip->track; } else if (clip->track > audio_track_limit) { audio_track_limit = clip->track; - } + } QRect clip_rect(panel_timeline->getScreenPointFromFrame(clip->timeline_in), getScreenPointFromTrack(clip->track), clip->getLength() * panel_timeline->zoom, track_height); clip_painter.fillRect(clip_rect, QColor(clip->color_r, clip->color_g, clip->color_b)); - clip_painter.setPen(Qt::white); - clip_painter.drawLine(clip_rect.bottomLeft(), clip_rect.topLeft()); - clip_painter.drawLine(clip_rect.topLeft(), clip_rect.topRight()); + clip_painter.setPen(Qt::white); + clip_painter.drawLine(clip_rect.bottomLeft(), clip_rect.topLeft()); + clip_painter.drawLine(clip_rect.topLeft(), clip_rect.topRight()); clip_painter.setPen(Qt::gray); - clip_painter.drawLine(clip_rect.bottomLeft(), clip_rect.bottomRight()); - clip_painter.drawLine(clip_rect.bottomRight(), clip_rect.topRight()); + clip_painter.drawLine(clip_rect.bottomLeft(), clip_rect.bottomRight()); + clip_painter.drawLine(clip_rect.bottomRight(), clip_rect.topRight()); if (color_brightness(clip->color_r, clip->color_g, clip->color_b) > 160) { - clip_painter.setPen(Qt::black); - } else { - clip_painter.setPen(Qt::white); - } - QRect text_rect(clip_rect.left() + CLIP_TEXT_PADDING, clip_rect.top() + CLIP_TEXT_PADDING, clip_rect.width() - CLIP_TEXT_PADDING - CLIP_TEXT_PADDING, clip_rect.height() - CLIP_TEXT_PADDING - CLIP_TEXT_PADDING); + clip_painter.setPen(Qt::black); + } else { + clip_painter.setPen(Qt::white); + } + QRect text_rect(clip_rect.left() + CLIP_TEXT_PADDING, clip_rect.top() + CLIP_TEXT_PADDING, clip_rect.width() - CLIP_TEXT_PADDING - CLIP_TEXT_PADDING, clip_rect.height() - CLIP_TEXT_PADDING - CLIP_TEXT_PADDING); clip_painter.drawText(text_rect, 0, clip->name, &text_rect); - } - } + } + } // Draw track lines if (show_track_lines) {