several conversions to smart pointers
This commit is contained in:
@@ -47,7 +47,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
|||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
Footage* f = item->to_footage();
|
FootagePtr f = item->to_footage();
|
||||||
|
|
||||||
grid->addWidget(new QLabel(tr("Tracks:"), this), row, 0, 1, 2);
|
grid->addWidget(new QLabel(tr("Tracks:"), this), row, 0, 1, 2);
|
||||||
row++;
|
row++;
|
||||||
@@ -143,7 +143,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MediaPropertiesDialog::accept() {
|
void MediaPropertiesDialog::accept() {
|
||||||
Footage* f = item->to_footage();
|
FootagePtr f = item->to_footage();
|
||||||
|
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
|
|
||||||
|
|||||||
@@ -34,11 +34,11 @@
|
|||||||
class MediaPropertiesDialog : public QDialog {
|
class MediaPropertiesDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MediaPropertiesDialog(QWidget *parent, Media* i);
|
MediaPropertiesDialog(QWidget *parent, Media* i);
|
||||||
private:
|
private:
|
||||||
QComboBox* interlacing_box;
|
QComboBox* interlacing_box;
|
||||||
QLineEdit* name_box;
|
QLineEdit* name_box;
|
||||||
Media* item;
|
Media* item;
|
||||||
QListWidget* track_list;
|
QListWidget* track_list;
|
||||||
QDoubleSpinBox* conform_fr;
|
QDoubleSpinBox* conform_fr;
|
||||||
QCheckBox* premultiply_alpha_setting;
|
QCheckBox* premultiply_alpha_setting;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void NewSequenceDialog::set_sequence_name(const QString& s) {
|
|||||||
|
|
||||||
void NewSequenceDialog::create() {
|
void NewSequenceDialog::create() {
|
||||||
if (existing_sequence == nullptr) {
|
if (existing_sequence == nullptr) {
|
||||||
Sequence* s = new Sequence();
|
SequencePtr s(new Sequence());
|
||||||
|
|
||||||
s->name = sequence_name_edit->text();
|
s->name = sequence_name_edit->text();
|
||||||
s->width = width_numeric->value();
|
s->width = width_numeric->value();
|
||||||
@@ -112,7 +112,7 @@ void NewSequenceDialog::create() {
|
|||||||
ca->append(esc);
|
ca->append(esc);
|
||||||
|
|
||||||
for (int i=0;i<existing_sequence->clips.size();i++) {
|
for (int i=0;i<existing_sequence->clips.size();i++) {
|
||||||
Clip* c = existing_sequence->clips.at(i);
|
ClipPtr c = existing_sequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
c->refactor_frame_rate(ca, multiplier, true);
|
c->refactor_frame_rate(ca, multiplier, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class NewSequenceDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NewSequenceDialog(QWidget *parent = 0, Media* existing = 0);
|
explicit NewSequenceDialog(QWidget *parent = nullptr, Media* existing = nullptr);
|
||||||
~NewSequenceDialog();
|
~NewSequenceDialog();
|
||||||
|
|
||||||
void set_sequence_name(const QString& s);
|
void set_sequence_name(const QString& s);
|
||||||
@@ -45,8 +45,8 @@ private slots:
|
|||||||
void preset_changed(int index);
|
void preset_changed(int index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Sequence* existing_sequence;
|
SequencePtr existing_sequence;
|
||||||
Media* existing_item;
|
Media* existing_item;
|
||||||
|
|
||||||
void setup_ui();
|
void setup_ui();
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "project/footage.h"
|
#include "project/footage.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
ProxyDialog::ProxyDialog(QWidget *parent, const QVector<Footage *> &footage) :
|
ProxyDialog::ProxyDialog(QWidget *parent, const QVector<FootagePtr> &footage) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
selected_footage(footage)
|
selected_footage(footage)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
class ProxyDialog : public QDialog {
|
class ProxyDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProxyDialog(QWidget* parent, const QVector<Footage*>& footage);
|
ProxyDialog(QWidget* parent, const QVector<FootagePtr>& footage);
|
||||||
public slots:
|
public slots:
|
||||||
// called if user clicks "OK" on the dialog
|
// called if user clicks "OK" on the dialog
|
||||||
virtual void accept() override;
|
virtual void accept() override;
|
||||||
@@ -51,7 +51,7 @@ private:
|
|||||||
QString proxy_folder_name;
|
QString proxy_folder_name;
|
||||||
|
|
||||||
// list of footage to make proxies for
|
// list of footage to make proxies for
|
||||||
QVector<Footage*> selected_footage;
|
QVector<FootagePtr> selected_footage;
|
||||||
private slots:
|
private slots:
|
||||||
// triggered when the user changes the index in the location combobox
|
// triggered when the user changes the index in the location combobox
|
||||||
void location_changed(int i);
|
void location_changed(int i);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media) :
|
ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media* old_media) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
media(old_media)
|
media(old_media)
|
||||||
{
|
{
|
||||||
@@ -80,7 +80,7 @@ void ReplaceClipMediaDialog::replace() {
|
|||||||
QMessageBox::Ok
|
QMessageBox::Ok
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Media* new_item = static_cast<Media*>(selected_items.at(0).internalPointer());
|
Media* new_item = static_cast<Media*>(selected_items.at(0).internalPointer());
|
||||||
if (media == new_item) {
|
if (media == new_item) {
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
this,
|
this,
|
||||||
@@ -111,7 +111,7 @@ void ReplaceClipMediaDialog::replace() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr && c->media == media) {
|
if (c != nullptr && c->media == media) {
|
||||||
rcmc->clips.append(c);
|
rcmc->clips.append(c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,11 @@
|
|||||||
class ReplaceClipMediaDialog : public QDialog {
|
class ReplaceClipMediaDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ReplaceClipMediaDialog(QWidget* parent, Media *old_media);
|
ReplaceClipMediaDialog(QWidget* parent, Media* old_media);
|
||||||
private slots:
|
private slots:
|
||||||
void replace();
|
void replace();
|
||||||
private:
|
private:
|
||||||
Media* media;
|
Media* media;
|
||||||
QTreeView* tree;
|
QTreeView* tree;
|
||||||
QCheckBox* use_same_media_in_points;
|
QCheckBox* use_same_media_in_points;
|
||||||
};
|
};
|
||||||
|
|||||||
+13
-13
@@ -94,7 +94,7 @@ void SpeedDialog::run() {
|
|||||||
current_length = -1;
|
current_length = -1;
|
||||||
|
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
|
|
||||||
double clip_percent;
|
double clip_percent;
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ void SpeedDialog::run() {
|
|||||||
if (c->track < 0) {
|
if (c->track < 0) {
|
||||||
bool process_video = true;
|
bool process_video = true;
|
||||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
Footage* m = c->media->to_footage();
|
FootagePtr m = c->media->to_footage();
|
||||||
FootageStream* ms = m->get_stream_from_file_index(true, c->media_stream);
|
FootageStream* ms = m->get_stream_from_file_index(true, c->media_stream);
|
||||||
if (ms != nullptr && ms->infinite_length) {
|
if (ms != nullptr && ms->infinite_length) {
|
||||||
process_video = false;
|
process_video = false;
|
||||||
@@ -187,7 +187,7 @@ void SpeedDialog::percent_update() {
|
|||||||
long len_val = -1;
|
long len_val = -1;
|
||||||
|
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
|
|
||||||
// get frame rate
|
// get frame rate
|
||||||
if (frame_rate->isEnabled() && c->track < 0) {
|
if (frame_rate->isEnabled() && c->track < 0) {
|
||||||
@@ -222,7 +222,7 @@ void SpeedDialog::duration_update() {
|
|||||||
double fr_val = qSNaN();
|
double fr_val = qSNaN();
|
||||||
|
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
|
|
||||||
// get percent
|
// get percent
|
||||||
long clip_default_length = qRound(c->getLength() * c->speed);
|
long clip_default_length = qRound(c->getLength() * c->speed);
|
||||||
@@ -265,7 +265,7 @@ void SpeedDialog::frame_rate_update() {
|
|||||||
|
|
||||||
// analyze video clips
|
// analyze video clips
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
|
|
||||||
// check if all selected clips are currently the same speed
|
// check if all selected clips are currently the same speed
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
@@ -297,7 +297,7 @@ void SpeedDialog::frame_rate_update() {
|
|||||||
|
|
||||||
// analyze audio clips
|
// analyze audio clips
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
|
|
||||||
if (c->track >= 0) {
|
if (c->track >= 0) {
|
||||||
long new_clip_len = (qIsNaN(old_pc_val) || qIsNaN(pc_val)) ? c->getLength() : ((c->getLength() * c->speed) / pc_val);
|
long new_clip_len = (qIsNaN(old_pc_val) || qIsNaN(pc_val)) ? c->getLength() : ((c->getLength() * c->speed) / pc_val);
|
||||||
@@ -312,7 +312,7 @@ void SpeedDialog::frame_rate_update() {
|
|||||||
duration->set_value((len_val == -1) ? qSNaN() : len_val, false);
|
duration->set_value((len_val == -1) ? qSNaN() : len_val, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, long& lr) {
|
void set_speed(ComboAction* ca, ClipPtr c, double speed, bool ripple, long& ep, long& lr) {
|
||||||
panel_timeline->deselect_area(c->timeline_in, c->timeline_out, c->track);
|
panel_timeline->deselect_area(c->timeline_in, c->timeline_out, c->track);
|
||||||
|
|
||||||
long proposed_out = c->timeline_out;
|
long proposed_out = c->timeline_out;
|
||||||
@@ -321,7 +321,7 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
|
|||||||
ca->append(new SetSpeedAction(c, speed));
|
ca->append(new SetSpeedAction(c, speed));
|
||||||
if (!ripple && proposed_out > c->timeline_out) {
|
if (!ripple && proposed_out > c->timeline_out) {
|
||||||
for (int i=0;i<c->sequence->clips.size();i++) {
|
for (int i=0;i<c->sequence->clips.size();i++) {
|
||||||
Clip* compare = c->sequence->clips.at(i);
|
ClipPtr compare = c->sequence->clips.at(i);
|
||||||
if (compare != nullptr
|
if (compare != nullptr
|
||||||
&& compare->track == c->track
|
&& compare->track == c->track
|
||||||
&& compare->timeline_in >= c->timeline_out && compare->timeline_in < proposed_out) {
|
&& compare->timeline_in >= c->timeline_out && compare->timeline_in < proposed_out) {
|
||||||
@@ -352,7 +352,7 @@ void SpeedDialog::accept() {
|
|||||||
long longest_ripple = LONG_MIN;
|
long longest_ripple = LONG_MIN;
|
||||||
|
|
||||||
for (int i=0;i<clips.size();i++) {
|
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);
|
if (c->open) close_clip(c, true);
|
||||||
|
|
||||||
if (c->track >= 0
|
if (c->track >= 0
|
||||||
@@ -372,7 +372,7 @@ void SpeedDialog::accept() {
|
|||||||
if (!qIsNaN(percent->value())) {
|
if (!qIsNaN(percent->value())) {
|
||||||
// simply set speed
|
// simply set speed
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
set_speed(ca, c, percent->value(), ripple->isChecked(), earliest_point, longest_ripple);
|
set_speed(ca, c, percent->value(), ripple->isChecked(), earliest_point, longest_ripple);
|
||||||
}
|
}
|
||||||
} else if (!qIsNaN(frame_rate->value())) {
|
} else if (!qIsNaN(frame_rate->value())) {
|
||||||
@@ -382,7 +382,7 @@ void SpeedDialog::accept() {
|
|||||||
|
|
||||||
// see if we can use the frame rate to change all the speeds
|
// see if we can use the frame rate to change all the speeds
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
cached_speed = c->speed;
|
cached_speed = c->speed;
|
||||||
} else if (!qFuzzyCompare(cached_speed, c->speed)) {
|
} else if (!qFuzzyCompare(cached_speed, c->speed)) {
|
||||||
@@ -400,7 +400,7 @@ void SpeedDialog::accept() {
|
|||||||
|
|
||||||
// make changes
|
// make changes
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
if (c->track < 0) {
|
if (c->track < 0) {
|
||||||
set_speed(ca, c, frame_rate->value() / c->getMediaFrameRate(), ripple->isChecked(), earliest_point, longest_ripple);
|
set_speed(ca, c, frame_rate->value() / c->getMediaFrameRate(), ripple->isChecked(), earliest_point, longest_ripple);
|
||||||
} else if (can_change_all) {
|
} else if (can_change_all) {
|
||||||
@@ -410,7 +410,7 @@ void SpeedDialog::accept() {
|
|||||||
} else if (!qIsNaN(duration->value())) {
|
} else if (!qIsNaN(duration->value())) {
|
||||||
// simply set duration
|
// simply set duration
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
set_speed(ca, c, (c->getLength() * c->speed) / duration->value(), ripple->isChecked(), earliest_point, longest_ripple);
|
set_speed(ca, c, (c->getLength() * c->speed) / duration->value(), ripple->isChecked(), earliest_point, longest_ripple);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class SpeedDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SpeedDialog(QWidget* parent = 0);
|
SpeedDialog(QWidget* parent = 0);
|
||||||
QVector<Clip*> clips;
|
QVector<ClipPtr> clips;
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
AudioNoiseEffect::AudioNoiseEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
AudioNoiseEffect::AudioNoiseEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||||
amount_val = add_row(tr("Amount"))->add_field(EFFECT_FIELD_DOUBLE, "amount");
|
amount_val = add_row(tr("Amount"))->add_field(EFFECT_FIELD_DOUBLE, "amount");
|
||||||
amount_val->set_double_minimum_value(0);
|
amount_val->set_double_minimum_value(0);
|
||||||
amount_val->set_double_maximum_value(100);
|
amount_val->set_double_maximum_value(100);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
class AudioNoiseEffect : public Effect {
|
class AudioNoiseEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AudioNoiseEffect(Clip* c, const EffectMeta* em);
|
AudioNoiseEffect(ClipPtr c, const EffectMeta* em);
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
|
|
||||||
EffectField* amount_val;
|
EffectField* amount_val;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "project/clip.h"
|
#include "project/clip.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
CornerPinEffect::CornerPinEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
|
CornerPinEffect::CornerPinEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||||
enable_coords = true;
|
enable_coords = true;
|
||||||
enable_shader = true;
|
enable_shader = true;
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
class CornerPinEffect : public Effect {
|
class CornerPinEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CornerPinEffect(Clip* c, const EffectMeta* em);
|
CornerPinEffect(ClipPtr c, const EffectMeta* em);
|
||||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||||
void process_shader(double timecode, GLTextureCoords& coords, int iterations);
|
void process_shader(double timecode, GLTextureCoords& coords, int iterations);
|
||||||
void gizmo_draw(double timecode, GLTextureCoords& coords);
|
void gizmo_draw(double timecode, GLTextureCoords& coords);
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <QOpenGLFunctions>
|
#include <QOpenGLFunctions>
|
||||||
|
|
||||||
CrossDissolveTransition::CrossDissolveTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {
|
CrossDissolveTransition::CrossDissolveTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {
|
||||||
enable_coords = true;
|
enable_coords = true;
|
||||||
|
|
||||||
// add_row("Smooth")->add_field(EFFECT_FIELD_BOOL, "smooth");
|
// add_row("Smooth")->add_field(EFFECT_FIELD_BOOL, "smooth");
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class CrossDissolveTransition : public Transition {
|
class CrossDissolveTransition : public Transition {
|
||||||
public:
|
public:
|
||||||
CrossDissolveTransition(Clip* c, Clip* s, const EffectMeta* em);
|
CrossDissolveTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||||
void process_coords(double timecode, GLTextureCoords &, int data);
|
void process_coords(double timecode, GLTextureCoords &, int data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
CubeTransition::CubeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {
|
CubeTransition::CubeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {
|
||||||
enable_coords = true;
|
enable_coords = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class CubeTransition : public Transition {
|
class CubeTransition : public Transition {
|
||||||
public:
|
public:
|
||||||
CubeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
CubeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||||
void process_coords(double timecode, GLTextureCoords &, int data);
|
void process_coords(double timecode, GLTextureCoords &, int data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
ExponentialFadeTransition::ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
ExponentialFadeTransition::ExponentialFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||||
|
|
||||||
void ExponentialFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
void ExponentialFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class ExponentialFadeTransition : public Transition {
|
class ExponentialFadeTransition : public Transition {
|
||||||
public:
|
public:
|
||||||
ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
ExponentialFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#define FILL_TYPE_LEFT 0
|
#define FILL_TYPE_LEFT 0
|
||||||
#define FILL_TYPE_RIGHT 1
|
#define FILL_TYPE_RIGHT 1
|
||||||
|
|
||||||
FillLeftRightEffect::FillLeftRightEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
FillLeftRightEffect::FillLeftRightEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||||
EffectRow* type_row = add_row(tr("Type"));
|
EffectRow* type_row = add_row(tr("Type"));
|
||||||
fill_type = type_row->add_field(EFFECT_FIELD_COMBO, "type");
|
fill_type = type_row->add_field(EFFECT_FIELD_COMBO, "type");
|
||||||
fill_type->add_combo_item(tr("Fill Left with Right"), FILL_TYPE_LEFT);
|
fill_type->add_combo_item(tr("Fill Left with Right"), FILL_TYPE_LEFT);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
class FillLeftRightEffect : public Effect {
|
class FillLeftRightEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FillLeftRightEffect(Clip* c, const EffectMeta* em);
|
FillLeftRightEffect(ClipPtr c, const EffectMeta* em);
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
private:
|
private:
|
||||||
EffectField* fill_type;
|
EffectField* fill_type;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info);
|
|||||||
typedef void (*f0rSetParamValue) (f0r_instance_t instance,
|
typedef void (*f0rSetParamValue) (f0r_instance_t instance,
|
||||||
f0r_param_t param, int param_index);
|
f0r_param_t param, int param_index);
|
||||||
|
|
||||||
Frei0rEffect::Frei0rEffect(Clip *c, const EffectMeta *em) :
|
Frei0rEffect::Frei0rEffect(ClipPtr c, const EffectMeta *em) :
|
||||||
Effect(c, em),
|
Effect(c, em),
|
||||||
open(false)
|
open(false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ typedef void (*f0rGetParamInfo)(f0r_param_info_t * info,
|
|||||||
class Frei0rEffect : public Effect {
|
class Frei0rEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Frei0rEffect(Clip* c, const EffectMeta* em);
|
Frei0rEffect(ClipPtr c, const EffectMeta* em);
|
||||||
~Frei0rEffect();
|
~Frei0rEffect();
|
||||||
|
|
||||||
virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size);
|
virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#include "linearfadetransition.h"
|
#include "linearfadetransition.h"
|
||||||
|
|
||||||
LinearFadeTransition::LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
LinearFadeTransition::LinearFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||||
|
|
||||||
void LinearFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
void LinearFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class LinearFadeTransition : public Transition {
|
class LinearFadeTransition : public Transition {
|
||||||
public:
|
public:
|
||||||
LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
LinearFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
LogarithmicFadeTransition::LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {}
|
LogarithmicFadeTransition::LogarithmicFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em) : Transition(c, s, em) {}
|
||||||
|
|
||||||
void LogarithmicFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
void LogarithmicFadeTransition::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int type) {
|
||||||
double interval = (timecode_end-timecode_start)/nb_bytes;
|
double interval = (timecode_end-timecode_start)/nb_bytes;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
class LogarithmicFadeTransition : public Transition {
|
class LogarithmicFadeTransition : public Transition {
|
||||||
public:
|
public:
|
||||||
LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em);
|
LogarithmicFadeTransition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "ui/labelslider.h"
|
#include "ui/labelslider.h"
|
||||||
#include "ui/collapsiblewidget.h"
|
#include "ui/collapsiblewidget.h"
|
||||||
|
|
||||||
PanEffect::PanEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
PanEffect::PanEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||||
EffectRow* pan_row = add_row(tr("Pan"));
|
EffectRow* pan_row = add_row(tr("Pan"));
|
||||||
pan_val = pan_row->add_field(EFFECT_FIELD_DOUBLE, "pan");
|
pan_val = pan_row->add_field(EFFECT_FIELD_DOUBLE, "pan");
|
||||||
pan_val->set_double_minimum_value(-100);
|
pan_val->set_double_minimum_value(-100);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
class PanEffect : public Effect {
|
class PanEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PanEffect(Clip* c, const EffectMeta* em);
|
PanEffect(ClipPtr c, const EffectMeta* em);
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
|
|
||||||
EffectField* pan_val;
|
EffectField* pan_val;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
ShakeEffect::ShakeEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
|
ShakeEffect::ShakeEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||||
enable_coords = true;
|
enable_coords = true;
|
||||||
|
|
||||||
EffectRow* intensity_row = add_row(tr("Intensity"));
|
EffectRow* intensity_row = add_row(tr("Intensity"));
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
class ShakeEffect : public Effect {
|
class ShakeEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ShakeEffect(Clip* c, const EffectMeta* em);
|
ShakeEffect(ClipPtr c, const EffectMeta* em);
|
||||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||||
|
|
||||||
EffectField* intensity_val;
|
EffectField* intensity_val;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
#define SMPTE_STRIP_COUNT 3
|
#define SMPTE_STRIP_COUNT 3
|
||||||
#define SMPTE_LOWER_BARS 4
|
#define SMPTE_LOWER_BARS 4
|
||||||
|
|
||||||
SolidEffect::SolidEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
|
SolidEffect::SolidEffect(ClipPtr c, const EffectMeta* em) : Effect(c, em) {
|
||||||
enable_superimpose = true;
|
enable_superimpose = true;
|
||||||
|
|
||||||
solid_type = add_row(tr("Type"))->add_field(EFFECT_FIELD_COMBO, "type");
|
solid_type = add_row(tr("Type"))->add_field(EFFECT_FIELD_COMBO, "type");
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
class SolidEffect : public Effect {
|
class SolidEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SolidEffect(Clip* c, const EffectMeta *em);
|
SolidEffect(ClipPtr c, const EffectMeta *em);
|
||||||
void redraw(double timecode);
|
void redraw(double timecode);
|
||||||
private slots:
|
private slots:
|
||||||
void ui_update(int);
|
void ui_update(int);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#include "io/config.h"
|
#include "io/config.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
TextEffect::TextEffect(Clip *c, const EffectMeta* em) :
|
TextEffect::TextEffect(ClipPtr c, const EffectMeta* em) :
|
||||||
Effect(c, em)
|
Effect(c, em)
|
||||||
{
|
{
|
||||||
enable_superimpose = true;
|
enable_superimpose = true;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
class TextEffect : public Effect {
|
class TextEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TextEffect(Clip* c, const EffectMeta *em);
|
TextEffect(ClipPtr c, const EffectMeta *em);
|
||||||
void redraw(double timecode);
|
void redraw(double timecode);
|
||||||
|
|
||||||
EffectField* text_val;
|
EffectField* text_val;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
#include "io/config.h"
|
#include "io/config.h"
|
||||||
#include "playback/playback.h"
|
#include "playback/playback.h"
|
||||||
|
|
||||||
TimecodeEffect::TimecodeEffect(Clip *c, const EffectMeta* em) :
|
TimecodeEffect::TimecodeEffect(ClipPtr c, const EffectMeta* em) :
|
||||||
Effect(c, em)
|
Effect(c, em)
|
||||||
{
|
{
|
||||||
enable_always_update = true;
|
enable_always_update = true;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
class TimecodeEffect : public Effect {
|
class TimecodeEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TimecodeEffect(Clip* c, const EffectMeta *em);
|
TimecodeEffect(ClipPtr c, const EffectMeta *em);
|
||||||
void redraw(double timecode);
|
void redraw(double timecode);
|
||||||
EffectField * scale_val;
|
EffectField * scale_val;
|
||||||
EffectField * color_val;
|
EffectField * color_val;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "project/sequence.h"
|
#include "project/sequence.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
ToneEffect::ToneEffect(Clip* c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) {
|
ToneEffect::ToneEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) {
|
||||||
type_val = add_row(tr("Type"))->add_field(EFFECT_FIELD_COMBO, "type");
|
type_val = add_row(tr("Type"))->add_field(EFFECT_FIELD_COMBO, "type");
|
||||||
type_val->add_combo_item("Sine", TONE_TYPE_SINE);
|
type_val->add_combo_item("Sine", TONE_TYPE_SINE);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
class ToneEffect : public Effect {
|
class ToneEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ToneEffect(Clip *c, const EffectMeta* em);
|
ToneEffect(ClipPtr c, const EffectMeta* em);
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
|
|
||||||
EffectField* type_val;
|
EffectField* type_val;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
#include "panels/viewer.h"
|
#include "panels/viewer.h"
|
||||||
#include "ui/viewerwidget.h"
|
#include "ui/viewerwidget.h"
|
||||||
|
|
||||||
TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
|
TransformEffect::TransformEffect(ClipPtr c, const EffectMeta* em) : Effect(c, em) {
|
||||||
enable_coords = true;
|
enable_coords = true;
|
||||||
|
|
||||||
EffectRow* position_row = add_row(tr("Position"));
|
EffectRow* position_row = add_row(tr("Position"));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
class TransformEffect : public Effect {
|
class TransformEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TransformEffect(Clip* c, const EffectMeta* em);
|
TransformEffect(ClipPtr c, const EffectMeta* em);
|
||||||
void refresh();
|
void refresh();
|
||||||
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
void process_coords(double timecode, GLTextureCoords& coords, int data);
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "ui/collapsiblewidget.h"
|
#include "ui/collapsiblewidget.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
VoidEffect::VoidEffect(Clip *c, const QString& n) : Effect(c, nullptr) {
|
VoidEffect::VoidEffect(ClipPtr c, const QString& n) : Effect(c, nullptr) {
|
||||||
name = n;
|
name = n;
|
||||||
QString display_name;
|
QString display_name;
|
||||||
if (n.isEmpty()) {
|
if (n.isEmpty()) {
|
||||||
@@ -43,8 +43,8 @@ VoidEffect::VoidEffect(Clip *c, const QString& n) : Effect(c, nullptr) {
|
|||||||
meta = &void_meta;
|
meta = &void_meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
Effect *VoidEffect::copy(Clip *c) {
|
EffectPtr VoidEffect::copy(ClipPtr c) {
|
||||||
Effect* copy = new VoidEffect(c, name);
|
EffectPtr copy(new VoidEffect(c, name));
|
||||||
copy->set_enabled(is_enabled());
|
copy->set_enabled(is_enabled());
|
||||||
copy_field_keyframes(copy);
|
copy_field_keyframes(copy);
|
||||||
return copy;
|
return copy;
|
||||||
|
|||||||
@@ -32,9 +32,9 @@
|
|||||||
class VoidEffect : public Effect {
|
class VoidEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VoidEffect(Clip* c, const QString& n);
|
VoidEffect(ClipPtr c, const QString& n);
|
||||||
|
|
||||||
virtual Effect* copy(Clip* c) override;
|
virtual EffectPtr copy(ClipPtr c) override;
|
||||||
virtual void load(QXmlStreamReader &stream) override;
|
virtual void load(QXmlStreamReader &stream) override;
|
||||||
virtual void save(QXmlStreamWriter &stream) override;
|
virtual void save(QXmlStreamWriter &stream) override;
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
#include "ui/labelslider.h"
|
#include "ui/labelslider.h"
|
||||||
#include "ui/collapsiblewidget.h"
|
#include "ui/collapsiblewidget.h"
|
||||||
|
|
||||||
VolumeEffect::VolumeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
VolumeEffect::VolumeEffect(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||||
EffectRow* volume_row = add_row(tr("Volume"));
|
EffectRow* volume_row = add_row(tr("Volume"));
|
||||||
volume_val = volume_row->add_field(EFFECT_FIELD_DOUBLE, "volume");
|
volume_val = volume_row->add_field(EFFECT_FIELD_DOUBLE, "volume");
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
class VolumeEffect : public Effect {
|
class VolumeEffect : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VolumeEffect(Clip* c, const EffectMeta* em);
|
VolumeEffect(ClipPtr c, const EffectMeta* em);
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
|
|
||||||
EffectField* volume_val;
|
EffectField* volume_val;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ void VSTHost::processAudio(long numFrames) {
|
|||||||
plugin->processReplacing(plugin, inputs, outputs, numFrames);
|
plugin->processReplacing(plugin, inputs, outputs, numFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
VSTHost::VSTHost(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
VSTHost::VSTHost(ClipPtr c, const EffectMeta *em) : Effect(c, em) {
|
||||||
plugin = nullptr;
|
plugin = nullptr;
|
||||||
|
|
||||||
inputs = new float* [CHANNEL_COUNT];
|
inputs = new float* [CHANNEL_COUNT];
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ typedef intptr_t (*dispatcherFuncPtr)(AEffect *effect, int32_t opCode, int32_t i
|
|||||||
class VSTHost : public Effect {
|
class VSTHost : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VSTHost(Clip* c, const EffectMeta* em);
|
VSTHost(ClipPtr c, const EffectMeta* em);
|
||||||
~VSTHost();
|
~VSTHost();
|
||||||
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||||
|
|
||||||
|
|||||||
+4
-15
@@ -25,21 +25,10 @@
|
|||||||
#include "project/transition.h"
|
#include "project/transition.h"
|
||||||
|
|
||||||
int clipboard_type = CLIPBOARD_TYPE_CLIP;
|
int clipboard_type = CLIPBOARD_TYPE_CLIP;
|
||||||
QVector<void*> clipboard;
|
QVector<VoidPtr> clipboard;
|
||||||
QVector<Transition*> clipboard_transitions;
|
QVector<TransitionPtr> clipboard_transitions;
|
||||||
|
|
||||||
void clear_clipboard() {
|
void clear_clipboard() {
|
||||||
int clipboard_size = clipboard.size();
|
clipboard.clear();
|
||||||
for (int i=0;i<clipboard_size;i++) {
|
clipboard_transitions.clear();
|
||||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
|
||||||
delete static_cast<Clip*>(clipboard.at(i));
|
|
||||||
} else if (clipboard_type == CLIPBOARD_TYPE_EFFECT) {
|
|
||||||
delete static_cast<Effect*>(clipboard.at(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
clipboard_size = clipboard_transitions.size();
|
|
||||||
for (int i=0;i<clipboard_size;i++) {
|
|
||||||
delete clipboard_transitions.at(i);
|
|
||||||
}
|
|
||||||
clipboard.clear();
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -28,9 +28,11 @@
|
|||||||
#define CLIPBOARD_TYPE_CLIP 0
|
#define CLIPBOARD_TYPE_CLIP 0
|
||||||
#define CLIPBOARD_TYPE_EFFECT 1
|
#define CLIPBOARD_TYPE_EFFECT 1
|
||||||
|
|
||||||
|
using VoidPtr = std::shared_ptr<void>;
|
||||||
|
|
||||||
extern int clipboard_type;
|
extern int clipboard_type;
|
||||||
extern QVector<Transition*> clipboard_transitions;
|
extern QVector<TransitionPtr> clipboard_transitions;
|
||||||
extern QVector<void*> clipboard;
|
extern QVector<VoidPtr> clipboard;
|
||||||
void clear_clipboard();
|
void clear_clipboard();
|
||||||
|
|
||||||
#endif // CLIPBOARD_H
|
#endif // CLIPBOARD_H
|
||||||
|
|||||||
+16
-16
@@ -41,12 +41,12 @@ LoadThread::LoadThread(bool a) : autorecovery(a), cancelled(false) {
|
|||||||
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
|
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
|
||||||
connect(this, SIGNAL(success()), this, SLOT(success_func()));
|
connect(this, SIGNAL(success()), this, SLOT(success_func()));
|
||||||
connect(this, SIGNAL(error()), this, SLOT(error_func()));
|
connect(this, SIGNAL(error()), this, SLOT(error_func()));
|
||||||
connect(this, SIGNAL(start_create_dual_transition(const TransitionData*,Clip*,Clip*,const EffectMeta*)), this, SLOT(create_dual_transition(const TransitionData*,Clip*,Clip*,const EffectMeta*)));
|
connect(this, SIGNAL(start_create_dual_transition(const TransitionData*,ClipPtr,ClipPtr,const EffectMeta*)), this, SLOT(create_dual_transition(const TransitionData*,ClipPtr,ClipPtr,const EffectMeta*)));
|
||||||
connect(this, SIGNAL(start_create_effect_ui(QXmlStreamReader*, Clip*, int, const QString*, const EffectMeta*, long, bool)), this, SLOT(create_effect_ui(QXmlStreamReader*, Clip*, int, const QString*, const EffectMeta*, long, bool)));
|
connect(this, SIGNAL(start_create_effect_ui(QXmlStreamReader*, ClipPtr, int, const QString*, const EffectMeta*, long, bool)), this, SLOT(create_effect_ui(QXmlStreamReader*, ClipPtr, int, const QString*, const EffectMeta*, long, bool)));
|
||||||
connect(this, SIGNAL(start_question(const QString&, const QString &, int)), this, SLOT(question_func(const QString &, const QString &, int)));
|
connect(this, SIGNAL(start_question(const QString&, const QString &, int)), this, SLOT(question_func(const QString &, const QString &, int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadThread::load_effect(QXmlStreamReader& stream, Clip* c) {
|
void LoadThread::load_effect(QXmlStreamReader& stream, ClipPtr c) {
|
||||||
int effect_id = -1;
|
int effect_id = -1;
|
||||||
QString effect_name;
|
QString effect_name;
|
||||||
bool effect_enabled = true;
|
bool effect_enabled = true;
|
||||||
@@ -194,7 +194,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
int folder = 0;
|
int folder = 0;
|
||||||
|
|
||||||
Media* item = new Media(0);
|
Media* item = new Media(0);
|
||||||
Footage* f = new Footage();
|
FootagePtr f(new Footage());
|
||||||
|
|
||||||
f->using_inout = false;
|
f->using_inout = false;
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
{
|
{
|
||||||
Media* parent = nullptr;
|
Media* parent = nullptr;
|
||||||
Sequence* s = new Sequence();
|
SequencePtr s(new Sequence());
|
||||||
|
|
||||||
// load attributes about sequence
|
// load attributes about sequence
|
||||||
for (int j=0;j<stream.attributes().size();j++) {
|
for (int j=0;j<stream.attributes().size();j++) {
|
||||||
@@ -367,7 +367,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
} else if (stream.name() == "clip" && stream.isStartElement()) {
|
} else if (stream.name() == "clip" && stream.isStartElement()) {
|
||||||
int media_type = -1;
|
int media_type = -1;
|
||||||
int media_id, stream_id;
|
int media_id, stream_id;
|
||||||
Clip* c = new Clip(s);
|
ClipPtr c(new Clip(s));
|
||||||
|
|
||||||
// backwards compatibility code
|
// backwards compatibility code
|
||||||
c->autoscale = false;
|
c->autoscale = false;
|
||||||
@@ -428,7 +428,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
case MEDIA_TYPE_FOOTAGE:
|
case MEDIA_TYPE_FOOTAGE:
|
||||||
if (media_id >= 0) {
|
if (media_id >= 0) {
|
||||||
for (int j=0;j<loaded_media_items.size();j++) {
|
for (int j=0;j<loaded_media_items.size();j++) {
|
||||||
Footage* m = loaded_media_items.at(j)->to_footage();
|
FootagePtr m = loaded_media_items.at(j)->to_footage();
|
||||||
if (m->save_id == media_id) {
|
if (m->save_id == media_id) {
|
||||||
c->media = loaded_media_items.at(j);
|
c->media = loaded_media_items.at(j);
|
||||||
c->media_stream = stream_id;
|
c->media_stream = stream_id;
|
||||||
@@ -487,7 +487,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
// correct links, clip IDs, transitions
|
// correct links, clip IDs, transitions
|
||||||
for (int i=0;i<s->clips.size();i++) {
|
for (int i=0;i<s->clips.size();i++) {
|
||||||
// correct links
|
// correct links
|
||||||
Clip* correct_clip = s->clips.at(i);
|
ClipPtr correct_clip = s->clips.at(i);
|
||||||
for (int j=0;j<correct_clip->linked.size();j++) {
|
for (int j=0;j<correct_clip->linked.size();j++) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int k=0;k<s->clips.size();k++) {
|
for (int k=0;k<s->clips.size();k++) {
|
||||||
@@ -508,7 +508,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
);
|
);
|
||||||
waitCond.wait(&mutex);
|
waitCond.wait(&mutex);
|
||||||
if (question_btn == QMessageBox::No) {
|
if (question_btn == QMessageBox::No) {
|
||||||
delete s;
|
s.reset();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -534,8 +534,8 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
|||||||
// create transitions
|
// create transitions
|
||||||
for (int i=0;i<transition_data.size();i++) {
|
for (int i=0;i<transition_data.size();i++) {
|
||||||
const TransitionData& td = transition_data.at(i);
|
const TransitionData& td = transition_data.at(i);
|
||||||
Clip* primary = td.otc;
|
ClipPtr primary = td.otc;
|
||||||
Clip* secondary = td.ctc;
|
ClipPtr secondary = td.ctc;
|
||||||
if (primary != nullptr || secondary != nullptr) {
|
if (primary != nullptr || secondary != nullptr) {
|
||||||
if (primary == nullptr) {
|
if (primary == nullptr) {
|
||||||
primary = secondary;
|
primary = secondary;
|
||||||
@@ -760,7 +760,7 @@ void LoadThread::success_func() {
|
|||||||
|
|
||||||
void LoadThread::create_effect_ui(
|
void LoadThread::create_effect_ui(
|
||||||
QXmlStreamReader* stream,
|
QXmlStreamReader* stream,
|
||||||
Clip* c,
|
ClipPtr c,
|
||||||
int type,
|
int type,
|
||||||
const QString* effect_name,
|
const QString* effect_name,
|
||||||
const EffectMeta* meta,
|
const EffectMeta* meta,
|
||||||
@@ -795,12 +795,12 @@ void LoadThread::create_effect_ui(
|
|||||||
if (type == TA_NO_TRANSITION) {
|
if (type == TA_NO_TRANSITION) {
|
||||||
if (meta == nullptr) {
|
if (meta == nullptr) {
|
||||||
// create void effect
|
// create void effect
|
||||||
VoidEffect* ve = new VoidEffect(c, *effect_name);
|
EffectPtr ve(new VoidEffect(c, *effect_name));
|
||||||
ve->set_enabled(effect_enabled);
|
ve->set_enabled(effect_enabled);
|
||||||
ve->load(*stream);
|
ve->load(*stream);
|
||||||
c->effects.append(ve);
|
c->effects.append(ve);
|
||||||
} else {
|
} else {
|
||||||
Effect* e = create_effect(c, meta);
|
EffectPtr e(create_effect(c, meta));
|
||||||
e->set_enabled(effect_enabled);
|
e->set_enabled(effect_enabled);
|
||||||
e->load(*stream);
|
e->load(*stream);
|
||||||
|
|
||||||
@@ -808,7 +808,7 @@ void LoadThread::create_effect_ui(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int transition_index = create_transition(c, nullptr, meta);
|
int transition_index = create_transition(c, nullptr, meta);
|
||||||
Transition* t = c->sequence->transitions.at(transition_index);
|
TransitionPtr t = c->sequence->transitions.at(transition_index);
|
||||||
if (effect_length > -1) t->set_length(effect_length);
|
if (effect_length > -1) t->set_length(effect_length);
|
||||||
t->set_enabled(effect_enabled);
|
t->set_enabled(effect_enabled);
|
||||||
t->load(*stream);
|
t->load(*stream);
|
||||||
@@ -825,7 +825,7 @@ void LoadThread::create_effect_ui(
|
|||||||
waitCond.wakeAll();
|
waitCond.wakeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadThread::create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta) {
|
void LoadThread::create_dual_transition(const TransitionData* td, ClipPtr primary, ClipPtr secondary, const EffectMeta* meta) {
|
||||||
// lock mutex - ensures the load thread is suspended while this happens
|
// lock mutex - ensures the load thread is suspended while this happens
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
|
|
||||||
|
|||||||
+9
-9
@@ -34,8 +34,8 @@ struct TransitionData {
|
|||||||
int id;
|
int id;
|
||||||
QString name;
|
QString name;
|
||||||
long length;
|
long length;
|
||||||
Clip* otc;
|
ClipPtr otc;
|
||||||
Clip* ctc;
|
ClipPtr ctc;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LoadThread : public QThread
|
class LoadThread : public QThread
|
||||||
@@ -49,26 +49,26 @@ signals:
|
|||||||
void start_question(const QString &title, const QString &text, int buttons);
|
void start_question(const QString &title, const QString &text, int buttons);
|
||||||
void success();
|
void success();
|
||||||
void error();
|
void error();
|
||||||
void start_create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
void start_create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||||
void start_create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
|
void start_create_dual_transition(const TransitionData* td, ClipPtr primary, ClipPtr secondary, const EffectMeta* meta);
|
||||||
void report_progress(int p);
|
void report_progress(int p);
|
||||||
private slots:
|
private slots:
|
||||||
void question_func(const QString &title, const QString &text, int buttons);
|
void question_func(const QString &title, const QString &text, int buttons);
|
||||||
void error_func();
|
void error_func();
|
||||||
void success_func();
|
void success_func();
|
||||||
void create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
void create_effect_ui(QXmlStreamReader* stream, ClipPtr c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||||
void create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
|
void create_dual_transition(const TransitionData* td, ClipPtr primary, ClipPtr secondary, const EffectMeta* meta);
|
||||||
private:
|
private:
|
||||||
bool autorecovery;
|
bool autorecovery;
|
||||||
|
|
||||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||||
void load_effect(QXmlStreamReader& stream, Clip* c);
|
void load_effect(QXmlStreamReader& stream, ClipPtr c);
|
||||||
|
|
||||||
void read_next(QXmlStreamReader& stream);
|
void read_next(QXmlStreamReader& stream);
|
||||||
void read_next_start_element(QXmlStreamReader& stream);
|
void read_next_start_element(QXmlStreamReader& stream);
|
||||||
void update_current_element_count(QXmlStreamReader& stream);
|
void update_current_element_count(QXmlStreamReader& stream);
|
||||||
|
|
||||||
Sequence* open_seq;
|
SequencePtr open_seq;
|
||||||
QVector<Media*> loaded_media_items;
|
QVector<Media*> loaded_media_items;
|
||||||
QDir proj_dir;
|
QDir proj_dir;
|
||||||
QDir internal_proj_dir;
|
QDir internal_proj_dir;
|
||||||
@@ -79,7 +79,7 @@ private:
|
|||||||
bool is_element(QXmlStreamReader& stream);
|
bool is_element(QXmlStreamReader& stream);
|
||||||
|
|
||||||
QVector<Media*> loaded_folders;
|
QVector<Media*> loaded_folders;
|
||||||
QVector<Clip*> loaded_clips;
|
QVector<ClipPtr> loaded_clips;
|
||||||
QVector<Media*> loaded_sequences;
|
QVector<Media*> loaded_sequences;
|
||||||
Media* find_loaded_folder_by_id(int id);
|
Media* find_loaded_folder_by_id(int id);
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
QSemaphore sem(5); // only 5 preview generators can run at one time
|
QSemaphore sem(5); // only 5 preview generators can run at one time
|
||||||
|
|
||||||
PreviewGenerator::PreviewGenerator(Media* i, Footage* m, bool r) :
|
PreviewGenerator::PreviewGenerator(Media* i, FootagePtr m, bool r) :
|
||||||
QThread(nullptr),
|
QThread(nullptr),
|
||||||
fmt_ctx(nullptr),
|
fmt_ctx(nullptr),
|
||||||
media(i),
|
media(i),
|
||||||
@@ -48,8 +48,7 @@ PreviewGenerator::PreviewGenerator(Media* i, Footage* m, bool r) :
|
|||||||
replace(r),
|
replace(r),
|
||||||
cancelled(false)
|
cancelled(false)
|
||||||
{
|
{
|
||||||
data_path = get_data_path() + "/previews";
|
data_dir = QDir(get_data_dir().filePath("previews"));
|
||||||
QDir data_dir(data_path);
|
|
||||||
if (!data_dir.exists()) {
|
if (!data_dir.exists()) {
|
||||||
data_dir.mkpath(".");
|
data_dir.mkpath(".");
|
||||||
}
|
}
|
||||||
@@ -506,11 +505,11 @@ void PreviewGenerator::generate_waveform() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString PreviewGenerator::get_thumbnail_path(const QString& hash, const FootageStream& ms) {
|
QString PreviewGenerator::get_thumbnail_path(const QString& hash, const FootageStream& ms) {
|
||||||
return data_path + "/" + hash + "t" + QString::number(ms.file_index);
|
return data_dir.filePath(QString("%1t%2").arg(hash, QString::number(ms.file_index)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PreviewGenerator::get_waveform_path(const QString& hash, const FootageStream& ms) {
|
QString PreviewGenerator::get_waveform_path(const QString& hash, const FootageStream& ms) {
|
||||||
return data_path + "/" + hash + "w" + QString::number(ms.file_index);
|
return data_dir.filePath(QString("%1w%2").arg(hash, QString::number(ms.file_index)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewGenerator::run() {
|
void PreviewGenerator::run() {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QSemaphore>
|
#include <QSemaphore>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
enum IconType {
|
enum IconType {
|
||||||
ICON_TYPE_VIDEO,
|
ICON_TYPE_VIDEO,
|
||||||
@@ -45,7 +46,7 @@ class PreviewGenerator : public QThread
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PreviewGenerator(Media*, Footage*, bool);
|
PreviewGenerator(Media*, FootagePtr, bool);
|
||||||
void run();
|
void run();
|
||||||
void cancel();
|
void cancel();
|
||||||
signals:
|
signals:
|
||||||
@@ -57,12 +58,12 @@ private:
|
|||||||
void finalize_media();
|
void finalize_media();
|
||||||
AVFormatContext* fmt_ctx;
|
AVFormatContext* fmt_ctx;
|
||||||
Media* media;
|
Media* media;
|
||||||
Footage* footage;
|
FootagePtr footage;
|
||||||
bool retrieve_duration;
|
bool retrieve_duration;
|
||||||
bool contains_still_image;
|
bool contains_still_image;
|
||||||
bool replace;
|
bool replace;
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
QString data_path;
|
QDir data_dir;
|
||||||
QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
|
QString get_thumbnail_path(const QString &hash, const FootageStream &ms);
|
||||||
QString get_waveform_path(const QString& hash, const FootageStream &ms);
|
QString get_waveform_path(const QString& hash, const FootageStream &ms);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ void ProxyGenerator::cancel() {
|
|||||||
wait();
|
wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
double ProxyGenerator::get_proxy_progress(Footage *f) {
|
double ProxyGenerator::get_proxy_progress(FootagePtr f) {
|
||||||
if (proxy_queue.first().footage == f) {
|
if (proxy_queue.first().footage == f) {
|
||||||
return current_progress;
|
return current_progress;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@
|
|||||||
#include "project/footage.h"
|
#include "project/footage.h"
|
||||||
|
|
||||||
struct ProxyInfo {
|
struct ProxyInfo {
|
||||||
Footage* footage;
|
FootagePtr footage;
|
||||||
double size_multiplier;
|
double size_multiplier;
|
||||||
int codec_type;
|
int codec_type;
|
||||||
QString path;
|
QString path;
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
void run();
|
void run();
|
||||||
void queue(const ProxyInfo& info);
|
void queue(const ProxyInfo& info);
|
||||||
void cancel();
|
void cancel();
|
||||||
double get_proxy_progress(Footage* f);
|
double get_proxy_progress(FootagePtr f);
|
||||||
private:
|
private:
|
||||||
// queue of footage to process proxies for
|
// queue of footage to process proxies for
|
||||||
QVector<ProxyInfo> proxy_queue;
|
QVector<ProxyInfo> proxy_queue;
|
||||||
|
|||||||
@@ -64,6 +64,8 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(ClipPtr);
|
||||||
|
|
||||||
MainWindow* olive::MainWindow;
|
MainWindow* olive::MainWindow;
|
||||||
|
|
||||||
#define DEFAULT_CSS "QPushButton::checked { background: rgb(25, 25, 25); }"
|
#define DEFAULT_CSS "QPushButton::checked { background: rgb(25, 25, 25); }"
|
||||||
@@ -100,6 +102,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
first_show(true)
|
first_show(true)
|
||||||
{
|
{
|
||||||
|
qRegisterMetaType<ClipPtr>();
|
||||||
|
|
||||||
init_custom_cursors();
|
init_custom_cursors();
|
||||||
|
|
||||||
open_debug_file();
|
open_debug_file();
|
||||||
|
|||||||
@@ -148,7 +148,8 @@ SOURCES += \
|
|||||||
ui/cursors.cpp \
|
ui/cursors.cpp \
|
||||||
ui/menuhelper.cpp \
|
ui/menuhelper.cpp \
|
||||||
oliveglobal.cpp \
|
oliveglobal.cpp \
|
||||||
ui/focusfilter.cpp
|
ui/focusfilter.cpp \
|
||||||
|
project/comboaction.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
@@ -254,7 +255,8 @@ HEADERS += \
|
|||||||
ui/menuhelper.h \
|
ui/menuhelper.h \
|
||||||
oliveglobal.h \
|
oliveglobal.h \
|
||||||
project/projectelements.h \
|
project/projectelements.h \
|
||||||
ui/focusfilter.h
|
ui/focusfilter.h \
|
||||||
|
project/comboaction.h
|
||||||
|
|
||||||
FORMS +=
|
FORMS +=
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -295,7 +295,7 @@ void OliveGlobal::open_speed_dialog() {
|
|||||||
if (olive::ActiveSequence != nullptr) {
|
if (olive::ActiveSequence != nullptr) {
|
||||||
SpeedDialog s(olive::MainWindow);
|
SpeedDialog s(olive::MainWindow);
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr && is_clip_selected(c, true)) {
|
if (c != nullptr && is_clip_selected(c, true)) {
|
||||||
s.clips.append(c);
|
s.clips.append(c);
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -100,7 +100,7 @@ void EffectControls::set_zoom(bool in) {
|
|||||||
void EffectControls::menu_select(QAction* q) {
|
void EffectControls::menu_select(QAction* q) {
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
||||||
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
||||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||||
@@ -140,9 +140,9 @@ void EffectControls::copy(bool del) {
|
|||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
Effect* effect = c->effects.at(j);
|
EffectPtr effect = c->effects.at(j);
|
||||||
if (effect->container->selected) {
|
if (effect->container->selected) {
|
||||||
if (!cleared) {
|
if (!cleared) {
|
||||||
clear_clipboard();
|
clear_clipboard();
|
||||||
@@ -150,7 +150,7 @@ void EffectControls::copy(bool del) {
|
|||||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
clipboard.append(effect->copy(nullptr));
|
clipboard.append(EffectPtr(effect->copy(nullptr)));
|
||||||
|
|
||||||
if (del_com != nullptr) {
|
if (del_com != nullptr) {
|
||||||
del_com->clips.append(c);
|
del_com->clips.append(c);
|
||||||
@@ -176,7 +176,7 @@ void EffectControls::scroll_to_frame(long frame) {
|
|||||||
|
|
||||||
void EffectControls::add_effect_paste_action(QMenu *menu) {
|
void EffectControls::add_effect_paste_action(QMenu *menu) {
|
||||||
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
||||||
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::cut() {
|
void EffectControls::cut() {
|
||||||
@@ -282,7 +282,7 @@ void EffectControls::clear_effects(bool clear_cache) {
|
|||||||
|
|
||||||
void EffectControls::deselect_all_effects(QWidget* sender) {
|
void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
if (c->effects.at(j)->container != sender) {
|
if (c->effects.at(j)->container != sender) {
|
||||||
c->effects.at(j)->container->header_click(false, false);
|
c->effects.at(j)->container->header_click(false, false);
|
||||||
@@ -292,7 +292,7 @@ void EffectControls::deselect_all_effects(QWidget* sender) {
|
|||||||
panel_sequence_viewer->viewer_widget->update();
|
panel_sequence_viewer->viewer_widget->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
|
void EffectControls::open_effect(QVBoxLayout* layout, EffectPtr e) {
|
||||||
CollapsibleWidget* container = e->container;
|
CollapsibleWidget* container = e->container;
|
||||||
layout->addWidget(container);
|
layout->addWidget(container);
|
||||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||||
@@ -505,7 +505,7 @@ void EffectControls::load_effects() {
|
|||||||
if (!multiple) {
|
if (!multiple) {
|
||||||
// load in new clips
|
// load in new clips
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
QVBoxLayout* layout;
|
QVBoxLayout* layout;
|
||||||
if (c->track < 0) {
|
if (c->track < 0) {
|
||||||
vcontainer->setVisible(true);
|
vcontainer->setVisible(true);
|
||||||
@@ -539,9 +539,9 @@ void EffectControls::delete_effects() {
|
|||||||
if (mode == TA_NO_TRANSITION) {
|
if (mode == TA_NO_TRANSITION) {
|
||||||
EffectDeleteCommand* command = new EffectDeleteCommand();
|
EffectDeleteCommand* command = new EffectDeleteCommand();
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
Effect* effect = c->effects.at(j);
|
EffectPtr effect = c->effects.at(j);
|
||||||
if (effect->container->selected) {
|
if (effect->container->selected) {
|
||||||
command->clips.append(c);
|
command->clips.append(c);
|
||||||
command->fx.append(j);
|
command->fx.append(j);
|
||||||
@@ -595,7 +595,7 @@ void EffectControls::resizeEvent(QResizeEvent*) {
|
|||||||
bool EffectControls::is_focused() {
|
bool EffectControls::is_focused() {
|
||||||
if (this->hasFocus()) return true;
|
if (this->hasFocus()) return true;
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
if (c->effects.at(j)->container->is_focused()) {
|
if (c->effects.at(j)->container->is_focused()) {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ private:
|
|||||||
void show_effect_menu(int type, int subtype);
|
void show_effect_menu(int type, int subtype);
|
||||||
void load_effects();
|
void load_effects();
|
||||||
void load_keyframes();
|
void load_keyframes();
|
||||||
void open_effect(QVBoxLayout* hlayout, Effect* e);
|
void open_effect(QVBoxLayout* hlayout, EffectPtr e);
|
||||||
|
|
||||||
void setup_ui();
|
void setup_ui();
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -50,7 +50,7 @@ void update_effect_controls() {
|
|||||||
int mode = TA_NO_TRANSITION;
|
int mode = TA_NO_TRANSITION;
|
||||||
if (olive::ActiveSequence != nullptr) {
|
if (olive::ActiveSequence != nullptr) {
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* clip = olive::ActiveSequence->clips.at(i);
|
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
||||||
if (clip != nullptr) {
|
if (clip != nullptr) {
|
||||||
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
||||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||||
@@ -88,7 +88,7 @@ void update_effect_controls() {
|
|||||||
if (aclip >= 0) selected_clips.append(aclip);
|
if (aclip >= 0) selected_clips.append(aclip);
|
||||||
if (vclip >= 0 && aclip >= 0) {
|
if (vclip >= 0 && aclip >= 0) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
Clip* vclip_ref = olive::ActiveSequence->clips.at(vclip);
|
ClipPtr vclip_ref = olive::ActiveSequence->clips.at(vclip);
|
||||||
for (int i=0;i<vclip_ref->linked.size();i++) {
|
for (int i=0;i<vclip_ref->linked.size();i++) {
|
||||||
if (vclip_ref->linked.at(i) == aclip) {
|
if (vclip_ref->linked.at(i) == aclip) {
|
||||||
found = true;
|
found = true;
|
||||||
|
|||||||
+66
-62
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "oliveglobal.h"
|
#include "oliveglobal.h"
|
||||||
|
|
||||||
|
#include "panels.h"
|
||||||
#include "playback/playback.h"
|
#include "playback/playback.h"
|
||||||
#include "io/previewgenerator.h"
|
#include "io/previewgenerator.h"
|
||||||
#include "project/undo.h"
|
#include "project/undo.h"
|
||||||
@@ -257,10 +258,10 @@ QString Project::get_next_sequence_name(QString start) {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
SequencePtr create_sequence_from_media(QVector<Media*>& media_list) {
|
||||||
Sequence* s = new Sequence();
|
SequencePtr s(new Sequence());
|
||||||
|
|
||||||
s->name = panel_project->get_next_sequence_name();
|
s->name = panel_project->get_next_sequence_name();
|
||||||
|
|
||||||
// shitty hardcoded default values
|
// shitty hardcoded default values
|
||||||
s->width = 1920;
|
s->width = 1920;
|
||||||
@@ -272,11 +273,11 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
|||||||
bool got_video_values = false;
|
bool got_video_values = false;
|
||||||
bool got_audio_values = false;
|
bool got_audio_values = false;
|
||||||
for (int i=0;i<media_list.size();i++) {
|
for (int i=0;i<media_list.size();i++) {
|
||||||
Media* media = media_list.at(i);
|
Media* media = media_list.at(i);
|
||||||
switch (media->get_type()) {
|
switch (media->get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
case MEDIA_TYPE_FOOTAGE:
|
||||||
{
|
{
|
||||||
Footage* m = media->to_footage();
|
FootagePtr m = media->to_footage();
|
||||||
if (m->ready) {
|
if (m->ready) {
|
||||||
if (!got_video_values) {
|
if (!got_video_values) {
|
||||||
for (int j=0;j<m->video_tracks.size();j++) {
|
for (int j=0;j<m->video_tracks.size();j++) {
|
||||||
@@ -304,7 +305,7 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
|||||||
break;
|
break;
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
{
|
{
|
||||||
Sequence* seq = media->to_sequence();
|
SequencePtr seq = media->to_sequence();
|
||||||
s->width = seq->width;
|
s->width = seq->width;
|
||||||
s->height = seq->height;
|
s->height = seq->height;
|
||||||
s->frame_rate = seq->frame_rate;
|
s->frame_rate = seq->frame_rate;
|
||||||
@@ -327,7 +328,7 @@ void Project::duplicate_selected() {
|
|||||||
bool duped = false;
|
bool duped = false;
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
for (int j=0;j<items.size();j++) {
|
for (int j=0;j<items.size();j++) {
|
||||||
Media* i = item_to_media(items.at(j));
|
Media* i = item_to_media(items.at(j));
|
||||||
if (i->get_type() == MEDIA_TYPE_SEQUENCE) {
|
if (i->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||||
create_sequence_internal(ca, i->to_sequence()->copy(), false, item_to_media(items.at(j).parent()));
|
create_sequence_internal(ca, i->to_sequence()->copy(), false, item_to_media(items.at(j).parent()));
|
||||||
duped = true;
|
duped = true;
|
||||||
@@ -343,7 +344,7 @@ void Project::duplicate_selected() {
|
|||||||
void Project::replace_selected_file() {
|
void Project::replace_selected_file() {
|
||||||
QModelIndexList selected_items = get_current_selected();
|
QModelIndexList selected_items = get_current_selected();
|
||||||
if (selected_items.size() == 1) {
|
if (selected_items.size() == 1) {
|
||||||
Media* item = item_to_media(selected_items.at(0));
|
Media* item = item_to_media(selected_items.at(0));
|
||||||
if (item->get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (item->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
replace_media(item, nullptr);
|
replace_media(item, nullptr);
|
||||||
}
|
}
|
||||||
@@ -373,7 +374,7 @@ void Project::replace_clip_media() {
|
|||||||
} else {
|
} else {
|
||||||
QModelIndexList selected_items = get_current_selected();
|
QModelIndexList selected_items = get_current_selected();
|
||||||
if (selected_items.size() == 1) {
|
if (selected_items.size() == 1) {
|
||||||
Media* item = item_to_media(selected_items.at(0));
|
Media* item = item_to_media(selected_items.at(0));
|
||||||
if (item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == item->to_sequence()) {
|
if (item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == item->to_sequence()) {
|
||||||
QMessageBox::critical(this,
|
QMessageBox::critical(this,
|
||||||
tr("Active sequence selected"),
|
tr("Active sequence selected"),
|
||||||
@@ -390,7 +391,7 @@ void Project::replace_clip_media() {
|
|||||||
void Project::open_properties() {
|
void Project::open_properties() {
|
||||||
QModelIndexList selected_items = get_current_selected();
|
QModelIndexList selected_items = get_current_selected();
|
||||||
if (selected_items.size() == 1) {
|
if (selected_items.size() == 1) {
|
||||||
Media* item = item_to_media(selected_items.at(0));
|
Media* item = item_to_media(selected_items.at(0));
|
||||||
switch (item->get_type()) {
|
switch (item->get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
case MEDIA_TYPE_FOOTAGE:
|
||||||
{
|
{
|
||||||
@@ -438,13 +439,16 @@ void Project::new_folder() {
|
|||||||
|
|
||||||
void Project::new_sequence() {
|
void Project::new_sequence() {
|
||||||
NewSequenceDialog nsd(this);
|
NewSequenceDialog nsd(this);
|
||||||
nsd.set_sequence_name(panel_project->get_next_sequence_name());
|
nsd.set_sequence_name(get_next_sequence_name());
|
||||||
nsd.exec();
|
nsd.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
Media* Project::create_sequence_internal(ComboAction *ca, Sequence *s, bool open, Media* parent) {
|
Media* Project::create_sequence_internal(ComboAction *ca, SequencePtr s, bool open, Media* parent) {
|
||||||
if (parent == nullptr) parent = project_model.get_root();
|
if (parent == nullptr) {
|
||||||
Media* item = new Media(parent);
|
parent = project_model.get_root();
|
||||||
|
}
|
||||||
|
|
||||||
|
Media* item(new Media(parent));
|
||||||
item->set_sequence(s);
|
item->set_sequence(s);
|
||||||
|
|
||||||
if (ca != nullptr) {
|
if (ca != nullptr) {
|
||||||
@@ -466,7 +470,7 @@ QString Project::get_file_name_from_path(const QString& path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Media* Project::new_item() {
|
/*Media* Project::new_item() {
|
||||||
Media* item = new Media(0);
|
Media* item = new Media(0);
|
||||||
//item->setFlags(item->flags() | Qt::ItemIsEditable);
|
//item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||||
return item;
|
return item;
|
||||||
}*/
|
}*/
|
||||||
@@ -476,22 +480,22 @@ bool Project::is_focused() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Media* Project::create_folder_internal(QString name) {
|
Media* Project::create_folder_internal(QString name) {
|
||||||
Media* item = new Media(nullptr);
|
Media* item = new Media(nullptr);
|
||||||
item->set_folder();
|
item->set_folder();
|
||||||
item->set_name(name);
|
item->set_name(name);
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
Media *Project::item_to_media(const QModelIndex &index) {
|
Media *Project::item_to_media(const QModelIndex &index) {
|
||||||
return static_cast<Media*>(sorter->mapToSource(index).internalPointer());
|
return static_cast<Media*>(sorter->mapToSource(index).internalPointer());
|
||||||
// return static_cast<Media*>(index.internalPointer());
|
// return static_cast<Media*>(index.internalPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::get_all_media_from_table(QList<Media*>& items, QList<Media*>& list, int search_type) {
|
void Project::get_all_media_from_table(QList<Media*>& items, QList<Media*>& list, int search_type) {
|
||||||
for (int i=0;i<items.size();i++) {
|
for (int i=0;i<items.size();i++) {
|
||||||
Media* item = items.at(i);
|
Media* item = items.at(i);
|
||||||
if (item->get_type() == MEDIA_TYPE_FOLDER) {
|
if (item->get_type() == MEDIA_TYPE_FOLDER) {
|
||||||
QList<Media*> children;
|
QList<Media*> children;
|
||||||
for (int j=0;j<item->childCount();j++) {
|
for (int j=0;j<item->childCount();j++) {
|
||||||
children.append(item->child(j));
|
children.append(item->child(j));
|
||||||
}
|
}
|
||||||
@@ -505,8 +509,8 @@ void Project::get_all_media_from_table(QList<Media*>& items, QList<Media*>& list
|
|||||||
bool delete_clips_in_clipboard_with_media(ComboAction* ca, Media* m) {
|
bool delete_clips_in_clipboard_with_media(ComboAction* ca, Media* m) {
|
||||||
int delete_count = 0;
|
int delete_count = 0;
|
||||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
||||||
for (int i=0;i<clipboard.size();i++) {
|
for (int i=0;i<clipboard.size();i++) {
|
||||||
Clip* c = static_cast<Clip*>(clipboard.at(i));
|
ClipPtr c = std::static_pointer_cast<Clip>(clipboard.at(i));
|
||||||
if (c->media == m) {
|
if (c->media == m) {
|
||||||
ca->append(new RemoveClipsFromClipboard(i-delete_count));
|
ca->append(new RemoveClipsFromClipboard(i-delete_count));
|
||||||
delete_count++;
|
delete_count++;
|
||||||
@@ -519,7 +523,7 @@ bool delete_clips_in_clipboard_with_media(ComboAction* ca, Media* m) {
|
|||||||
void Project::delete_selected_media() {
|
void Project::delete_selected_media() {
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
QModelIndexList selected_items = get_current_selected();
|
QModelIndexList selected_items = get_current_selected();
|
||||||
QList<Media*> items;
|
QList<Media*> items;
|
||||||
for (int i=0;i<selected_items.size();i++) {
|
for (int i=0;i<selected_items.size();i++) {
|
||||||
items.append(item_to_media(selected_items.at(i)));
|
items.append(item_to_media(selected_items.at(i)));
|
||||||
}
|
}
|
||||||
@@ -527,25 +531,25 @@ void Project::delete_selected_media() {
|
|||||||
bool redraw = false;
|
bool redraw = false;
|
||||||
|
|
||||||
// check if media is in use
|
// check if media is in use
|
||||||
QVector<Media*> parents;
|
QVector<Media*> parents;
|
||||||
QList<Media*> sequence_items;
|
QList<Media*> sequence_items;
|
||||||
QList<Media*> all_top_level_items;
|
QList<Media*> all_top_level_items;
|
||||||
for (int i=0;i<project_model.childCount();i++) {
|
for (int i=0;i<project_model.childCount();i++) {
|
||||||
all_top_level_items.append(project_model.child(i));
|
all_top_level_items.append(project_model.child(i));
|
||||||
}
|
}
|
||||||
get_all_media_from_table(all_top_level_items, sequence_items, MEDIA_TYPE_SEQUENCE); // find all sequences in project
|
get_all_media_from_table(all_top_level_items, sequence_items, MEDIA_TYPE_SEQUENCE); // find all sequences in project
|
||||||
if (sequence_items.size() > 0) {
|
if (sequence_items.size() > 0) {
|
||||||
QList<Media*> media_items;
|
QList<Media*> media_items;
|
||||||
get_all_media_from_table(items, media_items, MEDIA_TYPE_FOOTAGE);
|
get_all_media_from_table(items, media_items, MEDIA_TYPE_FOOTAGE);
|
||||||
for (int i=0;i<media_items.size();i++) {
|
for (int i=0;i<media_items.size();i++) {
|
||||||
Media* item = media_items.at(i);
|
Media* item = media_items.at(i);
|
||||||
Footage* media = item->to_footage();
|
FootagePtr media = item->to_footage();
|
||||||
bool confirm_delete = false;
|
bool confirm_delete = false;
|
||||||
for (int j=0;j<sequence_items.size();j++) {
|
for (int j=0;j<sequence_items.size();j++) {
|
||||||
Sequence* s = sequence_items.at(j)->to_sequence();
|
SequencePtr s = sequence_items.at(j)->to_sequence();
|
||||||
for (int k=0;k<s->clips.size();k++) {
|
for (int k=0;k<s->clips.size();k++) {
|
||||||
Clip* c = s->clips.at(k);
|
ClipPtr c = s->clips.at(k);
|
||||||
if (c != nullptr && c->media == item) {
|
if (c != nullptr && c->media == item) {
|
||||||
if (!confirm_delete) {
|
if (!confirm_delete) {
|
||||||
// we found a reference, so we know we'll need to ask if the user wants to delete it
|
// we found a reference, so we know we'll need to ask if the user wants to delete it
|
||||||
QMessageBox confirm(this);
|
QMessageBox confirm(this);
|
||||||
@@ -562,13 +566,13 @@ void Project::delete_selected_media() {
|
|||||||
redraw = true;
|
redraw = true;
|
||||||
} else if (confirm.clickedButton() == skip_button) {
|
} else if (confirm.clickedButton() == skip_button) {
|
||||||
// remove media item and any folders containing it from the remove list
|
// remove media item and any folders containing it from the remove list
|
||||||
Media* parent = item;
|
Media* parent = item;
|
||||||
while (parent != nullptr) {
|
while (parent != nullptr) {
|
||||||
parents.append(parent);
|
parents.append(parent);
|
||||||
|
|
||||||
// re-add item's siblings
|
// re-add item's siblings
|
||||||
for (int m=0;m<parent->childCount();m++) {
|
for (int m=0;m<parent->childCount();m++) {
|
||||||
Media* child = parent->child(m);
|
Media* child = parent->child(m);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int n=0;n<items.size();n++) {
|
for (int n=0;n<items.size();n++) {
|
||||||
if (items.at(n) == child) {
|
if (items.at(n) == child) {
|
||||||
@@ -628,7 +632,7 @@ void Project::delete_selected_media() {
|
|||||||
if (items.at(i)->get_type() == MEDIA_TYPE_SEQUENCE) {
|
if (items.at(i)->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||||
redraw = true;
|
redraw = true;
|
||||||
|
|
||||||
Sequence* s = items.at(i)->to_sequence();
|
SequencePtr s = items.at(i)->to_sequence();
|
||||||
|
|
||||||
if (s == olive::ActiveSequence) {
|
if (s == olive::ActiveSequence) {
|
||||||
ca->append(new ChangeSequenceAction(nullptr));
|
ca->append(new ChangeSequenceAction(nullptr));
|
||||||
@@ -640,8 +644,8 @@ void Project::delete_selected_media() {
|
|||||||
} else if (items.at(i)->get_type() == MEDIA_TYPE_FOOTAGE) {
|
} else if (items.at(i)->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
if (panel_footage_viewer->seq != nullptr) {
|
if (panel_footage_viewer->seq != nullptr) {
|
||||||
for (int j=0;j<panel_footage_viewer->seq->clips.size();j++) {
|
for (int j=0;j<panel_footage_viewer->seq->clips.size();j++) {
|
||||||
Clip* c = panel_footage_viewer->seq->clips.at(j);
|
ClipPtr c = panel_footage_viewer->seq->clips.at(j);
|
||||||
if (c != nullptr && c->media == items.at(i)) {
|
if (c != nullptr && c->media == items.at(i)) {
|
||||||
panel_footage_viewer->set_media(nullptr);
|
panel_footage_viewer->set_media(nullptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -689,7 +693,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
|||||||
for (int i=0;i<files.size();i++) {
|
for (int i=0;i<files.size();i++) {
|
||||||
if (QFileInfo(files.at(i)).isDir()) {
|
if (QFileInfo(files.at(i)).isDir()) {
|
||||||
QString folder_name = get_file_name_from_path(files.at(i));
|
QString folder_name = get_file_name_from_path(files.at(i));
|
||||||
Media* folder = create_folder_internal(folder_name);
|
Media* folder = create_folder_internal(folder_name);
|
||||||
|
|
||||||
QDir directory(files.at(i));
|
QDir directory(files.at(i));
|
||||||
directory.setFilter(QDir::NoDotAndDotDot | QDir::AllEntries);
|
directory.setFilter(QDir::NoDotAndDotDot | QDir::AllEntries);
|
||||||
@@ -714,7 +718,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
|||||||
QString file(files.at(i));
|
QString file(files.at(i));
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
|
|
||||||
/* Heuristic to determine whether file is part of an image sequence */
|
/* Heuristic to determine whether file is part of an image sequence */
|
||||||
|
|
||||||
// check file extension (assume it's not a
|
// check file extension (assume it's not a
|
||||||
|
|
||||||
@@ -791,8 +795,8 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!skip) {
|
if (!skip) {
|
||||||
Media* item;
|
Media* item;
|
||||||
Footage* m;
|
FootagePtr m;
|
||||||
|
|
||||||
if (replace != nullptr) {
|
if (replace != nullptr) {
|
||||||
item = replace;
|
item = replace;
|
||||||
@@ -800,7 +804,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
|||||||
m->reset();
|
m->reset();
|
||||||
} else {
|
} else {
|
||||||
item = new Media(parent);
|
item = new Media(parent);
|
||||||
m = new Footage();
|
m = FootagePtr(new Footage());
|
||||||
}
|
}
|
||||||
|
|
||||||
m->using_inout = false;
|
m->using_inout = false;
|
||||||
@@ -842,7 +846,7 @@ Media* Project::get_selected_folder() {
|
|||||||
// if one item is selected and it's a folder, return it
|
// if one item is selected and it's a folder, return it
|
||||||
QModelIndexList selected_items = get_current_selected();
|
QModelIndexList selected_items = get_current_selected();
|
||||||
if (selected_items.size() == 1) {
|
if (selected_items.size() == 1) {
|
||||||
Media* m = item_to_media(selected_items.at(0));
|
Media* m = item_to_media(selected_items.at(0));
|
||||||
if (m->get_type() == MEDIA_TYPE_FOLDER) return m;
|
if (m->get_type() == MEDIA_TYPE_FOLDER) return m;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -851,7 +855,7 @@ Media* Project::get_selected_folder() {
|
|||||||
bool Project::reveal_media(Media *media, QModelIndex parent) {
|
bool Project::reveal_media(Media *media, QModelIndex parent) {
|
||||||
for (int i=0;i<project_model.rowCount(parent);i++) {
|
for (int i=0;i<project_model.rowCount(parent);i++) {
|
||||||
const QModelIndex& item = project_model.index(i, 0, parent);
|
const QModelIndex& item = project_model.index(i, 0, parent);
|
||||||
Media* m = project_model.getItem(item);
|
Media* m = project_model.getItem(item);
|
||||||
|
|
||||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||||
|
|
||||||
@@ -923,10 +927,10 @@ void Project::delete_clips_using_selected_media() {
|
|||||||
bool deleted = false;
|
bool deleted = false;
|
||||||
QModelIndexList items = get_current_selected();
|
QModelIndexList items = get_current_selected();
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
const ClipPtr& c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
for (int j=0;j<items.size();j++) {
|
for (int j=0;j<items.size();j++) {
|
||||||
Media* m = item_to_media(items.at(j));
|
Media* m = item_to_media(items.at(j));
|
||||||
if (c->media == m) {
|
if (c->media == m) {
|
||||||
ca->append(new DeleteClipAction(olive::ActiveSequence, i));
|
ca->append(new DeleteClipAction(olive::ActiveSequence, i));
|
||||||
deleted = true;
|
deleted = true;
|
||||||
@@ -935,7 +939,7 @@ void Project::delete_clips_using_selected_media() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int j=0;j<items.size();j++) {
|
for (int j=0;j<items.size();j++) {
|
||||||
Media* m = item_to_media(items.at(j));
|
Media* m = item_to_media(items.at(j));
|
||||||
if (delete_clips_in_clipboard_with_media(ca, m)) deleted = true;
|
if (delete_clips_in_clipboard_with_media(ca, m)) deleted = true;
|
||||||
}
|
}
|
||||||
if (deleted) {
|
if (deleted) {
|
||||||
@@ -952,9 +956,9 @@ void Project::clear() {
|
|||||||
panel_effect_controls->clear_effects(true);
|
panel_effect_controls->clear_effects(true);
|
||||||
|
|
||||||
// delete sequences first because it's important to close all the clips before deleting the media
|
// delete sequences first because it's important to close all the clips before deleting the media
|
||||||
QVector<Media*> sequences = list_all_project_sequences();
|
QVector<Media*> sequences = list_all_project_sequences();
|
||||||
for (int i=0;i<sequences.size();i++) {
|
for (int i=0;i<sequences.size();i++) {
|
||||||
delete sequences.at(i)->to_sequence();
|
sequences.at(i)->to_sequence().reset();
|
||||||
sequences.at(i)->set_sequence(nullptr);
|
sequences.at(i)->set_sequence(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -962,7 +966,7 @@ void Project::clear() {
|
|||||||
project_model.clear();
|
project_model.clear();
|
||||||
|
|
||||||
// update tree view (sometimes this doesn't seem to update reliably)
|
// update tree view (sometimes this doesn't seem to update reliably)
|
||||||
panel_project->tree_view->update();
|
tree_view->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::new_project() {
|
void Project::new_project() {
|
||||||
@@ -990,7 +994,7 @@ void save_marker(QXmlStreamWriter& stream, const Marker& m) {
|
|||||||
void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex& parent) {
|
void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex& parent) {
|
||||||
for (int i=0;i<project_model.rowCount(parent);i++) {
|
for (int i=0;i<project_model.rowCount(parent);i++) {
|
||||||
const QModelIndex& item = project_model.index(i, 0, parent);
|
const QModelIndex& item = project_model.index(i, 0, parent);
|
||||||
Media* m = project_model.getItem(item);
|
Media* m = project_model.getItem(item);
|
||||||
|
|
||||||
if (type == m->get_type()) {
|
if (type == m->get_type()) {
|
||||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||||
@@ -1013,7 +1017,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
|||||||
} else {
|
} else {
|
||||||
int folder = m->parentItem()->temp_id;
|
int folder = m->parentItem()->temp_id;
|
||||||
if (type == MEDIA_TYPE_FOOTAGE) {
|
if (type == MEDIA_TYPE_FOOTAGE) {
|
||||||
Footage* f = m->to_footage();
|
FootagePtr f = m->to_footage();
|
||||||
f->save_id = media_id;
|
f->save_id = media_id;
|
||||||
stream.writeStartElement("footage");
|
stream.writeStartElement("footage");
|
||||||
stream.writeAttribute("id", QString::number(media_id));
|
stream.writeAttribute("id", QString::number(media_id));
|
||||||
@@ -1061,7 +1065,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
|||||||
stream.writeEndElement(); // footage
|
stream.writeEndElement(); // footage
|
||||||
media_id++;
|
media_id++;
|
||||||
} else if (type == MEDIA_TYPE_SEQUENCE) {
|
} else if (type == MEDIA_TYPE_SEQUENCE) {
|
||||||
Sequence* s = m->to_sequence();
|
SequencePtr s = m->to_sequence();
|
||||||
if (set_ids_only) {
|
if (set_ids_only) {
|
||||||
s->save_id = sequence_id;
|
s->save_id = sequence_id;
|
||||||
sequence_id++;
|
sequence_id++;
|
||||||
@@ -1083,7 +1087,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
|||||||
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
|
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
|
||||||
|
|
||||||
for (int j=0;j<s->transitions.size();j++) {
|
for (int j=0;j<s->transitions.size();j++) {
|
||||||
Transition* t = s->transitions.at(j);
|
TransitionPtr t = s->transitions.at(j);
|
||||||
if (t != nullptr) {
|
if (t != nullptr) {
|
||||||
stream.writeStartElement("transition");
|
stream.writeStartElement("transition");
|
||||||
stream.writeAttribute("id", QString::number(j));
|
stream.writeAttribute("id", QString::number(j));
|
||||||
@@ -1094,7 +1098,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int j=0;j<s->clips.size();j++) {
|
for (int j=0;j<s->clips.size();j++) {
|
||||||
Clip* c = s->clips.at(j);
|
const ClipPtr& c = s->clips.at(j);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
stream.writeStartElement("clip"); // clip
|
stream.writeStartElement("clip"); // clip
|
||||||
stream.writeAttribute("id", QString::number(j));
|
stream.writeAttribute("id", QString::number(j));
|
||||||
@@ -1305,7 +1309,7 @@ void Project::add_recent_project(QString url) {
|
|||||||
|
|
||||||
void Project::list_all_sequences_worker(QVector<Media*>* list, Media* parent) {
|
void Project::list_all_sequences_worker(QVector<Media*>* list, Media* parent) {
|
||||||
for (int i=0;i<project_model.childCount(parent);i++) {
|
for (int i=0;i<project_model.childCount(parent);i++) {
|
||||||
Media* item = project_model.child(i, parent);
|
Media* item = project_model.child(i, parent);
|
||||||
switch (item->get_type()) {
|
switch (item->get_type()) {
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
list->append(item);
|
list->append(item);
|
||||||
@@ -1318,16 +1322,16 @@ void Project::list_all_sequences_worker(QVector<Media*>* list, Media* parent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QVector<Media*> Project::list_all_project_sequences() {
|
QVector<Media*> Project::list_all_project_sequences() {
|
||||||
QVector<Media*> list;
|
QVector<Media*> list;
|
||||||
list_all_sequences_worker(&list, nullptr);
|
list_all_sequences_worker(&list, nullptr);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndexList Project::get_current_selected() {
|
QModelIndexList Project::get_current_selected() {
|
||||||
if (olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE) {
|
if (olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE) {
|
||||||
return panel_project->tree_view->selectionModel()->selectedRows();
|
return tree_view->selectionModel()->selectedRows();
|
||||||
}
|
}
|
||||||
return panel_project->icon_view->selectionModel()->selectedIndexes();
|
return icon_view->selectionModel()->selectedIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define THROBBER_LIMIT 20
|
#define THROBBER_LIMIT 20
|
||||||
@@ -1366,11 +1370,11 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// refresh all clips
|
// refresh all clips
|
||||||
QVector<Media*> sequences = panel_project->list_all_project_sequences();
|
QVector<Media*> sequences = panel_project->list_all_project_sequences();
|
||||||
for (int i=0;i<sequences.size();i++) {
|
for (int i=0;i<sequences.size();i++) {
|
||||||
Sequence* s = sequences.at(i)->to_sequence();
|
SequencePtr s = sequences.at(i)->to_sequence();
|
||||||
for (int j=0;j<s->clips.size();j++) {
|
for (int j=0;j<s->clips.size();j++) {
|
||||||
Clip* c = s->clips.at(j);
|
const ClipPtr& c = s->clips.at(j);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
c->refresh();
|
c->refresh();
|
||||||
}
|
}
|
||||||
@@ -1380,7 +1384,7 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
|||||||
// redraw clips
|
// redraw clips
|
||||||
update_ui(replace);
|
update_ui(replace);
|
||||||
|
|
||||||
panel_project->tree_view->viewport()->update();
|
panel_project->tree_view->viewport()->update();
|
||||||
item->throbber = nullptr;
|
item->throbber = nullptr;
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-17
@@ -37,8 +37,6 @@
|
|||||||
#include "project/sourcescommon.h"
|
#include "project/sourcescommon.h"
|
||||||
#include "ui/sourceiconview.h"
|
#include "ui/sourceiconview.h"
|
||||||
|
|
||||||
#include "panels.h"
|
|
||||||
|
|
||||||
#include "ui/sourcetable.h"
|
#include "ui/sourcetable.h"
|
||||||
|
|
||||||
#define LOAD_TYPE_VERSION 69
|
#define LOAD_TYPE_VERSION 69
|
||||||
@@ -48,7 +46,7 @@ extern QString autorecovery_filename;
|
|||||||
extern QStringList recent_projects;
|
extern QStringList recent_projects;
|
||||||
extern ProjectModel project_model;
|
extern ProjectModel project_model;
|
||||||
|
|
||||||
Sequence* create_sequence_from_media(QVector<Media *> &media_list);
|
SequencePtr create_sequence_from_media(QVector<Media *> &media_list);
|
||||||
|
|
||||||
QString get_channel_layout_name(int channels, uint64_t layout);
|
QString get_channel_layout_name(int channels, uint64_t layout);
|
||||||
QString get_interlacing_name(int interlacing);
|
QString get_interlacing_name(int interlacing);
|
||||||
@@ -56,15 +54,15 @@ QString get_interlacing_name(int interlacing);
|
|||||||
class Project : public QDockWidget {
|
class Project : public QDockWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Project(QWidget *parent = 0);
|
explicit Project(QWidget *parent = nullptr);
|
||||||
~Project();
|
~Project();
|
||||||
bool is_focused();
|
bool is_focused();
|
||||||
void clear();
|
void clear();
|
||||||
Media* create_sequence_internal(ComboAction *ca, Sequence* s, bool open, Media* parent);
|
Media* create_sequence_internal(ComboAction *ca, SequencePtr s, bool open, Media* parent);
|
||||||
QString get_next_sequence_name(QString start = 0);
|
QString get_next_sequence_name(QString start = nullptr);
|
||||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
|
void process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
|
||||||
void replace_media(Media* item, QString filename);
|
void replace_media(Media* item, QString filename);
|
||||||
Media *get_selected_folder();
|
Media* get_selected_folder();
|
||||||
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
||||||
void add_recent_project(QString url);
|
void add_recent_project(QString url);
|
||||||
|
|
||||||
@@ -72,12 +70,12 @@ public:
|
|||||||
void load_project(bool autorecovery);
|
void load_project(bool autorecovery);
|
||||||
void save_project(bool autorecovery);
|
void save_project(bool autorecovery);
|
||||||
|
|
||||||
Media* create_folder_internal(QString name);
|
Media* create_folder_internal(QString name);
|
||||||
Media* item_to_media(const QModelIndex& index);
|
Media* item_to_media(const QModelIndex& index);
|
||||||
|
|
||||||
void save_recent_projects();
|
void save_recent_projects();
|
||||||
|
|
||||||
QVector<Media*> list_all_project_sequences();
|
QVector<Media*> list_all_project_sequences();
|
||||||
|
|
||||||
SourceTable* tree_view;
|
SourceTable* tree_view;
|
||||||
SourceIconView* icon_view;
|
SourceIconView* icon_view;
|
||||||
@@ -85,11 +83,11 @@ public:
|
|||||||
|
|
||||||
ProjectFilter* sorter;
|
ProjectFilter* sorter;
|
||||||
|
|
||||||
QVector<Media*> last_imported_media;
|
QVector<Media*> last_imported_media;
|
||||||
|
|
||||||
QModelIndexList get_current_selected();
|
QModelIndexList get_current_selected();
|
||||||
|
|
||||||
void start_preview_generator(Media* item, bool replacing);
|
void start_preview_generator(Media* item, bool replacing);
|
||||||
void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
|
void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
|
||||||
|
|
||||||
QWidget* toolbar_widget;
|
QWidget* toolbar_widget;
|
||||||
@@ -108,7 +106,7 @@ private:
|
|||||||
int folder_id;
|
int folder_id;
|
||||||
int media_id;
|
int media_id;
|
||||||
int sequence_id;
|
int sequence_id;
|
||||||
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
|
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
|
||||||
QString get_file_name_from_path(const QString &path);
|
QString get_file_name_from_path(const QString &path);
|
||||||
QDir proj_dir;
|
QDir proj_dir;
|
||||||
QWidget* icon_view_container;
|
QWidget* icon_view_container;
|
||||||
@@ -127,7 +125,7 @@ private slots:
|
|||||||
class MediaThrobber : public QObject {
|
class MediaThrobber : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MediaThrobber(Media*);
|
MediaThrobber(Media*);
|
||||||
public slots:
|
public slots:
|
||||||
void start();
|
void start();
|
||||||
void stop(int, bool replace);
|
void stop(int, bool replace);
|
||||||
@@ -136,7 +134,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
int animation;
|
int animation;
|
||||||
Media* item;
|
Media* item;
|
||||||
QTimer* animator;
|
QTimer* animator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+83
-79
@@ -122,7 +122,7 @@ void Timeline::previous_cut() {
|
|||||||
&& olive::ActiveSequence->playhead > 0) {
|
&& olive::ActiveSequence->playhead > 0) {
|
||||||
long p_cut = 0;
|
long p_cut = 0;
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if (c->timeline_out > p_cut && c->timeline_out < olive::ActiveSequence->playhead) {
|
if (c->timeline_out > p_cut && c->timeline_out < olive::ActiveSequence->playhead) {
|
||||||
p_cut = c->timeline_out;
|
p_cut = c->timeline_out;
|
||||||
@@ -140,7 +140,7 @@ void Timeline::next_cut() {
|
|||||||
bool seek_enabled = false;
|
bool seek_enabled = false;
|
||||||
long n_cut = LONG_MAX;
|
long n_cut = LONG_MAX;
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if (c->timeline_in < n_cut && c->timeline_in > olive::ActiveSequence->playhead) {
|
if (c->timeline_in < n_cut && c->timeline_in > olive::ActiveSequence->playhead) {
|
||||||
n_cut = c->timeline_in;
|
n_cut = c->timeline_in;
|
||||||
@@ -155,7 +155,7 @@ void Timeline::next_cut() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ripple_clips(ComboAction* ca, Sequence *s, long point, long length, const QVector<int>& ignore) {
|
void ripple_clips(ComboAction* ca, SequencePtr s, long point, long length, const QVector<int>& ignore) {
|
||||||
ca->append(new RippleAction(s, point, length, ignore));
|
ca->append(new RippleAction(s, point, length, ignore));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ void Timeline::toggle_show_all() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector<Media*>& media_list) {
|
void Timeline::create_ghosts_from_media(SequencePtr seq, long entry_point, QVector<Media*>& media_list) {
|
||||||
video_ghosts = false;
|
video_ghosts = false;
|
||||||
audio_ghosts = false;
|
audio_ghosts = false;
|
||||||
|
|
||||||
@@ -179,8 +179,8 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
|||||||
bool can_import = true;
|
bool can_import = true;
|
||||||
|
|
||||||
Media* medium = media_list.at(i);
|
Media* medium = media_list.at(i);
|
||||||
Footage* m = nullptr;
|
FootagePtr m = nullptr;
|
||||||
Sequence* s = nullptr;
|
SequencePtr s = nullptr;
|
||||||
long sequence_length = 0;
|
long sequence_length = 0;
|
||||||
long default_clip_in = 0;
|
long default_clip_in = 0;
|
||||||
long default_clip_out = 0;
|
long default_clip_out = 0;
|
||||||
@@ -276,16 +276,16 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
void Timeline::add_clips_from_ghosts(ComboAction* ca, SequencePtr s) {
|
||||||
// add clips
|
// add clips
|
||||||
long earliest_point = LONG_MAX;
|
long earliest_point = LONG_MAX;
|
||||||
QVector<Clip*> added_clips;
|
QVector<ClipPtr> added_clips;
|
||||||
for (int i=0;i<ghosts.size();i++) {
|
for (int i=0;i<ghosts.size();i++) {
|
||||||
const Ghost& g = ghosts.at(i);
|
const Ghost& g = ghosts.at(i);
|
||||||
|
|
||||||
earliest_point = qMin(earliest_point, g.in);
|
earliest_point = qMin(earliest_point, g.in);
|
||||||
|
|
||||||
Clip* c = new Clip(s);
|
ClipPtr c = ClipPtr(new Clip(s));
|
||||||
c->media = g.media;
|
c->media = g.media;
|
||||||
c->media_stream = g.media_stream;
|
c->media_stream = g.media_stream;
|
||||||
c->timeline_in = g.in;
|
c->timeline_in = g.in;
|
||||||
@@ -293,7 +293,7 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
|||||||
c->clip_in = g.clip_in;
|
c->clip_in = g.clip_in;
|
||||||
c->track = g.track;
|
c->track = g.track;
|
||||||
if (c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
Footage* m = c->media->to_footage();
|
FootagePtr m = c->media->to_footage();
|
||||||
if (m->video_tracks.size() == 0) {
|
if (m->video_tracks.size() == 0) {
|
||||||
// audio only (greenish)
|
// audio only (greenish)
|
||||||
c->color_r = 128;
|
c->color_r = 128;
|
||||||
@@ -317,7 +317,7 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
|||||||
c->color_g = 128;
|
c->color_g = 128;
|
||||||
c->color_b = 128;
|
c->color_b = 128;
|
||||||
|
|
||||||
Sequence* media = c->media->to_sequence();
|
SequencePtr media = c->media->to_sequence();
|
||||||
c->name = media->name;
|
c->name = media->name;
|
||||||
}
|
}
|
||||||
c->recalculateMaxLength();
|
c->recalculateMaxLength();
|
||||||
@@ -327,9 +327,9 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
|||||||
|
|
||||||
// link clips from the same media
|
// link clips from the same media
|
||||||
for (int i=0;i<added_clips.size();i++) {
|
for (int i=0;i<added_clips.size();i++) {
|
||||||
Clip* c = added_clips.at(i);
|
ClipPtr c = added_clips.at(i);
|
||||||
for (int j=0;j<added_clips.size();j++) {
|
for (int j=0;j<added_clips.size();j++) {
|
||||||
Clip* cc = added_clips.at(j);
|
ClipPtr cc = added_clips.at(j);
|
||||||
if (c != cc && c->media == cc->media) {
|
if (c != cc && c->media == cc->media) {
|
||||||
c->linked.append(j);
|
c->linked.append(j);
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ void Timeline::add_transition() {
|
|||||||
bool adding = false;
|
bool adding = false;
|
||||||
|
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr && is_clip_selected(c, true)) {
|
if (c != nullptr && is_clip_selected(c, true)) {
|
||||||
int transition_to_add = (c->track < 0) ? TRANSITION_INTERNAL_CROSSDISSOLVE : TRANSITION_INTERNAL_LINEARFADE;
|
int transition_to_add = (c->track < 0) ? TRANSITION_INTERNAL_CROSSDISSOLVE : TRANSITION_INTERNAL_LINEARFADE;
|
||||||
if (c->get_opening_transition() == nullptr) {
|
if (c->get_opening_transition() == nullptr) {
|
||||||
@@ -397,7 +397,7 @@ void Timeline::nest() {
|
|||||||
|
|
||||||
// get selected clips
|
// get selected clips
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr && is_clip_selected(c, true)) {
|
if (c != nullptr && is_clip_selected(c, true)) {
|
||||||
selected_clips.append(i);
|
selected_clips.append(i);
|
||||||
earliest_point = qMin(c->timeline_in, earliest_point);
|
earliest_point = qMin(c->timeline_in, earliest_point);
|
||||||
@@ -408,7 +408,7 @@ void Timeline::nest() {
|
|||||||
if (!selected_clips.isEmpty()) {
|
if (!selected_clips.isEmpty()) {
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
|
|
||||||
Sequence* s = new Sequence();
|
SequencePtr s(new Sequence());
|
||||||
|
|
||||||
// create "nest" sequence
|
// create "nest" sequence
|
||||||
s->name = panel_project->get_next_sequence_name(tr("Nested Sequence"));
|
s->name = panel_project->get_next_sequence_name(tr("Nested Sequence"));
|
||||||
@@ -424,7 +424,7 @@ void Timeline::nest() {
|
|||||||
ca->append(new DeleteClipAction(olive::ActiveSequence, selected_clips.at(i)));
|
ca->append(new DeleteClipAction(olive::ActiveSequence, selected_clips.at(i)));
|
||||||
|
|
||||||
// copy to new
|
// copy to new
|
||||||
Clip* copy = olive::ActiveSequence->clips.at(selected_clips.at(i))->copy(s);
|
ClipPtr copy(olive::ActiveSequence->clips.at(selected_clips.at(i))->copy(s));
|
||||||
copy->timeline_in -= earliest_point;
|
copy->timeline_in -= earliest_point;
|
||||||
copy->timeline_out -= earliest_point;
|
copy->timeline_out -= earliest_point;
|
||||||
s->clips.append(copy);
|
s->clips.append(copy);
|
||||||
@@ -536,7 +536,7 @@ void Timeline::select_all() {
|
|||||||
if (olive::ActiveSequence != nullptr) {
|
if (olive::ActiveSequence != nullptr) {
|
||||||
olive::ActiveSequence->selections.clear();
|
olive::ActiveSequence->selections.clear();
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
Selection s;
|
Selection s;
|
||||||
s.in = c->timeline_in;
|
s.in = c->timeline_in;
|
||||||
@@ -556,7 +556,7 @@ void Timeline::scroll_to_frame(long frame) {
|
|||||||
void Timeline::select_from_playhead() {
|
void Timeline::select_from_playhead() {
|
||||||
olive::ActiveSequence->selections.clear();
|
olive::ActiveSequence->selections.clear();
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr
|
if (c != nullptr
|
||||||
&& c->timeline_in <= olive::ActiveSequence->playhead
|
&& c->timeline_in <= olive::ActiveSequence->playhead
|
||||||
&& c->timeline_out > olive::ActiveSequence->playhead) {
|
&& c->timeline_out > olive::ActiveSequence->playhead) {
|
||||||
@@ -576,7 +576,7 @@ bool Timeline::can_ripple_empty_space(long frame, int track) {
|
|||||||
rc_ripple_max = LONG_MAX;
|
rc_ripple_max = LONG_MAX;
|
||||||
|
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if (c->timeline_in > frame || c->timeline_out > frame) {
|
if (c->timeline_in > frame || c->timeline_out > frame) {
|
||||||
at_end_of_sequence = false;
|
at_end_of_sequence = false;
|
||||||
@@ -667,7 +667,7 @@ void Timeline::toggle_enable_on_selected_clips() {
|
|||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
bool push_undo = false;
|
bool push_undo = false;
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr && is_clip_selected(c, true)) {
|
if (c != nullptr && is_clip_selected(c, true)) {
|
||||||
ca->append(new SetBool(&c->enabled, !c->enabled));
|
ca->append(new SetBool(&c->enabled, !c->enabled));
|
||||||
push_undo = true;
|
push_undo = true;
|
||||||
@@ -706,7 +706,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
|||||||
|
|
||||||
bool can_ripple = true;
|
bool can_ripple = true;
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr && c->timeline_in < ripple_point && c->timeline_out > ripple_point) {
|
if (c != nullptr && c->timeline_in < ripple_point && c->timeline_out > ripple_point) {
|
||||||
// conflict detected, but this clip may be getting deleted so let's check
|
// conflict detected, but this clip may be getting deleted so let's check
|
||||||
bool deleted = false;
|
bool deleted = false;
|
||||||
@@ -721,7 +721,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
|||||||
}
|
}
|
||||||
if (!deleted) {
|
if (!deleted) {
|
||||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||||
Clip* cc = olive::ActiveSequence->clips.at(j);
|
ClipPtr cc = olive::ActiveSequence->clips.at(j);
|
||||||
if (cc != nullptr
|
if (cc != nullptr
|
||||||
&& cc->track == c->track
|
&& cc->track == c->track
|
||||||
&& cc->timeline_in > c->timeline_out
|
&& cc->timeline_in > c->timeline_out
|
||||||
@@ -781,7 +781,7 @@ void Timeline::decheck_tool_buttons(QObject* sender) {
|
|||||||
|
|
||||||
QVector<int> Timeline::get_tracks_of_linked_clips(int i) {
|
QVector<int> Timeline::get_tracks_of_linked_clips(int i) {
|
||||||
QVector<int> tracks;
|
QVector<int> tracks;
|
||||||
Clip* clip = olive::ActiveSequence->clips.at(i);
|
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
||||||
for (int j=0;j<clip->linked.size();j++) {
|
for (int j=0;j<clip->linked.size();j++) {
|
||||||
tracks.append(olive::ActiveSequence->clips.at(clip->linked.at(j))->track);
|
tracks.append(olive::ActiveSequence->clips.at(clip->linked.at(j))->track);
|
||||||
}
|
}
|
||||||
@@ -796,7 +796,7 @@ void Timeline::zoom_out() {
|
|||||||
multiply_zoom(0.5);
|
multiply_zoom(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_clip_selected(Clip* clip, bool containing) {
|
bool is_clip_selected(ClipPtr clip, bool containing) {
|
||||||
for (int i=0;i<clip->sequence->selections.size();i++) {
|
for (int i=0;i<clip->sequence->selections.size();i++) {
|
||||||
const Selection& s = clip->sequence->selections.at(i);
|
const Selection& s = clip->sequence->selections.at(i);
|
||||||
if (clip->track == s.track && ((clip->timeline_in >= s.in && clip->timeline_out <= s.out && containing) ||
|
if (clip->track == s.track && ((clip->timeline_in >= s.in && clip->timeline_out <= s.out && containing) ||
|
||||||
@@ -811,12 +811,12 @@ void Timeline::snapping_clicked(bool checked) {
|
|||||||
snapping = checked;
|
snapping = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
Clip* Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame) {
|
ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame) {
|
||||||
return split_clip(ca, transitions, p, frame, frame);
|
return split_clip(ca, transitions, p, frame, frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
Clip* Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in) {
|
ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in) {
|
||||||
Clip* pre = olive::ActiveSequence->clips.at(p);
|
ClipPtr pre = olive::ActiveSequence->clips.at(p);
|
||||||
if (pre != nullptr && pre->timeline_in < frame && pre->timeline_out > frame) { // guard against attempts to split at in/out points
|
if (pre != nullptr && pre->timeline_in < frame && pre->timeline_out > frame) { // guard against attempts to split at in/out points
|
||||||
bool splitting_closing_dual_transition = false;
|
bool splitting_closing_dual_transition = false;
|
||||||
|
|
||||||
@@ -826,7 +826,7 @@ Clip* Timeline::split_clip(ComboAction* ca, bool transitions, int p, long frame,
|
|||||||
splitting_closing_dual_transition = true;
|
splitting_closing_dual_transition = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Clip* post = pre->copy(olive::ActiveSequence, transitions && !splitting_closing_dual_transition);
|
ClipPtr post = ClipPtr(pre->copy(olive::ActiveSequence, transitions && !splitting_closing_dual_transition));
|
||||||
|
|
||||||
long new_clip_length = frame - pre->timeline_in;
|
long new_clip_length = frame - pre->timeline_in;
|
||||||
|
|
||||||
@@ -891,12 +891,12 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
|||||||
|
|
||||||
split_cache.append(clip);
|
split_cache.append(clip);
|
||||||
|
|
||||||
Clip* c = olive::ActiveSequence->clips.at(clip);
|
ClipPtr c = olive::ActiveSequence->clips.at(clip);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
QVector<int> pre_clips;
|
QVector<int> pre_clips;
|
||||||
QVector<Clip*> post_clips;
|
QVector<ClipPtr> post_clips;
|
||||||
|
|
||||||
Clip* post = split_clip(ca, true, clip, frame);
|
ClipPtr post = split_clip(ca, true, clip, frame);
|
||||||
|
|
||||||
// if alt is not down, split clips links too
|
// if alt is not down, split clips links too
|
||||||
if (post == nullptr) {
|
if (post == nullptr) {
|
||||||
@@ -912,10 +912,10 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
|||||||
for (int i=0;i<c->linked.size();i++) {
|
for (int i=0;i<c->linked.size();i++) {
|
||||||
int l = c->linked.at(i);
|
int l = c->linked.at(i);
|
||||||
if (!has_clip_been_split(l)) {
|
if (!has_clip_been_split(l)) {
|
||||||
Clip* link = olive::ActiveSequence->clips.at(l);
|
ClipPtr link = olive::ActiveSequence->clips.at(l);
|
||||||
if ((original_clip_is_selected && is_clip_selected(link, true)) || !original_clip_is_selected) {
|
if ((original_clip_is_selected && is_clip_selected(link, true)) || !original_clip_is_selected) {
|
||||||
split_cache.append(l);
|
split_cache.append(l);
|
||||||
Clip* s = split_clip(ca, true, l, frame);
|
ClipPtr s = split_clip(ca, true, l, frame);
|
||||||
if (s != nullptr) {
|
if (s != nullptr) {
|
||||||
pre_clips.append(l);
|
pre_clips.append(l);
|
||||||
post_clips.append(s);
|
post_clips.append(s);
|
||||||
@@ -963,7 +963,7 @@ void Timeline::clean_up_selections(QVector<Selection>& areas) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool selection_contains_transition(const Selection& s, Clip* c, int type) {
|
bool selection_contains_transition(const Selection& s, ClipPtr c, int type) {
|
||||||
if (type == TA_OPENING_TRANSITION) {
|
if (type == TA_OPENING_TRANSITION) {
|
||||||
return c->get_opening_transition() != nullptr
|
return c->get_opening_transition() != nullptr
|
||||||
&& s.out == c->timeline_in + c->get_opening_transition()->get_true_length()
|
&& s.out == c->timeline_in + c->get_opening_transition()->get_true_length()
|
||||||
@@ -982,12 +982,12 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
|||||||
panel_effect_controls->clear_effects(true);
|
panel_effect_controls->clear_effects(true);
|
||||||
|
|
||||||
QVector<int> pre_clips;
|
QVector<int> pre_clips;
|
||||||
QVector<Clip*> post_clips;
|
QVector<ClipPtr> post_clips;
|
||||||
|
|
||||||
for (int i=0;i<areas.size();i++) {
|
for (int i=0;i<areas.size();i++) {
|
||||||
const Selection& s = areas.at(i);
|
const Selection& s = areas.at(i);
|
||||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(j);
|
ClipPtr c = olive::ActiveSequence->clips.at(j);
|
||||||
if (c != nullptr && c->track == s.track && !c->undeletable) {
|
if (c != nullptr && c->track == s.track && !c->undeletable) {
|
||||||
if (selection_contains_transition(s, c, TA_OPENING_TRANSITION)) {
|
if (selection_contains_transition(s, c, TA_OPENING_TRANSITION)) {
|
||||||
// delete opening transition
|
// delete opening transition
|
||||||
@@ -1002,7 +1002,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
|||||||
// middle of clip is within deletion area
|
// middle of clip is within deletion area
|
||||||
|
|
||||||
// duplicate clip
|
// duplicate clip
|
||||||
Clip* post = split_clip(ca, true, j, s.in, s.out);
|
ClipPtr post = split_clip(ca, true, j, s.in, s.out);
|
||||||
|
|
||||||
pre_clips.append(j);
|
pre_clips.append(j);
|
||||||
post_clips.append(post);
|
post_clips.append(post);
|
||||||
@@ -1053,7 +1053,7 @@ void Timeline::copy(bool del) {
|
|||||||
long min_in = 0;
|
long min_in = 0;
|
||||||
|
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->selections.size();j++) {
|
||||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||||
@@ -1064,7 +1064,7 @@ void Timeline::copy(bool del) {
|
|||||||
clipboard_type = CLIPBOARD_TYPE_CLIP;
|
clipboard_type = CLIPBOARD_TYPE_CLIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
Clip* copied_clip = c->copy(nullptr);
|
ClipPtr copied_clip = c->copy(nullptr);
|
||||||
|
|
||||||
// copy linked IDs (we correct these later in paste())
|
// copy linked IDs (we correct these later in paste())
|
||||||
copied_clip->linked = c->linked;
|
copied_clip->linked = c->linked;
|
||||||
@@ -1087,16 +1087,16 @@ void Timeline::copy(bool del) {
|
|||||||
|
|
||||||
copied_clip->load_id = i;
|
copied_clip->load_id = i;
|
||||||
|
|
||||||
clipboard.append(copied_clip);
|
clipboard.append(copied_clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0;i<clipboard.size();i++) {
|
for (int i=0;i<clipboard.size();i++) {
|
||||||
// initialize all timeline_ins to 0 or offsets of
|
// initialize all timeline_ins to 0 or offsets of
|
||||||
static_cast<Clip*>(clipboard.at(i))->timeline_in -= min_in;
|
std::static_pointer_cast<Clip>(clipboard.at(i))->timeline_in -= min_in;
|
||||||
static_cast<Clip*>(clipboard.at(i))->timeline_out -= min_in;
|
std::static_pointer_cast<Clip>(clipboard.at(i))->timeline_out -= min_in;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (del && copied) {
|
if (del && copied) {
|
||||||
@@ -1104,11 +1104,11 @@ void Timeline::copy(bool del) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& new_clips) {
|
void Timeline::relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips) {
|
||||||
// relink pasted clips
|
// relink pasted clips
|
||||||
for (int i=0;i<old_clips.size();i++) {
|
for (int i=0;i<old_clips.size();i++) {
|
||||||
// these indices should correspond
|
// these indices should correspond
|
||||||
Clip* oc = olive::ActiveSequence->clips.at(old_clips.at(i));
|
ClipPtr oc = olive::ActiveSequence->clips.at(old_clips.at(i));
|
||||||
for (int j=0;j<oc->linked.size();j++) {
|
for (int j=0;j<oc->linked.size();j++) {
|
||||||
for (int k=0;k<old_clips.size();k++) { // find clip with that ID
|
for (int k=0;k<old_clips.size();k++) { // find clip with that ID
|
||||||
if (oc->linked.at(j) == old_clips.at(k)) {
|
if (oc->linked.at(j) == old_clips.at(k)) {
|
||||||
@@ -1123,19 +1123,19 @@ void Timeline::relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& n
|
|||||||
|
|
||||||
void Timeline::paste(bool insert) {
|
void Timeline::paste(bool insert) {
|
||||||
if (clipboard.size() > 0) {
|
if (clipboard.size() > 0) {
|
||||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
|
|
||||||
// create copies and delete areas that we'll be pasting to
|
// create copies and delete areas that we'll be pasting to
|
||||||
QVector<Selection> delete_areas;
|
QVector<Selection> delete_areas;
|
||||||
QVector<Clip*> pasted_clips;
|
QVector<ClipPtr> pasted_clips;
|
||||||
long paste_start = LONG_MAX;
|
long paste_start = LONG_MAX;
|
||||||
long paste_end = LONG_MIN;
|
long paste_end = LONG_MIN;
|
||||||
for (int i=0;i<clipboard.size();i++) {
|
for (int i=0;i<clipboard.size();i++) {
|
||||||
Clip* c = static_cast<Clip*>(clipboard.at(i));
|
ClipPtr c = std::static_pointer_cast<Clip>(clipboard.at(i));
|
||||||
|
|
||||||
// create copy of clip and offset by playhead
|
// create copy of clip and offset by playhead
|
||||||
Clip* cc = c->copy(olive::ActiveSequence);
|
ClipPtr cc(c->copy(olive::ActiveSequence));
|
||||||
|
|
||||||
// convert frame rates
|
// convert frame rates
|
||||||
cc->timeline_in = refactor_frame_number(cc->timeline_in, c->cached_fr, olive::ActiveSequence->frame_rate);
|
cc->timeline_in = refactor_frame_number(cc->timeline_in, c->cached_fr, olive::ActiveSequence->frame_rate);
|
||||||
@@ -1168,13 +1168,13 @@ void Timeline::paste(bool insert) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// correct linked clips
|
// correct linked clips
|
||||||
for (int i=0;i<clipboard.size();i++) {
|
for (int i=0;i<clipboard.size();i++) {
|
||||||
// these indices should correspond
|
// these indices should correspond
|
||||||
Clip* oc = static_cast<Clip*>(clipboard.at(i));
|
ClipPtr oc = std::static_pointer_cast<Clip>(clipboard.at(i));
|
||||||
|
|
||||||
for (int j=0;j<oc->linked.size();j++) {
|
for (int j=0;j<oc->linked.size();j++) {
|
||||||
for (int k=0;k<clipboard.size();k++) { // find clip with that ID
|
for (int k=0;k<clipboard.size();k++) { // find clip with that ID
|
||||||
Clip* comp = static_cast<Clip*>(clipboard.at(k));
|
ClipPtr comp = std::static_pointer_cast<Clip>(clipboard.at(k));
|
||||||
if (comp->load_id == oc->linked.at(j)) {
|
if (comp->load_id == oc->linked.at(j)) {
|
||||||
pasted_clips.at(i)->linked.append(k);
|
pasted_clips.at(i)->linked.append(k);
|
||||||
}
|
}
|
||||||
@@ -1200,10 +1200,10 @@ void Timeline::paste(bool insert) {
|
|||||||
bool ask_conflict = true;
|
bool ask_conflict = true;
|
||||||
|
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr && is_clip_selected(c, true)) {
|
if (c != nullptr && is_clip_selected(c, true)) {
|
||||||
for (int j=0;j<clipboard.size();j++) {
|
for (int j=0;j<clipboard.size();j++) {
|
||||||
Effect* e = static_cast<Effect*>(clipboard.at(j));
|
EffectPtr e = std::static_pointer_cast<Effect>(clipboard.at(j));
|
||||||
if ((c->track < 0) == (e->meta->subtype == EFFECT_TYPE_VIDEO)) {
|
if ((c->track < 0) == (e->meta->subtype == EFFECT_TYPE_VIDEO)) {
|
||||||
int found = -1;
|
int found = -1;
|
||||||
if (ask_conflict) {
|
if (ask_conflict) {
|
||||||
@@ -1283,7 +1283,7 @@ void Timeline::edit_to_point_internal(bool in, bool ripple) {
|
|||||||
|
|
||||||
// find closest in point to playhead
|
// find closest in point to playhead
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
track_min = qMin(track_min, c->track);
|
track_min = qMin(track_min, c->track);
|
||||||
track_max = qMax(track_max, c->track);
|
track_max = qMax(track_max, c->track);
|
||||||
@@ -1382,18 +1382,18 @@ bool Timeline::split_selection(ComboAction* ca) {
|
|||||||
|
|
||||||
// temporary relinking vectors
|
// temporary relinking vectors
|
||||||
QVector<int> pre_splits;
|
QVector<int> pre_splits;
|
||||||
QVector<Clip*> post_splits;
|
QVector<ClipPtr> post_splits;
|
||||||
QVector<Clip*> secondary_post_splits;
|
QVector<ClipPtr> secondary_post_splits;
|
||||||
|
|
||||||
// find clips within selection and split
|
// find clips within selection and split
|
||||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||||
Clip* clip = olive::ActiveSequence->clips.at(j);
|
ClipPtr clip = olive::ActiveSequence->clips.at(j);
|
||||||
if (clip != nullptr) {
|
if (clip != nullptr) {
|
||||||
for (int i=0;i<olive::ActiveSequence->selections.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->selections.size();i++) {
|
||||||
const Selection& s = olive::ActiveSequence->selections.at(i);
|
const Selection& s = olive::ActiveSequence->selections.at(i);
|
||||||
if (s.track == clip->track) {
|
if (s.track == clip->track) {
|
||||||
Clip* post_b = split_clip(ca, true, j, s.out);
|
ClipPtr post_b = split_clip(ca, true, j, s.out);
|
||||||
Clip* post_a = split_clip(ca, post_b == nullptr, j, s.in);
|
ClipPtr post_a = split_clip(ca, post_b == nullptr, j, s.in);
|
||||||
pre_splits.append(j);
|
pre_splits.append(j);
|
||||||
post_splits.append(post_a);
|
post_splits.append(post_a);
|
||||||
secondary_post_splits.append(post_b);
|
secondary_post_splits.append(post_b);
|
||||||
@@ -1424,7 +1424,7 @@ bool Timeline::split_selection(ComboAction* ca) {
|
|||||||
bool Timeline::split_all_clips_at_point(ComboAction* ca, long point) {
|
bool Timeline::split_all_clips_at_point(ComboAction* ca, long point) {
|
||||||
bool split = false;
|
bool split = false;
|
||||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(j);
|
ClipPtr c = olive::ActiveSequence->clips.at(j);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
// always relinks
|
// always relinks
|
||||||
if (split_clip_and_relink(ca, j, point, true)) {
|
if (split_clip_and_relink(ca, j, point, true)) {
|
||||||
@@ -1443,11 +1443,11 @@ void Timeline::split_at_playhead() {
|
|||||||
if (olive::ActiveSequence->selections.size() > 0) {
|
if (olive::ActiveSequence->selections.size() > 0) {
|
||||||
// see if whole clips are selected
|
// see if whole clips are selected
|
||||||
QVector<int> pre_clips;
|
QVector<int> pre_clips;
|
||||||
QVector<Clip*> post_clips;
|
QVector<ClipPtr> post_clips;
|
||||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||||
Clip* clip = olive::ActiveSequence->clips.at(j);
|
ClipPtr clip = olive::ActiveSequence->clips.at(j);
|
||||||
if (clip != nullptr && is_clip_selected(clip, true)) {
|
if (clip != nullptr && is_clip_selected(clip, true)) {
|
||||||
Clip* s = split_clip(ca, true, j, olive::ActiveSequence->playhead);
|
ClipPtr s = split_clip(ca, true, j, olive::ActiveSequence->playhead);
|
||||||
if (s != nullptr) {
|
if (s != nullptr) {
|
||||||
pre_clips.append(j);
|
pre_clips.append(j);
|
||||||
post_clips.append(s);
|
post_clips.append(s);
|
||||||
@@ -1555,7 +1555,7 @@ bool Timeline::snap_to_timeline(long* l, bool use_playhead, bool use_markers, bo
|
|||||||
|
|
||||||
// snap to clip/transition
|
// snap to clip/transition
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if (snap_to_point(c->timeline_in, l)) {
|
if (snap_to_point(c->timeline_in, l)) {
|
||||||
return true;
|
return true;
|
||||||
@@ -1587,7 +1587,7 @@ void Timeline::set_marker() {
|
|||||||
bool clip_mode = false;
|
bool clip_mode = false;
|
||||||
|
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr
|
if (c != nullptr
|
||||||
&& is_clip_selected(c, true)) {
|
&& is_clip_selected(c, true)) {
|
||||||
|
|
||||||
@@ -1642,7 +1642,7 @@ void Timeline::toggle_links() {
|
|||||||
LinkCommand* command = new LinkCommand();
|
LinkCommand* command = new LinkCommand();
|
||||||
command->s = olive::ActiveSequence;
|
command->s = olive::ActiveSequence;
|
||||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(i);
|
ClipPtr c = olive::ActiveSequence->clips.at(i);
|
||||||
if (c != nullptr && is_clip_selected(c, true)) {
|
if (c != nullptr && is_clip_selected(c, true)) {
|
||||||
if (!command->clips.contains(i)) command->clips.append(i);
|
if (!command->clips.contains(i)) command->clips.append(i);
|
||||||
|
|
||||||
@@ -1665,22 +1665,26 @@ void Timeline::toggle_links() {
|
|||||||
|
|
||||||
void Timeline::increase_track_height() {
|
void Timeline::increase_track_height() {
|
||||||
for (int i=0;i<video_track_heights.size();i++) {
|
for (int i=0;i<video_track_heights.size();i++) {
|
||||||
video_track_heights[i] += TRACK_HEIGHT_INCREMENT;
|
video_track_heights[i] += olive::timeline::kTrackHeightIncrement;
|
||||||
}
|
}
|
||||||
for (int i=0;i<audio_track_heights.size();i++) {
|
for (int i=0;i<audio_track_heights.size();i++) {
|
||||||
audio_track_heights[i] += TRACK_HEIGHT_INCREMENT;
|
audio_track_heights[i] += olive::timeline::kTrackHeightIncrement;
|
||||||
}
|
}
|
||||||
repaint_timeline();
|
repaint_timeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::decrease_track_height() {
|
void Timeline::decrease_track_height() {
|
||||||
for (int i=0;i<video_track_heights.size();i++) {
|
for (int i=0;i<video_track_heights.size();i++) {
|
||||||
video_track_heights[i] -= TRACK_HEIGHT_INCREMENT;
|
video_track_heights[i] = qMax(
|
||||||
if (video_track_heights[i] < TRACK_MIN_HEIGHT) video_track_heights[i] = TRACK_MIN_HEIGHT;
|
video_track_heights[i] - olive::timeline::kTrackHeightIncrement,
|
||||||
|
olive::timeline::kTrackMinHeight
|
||||||
|
);
|
||||||
}
|
}
|
||||||
for (int i=0;i<audio_track_heights.size();i++) {
|
for (int i=0;i<audio_track_heights.size();i++) {
|
||||||
audio_track_heights[i] -= TRACK_HEIGHT_INCREMENT;
|
audio_track_heights[i] = qMax(
|
||||||
if (audio_track_heights[i] < TRACK_MIN_HEIGHT) audio_track_heights[i] = TRACK_MIN_HEIGHT;
|
audio_track_heights[i] - olive::timeline::kTrackHeightIncrement,
|
||||||
|
olive::timeline::kTrackMinHeight
|
||||||
|
);
|
||||||
}
|
}
|
||||||
repaint_timeline();
|
repaint_timeline();
|
||||||
}
|
}
|
||||||
@@ -2059,7 +2063,7 @@ void Timeline::setup_ui() {
|
|||||||
setWidget(dockWidgetContents);
|
setWidget(dockWidgetContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_clip(ComboAction* ca, Clip *c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions, bool relative) {
|
void move_clip(ComboAction* ca, ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions, bool relative) {
|
||||||
ca->append(new MoveClipAction(c, iin, iout, iclip_in, itrack, relative));
|
ca->append(new MoveClipAction(c, iin, iout, iclip_in, itrack, relative));
|
||||||
|
|
||||||
if (verify_transitions) {
|
if (verify_transitions) {
|
||||||
|
|||||||
+17
-28
@@ -23,10 +23,17 @@
|
|||||||
|
|
||||||
#include "ui/timelinetools.h"
|
#include "ui/timelinetools.h"
|
||||||
#include "project/selection.h"
|
#include "project/selection.h"
|
||||||
|
#include "project/clip.h"
|
||||||
|
#include "project/undo.h"
|
||||||
|
#include "ui/timelineheader.h"
|
||||||
|
#include "ui/resizablescrollbar.h"
|
||||||
|
#include "ui/audiomonitor.h"
|
||||||
|
#include "ui/timelinewidget.h"
|
||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
#define TRACK_DEFAULT_HEIGHT 40
|
#define TRACK_DEFAULT_HEIGHT 40
|
||||||
|
|
||||||
@@ -37,30 +44,12 @@
|
|||||||
#define ADD_OBJ_NOISE 4
|
#define ADD_OBJ_NOISE 4
|
||||||
#define ADD_OBJ_AUDIO 5
|
#define ADD_OBJ_AUDIO 5
|
||||||
|
|
||||||
class QPushButton;
|
bool is_clip_selected(ClipPtr clip, bool containing);
|
||||||
class SourceTable;
|
|
||||||
class ViewerWidget;
|
|
||||||
class ComboAction;
|
|
||||||
class Effect;
|
|
||||||
class Media;
|
|
||||||
class Transition;
|
|
||||||
class TimelineHeader;
|
|
||||||
class TimelineWidget;
|
|
||||||
class ResizableScrollBar;
|
|
||||||
class AudioMonitor;
|
|
||||||
class QScrollBar;
|
|
||||||
struct EffectMeta;
|
|
||||||
struct Sequence;
|
|
||||||
class Clip;
|
|
||||||
struct Footage;
|
|
||||||
struct FootageStream;
|
|
||||||
|
|
||||||
bool is_clip_selected(Clip* clip, bool containing);
|
|
||||||
int getScreenPointFromFrame(double zoom, long frame);
|
int getScreenPointFromFrame(double zoom, long frame);
|
||||||
long getFrameFromScreenPoint(double zoom, int x);
|
long getFrameFromScreenPoint(double zoom, int x);
|
||||||
bool selection_contains_transition(const Selection& s, Clip* c, int type);
|
bool selection_contains_transition(const Selection& s, ClipPtr c, int type);
|
||||||
void move_clip(ComboAction *ca, Clip *c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions = true, bool relative = false);
|
void move_clip(ComboAction *ca, ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions = true, bool relative = false);
|
||||||
void ripple_clips(ComboAction *ca, Sequence* s, long point, long length, const QVector<int>& ignore = QVector<int>());
|
void ripple_clips(ComboAction *ca, SequencePtr s, long point, long length, const QVector<int>& ignore = QVector<int>());
|
||||||
|
|
||||||
struct Ghost {
|
struct Ghost {
|
||||||
int clip;
|
int clip;
|
||||||
@@ -85,7 +74,7 @@ struct Ghost {
|
|||||||
bool trimming;
|
bool trimming;
|
||||||
|
|
||||||
// transition trimming
|
// transition trimming
|
||||||
Transition* transition;
|
TransitionPtr transition;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Timeline : public QDockWidget
|
class Timeline : public QDockWidget
|
||||||
@@ -98,15 +87,15 @@ public:
|
|||||||
bool focused();
|
bool focused();
|
||||||
void multiply_zoom(double m);
|
void multiply_zoom(double m);
|
||||||
void copy(bool del);
|
void copy(bool del);
|
||||||
Clip* split_clip(ComboAction* ca, bool transitions, int p, long frame);
|
ClipPtr split_clip(ComboAction* ca, bool transitions, int p, long frame);
|
||||||
Clip* split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in);
|
ClipPtr split_clip(ComboAction* ca, bool transitions, int p, long frame, long post_in);
|
||||||
bool split_selection(ComboAction* ca);
|
bool split_selection(ComboAction* ca);
|
||||||
bool split_all_clips_at_point(ComboAction *ca, long point);
|
bool split_all_clips_at_point(ComboAction *ca, long point);
|
||||||
bool split_clip_and_relink(ComboAction* ca, int clip, long frame, bool relink);
|
bool split_clip_and_relink(ComboAction* ca, int clip, long frame, bool relink);
|
||||||
void clean_up_selections(QVector<Selection>& areas);
|
void clean_up_selections(QVector<Selection>& areas);
|
||||||
void deselect_area(long in, long out, int track);
|
void deselect_area(long in, long out, int track);
|
||||||
void delete_areas_and_relink(ComboAction *ca, QVector<Selection>& areas, bool deselect_areas);
|
void delete_areas_and_relink(ComboAction *ca, QVector<Selection>& areas, bool deselect_areas);
|
||||||
void relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& new_clips);
|
void relink_clips_using_ids(QVector<int>& old_clips, QVector<ClipPtr>& new_clips);
|
||||||
void update_sequence();
|
void update_sequence();
|
||||||
|
|
||||||
QVector<int> get_tracks_of_linked_clips(int i);
|
QVector<int> get_tracks_of_linked_clips(int i);
|
||||||
@@ -114,8 +103,8 @@ public:
|
|||||||
void edit_to_point_internal(bool in, bool ripple);
|
void edit_to_point_internal(bool in, bool ripple);
|
||||||
void delete_in_out_internal(bool ripple);
|
void delete_in_out_internal(bool ripple);
|
||||||
|
|
||||||
void create_ghosts_from_media(Sequence *seq, long entry_point, QVector<Media *> &media_list);
|
void create_ghosts_from_media(SequencePtr seq, long entry_point, QVector<Media *> &media_list);
|
||||||
void add_clips_from_ghosts(ComboAction *ca, Sequence *s);
|
void add_clips_from_ghosts(ComboAction *ca, SequencePtr s);
|
||||||
|
|
||||||
int getTimelineScreenPointFromFrame(long frame);
|
int getTimelineScreenPointFromFrame(long frame);
|
||||||
long getTimelineFrameFromScreenPoint(int x);
|
long getTimelineFrameFromScreenPoint(int x);
|
||||||
|
|||||||
+10
-11
@@ -123,7 +123,7 @@ void Viewer::reset_all_audio() {
|
|||||||
if (seq != nullptr) {
|
if (seq != nullptr) {
|
||||||
long last_frame = 0;
|
long last_frame = 0;
|
||||||
for (int i=0;i<seq->clips.size();i++) {
|
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 != nullptr) {
|
||||||
c->reset_audio();
|
c->reset_audio();
|
||||||
last_frame = qMax(last_frame, c->timeline_out);
|
last_frame = qMax(last_frame, c->timeline_out);
|
||||||
@@ -438,9 +438,9 @@ void Viewer::pause() {
|
|||||||
panel_project->process_file_list(file_list);
|
panel_project->process_file_list(file_list);
|
||||||
|
|
||||||
// add it to the sequence
|
// add it to the sequence
|
||||||
Clip* c = new Clip(seq);
|
ClipPtr c = ClipPtr(new Clip(seq));
|
||||||
Media* m = panel_project->last_imported_media.at(0);
|
Media* m = panel_project->last_imported_media.at(0);
|
||||||
Footage* f = m->to_footage();
|
FootagePtr f = m->to_footage();
|
||||||
|
|
||||||
f->ready_lock.lock();
|
f->ready_lock.lock();
|
||||||
|
|
||||||
@@ -457,7 +457,7 @@ void Viewer::pause() {
|
|||||||
|
|
||||||
f->ready_lock.unlock();
|
f->ready_lock.unlock();
|
||||||
|
|
||||||
QVector<Clip*> add_clips;
|
QVector<ClipPtr> add_clips;
|
||||||
add_clips.append(c);
|
add_clips.append(c);
|
||||||
olive::UndoStack.push(new AddClipCommand(seq, add_clips)); // add clip
|
olive::UndoStack.push(new AddClipCommand(seq, add_clips)); // add clip
|
||||||
}
|
}
|
||||||
@@ -720,11 +720,11 @@ void Viewer::set_media(Media* m) {
|
|||||||
switch (media->get_type()) {
|
switch (media->get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
case MEDIA_TYPE_FOOTAGE:
|
||||||
{
|
{
|
||||||
Footage* footage = media->to_footage();
|
FootagePtr footage = media->to_footage();
|
||||||
|
|
||||||
marker_ref = &footage->markers;
|
marker_ref = &footage->markers;
|
||||||
|
|
||||||
seq = new Sequence();
|
seq = SequencePtr(new Sequence());
|
||||||
created_sequence = true;
|
created_sequence = true;
|
||||||
seq->wrapper_sequence = true;
|
seq->wrapper_sequence = true;
|
||||||
seq->name = footage->name;
|
seq->name = footage->name;
|
||||||
@@ -743,7 +743,7 @@ void Viewer::set_media(Media* m) {
|
|||||||
seq->height = video_stream.video_height;
|
seq->height = video_stream.video_height;
|
||||||
if (video_stream.video_frame_rate > 0 && !video_stream.infinite_length) seq->frame_rate = video_stream.video_frame_rate * footage->speed;
|
if (video_stream.video_frame_rate > 0 && !video_stream.infinite_length) seq->frame_rate = video_stream.video_frame_rate * footage->speed;
|
||||||
|
|
||||||
Clip* c = new Clip(seq);
|
ClipPtr c = ClipPtr(new Clip(seq));
|
||||||
c->media = media;
|
c->media = media;
|
||||||
c->media_stream = video_stream.file_index;
|
c->media_stream = video_stream.file_index;
|
||||||
c->timeline_in = 0;
|
c->timeline_in = 0;
|
||||||
@@ -762,7 +762,7 @@ void Viewer::set_media(Media* m) {
|
|||||||
const FootageStream& audio_stream = footage->audio_tracks.at(0);
|
const FootageStream& audio_stream = footage->audio_tracks.at(0);
|
||||||
seq->audio_frequency = audio_stream.audio_frequency;
|
seq->audio_frequency = audio_stream.audio_frequency;
|
||||||
|
|
||||||
Clip* c = new Clip(seq);
|
ClipPtr c = ClipPtr(new Clip(seq));
|
||||||
c->media = media;
|
c->media = media;
|
||||||
c->media_stream = audio_stream.file_index;
|
c->media_stream = audio_stream.file_index;
|
||||||
c->timeline_in = 0;
|
c->timeline_in = 0;
|
||||||
@@ -848,13 +848,12 @@ void Viewer::clean_created_seq() {
|
|||||||
undo_stack.command(i)
|
undo_stack.command(i)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
delete seq;
|
seq.reset();
|
||||||
seq = nullptr;
|
|
||||||
created_sequence = false;
|
created_sequence = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_sequence(bool main, Sequence *s) {
|
void Viewer::set_sequence(bool main, SequencePtr s) {
|
||||||
pause();
|
pause();
|
||||||
|
|
||||||
reset_all_audio();
|
reset_all_audio();
|
||||||
|
|||||||
+10
-12
@@ -24,19 +24,17 @@
|
|||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QLabel>
|
||||||
class Timeline;
|
#include <QPushButton>
|
||||||
class Media;
|
|
||||||
struct Sequence;
|
|
||||||
class TimelineHeader;
|
|
||||||
class ResizableScrollBar;
|
|
||||||
class ViewerContainer;
|
|
||||||
class LabelSlider;
|
|
||||||
class QPushButton;
|
|
||||||
class QLabel;
|
|
||||||
|
|
||||||
#include "project/marker.h"
|
#include "project/marker.h"
|
||||||
|
#include "project/media.h"
|
||||||
|
|
||||||
#include "ui/viewerwidget.h"
|
#include "ui/viewerwidget.h"
|
||||||
|
#include "ui/timelinewidget.h"
|
||||||
|
#include "ui/timelineheader.h"
|
||||||
|
#include "ui/labelslider.h"
|
||||||
|
#include "ui/resizablescrollbar.h"
|
||||||
|
|
||||||
bool frame_rate_is_droppable(float rate);
|
bool frame_rate_is_droppable(float rate);
|
||||||
long timecode_to_frame(const QString& s, int view, double frame_rate);
|
long timecode_to_frame(const QString& s, int view, double frame_rate);
|
||||||
@@ -92,7 +90,7 @@ public:
|
|||||||
ViewerWidget* viewer_widget;
|
ViewerWidget* viewer_widget;
|
||||||
|
|
||||||
Media* media;
|
Media* media;
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
QVector<Marker>* marker_ref;
|
QVector<Marker>* marker_ref;
|
||||||
|
|
||||||
void set_marker();
|
void set_marker();
|
||||||
@@ -124,7 +122,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
void update_window_title();
|
void update_window_title();
|
||||||
void clean_created_seq();
|
void clean_created_seq();
|
||||||
void set_sequence(bool main, Sequence* s);
|
void set_sequence(bool main, SequencePtr s);
|
||||||
bool main_sequence;
|
bool main_sequence;
|
||||||
bool created_sequence;
|
bool created_sequence;
|
||||||
long cached_end_frame;
|
long cached_end_frame;
|
||||||
|
|||||||
+4
-8
@@ -25,15 +25,11 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QWaitCondition>
|
#include <QWaitCondition>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
#include <QIODevice>
|
||||||
|
#include <QAudioOutput>
|
||||||
|
#include <QComboBox>
|
||||||
|
|
||||||
//#define INT16_MAX 0x7fff
|
#include "project/sequence.h"
|
||||||
//#define INT16_MIN (-INT16_MAX-1)
|
|
||||||
|
|
||||||
class QIODevice;
|
|
||||||
class QAudioOutput;
|
|
||||||
class QComboBox;
|
|
||||||
|
|
||||||
struct Sequence;
|
|
||||||
|
|
||||||
class AudioSenderThread : public QThread {
|
class AudioSenderThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
+12
-12
@@ -62,13 +62,13 @@ double bytes_to_seconds(int nb_bytes, int nb_channels, int sample_rate) {
|
|||||||
return ((double) (nb_bytes >> 1) / nb_channels / sample_rate);
|
return ((double) (nb_bytes >> 1) / nb_channels / sample_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_bytes, QVector<Clip*> nests) {
|
void apply_audio_effects(ClipPtr c, double timecode_start, AVFrame* frame, int nb_bytes, QVector<ClipPtr> nests) {
|
||||||
// perform all audio effects
|
// perform all audio effects
|
||||||
double timecode_end;
|
double timecode_end;
|
||||||
timecode_end = timecode_start + bytes_to_seconds(nb_bytes, frame->channels, frame->sample_rate);
|
timecode_end = timecode_start + bytes_to_seconds(nb_bytes, frame->channels, frame->sample_rate);
|
||||||
|
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
Effect* e = c->effects.at(j);
|
EffectPtr e = c->effects.at(j);
|
||||||
if (e->is_enabled()) e->process_audio(timecode_start, timecode_end, frame->data[0], nb_bytes, 2);
|
if (e->is_enabled()) e->process_audio(timecode_start, timecode_end, frame->data[0], nb_bytes, 2);
|
||||||
}
|
}
|
||||||
if (c->get_opening_transition() != nullptr) {
|
if (c->get_opening_transition() != nullptr) {
|
||||||
@@ -98,7 +98,7 @@ void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!nests.isEmpty()) {
|
if (!nests.isEmpty()) {
|
||||||
Clip* next_nest = nests.last();
|
ClipPtr next_nest = nests.last();
|
||||||
nests.removeLast();
|
nests.removeLast();
|
||||||
apply_audio_effects(next_nest, timecode_start + (((double)c->get_timeline_in_with_transition()-c->get_clip_in_with_transition())/c->sequence->frame_rate), frame, nb_bytes, nests);
|
apply_audio_effects(next_nest, timecode_start + (((double)c->get_timeline_in_with_transition()-c->get_clip_in_with_transition())/c->sequence->frame_rate), frame, nb_bytes, nests);
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_
|
|||||||
|
|
||||||
#define AUDIO_BUFFER_PADDING 2048
|
#define AUDIO_BUFFER_PADDING 2048
|
||||||
|
|
||||||
void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests, int playback_speed) {
|
void cache_audio_worker(ClipPtr c, bool scrubbing, QVector<ClipPtr>& nests, int playback_speed) {
|
||||||
long timeline_in = c->get_timeline_in_with_transition();
|
long timeline_in = c->get_timeline_in_with_transition();
|
||||||
long timeline_out = c->get_timeline_out_with_transition();
|
long timeline_out = c->get_timeline_out_with_transition();
|
||||||
long target_frame = c->audio_target_frame;
|
long target_frame = c->audio_target_frame;
|
||||||
@@ -460,7 +460,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests, int play
|
|||||||
QMetaObject::invokeMethod(panel_sequence_viewer, "play_wake", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(panel_sequence_viewer, "play_wake", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cache_video_worker(Clip* c, long playhead) {
|
void cache_video_worker(ClipPtr c, long playhead) {
|
||||||
int read_ret, send_ret, retr_ret;
|
int read_ret, send_ret, retr_ret;
|
||||||
|
|
||||||
int64_t target_pts = seconds_to_timestamp(c, playhead_to_clip_seconds(c, playhead));
|
int64_t target_pts = seconds_to_timestamp(c, playhead_to_clip_seconds(c, playhead));
|
||||||
@@ -498,7 +498,7 @@ void cache_video_worker(Clip* c, long playhead) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
AVFrame* frame = av_frame_alloc();
|
AVFrame* frame = av_frame_alloc();
|
||||||
|
|
||||||
Footage* media = c->media->to_footage();
|
FootagePtr media = c->media->to_footage();
|
||||||
const FootageStream* ms = media->get_stream_from_file_index(true, c->media_stream);
|
const FootageStream* ms = media->get_stream_from_file_index(true, c->media_stream);
|
||||||
|
|
||||||
while ((retr_ret = av_buffersink_get_frame(c->buffersink_ctx, frame)) == AVERROR(EAGAIN)) {
|
while ((retr_ret = av_buffersink_get_frame(c->buffersink_ctx, frame)) == AVERROR(EAGAIN)) {
|
||||||
@@ -585,7 +585,7 @@ void cache_video_worker(Clip* c, long playhead) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_cache(Clip* c, long target_frame, int playback_speed) {
|
void reset_cache(ClipPtr c, long target_frame, int playback_speed) {
|
||||||
// if we seek to a whole other place in the timeline, we'll need to reset the cache with new values
|
// if we seek to a whole other place in the timeline, we'll need to reset the cache with new values
|
||||||
if (c->media == nullptr) {
|
if (c->media == nullptr) {
|
||||||
if (c->track >= 0) {
|
if (c->track >= 0) {
|
||||||
@@ -671,11 +671,11 @@ void reset_cache(Clip* c, long target_frame, int playback_speed) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cacher::Cacher(Clip* c) : clip(c) {}
|
Cacher::Cacher(ClipPtr c) : clip(c) {}
|
||||||
|
|
||||||
AVSampleFormat sample_format = AV_SAMPLE_FMT_S16;
|
AVSampleFormat sample_format = AV_SAMPLE_FMT_S16;
|
||||||
|
|
||||||
void open_clip_worker(Clip* clip) {
|
void open_clip_worker(ClipPtr clip) {
|
||||||
qint64 time_start = QDateTime::currentMSecsSinceEpoch();
|
qint64 time_start = QDateTime::currentMSecsSinceEpoch();
|
||||||
|
|
||||||
if (clip->media == nullptr) {
|
if (clip->media == nullptr) {
|
||||||
@@ -694,7 +694,7 @@ void open_clip_worker(Clip* clip) {
|
|||||||
}
|
}
|
||||||
} else if (clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
} else if (clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
// opens file resource for FFmpeg and prepares Clip struct for playback
|
// opens file resource for FFmpeg and prepares Clip struct for playback
|
||||||
Footage* m = clip->media->to_footage();
|
FootagePtr m = clip->media->to_footage();
|
||||||
|
|
||||||
// byte array for retriving raw bytes from QString URL
|
// byte array for retriving raw bytes from QString URL
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
@@ -947,7 +947,7 @@ void open_clip_worker(Clip* clip) {
|
|||||||
qInfo() << "Clip opened on track" << clip->track << "(took" << (QDateTime::currentMSecsSinceEpoch() - time_start) << "ms)";
|
qInfo() << "Clip opened on track" << clip->track << "(took" << (QDateTime::currentMSecsSinceEpoch() - time_start) << "ms)";
|
||||||
}
|
}
|
||||||
|
|
||||||
void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip*> nests, int playback_speed) {
|
void cache_clip_worker(ClipPtr clip, long playhead, bool reset, bool scrubbing, QVector<ClipPtr> nests, int playback_speed) {
|
||||||
if (reset) {
|
if (reset) {
|
||||||
// note: for video, playhead is in "internal clip" frames - for audio, it's the timeline playhead
|
// note: for video, playhead is in "internal clip" frames - for audio, it's the timeline playhead
|
||||||
reset_cache(clip, playhead, playback_speed);
|
reset_cache(clip, playhead, playback_speed);
|
||||||
@@ -967,7 +967,7 @@ void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void close_clip_worker(Clip* clip) {
|
void close_clip_worker(ClipPtr clip) {
|
||||||
clip->finished_opening = false;
|
clip->finished_opening = false;
|
||||||
|
|
||||||
if (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
|
|||||||
+7
-6
@@ -25,12 +25,13 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
class Clip;
|
class Clip;
|
||||||
|
using ClipPtr = std::shared_ptr<Clip>;
|
||||||
|
|
||||||
class Cacher : public QThread
|
class Cacher : public QThread
|
||||||
{
|
{
|
||||||
// Q_OBJECT
|
// Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Cacher(Clip* c);
|
Cacher(ClipPtr c);
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
bool caching;
|
bool caching;
|
||||||
@@ -42,14 +43,14 @@ public:
|
|||||||
bool interrupt;
|
bool interrupt;
|
||||||
bool queued;
|
bool queued;
|
||||||
int playback_speed;
|
int playback_speed;
|
||||||
QVector<Clip*> nests;
|
QVector<ClipPtr> nests;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Clip* clip;
|
ClipPtr clip;
|
||||||
};
|
};
|
||||||
|
|
||||||
void open_clip_worker(Clip* clip);
|
void open_clip_worker(ClipPtr clip);
|
||||||
void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip *> nest, int playback_speed);
|
void cache_clip_worker(ClipPtr clip, long playhead, bool reset, bool scrubbing, QVector<ClipPtr> nest, int playback_speed);
|
||||||
void close_clip_worker(Clip* clip);
|
void close_clip_worker(ClipPtr clip);
|
||||||
|
|
||||||
#endif // CACHER_H
|
#endif // CACHER_H
|
||||||
|
|||||||
+17
-18
@@ -36,7 +36,6 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
#include <libavutil/pixdesc.h>
|
#include <libavutil/pixdesc.h>
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libswscale/swscale.h>
|
#include <libswscale/swscale.h>
|
||||||
@@ -59,11 +58,11 @@ long refactor_frame_number(long framenumber, double source_frame_rate, double ta
|
|||||||
return qRound((double(framenumber)/source_frame_rate)*target_frame_rate);
|
return qRound((double(framenumber)/source_frame_rate)*target_frame_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool clip_uses_cacher(Clip* clip) {
|
bool clip_uses_cacher(ClipPtr clip) {
|
||||||
return (clip->media == nullptr && clip->track >= 0) || (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE);
|
return (clip->media == nullptr && clip->track >= 0) || (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_clip(Clip* clip, bool multithreaded) {
|
void open_clip(ClipPtr clip, bool multithreaded) {
|
||||||
if (clip_uses_cacher(clip)) {
|
if (clip_uses_cacher(clip)) {
|
||||||
clip->multithreaded = multithreaded;
|
clip->multithreaded = multithreaded;
|
||||||
if (multithreaded) {
|
if (multithreaded) {
|
||||||
@@ -85,7 +84,7 @@ void open_clip(Clip* clip, bool multithreaded) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void close_clip(Clip* clip, bool wait) {
|
void close_clip(ClipPtr clip, bool wait) {
|
||||||
clip->finished_opening = false;
|
clip->finished_opening = false;
|
||||||
|
|
||||||
// destroy opengl texture in main thread
|
// destroy opengl texture in main thread
|
||||||
@@ -129,7 +128,7 @@ void close_clip(Clip* clip, bool wait) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cache_clip(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip*>& nests, int playback_speed) {
|
void cache_clip(ClipPtr clip, long playhead, bool reset, bool scrubbing, QVector<ClipPtr>& nests, int playback_speed) {
|
||||||
if (clip_uses_cacher(clip)) {
|
if (clip_uses_cacher(clip)) {
|
||||||
if (clip->multithreaded) {
|
if (clip->multithreaded) {
|
||||||
clip->cacher->playhead = playhead;
|
clip->cacher->playhead = playhead;
|
||||||
@@ -147,11 +146,11 @@ void cache_clip(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double get_timecode(Clip* c, long playhead) {
|
double get_timecode(ClipPtr c, long playhead) {
|
||||||
return ((double)(playhead-c->get_timeline_in_with_transition()+c->get_clip_in_with_transition())/(double)c->sequence->frame_rate);
|
return ((double)(playhead-c->get_timeline_in_with_transition()+c->get_clip_in_with_transition())/(double)c->sequence->frame_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
|
void get_clip_frame(ClipPtr c, long playhead, bool& texture_failed) {
|
||||||
if (c->finished_opening) {
|
if (c->finished_opening) {
|
||||||
const FootageStream* ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
|
const FootageStream* ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||||
|
|
||||||
@@ -336,7 +335,7 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0;i<c->effects.size();i++) {
|
for (int i=0;i<c->effects.size();i++) {
|
||||||
Effect* e = c->effects.at(i);
|
EffectPtr e = c->effects.at(i);
|
||||||
if (e->enable_image && e->is_enabled()) {
|
if (e->enable_image && e->is_enabled()) {
|
||||||
if (data_buffer_1 == target_frame->data[0]) {
|
if (data_buffer_1 == target_frame->data[0]) {
|
||||||
data_buffer_1 = new uint8_t[frame_size];
|
data_buffer_1 = new uint8_t[frame_size];
|
||||||
@@ -366,16 +365,16 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) {
|
|||||||
c->queue_lock.unlock();
|
c->queue_lock.unlock();
|
||||||
|
|
||||||
// get more frames
|
// get more frames
|
||||||
QVector<Clip*> empty;
|
QVector<ClipPtr> empty;
|
||||||
if (cache) cache_clip(c, playhead, reset, false, empty, false);
|
if (cache) cache_clip(c, playhead, reset, false, empty, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long playhead_to_clip_frame(Clip* c, long playhead) {
|
long playhead_to_clip_frame(ClipPtr c, long playhead) {
|
||||||
return (qMax(0L, playhead - c->get_timeline_in_with_transition()) + c->get_clip_in_with_transition());
|
return (qMax(0L, playhead - c->get_timeline_in_with_transition()) + c->get_clip_in_with_transition());
|
||||||
}
|
}
|
||||||
|
|
||||||
double playhead_to_clip_seconds(Clip* c, long playhead) {
|
double playhead_to_clip_seconds(ClipPtr c, long playhead) {
|
||||||
// returns time in seconds
|
// returns time in seconds
|
||||||
long clip_frame = playhead_to_clip_frame(c, playhead);
|
long clip_frame = playhead_to_clip_frame(c, playhead);
|
||||||
if (c->reverse) clip_frame = c->getMaximumLength() - clip_frame - 1;
|
if (c->reverse) clip_frame = c->getMaximumLength() - clip_frame - 1;
|
||||||
@@ -384,15 +383,15 @@ double playhead_to_clip_seconds(Clip* c, long playhead) {
|
|||||||
return secs;
|
return secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t seconds_to_timestamp(Clip* c, double seconds) {
|
int64_t seconds_to_timestamp(ClipPtr c, double seconds) {
|
||||||
return qRound64(seconds * av_q2d(av_inv_q(c->stream->time_base))) + qMax((int64_t) 0, c->stream->start_time);
|
return qRound64(seconds * av_q2d(av_inv_q(c->stream->time_base))) + qMax((int64_t) 0, c->stream->start_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t playhead_to_timestamp(Clip* c, long playhead) {
|
int64_t playhead_to_timestamp(ClipPtr c, long playhead) {
|
||||||
return seconds_to_timestamp(c, playhead_to_clip_seconds(c, playhead));
|
return seconds_to_timestamp(c, playhead_to_clip_seconds(c, playhead));
|
||||||
}
|
}
|
||||||
|
|
||||||
int retrieve_next_frame(Clip* c, AVFrame* f) {
|
int retrieve_next_frame(ClipPtr c, AVFrame* f) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int receive_ret;
|
int receive_ret;
|
||||||
|
|
||||||
@@ -438,7 +437,7 @@ int retrieve_next_frame(Clip* c, AVFrame* f) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_clip_active(Clip* c, long playhead) {
|
bool is_clip_active(ClipPtr c, long playhead) {
|
||||||
// these buffers allow clips to be opened and prepared well before they're displayed
|
// these buffers allow clips to be opened and prepared well before they're displayed
|
||||||
// as well as closed a little after they're not needed anymore
|
// as well as closed a little after they're not needed anymore
|
||||||
int open_buffer = qCeil(c->sequence->frame_rate*2);
|
int open_buffer = qCeil(c->sequence->frame_rate*2);
|
||||||
@@ -451,7 +450,7 @@ bool is_clip_active(Clip* c, long playhead) {
|
|||||||
&& playhead - c->get_timeline_in_with_transition() + c->get_clip_in_with_transition() < c->getMaximumLength();
|
&& playhead - c->get_timeline_in_with_transition() + c->get_clip_in_with_transition() < c->getMaximumLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_sequence(Sequence* s) {
|
void set_sequence(SequencePtr s) {
|
||||||
panel_effect_controls->clear_effects(true);
|
panel_effect_controls->clear_effects(true);
|
||||||
olive::ActiveSequence = s;
|
olive::ActiveSequence = s;
|
||||||
panel_sequence_viewer->set_main_sequence();
|
panel_sequence_viewer->set_main_sequence();
|
||||||
@@ -459,10 +458,10 @@ void set_sequence(Sequence* s) {
|
|||||||
panel_timeline->setFocus();
|
panel_timeline->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void closeActiveClips(Sequence *s) {
|
void closeActiveClips(SequencePtr s) {
|
||||||
if (s != nullptr) {
|
if (s != nullptr) {
|
||||||
for (int i=0;i<s->clips.size();i++) {
|
for (int i=0;i<s->clips.size();i++) {
|
||||||
Clip* c = s->clips.at(i);
|
ClipPtr c = s->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||||
closeActiveClips(c->media->to_sequence());
|
closeActiveClips(c->media->to_sequence());
|
||||||
|
|||||||
+23
-21
@@ -24,30 +24,32 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
class Clip;
|
#include "project/clip.h"
|
||||||
struct ClipCache;
|
#include "project/sequence.h"
|
||||||
struct Sequence;
|
|
||||||
struct AVFrame;
|
extern "C" {
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
}
|
||||||
|
|
||||||
long refactor_frame_number(long framenumber, double source_frame_rate, double target_frame_rate);
|
long refactor_frame_number(long framenumber, double source_frame_rate, double target_frame_rate);
|
||||||
bool clip_uses_cacher(Clip* clip);
|
bool clip_uses_cacher(ClipPtr clip);
|
||||||
void open_clip(Clip* clip, bool multithreaded);
|
void open_clip(ClipPtr clip, bool multithreaded);
|
||||||
void cache_clip(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip *> &nests, int playback_speed);
|
void cache_clip(ClipPtr clip, long playhead, bool reset, bool scrubbing, QVector<ClipPtr> &nests, int playback_speed);
|
||||||
void close_clip(Clip* clip, bool wait);
|
void close_clip(ClipPtr clip, bool wait);
|
||||||
void handle_media(Sequence* sequence, long playhead, bool multithreaded);
|
void handle_media(SequencePtr sequence, long playhead, bool multithreaded);
|
||||||
void reset_cache(Clip* c, long target_frame, int playback_speed);
|
void reset_cache(ClipPtr c, long target_frame, int playback_speed);
|
||||||
void get_clip_frame(Clip* c, long playhead, bool &texture_failed);
|
void get_clip_frame(ClipPtr c, long playhead, bool &texture_failed);
|
||||||
double get_timecode(Clip* c, long playhead);
|
double get_timecode(ClipPtr c, long playhead);
|
||||||
|
|
||||||
long playhead_to_clip_frame(Clip* c, long playhead);
|
long playhead_to_clip_frame(ClipPtr c, long playhead);
|
||||||
double playhead_to_clip_seconds(Clip* c, long playhead);
|
double playhead_to_clip_seconds(ClipPtr c, long playhead);
|
||||||
int64_t seconds_to_timestamp(Clip* c, double seconds);
|
int64_t seconds_to_timestamp(ClipPtr c, double seconds);
|
||||||
int64_t playhead_to_timestamp(Clip* c, long playhead);
|
int64_t playhead_to_timestamp(ClipPtr c, long playhead);
|
||||||
|
|
||||||
int retrieve_next_frame(Clip* c, AVFrame* f);
|
int retrieve_next_frame(ClipPtr c, AVFrame* f);
|
||||||
bool is_clip_active(Clip* c, long playhead);
|
bool is_clip_active(ClipPtr c, long playhead);
|
||||||
void get_next_audio(Clip* c, bool mix);
|
void get_next_audio(ClipPtr c, bool mix);
|
||||||
void set_sequence(Sequence* s);
|
void set_sequence(SequencePtr s);
|
||||||
void closeActiveClips(Sequence* s);
|
void closeActiveClips(SequencePtr s);
|
||||||
|
|
||||||
#endif // PLAYBACK_H
|
#endif // PLAYBACK_H
|
||||||
|
|||||||
+18
-24
@@ -34,11 +34,7 @@
|
|||||||
#include "undo.h"
|
#include "undo.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
extern "C" {
|
Clip::Clip(SequencePtr s) :
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
}
|
|
||||||
|
|
||||||
Clip::Clip(Sequence* s) :
|
|
||||||
sequence(s),
|
sequence(s),
|
||||||
enabled(true),
|
enabled(true),
|
||||||
clip_in(0),
|
clip_in(0),
|
||||||
@@ -64,8 +60,8 @@ Clip::Clip(Sequence* s) :
|
|||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
Clip* Clip::copy(Sequence* s, bool duplicate_transitions) {
|
ClipPtr Clip::copy(SequencePtr s, bool duplicate_transitions) {
|
||||||
Clip* copy = new Clip(s);
|
ClipPtr copy(new Clip(s));
|
||||||
|
|
||||||
copy->enabled = enabled;
|
copy->enabled = enabled;
|
||||||
copy->name = QString(name);
|
copy->name = QString(name);
|
||||||
@@ -122,9 +118,9 @@ void Clip::reset_audio() {
|
|||||||
frame_sample_index = -1;
|
frame_sample_index = -1;
|
||||||
audio_buffer_write = 0;
|
audio_buffer_write = 0;
|
||||||
} else if (media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
} 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++) {
|
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();
|
if (c != nullptr) c->reset_audio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +129,7 @@ void Clip::reset_audio() {
|
|||||||
void Clip::refresh() {
|
void Clip::refresh() {
|
||||||
// validates media if it was replaced
|
// validates media if it was replaced
|
||||||
if (replaced && media != nullptr && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
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) {
|
if (track < 0 && m->video_tracks.size() > 0) {
|
||||||
media_stream = m->video_tracks.at(0).file_index;
|
media_stream = m->video_tracks.at(0).file_index;
|
||||||
@@ -177,7 +173,7 @@ QVector<Marker> &Clip::get_markers() {
|
|||||||
return markers;
|
return markers;
|
||||||
}
|
}
|
||||||
|
|
||||||
Transition* Clip::get_opening_transition() {
|
TransitionPtr Clip::get_opening_transition() {
|
||||||
if (opening_transition > -1) {
|
if (opening_transition > -1) {
|
||||||
if (this->sequence == nullptr) {
|
if (this->sequence == nullptr) {
|
||||||
return clipboard_transitions.at(opening_transition);
|
return clipboard_transitions.at(opening_transition);
|
||||||
@@ -188,7 +184,7 @@ Transition* Clip::get_opening_transition() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Transition* Clip::get_closing_transition() {
|
TransitionPtr Clip::get_closing_transition() {
|
||||||
if (closing_transition > -1) {
|
if (closing_transition > -1) {
|
||||||
if (this->sequence == nullptr) {
|
if (this->sequence == nullptr) {
|
||||||
return clipboard_transitions.at(closing_transition);
|
return clipboard_transitions.at(closing_transition);
|
||||||
@@ -201,15 +197,13 @@ Transition* Clip::get_closing_transition() {
|
|||||||
|
|
||||||
Clip::~Clip() {
|
Clip::~Clip() {
|
||||||
if (open) {
|
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 (opening_transition != -1) this->sequence->hard_delete_transition(ClipPtr(this), TA_OPENING_TRANSITION);
|
||||||
if (closing_transition != -1) this->sequence->hard_delete_transition(this, TA_CLOSING_TRANSITION);
|
if (closing_transition != -1) this->sequence->hard_delete_transition(ClipPtr(this), TA_CLOSING_TRANSITION);
|
||||||
|
|
||||||
for (int i=0;i<effects.size();i++) {
|
effects.clear();
|
||||||
delete effects.at(i);
|
|
||||||
}
|
|
||||||
av_packet_free(&pkt);
|
av_packet_free(&pkt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +259,7 @@ void Clip::recalculateMaxLength() {
|
|||||||
switch (media->get_type()) {
|
switch (media->get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
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);
|
const FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
|
||||||
if (ms != nullptr && ms->infinite_length) {
|
if (ms != nullptr && ms->infinite_length) {
|
||||||
calculated_length = LONG_MAX;
|
calculated_length = LONG_MAX;
|
||||||
@@ -276,7 +270,7 @@ void Clip::recalculateMaxLength() {
|
|||||||
break;
|
break;
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
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);
|
calculated_length = refactor_frame_number(s->getEndFrame(), s->frame_rate, fr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -301,7 +295,7 @@ int Clip::getWidth() {
|
|||||||
}
|
}
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
{
|
{
|
||||||
Sequence* s = media->to_sequence();
|
SequencePtr s = media->to_sequence();
|
||||||
return s->width;
|
return s->width;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -320,7 +314,7 @@ int Clip::getHeight() {
|
|||||||
}
|
}
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
{
|
{
|
||||||
Sequence* s = media->to_sequence();
|
SequencePtr s = media->to_sequence();
|
||||||
return s->height;
|
return s->height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,7 +323,7 @@ int Clip::getHeight() {
|
|||||||
|
|
||||||
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
|
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
|
||||||
if (change_timeline_points) {
|
if (change_timeline_points) {
|
||||||
move_clip(ca, this,
|
move_clip(ca, ClipPtr(this),
|
||||||
qRound((double) timeline_in * multiplier),
|
qRound((double) timeline_in * multiplier),
|
||||||
qRound((double) timeline_out * multiplier),
|
qRound((double) timeline_out * multiplier),
|
||||||
qRound((double) clip_in * multiplier),
|
qRound((double) clip_in * multiplier),
|
||||||
@@ -338,7 +332,7 @@ void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_t
|
|||||||
|
|
||||||
// move keyframes
|
// move keyframes
|
||||||
for (int i=0;i<effects.size();i++) {
|
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++) {
|
for (int j=0;j<e->row_count();j++) {
|
||||||
EffectRow* r = e->row(j);
|
EffectRow* r = e->row(j);
|
||||||
for (int l=0;l<r->fieldCount();l++) {
|
for (int l=0;l<r->fieldCount();l++) {
|
||||||
|
|||||||
+25
-28
@@ -24,37 +24,34 @@
|
|||||||
#include <QWaitCondition>
|
#include <QWaitCondition>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QVector>
|
#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"
|
#include "marker.h"
|
||||||
|
|
||||||
class Cacher;
|
extern "C" {
|
||||||
class Effect;
|
#include <libavformat/avformat.h>
|
||||||
class Transition;
|
#include <libavfilter/avfilter.h>
|
||||||
class QOpenGLFramebufferObject;
|
}
|
||||||
class ComboAction;
|
|
||||||
class Media;
|
|
||||||
struct Sequence;
|
|
||||||
struct Footage;
|
|
||||||
struct FootageStream;
|
|
||||||
|
|
||||||
struct AVFormatContext;
|
using ClipPtr = std::shared_ptr<Clip>;
|
||||||
struct AVStream;
|
|
||||||
struct AVCodec;
|
class Sequence;
|
||||||
struct AVCodecContext;
|
using SequencePtr = std::shared_ptr<Sequence>;
|
||||||
struct AVFrame;
|
|
||||||
struct AVPacket;
|
|
||||||
struct SwsContext;
|
|
||||||
struct SwrContext;
|
|
||||||
struct AVFilterGraph;
|
|
||||||
struct AVFilterContext;
|
|
||||||
struct AVDictionary;
|
|
||||||
class QOpenGLTexture;
|
|
||||||
|
|
||||||
class Clip {
|
class Clip {
|
||||||
public:
|
public:
|
||||||
Clip(Sequence* s);
|
Clip(SequencePtr s);
|
||||||
~Clip();
|
~Clip();
|
||||||
Clip* copy(Sequence* s, bool duplicate_transitions = true);
|
ClipPtr copy(SequencePtr s, bool duplicate_transitions = true);
|
||||||
void reset_audio();
|
void reset_audio();
|
||||||
void reset();
|
void reset();
|
||||||
void refresh();
|
void refresh();
|
||||||
@@ -68,7 +65,7 @@ public:
|
|||||||
int getWidth();
|
int getWidth();
|
||||||
int getHeight();
|
int getHeight();
|
||||||
void refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points);
|
void refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points);
|
||||||
Sequence* sequence;
|
SequencePtr sequence;
|
||||||
|
|
||||||
// queue functions
|
// queue functions
|
||||||
void queue_clear();
|
void queue_clear();
|
||||||
@@ -84,7 +81,7 @@ public:
|
|||||||
quint8 color_r;
|
quint8 color_r;
|
||||||
quint8 color_g;
|
quint8 color_g;
|
||||||
quint8 color_b;
|
quint8 color_b;
|
||||||
Media* media;
|
Media* media;
|
||||||
int media_stream;
|
int media_stream;
|
||||||
double speed;
|
double speed;
|
||||||
double cached_fr;
|
double cached_fr;
|
||||||
@@ -96,12 +93,12 @@ public:
|
|||||||
QVector<Marker>& get_markers();
|
QVector<Marker>& get_markers();
|
||||||
|
|
||||||
// other variables (should be deep copied/duplicated in copy())
|
// other variables (should be deep copied/duplicated in copy())
|
||||||
QList<Effect*> effects;
|
QList<EffectPtr> effects;
|
||||||
QVector<int> linked;
|
QVector<int> linked;
|
||||||
int opening_transition;
|
int opening_transition;
|
||||||
Transition* get_opening_transition();
|
TransitionPtr get_opening_transition();
|
||||||
int closing_transition;
|
int closing_transition;
|
||||||
Transition* get_closing_transition();
|
TransitionPtr get_closing_transition();
|
||||||
|
|
||||||
// media handling
|
// media handling
|
||||||
AVFormatContext* formatCtx;
|
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;
|
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) {
|
if (em->internal >= 0 && em->internal < EFFECT_INTERNAL_COUNT) {
|
||||||
// must be an internal effect
|
// must be an internal effect
|
||||||
switch (em->internal) {
|
switch (em->internal) {
|
||||||
case EFFECT_INTERNAL_TRANSFORM: return new TransformEffect(c, em);
|
case EFFECT_INTERNAL_TRANSFORM: return EffectPtr(new TransformEffect(c, em));
|
||||||
case EFFECT_INTERNAL_TEXT: return new TextEffect(c, em);
|
case EFFECT_INTERNAL_TEXT: return EffectPtr(new TextEffect(c, em));
|
||||||
case EFFECT_INTERNAL_TIMECODE: return new TimecodeEffect(c, em);
|
case EFFECT_INTERNAL_TIMECODE: return EffectPtr(new TimecodeEffect(c, em));
|
||||||
case EFFECT_INTERNAL_SOLID: return new SolidEffect(c, em);
|
case EFFECT_INTERNAL_SOLID: return EffectPtr(new SolidEffect(c, em));
|
||||||
case EFFECT_INTERNAL_NOISE: return new AudioNoiseEffect(c, em);
|
case EFFECT_INTERNAL_NOISE: return EffectPtr(new AudioNoiseEffect(c, em));
|
||||||
case EFFECT_INTERNAL_VOLUME: return new VolumeEffect(c, em);
|
case EFFECT_INTERNAL_VOLUME: return EffectPtr(new VolumeEffect(c, em));
|
||||||
case EFFECT_INTERNAL_PAN: return new PanEffect(c, em);
|
case EFFECT_INTERNAL_PAN: return EffectPtr(new PanEffect(c, em));
|
||||||
case EFFECT_INTERNAL_TONE: return new ToneEffect(c, em);
|
case EFFECT_INTERNAL_TONE: return EffectPtr(new ToneEffect(c, em));
|
||||||
case EFFECT_INTERNAL_SHAKE: return new ShakeEffect(c, em);
|
case EFFECT_INTERNAL_SHAKE: return EffectPtr(new ShakeEffect(c, em));
|
||||||
case EFFECT_INTERNAL_CORNERPIN: return new CornerPinEffect(c, em);
|
case EFFECT_INTERNAL_CORNERPIN: return EffectPtr(new CornerPinEffect(c, em));
|
||||||
case EFFECT_INTERNAL_FILLLEFTRIGHT: return new FillLeftRightEffect(c, em);
|
case EFFECT_INTERNAL_FILLLEFTRIGHT: return EffectPtr(new FillLeftRightEffect(c, em));
|
||||||
#ifndef NOVST
|
#ifndef NOVST
|
||||||
case EFFECT_INTERNAL_VST: return new VSTHost(c, em);
|
case EFFECT_INTERNAL_VST: return EffectPtr(new VSTHost(c, em));
|
||||||
#endif
|
#endif
|
||||||
#ifndef NOFREI0R
|
#ifndef NOFREI0R
|
||||||
case EFFECT_INTERNAL_FREI0R: return new Frei0rEffect(c, em);
|
case EFFECT_INTERNAL_FREI0R: return EffectPtr(new Frei0rEffect(c, em));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else if (!em->filename.isEmpty()) {
|
} else if (!em->filename.isEmpty()) {
|
||||||
// load effect from file
|
// load effect from file
|
||||||
return new Effect(c, em);
|
return EffectPtr(new Effect(c, em));
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "Invalid effect data";
|
qCritical() << "Invalid effect data";
|
||||||
QMessageBox::critical(olive::MainWindow,
|
QMessageBox::critical(olive::MainWindow,
|
||||||
@@ -112,7 +112,7 @@ const EffectMeta* get_internal_meta(int internal_id, int type) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Effect::Effect(Clip* c, const EffectMeta *em) :
|
Effect::Effect(ClipPtr c, const EffectMeta *em) :
|
||||||
parent_clip(c),
|
parent_clip(c),
|
||||||
meta(em),
|
meta(em),
|
||||||
enable_shader(false),
|
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++) {
|
for (int i=0;i<rows.size();i++) {
|
||||||
EffectRow* row = rows.at(i);
|
EffectRow* row = rows.at(i);
|
||||||
EffectRow* copy_row = e->rows.at(i);
|
EffectRow* copy_row = e->rows.at(i);
|
||||||
@@ -498,7 +498,7 @@ void Effect::load_from_file() {
|
|||||||
QFile file_handle(file);
|
QFile file_handle(file);
|
||||||
if (file_handle.open(QFile::ReadOnly)) {
|
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();
|
file_handle.close();
|
||||||
|
|
||||||
@@ -515,7 +515,7 @@ void Effect::load_from_file() {
|
|||||||
int Effect::get_index_in_clip() {
|
int Effect::get_index_in_clip() {
|
||||||
if (parent_clip != nullptr) {
|
if (parent_clip != nullptr) {
|
||||||
for (int i=0;i<parent_clip->effects.size();i++) {
|
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;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -854,8 +854,8 @@ void Effect::setIterations(int i) {
|
|||||||
|
|
||||||
void Effect::process_image(double, uint8_t *, uint8_t *, int){}
|
void Effect::process_image(double, uint8_t *, uint8_t *, int){}
|
||||||
|
|
||||||
Effect* Effect::copy(Clip* c) {
|
EffectPtr Effect::copy(ClipPtr c) {
|
||||||
Effect* copy = create_effect(c, meta);
|
EffectPtr copy = create_effect(c, meta);
|
||||||
copy->set_enabled(is_enabled());
|
copy->set_enabled(is_enabled());
|
||||||
copy_field_keyframes(copy);
|
copy_field_keyframes(copy);
|
||||||
return copy;
|
return copy;
|
||||||
|
|||||||
+18
-15
@@ -30,19 +30,22 @@
|
|||||||
#include <QOpenGLTexture>
|
#include <QOpenGLTexture>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
class QLabel;
|
#include <QLabel>
|
||||||
class QWidget;
|
#include <QWidget>
|
||||||
class CollapsibleWidget;
|
#include <QGridLayout>
|
||||||
class QGridLayout;
|
#include <QPushButton>
|
||||||
class QPushButton;
|
#include <QMouseEvent>
|
||||||
class QMouseEvent;
|
#include <QXmlStreamReader>
|
||||||
|
#include <QXmlStreamWriter>
|
||||||
|
|
||||||
|
#include "ui/collapsiblewidget.h"
|
||||||
|
#include "ui/checkboxex.h"
|
||||||
|
|
||||||
class Clip;
|
class Clip;
|
||||||
class QXmlStreamReader;
|
using ClipPtr = std::shared_ptr<Clip>;
|
||||||
class QXmlStreamWriter;
|
|
||||||
class Effect;
|
class Effect;
|
||||||
class EffectRow;
|
using EffectPtr = std::shared_ptr<Effect>;
|
||||||
class CheckboxEx;
|
|
||||||
|
|
||||||
struct EffectMeta {
|
struct EffectMeta {
|
||||||
QString name;
|
QString name;
|
||||||
@@ -57,7 +60,7 @@ struct EffectMeta {
|
|||||||
extern QVector<EffectMeta> effects;
|
extern QVector<EffectMeta> effects;
|
||||||
|
|
||||||
double log_volume(double linear);
|
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);
|
const EffectMeta* get_internal_meta(int internal_id, int type);
|
||||||
|
|
||||||
enum EffectType {
|
enum EffectType {
|
||||||
@@ -166,9 +169,9 @@ qint16 mix_audio_sample(qint16 a, qint16 b);
|
|||||||
class Effect : public QObject {
|
class Effect : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Effect(Clip* c, const EffectMeta* em);
|
Effect(ClipPtr c, const EffectMeta* em);
|
||||||
~Effect();
|
~Effect();
|
||||||
Clip* parent_clip;
|
ClipPtr parent_clip;
|
||||||
const EffectMeta* meta;
|
const EffectMeta* meta;
|
||||||
int id;
|
int id;
|
||||||
QString name;
|
QString name;
|
||||||
@@ -187,8 +190,8 @@ public:
|
|||||||
|
|
||||||
virtual void refresh();
|
virtual void refresh();
|
||||||
|
|
||||||
virtual Effect* copy(Clip* c);
|
virtual EffectPtr copy(ClipPtr c);
|
||||||
void copy_field_keyframes(Effect *e);
|
void copy_field_keyframes(EffectPtr e);
|
||||||
|
|
||||||
virtual void load(QXmlStreamReader& stream);
|
virtual void load(QXmlStreamReader& stream);
|
||||||
virtual void custom_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() {
|
void EffectRow::goto_previous_key() {
|
||||||
long key = LONG_MIN;
|
long key = LONG_MIN;
|
||||||
Clip* c = parent_effect->parent_clip;
|
ClipPtr c = parent_effect->parent_clip;
|
||||||
for (int i=0;i<fieldCount();i++) {
|
for (int i=0;i<fieldCount();i++) {
|
||||||
EffectField* f = field(i);
|
EffectField* f = field(i);
|
||||||
for (int j=0;j<f->keyframes.size();j++) {
|
for (int j=0;j<f->keyframes.size();j++) {
|
||||||
@@ -132,7 +132,7 @@ void EffectRow::goto_previous_key() {
|
|||||||
void EffectRow::toggle_key() {
|
void EffectRow::toggle_key() {
|
||||||
QVector<EffectField*> key_fields;
|
QVector<EffectField*> key_fields;
|
||||||
QVector<int> key_field_index;
|
QVector<int> key_field_index;
|
||||||
Clip* c = parent_effect->parent_clip;
|
ClipPtr c = parent_effect->parent_clip;
|
||||||
for (int j=0;j<fieldCount();j++) {
|
for (int j=0;j<fieldCount();j++) {
|
||||||
EffectField* f = field(j);
|
EffectField* f = field(j);
|
||||||
for (int i=0;i<f->keyframes.size();i++) {
|
for (int i=0;i<f->keyframes.size();i++) {
|
||||||
@@ -159,7 +159,7 @@ void EffectRow::toggle_key() {
|
|||||||
|
|
||||||
void EffectRow::goto_next_key() {
|
void EffectRow::goto_next_key() {
|
||||||
long key = LONG_MAX;
|
long key = LONG_MAX;
|
||||||
Clip* c = parent_effect->parent_clip;
|
ClipPtr c = parent_effect->parent_clip;
|
||||||
for (int i=0;i<fieldCount();i++) {
|
for (int i=0;i<fieldCount();i++) {
|
||||||
EffectField* f = field(i);
|
EffectField* f = field(i);
|
||||||
for (int j=0;j<f->keyframes.size();j++) {
|
for (int j=0;j<f->keyframes.size();j++) {
|
||||||
|
|||||||
+3
-1
@@ -37,7 +37,7 @@ enum VideoInterlacingMode {
|
|||||||
VIDEO_BOTTOM_FIELD_FIRST
|
VIDEO_BOTTOM_FIELD_FIRST
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Sequence;
|
class Sequence;
|
||||||
class Clip;
|
class Clip;
|
||||||
class PreviewGenerator;
|
class PreviewGenerator;
|
||||||
class MediaThrobber;
|
class MediaThrobber;
|
||||||
@@ -101,4 +101,6 @@ struct Footage {
|
|||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using FootagePtr = std::shared_ptr<Footage>;
|
||||||
|
|
||||||
#endif // FOOTAGE_H
|
#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);
|
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
|
// 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
|
// 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
|
// add a marker action for each clip
|
||||||
foreach (int i, clips) {
|
foreach (int i, clips) {
|
||||||
Clip* c = seq->clips.at(i);
|
ClipPtr c = seq->clips.at(i);
|
||||||
ca->append(new AddMarkerAction(&c->get_markers(),
|
ca->append(new AddMarkerAction(&c->get_markers(),
|
||||||
seq->playhead - c->timeline_in + c->clip_in,
|
seq->playhead - c->timeline_in + c->clip_in,
|
||||||
marker_name));
|
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
|
// create empty clip array
|
||||||
QVector<int> clips;
|
QVector<int> clips;
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -26,7 +26,8 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
struct Sequence;
|
class Sequence;
|
||||||
|
using SequencePtr = std::shared_ptr<Sequence>;
|
||||||
|
|
||||||
struct Marker {
|
struct Marker {
|
||||||
long frame;
|
long frame;
|
||||||
@@ -35,7 +36,7 @@ struct Marker {
|
|||||||
|
|
||||||
void draw_marker(QPainter& p, int x, int y, int bottom, bool selected);
|
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(SequencePtr seq, const QVector<int>& clips);
|
||||||
void set_marker_internal(Sequence* seq);
|
void set_marker_internal(SequencePtr seq);
|
||||||
|
|
||||||
#endif // MARKER_H
|
#endif // MARKER_H
|
||||||
|
|||||||
+20
-21
@@ -68,30 +68,29 @@ Media::Media(Media* iparent) :
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
Media::~Media() {
|
Media::~Media() {
|
||||||
switch (get_type()) {
|
for (int i=0;i<children.size();i++) {
|
||||||
case MEDIA_TYPE_FOOTAGE: delete to_footage(); break;
|
delete children.at(i);
|
||||||
case MEDIA_TYPE_SEQUENCE: if (object != nullptr) delete to_sequence(); break;
|
}
|
||||||
}
|
|
||||||
delete throbber;
|
delete throbber;
|
||||||
}
|
}
|
||||||
|
|
||||||
Footage *Media::to_footage() {
|
FootagePtr Media::to_footage() {
|
||||||
return static_cast<Footage*>(object);
|
return std::static_pointer_cast<Footage>(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence *Media::to_sequence() {
|
SequencePtr Media::to_sequence() {
|
||||||
return static_cast<Sequence*>(object);
|
return std::static_pointer_cast<Sequence>(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Media::set_footage(Footage *f) {
|
void Media::set_footage(FootagePtr f) {
|
||||||
type = MEDIA_TYPE_FOOTAGE;
|
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"));
|
set_icon(QIcon(":/icons/sequence.png"));
|
||||||
type = MEDIA_TYPE_SEQUENCE;
|
type = MEDIA_TYPE_SEQUENCE;
|
||||||
object = s;
|
object = VoidPtr(s);
|
||||||
if (s != nullptr) update_tooltip();
|
if (s != nullptr) update_tooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +113,7 @@ void Media::update_tooltip(const QString& error) {
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
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";
|
tooltip = QCoreApplication::translate("Media", "Name:") + " " + f->name + "\n" + QCoreApplication::translate("Media", "Filename:") + " " + f->url + "\n";
|
||||||
|
|
||||||
if (error.isEmpty()) {
|
if (error.isEmpty()) {
|
||||||
@@ -185,7 +184,7 @@ void Media::update_tooltip(const QString& error) {
|
|||||||
break;
|
break;
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
{
|
{
|
||||||
Sequence* s = to_sequence();
|
SequencePtr s = to_sequence();
|
||||||
|
|
||||||
tooltip = QCoreApplication::translate("Media", "Name: %1"
|
tooltip = QCoreApplication::translate("Media", "Name: %1"
|
||||||
"\nVideo Dimensions: %2x%3"
|
"\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;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +232,7 @@ double Media::get_frame_rate(int stream) {
|
|||||||
switch (get_type()) {
|
switch (get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
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;
|
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;
|
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()) {
|
switch (get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
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;
|
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;
|
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:
|
case Qt::DecorationRole:
|
||||||
if (column == 0) {
|
if (column == 0) {
|
||||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
Footage* f = to_footage();
|
FootagePtr f = to_footage();
|
||||||
if (f->video_tracks.size() > 0
|
if (f->video_tracks.size() > 0
|
||||||
&& f->video_tracks.at(0).preview_done) {
|
&& f->video_tracks.at(0).preview_done) {
|
||||||
return f->video_tracks.at(0).video_preview_square;
|
return f->video_tracks.at(0).video_preview_square;
|
||||||
@@ -304,11 +303,11 @@ QVariant Media::data(int column, int role) {
|
|||||||
case 1:
|
case 1:
|
||||||
if (root) return QCoreApplication::translate("Media", "Duration");
|
if (root) return QCoreApplication::translate("Media", "Duration");
|
||||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
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);
|
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
|
||||||
}
|
}
|
||||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
Footage* f = to_footage();
|
FootagePtr f = to_footage();
|
||||||
double r = 30;
|
double r = 30;
|
||||||
|
|
||||||
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
|
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 (root) return QCoreApplication::translate("Media", "Rate");
|
||||||
if (get_type() == MEDIA_TYPE_SEQUENCE) return QString::number(get_frame_rate()) + " FPS";
|
if (get_type() == MEDIA_TYPE_SEQUENCE) return QString::number(get_frame_rate()) + " FPS";
|
||||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
Footage* f = to_footage();
|
FootagePtr f = to_footage();
|
||||||
double r;
|
double r;
|
||||||
if (f->video_tracks.size() > 0 && !qIsNull(r = get_frame_rate())) {
|
if (f->video_tracks.size() > 0 && !qIsNull(r = get_frame_rate())) {
|
||||||
return QString::number(get_frame_rate()) + " FPS";
|
return QString::number(get_frame_rate()) + " FPS";
|
||||||
|
|||||||
+13
-9
@@ -23,8 +23,10 @@
|
|||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
#include "project/marker.h"
|
#include "project/marker.h"
|
||||||
|
#include "project/footage.h"
|
||||||
|
|
||||||
enum MediaType {
|
enum MediaType {
|
||||||
MEDIA_TYPE_FOOTAGE,
|
MEDIA_TYPE_FOOTAGE,
|
||||||
@@ -32,25 +34,27 @@ enum MediaType {
|
|||||||
MEDIA_TYPE_FOLDER
|
MEDIA_TYPE_FOLDER
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Footage;
|
class Sequence;
|
||||||
|
using SequencePtr = std::shared_ptr<Sequence>;
|
||||||
|
|
||||||
|
using VoidPtr = std::shared_ptr<void>;
|
||||||
|
|
||||||
class MediaThrobber;
|
class MediaThrobber;
|
||||||
struct Sequence;
|
|
||||||
#include <QIcon>
|
|
||||||
|
|
||||||
class Media
|
class Media
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Media(Media* iparent);
|
Media(Media* iparent);
|
||||||
~Media();
|
~Media();
|
||||||
Footage *to_footage();
|
FootagePtr to_footage();
|
||||||
Sequence* to_sequence();
|
SequencePtr to_sequence();
|
||||||
void set_footage(Footage* f);
|
void set_footage(FootagePtr f);
|
||||||
void set_sequence(Sequence* s);
|
void set_sequence(SequencePtr s);
|
||||||
void set_folder();
|
void set_folder();
|
||||||
void set_icon(const QIcon &ico);
|
void set_icon(const QIcon &ico);
|
||||||
void set_parent(Media* p);
|
void set_parent(Media* p);
|
||||||
void update_tooltip(const QString& error = 0);
|
void update_tooltip(const QString& error = 0);
|
||||||
void *to_object();
|
VoidPtr to_object();
|
||||||
int get_type();
|
int get_type();
|
||||||
const QString& get_name();
|
const QString& get_name();
|
||||||
void set_name(const QString& n);
|
void set_name(const QString& n);
|
||||||
@@ -78,7 +82,7 @@ public:
|
|||||||
int temp_id2;
|
int temp_id2;
|
||||||
private:
|
private:
|
||||||
int type;
|
int type;
|
||||||
void* object;
|
VoidPtr object;
|
||||||
|
|
||||||
// item functions
|
// item functions
|
||||||
QList<Media*> children;
|
QList<Media*> children;
|
||||||
|
|||||||
@@ -99,8 +99,8 @@ QModelIndex ProjectModel::index(int row, int column, const QModelIndex &parent)
|
|||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex ProjectModel::create_index(int arow, int acolumn, void* aid) {
|
QModelIndex ProjectModel::create_index(int arow, int acolumn, void* adata) {
|
||||||
return createIndex(arow, acolumn, aid);
|
return createIndex(arow, acolumn, adata);
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex ProjectModel::parent(const QModelIndex &index) const {
|
QModelIndex ProjectModel::parent(const QModelIndex &index) const {
|
||||||
|
|||||||
+11
-11
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
class Media;
|
#include "project/media.h"
|
||||||
|
|
||||||
class ProjectModel : public QAbstractItemModel
|
class ProjectModel : public QAbstractItemModel
|
||||||
{
|
{
|
||||||
@@ -35,29 +35,29 @@ public:
|
|||||||
void make_root();
|
void make_root();
|
||||||
void destroy_root();
|
void destroy_root();
|
||||||
void clear();
|
void clear();
|
||||||
Media* get_root();
|
Media* get_root();
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation,
|
QVariant headerData(int section, Qt::Orientation orientation,
|
||||||
int role = Qt::DisplayRole) const override;
|
int role = Qt::DisplayRole) const override;
|
||||||
QModelIndex index(int row, int column,
|
QModelIndex index(int row, int column,
|
||||||
const QModelIndex &parent = QModelIndex()) const override;
|
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;
|
QModelIndex parent(const QModelIndex &index) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(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 appendChild(Media* parent, Media* child);
|
||||||
void moveChild(Media *child, Media *to);
|
void moveChild(Media* child, Media* to);
|
||||||
void removeChild(Media *parent, Media* m);
|
void removeChild(Media* parent, Media* m);
|
||||||
Media *child(int i, Media* parent = nullptr);
|
Media* child(int i, Media* parent = nullptr);
|
||||||
int childCount(Media* parent = nullptr);
|
int childCount(Media* parent = nullptr);
|
||||||
void set_icon(Media* m, const QIcon &ico);
|
void set_icon(Media* m, const QIcon &ico);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Media* root_item;
|
Media* root_item;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROJECTMODEL_H
|
#endif // PROJECTMODEL_H
|
||||||
|
|||||||
+13
-22
@@ -20,9 +20,6 @@
|
|||||||
|
|
||||||
#include "sequence.h"
|
#include "sequence.h"
|
||||||
|
|
||||||
#include "clip.h"
|
|
||||||
#include "transition.h"
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@@ -36,15 +33,10 @@ Sequence::Sequence() :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence::~Sequence() {
|
Sequence::~Sequence() {}
|
||||||
// dealloc all clips
|
|
||||||
for (int i=0;i<clips.size();i++) {
|
|
||||||
delete clips.at(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Sequence* Sequence::copy() {
|
SequencePtr Sequence::copy() {
|
||||||
Sequence* s = new Sequence();
|
SequencePtr s(new Sequence());
|
||||||
s->name = QCoreApplication::translate("Sequence", "%1 (copy)").arg(name);
|
s->name = QCoreApplication::translate("Sequence", "%1 (copy)").arg(name);
|
||||||
s->width = width;
|
s->width = width;
|
||||||
s->height = height;
|
s->height = height;
|
||||||
@@ -53,11 +45,11 @@ Sequence* Sequence::copy() {
|
|||||||
s->audio_layout = audio_layout;
|
s->audio_layout = audio_layout;
|
||||||
s->clips.resize(clips.size());
|
s->clips.resize(clips.size());
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
if (c == nullptr) {
|
if (c == nullptr) {
|
||||||
s->clips[i] = nullptr;
|
s->clips[i] = nullptr;
|
||||||
} else {
|
} else {
|
||||||
Clip* copy = c->copy(s);
|
ClipPtr copy = c->copy(s);
|
||||||
copy->linked = c->linked;
|
copy->linked = c->linked;
|
||||||
s->clips[i] = copy;
|
s->clips[i] = copy;
|
||||||
}
|
}
|
||||||
@@ -68,7 +60,7 @@ Sequence* Sequence::copy() {
|
|||||||
long Sequence::getEndFrame() {
|
long Sequence::getEndFrame() {
|
||||||
long end = 0;
|
long end = 0;
|
||||||
for (int j=0;j<clips.size();j++) {
|
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) {
|
if (c != nullptr && c->timeline_out > end) {
|
||||||
end = c->timeline_out;
|
end = c->timeline_out;
|
||||||
}
|
}
|
||||||
@@ -76,15 +68,15 @@ long Sequence::getEndFrame() {
|
|||||||
return end;
|
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;
|
int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition;
|
||||||
if (transition_index > -1) {
|
if (transition_index > -1) {
|
||||||
bool del = true;
|
bool del = true;
|
||||||
|
|
||||||
Transition* t = transitions.at(transition_index);
|
TransitionPtr t = transitions.at(transition_index);
|
||||||
if (t->secondary_clip != nullptr) {
|
if (t->secondary_clip != nullptr) {
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* comp = clips.at(i);
|
ClipPtr comp = clips.at(i);
|
||||||
if (comp != nullptr
|
if (comp != nullptr
|
||||||
&& c != comp
|
&& c != comp
|
||||||
&& (c->opening_transition == transition_index
|
&& (c->opening_transition == transition_index
|
||||||
@@ -100,9 +92,8 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (del) {
|
if (del) {
|
||||||
delete transitions.at(transition_index);
|
transitions[transition_index].reset();
|
||||||
transitions[transition_index] = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == TA_OPENING_TRANSITION) {
|
if (type == TA_OPENING_TRANSITION) {
|
||||||
@@ -117,7 +108,7 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
|||||||
int vt = 0;
|
int vt = 0;
|
||||||
int at = 0;
|
int at = 0;
|
||||||
for (int j=0;j<clips.size();j++) {
|
for (int j=0;j<clips.size();j++) {
|
||||||
Clip* c = clips.at(j);
|
ClipPtr c = clips.at(j);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if (c->track < 0 && c->track < vt) { // video clip
|
if (c->track < 0 && c->track < vt) { // video clip
|
||||||
vt = c->track;
|
vt = c->track;
|
||||||
@@ -131,4 +122,4 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static variable for the currently active sequence
|
// static variable for the currently active sequence
|
||||||
Sequence* olive::ActiveSequence = nullptr;
|
SequencePtr olive::ActiveSequence = nullptr;
|
||||||
|
|||||||
+11
-10
@@ -23,21 +23,20 @@
|
|||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
#include "project/clip.h"
|
||||||
#include "project/marker.h"
|
#include "project/marker.h"
|
||||||
|
#include "project/transition.h"
|
||||||
#include "project/selection.h"
|
#include "project/selection.h"
|
||||||
|
|
||||||
class Clip;
|
class Sequence {
|
||||||
class Transition;
|
public:
|
||||||
class Media;
|
|
||||||
|
|
||||||
struct Sequence {
|
|
||||||
Sequence();
|
Sequence();
|
||||||
~Sequence();
|
~Sequence();
|
||||||
Sequence* copy();
|
SequencePtr copy();
|
||||||
QString name;
|
QString name;
|
||||||
void getTrackLimits(int* video_tracks, int* audio_tracks);
|
void getTrackLimits(int* video_tracks, int* audio_tracks);
|
||||||
long getEndFrame();
|
long getEndFrame();
|
||||||
void hard_delete_transition(Clip *c, int type);
|
void hard_delete_transition(ClipPtr c, int type);
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
double frame_rate;
|
double frame_rate;
|
||||||
@@ -56,13 +55,15 @@ struct Sequence {
|
|||||||
int save_id;
|
int save_id;
|
||||||
|
|
||||||
QVector<Marker> markers;
|
QVector<Marker> markers;
|
||||||
QVector<Clip*> clips;
|
QVector<ClipPtr> clips;
|
||||||
QVector<Transition*> transitions;
|
QVector<TransitionPtr> transitions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using SequencePtr = std::shared_ptr<Sequence>;
|
||||||
|
|
||||||
// static variable for the currently active sequence
|
// static variable for the currently active sequence
|
||||||
namespace olive {
|
namespace olive {
|
||||||
extern Sequence* ActiveSequence;
|
extern SequencePtr ActiveSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // SEQUENCE_H
|
#endif // SEQUENCE_H
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void SourcesCommon::create_seq_from_selected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
Sequence* s = create_sequence_from_media(media_list);
|
SequencePtr s = create_sequence_from_media(media_list);
|
||||||
|
|
||||||
// add clips to it
|
// add clips to it
|
||||||
panel_timeline->create_ghosts_from_media(s, 0, media_list);
|
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() {
|
void SourcesCommon::reveal_in_browser() {
|
||||||
Media* media = project_parent->item_to_media(selected_items.at(0));
|
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)
|
#if defined(Q_OS_WIN)
|
||||||
QStringList args;
|
QStringList args;
|
||||||
@@ -385,7 +385,7 @@ void SourcesCommon::clear_proxies_from_selected() {
|
|||||||
QList<QString> delete_list;
|
QList<QString> delete_list;
|
||||||
|
|
||||||
for (int i=0;i<cached_selected_footage.size();i++) {
|
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 (f->proxy && !f->proxy_path.isEmpty()) {
|
||||||
if (QFileInfo::exists(f->proxy_path)) {
|
if (QFileInfo::exists(f->proxy_path)) {
|
||||||
|
|||||||
@@ -25,6 +25,8 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
#include "project/footage.h"
|
||||||
|
|
||||||
class Project;
|
class Project;
|
||||||
class QMouseEvent;
|
class QMouseEvent;
|
||||||
class Media;
|
class Media;
|
||||||
@@ -63,7 +65,7 @@ private:
|
|||||||
QTimer rename_timer;
|
QTimer rename_timer;
|
||||||
|
|
||||||
// we cache the selected footage items for open_create_proxy_dialog()
|
// we cache the selected footage items for open_create_proxy_dialog()
|
||||||
QVector<Footage*> cached_selected_footage;
|
QVector<FootagePtr> cached_selected_footage;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SOURCESCOMMON_H
|
#endif // SOURCESCOMMON_H
|
||||||
|
|||||||
+12
-12
@@ -41,7 +41,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QCoreApplication>
|
#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),
|
Effect(c, em), secondary_clip(s),
|
||||||
length(30)
|
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);
|
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);
|
return create_transition(c, s, meta, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,18 +80,18 @@ void Transition::set_length_from_slider() {
|
|||||||
update_ui(false);
|
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()) {
|
if (!em->filename.isEmpty()) {
|
||||||
// load effect from file
|
// 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) {
|
} else if (em->internal >= 0 && em->internal < TRANSITION_INTERNAL_COUNT) {
|
||||||
// must be an internal effect
|
// must be an internal effect
|
||||||
switch (em->internal) {
|
switch (em->internal) {
|
||||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return new CrossDissolveTransition(c, s, em);
|
case TRANSITION_INTERNAL_CROSSDISSOLVE: return TransitionPtr(new CrossDissolveTransition(c, s, em));
|
||||||
case TRANSITION_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, s, em);
|
case TRANSITION_INTERNAL_LINEARFADE: return TransitionPtr(new LinearFadeTransition(c, s, em));
|
||||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, s, em);
|
case TRANSITION_INTERNAL_EXPONENTIALFADE: return TransitionPtr(new ExponentialFadeTransition(c, s, em));
|
||||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, s, em);
|
case TRANSITION_INTERNAL_LOGARITHMICFADE: return TransitionPtr(new LogarithmicFadeTransition(c, s, em));
|
||||||
case TRANSITION_INTERNAL_CUBE: return new CubeTransition(c, s, em);
|
case TRANSITION_INTERNAL_CUBE: return TransitionPtr(new CubeTransition(c, s, em));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "Invalid transition data";
|
qCritical() << "Invalid transition data";
|
||||||
@@ -103,11 +103,11 @@ Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em, long length) {
|
int create_transition(ClipPtr c, ClipPtr s, const EffectMeta* em, long length) {
|
||||||
Transition* t = get_transition_from_meta(c, s, em);
|
TransitionPtr t(get_transition_from_meta(c, s, em));
|
||||||
if (t != nullptr) {
|
if (t != nullptr) {
|
||||||
if (length >= 0) t->set_length(length);
|
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);
|
transition_list.append(t);
|
||||||
return transition_list.size() - 1;
|
return transition_list.size() - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,14 +34,14 @@
|
|||||||
#define TRANSITION_INTERNAL_CUBE 4
|
#define TRANSITION_INTERNAL_CUBE 4
|
||||||
#define TRANSITION_INTERNAL_COUNT 5
|
#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 {
|
class Transition : public Effect {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Transition(Clip* c, Clip* s, const EffectMeta* em);
|
Transition(ClipPtr c, ClipPtr s, const EffectMeta* em);
|
||||||
int copy(Clip* c, Clip* s);
|
int copy(ClipPtr c, ClipPtr s);
|
||||||
Clip* secondary_clip;
|
ClipPtr secondary_clip;
|
||||||
void set_length(long l);
|
void set_length(long l);
|
||||||
long get_true_length();
|
long get_true_length();
|
||||||
long get_length();
|
long get_length();
|
||||||
@@ -52,4 +52,6 @@ private:
|
|||||||
EffectField* length_field;
|
EffectField* length_field;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using TransitionPtr = std::shared_ptr<Transition>;
|
||||||
|
|
||||||
#endif // TRANSITION_H
|
#endif // TRANSITION_H
|
||||||
|
|||||||
+45
-104
@@ -48,41 +48,7 @@
|
|||||||
|
|
||||||
QUndoStack olive::UndoStack;
|
QUndoStack olive::UndoStack;
|
||||||
|
|
||||||
ComboAction::ComboAction() {}
|
MoveClipAction::MoveClipAction(ClipPtr c, long iin, long iout, long iclip_in, int itrack, bool irelative) {
|
||||||
|
|
||||||
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) {
|
|
||||||
clip = c;
|
clip = c;
|
||||||
|
|
||||||
old_in = c->timeline_in;
|
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;
|
seq = s;
|
||||||
index = clip;
|
index = clip;
|
||||||
opening_transition = -1;
|
opening_transition = -1;
|
||||||
closing_transition = -1;
|
closing_transition = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteClipAction::~DeleteClipAction() {
|
DeleteClipAction::~DeleteClipAction() {}
|
||||||
if (ref != nullptr) delete ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeleteClipAction::doUndo() {
|
void DeleteClipAction::doUndo() {
|
||||||
// restore ref to clip
|
// restore ref to clip
|
||||||
@@ -187,7 +151,7 @@ void DeleteClipAction::doRedo() {
|
|||||||
linkClipIndex.clear();
|
linkClipIndex.clear();
|
||||||
linkLinkIndex.clear();
|
linkLinkIndex.clear();
|
||||||
for (int i=0;i<seq->clips.size();i++) {
|
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 != nullptr) {
|
||||||
for (int j=0;j<c->linked.size();j++) {
|
for (int j=0;j<c->linked.size();j++) {
|
||||||
if (c->linked.at(j) == index) {
|
if (c->linked.at(j) == index) {
|
||||||
@@ -200,7 +164,7 @@ void DeleteClipAction::doRedo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeSequenceAction::ChangeSequenceAction(Sequence* s) {
|
ChangeSequenceAction::ChangeSequenceAction(SequencePtr s) {
|
||||||
new_sequence = s;
|
new_sequence = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +177,7 @@ void ChangeSequenceAction::doRedo() {
|
|||||||
set_sequence(new_sequence);
|
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;
|
seq = s;
|
||||||
new_enabled = enabled;
|
new_enabled = enabled;
|
||||||
new_in = in;
|
new_in = in;
|
||||||
@@ -227,7 +191,7 @@ void SetTimelineInOutCommand::doUndo() {
|
|||||||
|
|
||||||
// footage viewer functions
|
// footage viewer functions
|
||||||
if (seq->wrapper_sequence) {
|
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->using_inout = old_enabled;
|
||||||
m->in = old_in;
|
m->in = old_in;
|
||||||
m->out = old_out;
|
m->out = old_out;
|
||||||
@@ -245,14 +209,14 @@ void SetTimelineInOutCommand::doRedo() {
|
|||||||
|
|
||||||
// footage viewer functions
|
// footage viewer functions
|
||||||
if (seq->wrapper_sequence) {
|
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->using_inout = new_enabled;
|
||||||
m->in = new_in;
|
m->in = new_in;
|
||||||
m->out = new_out;
|
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;
|
clip = c;
|
||||||
ref = e;
|
ref = e;
|
||||||
meta = m;
|
meta = m;
|
||||||
@@ -260,10 +224,6 @@ AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m, int
|
|||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddEffectCommand::~AddEffectCommand() {
|
|
||||||
if (!done && ref != nullptr) delete ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddEffectCommand::doUndo() {
|
void AddEffectCommand::doUndo() {
|
||||||
clip->effects.last()->close();
|
clip->effects.last()->close();
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
@@ -286,9 +246,9 @@ void AddEffectCommand::doRedo() {
|
|||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddTransitionCommand::AddTransitionCommand(Clip* c,
|
AddTransitionCommand::AddTransitionCommand(ClipPtr c,
|
||||||
Clip *s,
|
ClipPtr s,
|
||||||
Transition* copy,
|
TransitionPtr copy,
|
||||||
const EffectMeta *itransition,
|
const EffectMeta *itransition,
|
||||||
int itype,
|
int itype,
|
||||||
int ilength) {
|
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;
|
clip = c;
|
||||||
type = itype;
|
type = itype;
|
||||||
new_length = ilength;
|
new_length = ilength;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModifyTransitionCommand::doUndo() {
|
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);
|
t->set_length(old_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModifyTransitionCommand::doRedo() {
|
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();
|
old_length = t->get_true_length();
|
||||||
t->set_length(new_length);
|
t->set_length(new_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteTransitionCommand::DeleteTransitionCommand(Sequence* s, int transition_index) {
|
DeleteTransitionCommand::DeleteTransitionCommand(SequencePtr s, int transition_index) {
|
||||||
seq = s;
|
seq = s;
|
||||||
index = transition_index;
|
index = transition_index;
|
||||||
transition = nullptr;
|
transition = nullptr;
|
||||||
@@ -362,9 +322,7 @@ DeleteTransitionCommand::DeleteTransitionCommand(Sequence* s, int transition_ind
|
|||||||
ctc = nullptr;
|
ctc = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteTransitionCommand::~DeleteTransitionCommand() {
|
DeleteTransitionCommand::~DeleteTransitionCommand() {}
|
||||||
if (transition != nullptr) delete transition;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeleteTransitionCommand::doUndo() {
|
void DeleteTransitionCommand::doUndo() {
|
||||||
seq->transitions[index] = transition;
|
seq->transitions[index] = transition;
|
||||||
@@ -377,7 +335,7 @@ void DeleteTransitionCommand::doUndo() {
|
|||||||
|
|
||||||
void DeleteTransitionCommand::doRedo() {
|
void DeleteTransitionCommand::doRedo() {
|
||||||
for (int i=0;i<seq->clips.size();i++) {
|
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 != nullptr) {
|
||||||
if (c->opening_transition == index) {
|
if (c->opening_transition == index) {
|
||||||
otc = c;
|
otc = c;
|
||||||
@@ -466,24 +424,17 @@ void DeleteMediaCommand::doRedo() {
|
|||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddClipCommand::AddClipCommand(Sequence* s, QVector<Clip*>& add) {
|
AddClipCommand::AddClipCommand(SequencePtr s, QVector<ClipPtr>& add) {
|
||||||
seq = s;
|
seq = s;
|
||||||
clips = add;
|
clips = add;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddClipCommand::~AddClipCommand() {
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddClipCommand::doUndo() {
|
void AddClipCommand::doUndo() {
|
||||||
panel_effect_controls->clear_effects(true);
|
panel_effect_controls->clear_effects(true);
|
||||||
for (int i=0;i<clips.size();i++) {
|
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);
|
panel_timeline->deselect_area(c->timeline_in, c->timeline_out, c->track);
|
||||||
undone_clips.prepend(c);
|
undone_clips.prepend(c);
|
||||||
if (c->open) close_clip(c, true);
|
if (c->open) close_clip(c, true);
|
||||||
@@ -501,9 +452,9 @@ void AddClipCommand::doRedo() {
|
|||||||
} else {
|
} else {
|
||||||
int linkOffset = seq->clips.size();
|
int linkOffset = seq->clips.size();
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* original = clips.at(i);
|
ClipPtr original = clips.at(i);
|
||||||
if (original != nullptr) {
|
if (original != nullptr) {
|
||||||
Clip* copy = original->copy(seq);
|
ClipPtr copy = original->copy(seq);
|
||||||
copy->linked.resize(original->linked.size());
|
copy->linked.resize(original->linked.size());
|
||||||
for (int j=0;j<original->linked.size();j++) {
|
for (int j=0;j<original->linked.size();j++) {
|
||||||
copy->linked[j] = original->linked.at(j) + linkOffset;
|
copy->linked[j] = original->linked.at(j) + linkOffset;
|
||||||
@@ -524,7 +475,7 @@ LinkCommand::LinkCommand() {
|
|||||||
|
|
||||||
void LinkCommand::doUndo() {
|
void LinkCommand::doUndo() {
|
||||||
for (int i=0;i<clips.size();i++) {
|
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) {
|
if (link) {
|
||||||
c->linked.clear();
|
c->linked.clear();
|
||||||
} else {
|
} else {
|
||||||
@@ -538,7 +489,7 @@ void LinkCommand::doRedo() {
|
|||||||
old_links.clear();
|
old_links.clear();
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
dout << clips.at(i);
|
dout << clips.at(i);
|
||||||
Clip* c = s->clips.at(clips.at(i));
|
ClipPtr c = s->clips.at(clips.at(i));
|
||||||
if (link) {
|
if (link) {
|
||||||
for (int j=0;j<clips.size();j++) {
|
for (int j=0;j<clips.size();j++) {
|
||||||
if (i != j) {
|
if (i != j) {
|
||||||
@@ -580,11 +531,11 @@ ReplaceMediaCommand::ReplaceMediaCommand(Media* i, QString s) {
|
|||||||
|
|
||||||
void ReplaceMediaCommand::replace(QString& filename) {
|
void ReplaceMediaCommand::replace(QString& filename) {
|
||||||
// close any clips currently using this media
|
// 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++) {
|
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++) {
|
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) {
|
if (c != nullptr && c->media == item && c->open) {
|
||||||
close_clip(c, true);
|
close_clip(c, true);
|
||||||
c->replaced = true;
|
c->replaced = true;
|
||||||
@@ -621,7 +572,7 @@ void ReplaceClipMediaCommand::replace(bool undo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0;i<clips.size();i++) {
|
for (int i=0;i<clips.size();i++) {
|
||||||
Clip* c = clips.at(i);
|
ClipPtr c = clips.at(i);
|
||||||
if (c->open) {
|
if (c->open) {
|
||||||
close_clip(c, true);
|
close_clip(c, true);
|
||||||
}
|
}
|
||||||
@@ -660,17 +611,11 @@ EffectDeleteCommand::EffectDeleteCommand() {
|
|||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectDeleteCommand::~EffectDeleteCommand() {
|
EffectDeleteCommand::~EffectDeleteCommand() {}
|
||||||
if (done) {
|
|
||||||
for (int i=0;i<deleted_objects.size();i++) {
|
|
||||||
delete deleted_objects.at(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EffectDeleteCommand::doUndo() {
|
void EffectDeleteCommand::doUndo() {
|
||||||
for (int i=0;i<clips.size();i++) {
|
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));
|
c->effects.insert(fx.at(i), deleted_objects.at(i));
|
||||||
}
|
}
|
||||||
panel_effect_controls->reload_clips();
|
panel_effect_controls->reload_clips();
|
||||||
@@ -681,9 +626,9 @@ void EffectDeleteCommand::doUndo() {
|
|||||||
void EffectDeleteCommand::doRedo() {
|
void EffectDeleteCommand::doRedo() {
|
||||||
deleted_objects.clear();
|
deleted_objects.clear();
|
||||||
for (int i=0;i<clips.size();i++) {
|
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;
|
int fx_id = fx.at(i) - i;
|
||||||
Effect* e = c->effects.at(fx_id);
|
EffectPtr e = c->effects.at(fx_id);
|
||||||
e->close();
|
e->close();
|
||||||
deleted_objects.append(e);
|
deleted_objects.append(e);
|
||||||
c->effects.removeAt(fx_id);
|
c->effects.removeAt(fx_id);
|
||||||
@@ -705,7 +650,7 @@ void MediaMove::doRedo() {
|
|||||||
if (to == nullptr) to = project_model.get_root();
|
if (to == nullptr) to = project_model.get_root();
|
||||||
froms.resize(items.size());
|
froms.resize(items.size());
|
||||||
for (int i=0;i<items.size();i++) {
|
for (int i=0;i<items.size();i++) {
|
||||||
Media* parent = items.at(i)->parentItem();
|
Media* parent = items.at(i)->parentItem();
|
||||||
froms[i] = parent;
|
froms[i] = parent;
|
||||||
project_model.moveChild(items.at(i), to);
|
project_model.moveChild(items.at(i), to);
|
||||||
}
|
}
|
||||||
@@ -855,7 +800,7 @@ void DeleteMarkerAction::doRedo() {
|
|||||||
sorted = true;
|
sorted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSpeedAction::SetSpeedAction(Clip* c, double speed) {
|
SetSpeedAction::SetSpeedAction(ClipPtr c, double speed) {
|
||||||
clip = c;
|
clip = c;
|
||||||
old_speed = c->speed;
|
old_speed = c->speed;
|
||||||
new_speed = speed;
|
new_speed = speed;
|
||||||
@@ -886,7 +831,7 @@ void SetBool::doRedo() {
|
|||||||
*boolean = new_setting;
|
*boolean = new_setting;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSelectionsCommand::SetSelectionsCommand(Sequence* s) {
|
SetSelectionsCommand::SetSelectionsCommand(SequencePtr s) {
|
||||||
seq = s;
|
seq = s;
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
@@ -903,7 +848,7 @@ void SetSelectionsCommand::doRedo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EditSequenceCommand::EditSequenceCommand(Media* i, Sequence *s) {
|
EditSequenceCommand::EditSequenceCommand(Media* i, SequencePtr s) {
|
||||||
item = i;
|
item = i;
|
||||||
seq = s;
|
seq = s;
|
||||||
old_name = s->name;
|
old_name = s->name;
|
||||||
@@ -1013,11 +958,7 @@ RemoveClipsFromClipboard::RemoveClipsFromClipboard(int index) {
|
|||||||
done = false;
|
done = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveClipsFromClipboard::~RemoveClipsFromClipboard() {
|
RemoveClipsFromClipboard::~RemoveClipsFromClipboard() {}
|
||||||
if (done) {
|
|
||||||
delete clip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RemoveClipsFromClipboard::doUndo() {
|
void RemoveClipsFromClipboard::doUndo() {
|
||||||
clipboard.insert(pos, clip);
|
clipboard.insert(pos, clip);
|
||||||
@@ -1025,7 +966,7 @@ void RemoveClipsFromClipboard::doUndo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RemoveClipsFromClipboard::doRedo() {
|
void RemoveClipsFromClipboard::doRedo() {
|
||||||
clip = static_cast<Clip*>(clipboard.at(pos));
|
clip = std::static_pointer_cast<Clip>(clipboard.at(pos));
|
||||||
clipboard.removeAt(pos);
|
clipboard.removeAt(pos);
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
@@ -1068,7 +1009,7 @@ void ReloadEffectsCommand::doRedo() {
|
|||||||
panel_effect_controls->reload_clips();
|
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;
|
s = is;
|
||||||
point = ipoint;
|
point = ipoint;
|
||||||
length = ilength;
|
length = ilength;
|
||||||
@@ -1084,7 +1025,7 @@ void RippleAction::doRedo() {
|
|||||||
ca = new ComboAction();
|
ca = new ComboAction();
|
||||||
for (int i=0;i<s->clips.size();i++) {
|
for (int i=0;i<s->clips.size();i++) {
|
||||||
if (!ignore.contains(i)) {
|
if (!ignore.contains(i)) {
|
||||||
Clip* c = s->clips.at(i);
|
ClipPtr c = s->clips.at(i);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
if (c->timeline_in >= point) {
|
if (c->timeline_in >= point) {
|
||||||
move_clip(ca, c, length, length, 0, 0, true, true);
|
move_clip(ca, c, length, length, 0, 0, true, true);
|
||||||
@@ -1182,11 +1123,11 @@ void RefreshClips::doUndo() {
|
|||||||
|
|
||||||
void RefreshClips::doRedo() {
|
void RefreshClips::doRedo() {
|
||||||
// close any clips currently using this media
|
// 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++) {
|
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++) {
|
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) {
|
if (c != nullptr && c->media == media) {
|
||||||
c->replaced = true;
|
c->replaced = true;
|
||||||
c->refresh();
|
c->refresh();
|
||||||
@@ -1203,7 +1144,7 @@ void UpdateViewer::doRedo() {
|
|||||||
panel_sequence_viewer->viewer_widget->frame_update();
|
panel_sequence_viewer->viewer_widget->frame_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetEffectData::SetEffectData(Effect *e, const QByteArray &s) {
|
SetEffectData::SetEffectData(EffectPtr e, const QByteArray &s) {
|
||||||
effect = e;
|
effect = e;
|
||||||
data = s;
|
data = s;
|
||||||
}
|
}
|
||||||
|
|||||||
+70
-94
@@ -21,24 +21,14 @@
|
|||||||
#ifndef UNDO_H
|
#ifndef UNDO_H
|
||||||
#define UNDO_H
|
#define UNDO_H
|
||||||
|
|
||||||
class Media;
|
#include "project/projectelements.h"
|
||||||
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/selection.h"
|
#include "project/selection.h"
|
||||||
#include "project/effectfield.h"
|
#include "project/effectfield.h"
|
||||||
|
|
||||||
|
#include "ui/labelslider.h"
|
||||||
|
#include "ui/sourcetable.h"
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
#include <QUndoCommand>
|
#include <QUndoCommand>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
@@ -49,19 +39,6 @@ namespace olive {
|
|||||||
extern QUndoStack UndoStack;
|
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 {
|
class OliveAction : public QUndoCommand {
|
||||||
public:
|
public:
|
||||||
OliveAction(bool iset_window_modified = true);
|
OliveAction(bool iset_window_modified = true);
|
||||||
@@ -86,11 +63,11 @@ private:
|
|||||||
|
|
||||||
class MoveClipAction : public OliveAction {
|
class MoveClipAction : public OliveAction {
|
||||||
public:
|
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 doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Clip* clip;
|
ClipPtr clip;
|
||||||
|
|
||||||
long old_in;
|
long old_in;
|
||||||
long old_out;
|
long old_out;
|
||||||
@@ -107,11 +84,11 @@ private:
|
|||||||
|
|
||||||
class RippleAction : public OliveAction {
|
class RippleAction : public OliveAction {
|
||||||
public:
|
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 doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Sequence *s;
|
SequencePtr s;
|
||||||
long point;
|
long point;
|
||||||
long length;
|
long length;
|
||||||
QVector<int> ignore;
|
QVector<int> ignore;
|
||||||
@@ -120,13 +97,13 @@ private:
|
|||||||
|
|
||||||
class DeleteClipAction : public OliveAction {
|
class DeleteClipAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
DeleteClipAction(Sequence* s, int clip);
|
DeleteClipAction(SequencePtr s, int clip);
|
||||||
virtual ~DeleteClipAction() override;
|
virtual ~DeleteClipAction() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
Clip* ref;
|
ClipPtr ref;
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
int opening_transition;
|
int opening_transition;
|
||||||
@@ -138,37 +115,36 @@ private:
|
|||||||
|
|
||||||
class ChangeSequenceAction : public OliveAction {
|
class ChangeSequenceAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
ChangeSequenceAction(Sequence* s);
|
ChangeSequenceAction(SequencePtr s);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Sequence* old_sequence;
|
SequencePtr old_sequence;
|
||||||
Sequence* new_sequence;
|
SequencePtr new_sequence;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddEffectCommand : public OliveAction {
|
class AddEffectCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
AddEffectCommand(Clip* c, Effect *e, const EffectMeta* m, int insert_pos = -1);
|
AddEffectCommand(ClipPtr c, EffectPtr e, const EffectMeta* m, int insert_pos = -1);
|
||||||
virtual ~AddEffectCommand() override;
|
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Clip* clip;
|
ClipPtr clip;
|
||||||
const EffectMeta* meta;
|
const EffectMeta* meta;
|
||||||
Effect* ref;
|
EffectPtr ref;
|
||||||
int pos;
|
int pos;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddTransitionCommand : public OliveAction {
|
class AddTransitionCommand : public OliveAction {
|
||||||
public:
|
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 doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Clip* clip;
|
ClipPtr clip;
|
||||||
Clip* secondary;
|
ClipPtr secondary;
|
||||||
Transition* transition_to_copy;
|
TransitionPtr transition_to_copy;
|
||||||
const EffectMeta* transition;
|
const EffectMeta* transition;
|
||||||
int type;
|
int type;
|
||||||
int length;
|
int length;
|
||||||
@@ -178,11 +154,11 @@ private:
|
|||||||
|
|
||||||
class ModifyTransitionCommand : public OliveAction {
|
class ModifyTransitionCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
ModifyTransitionCommand(Clip* c, int itype, long ilength);
|
ModifyTransitionCommand(ClipPtr c, int itype, long ilength);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Clip* clip;
|
ClipPtr clip;
|
||||||
int type;
|
int type;
|
||||||
long new_length;
|
long new_length;
|
||||||
long old_length;
|
long old_length;
|
||||||
@@ -190,25 +166,25 @@ private:
|
|||||||
|
|
||||||
class DeleteTransitionCommand : public OliveAction {
|
class DeleteTransitionCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
DeleteTransitionCommand(Sequence* s, int transition_index);
|
DeleteTransitionCommand(SequencePtr s, int transition_index);
|
||||||
virtual ~DeleteTransitionCommand() override;
|
virtual ~DeleteTransitionCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
int index;
|
int index;
|
||||||
Transition* transition;
|
TransitionPtr transition;
|
||||||
Clip* otc;
|
ClipPtr otc;
|
||||||
Clip* ctc;
|
ClipPtr ctc;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetTimelineInOutCommand : public OliveAction {
|
class SetTimelineInOutCommand : public OliveAction {
|
||||||
public:
|
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 doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
|
|
||||||
bool old_enabled;
|
bool old_enabled;
|
||||||
long old_in;
|
long old_in;
|
||||||
@@ -221,25 +197,25 @@ private:
|
|||||||
|
|
||||||
class NewSequenceCommand : public OliveAction {
|
class NewSequenceCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
NewSequenceCommand(Media *s, Media* iparent);
|
NewSequenceCommand(Media* s, Media* iparent);
|
||||||
virtual ~NewSequenceCommand() override;
|
virtual ~NewSequenceCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* seq;
|
Media* seq;
|
||||||
Media* parent;
|
Media* parent;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddMediaCommand : public OliveAction {
|
class AddMediaCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
AddMediaCommand(Media* iitem, Media* iparent);
|
AddMediaCommand(Media* iitem, Media* iparent);
|
||||||
virtual ~AddMediaCommand() override;
|
virtual ~AddMediaCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
Media* parent;
|
Media* parent;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -250,21 +226,21 @@ public:
|
|||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
Media* parent;
|
Media* parent;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddClipCommand : public OliveAction {
|
class AddClipCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
AddClipCommand(Sequence* s, QVector<Clip*>& add);
|
AddClipCommand(SequencePtr s, QVector<ClipPtr>& add);
|
||||||
virtual ~AddClipCommand() override;
|
virtual ~AddClipCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
QVector<Clip*> clips;
|
QVector<ClipPtr> clips;
|
||||||
QVector<Clip*> undone_clips;
|
QVector<ClipPtr> undone_clips;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LinkCommand : public OliveAction {
|
class LinkCommand : public OliveAction {
|
||||||
@@ -272,7 +248,7 @@ public:
|
|||||||
LinkCommand();
|
LinkCommand();
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
Sequence* s;
|
SequencePtr s;
|
||||||
QVector<int> clips;
|
QVector<int> clips;
|
||||||
bool link;
|
bool link;
|
||||||
private:
|
private:
|
||||||
@@ -293,7 +269,7 @@ private:
|
|||||||
|
|
||||||
class ReplaceMediaCommand : public OliveAction {
|
class ReplaceMediaCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
ReplaceMediaCommand(Media*, QString);
|
ReplaceMediaCommand(Media*, QString);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
@@ -308,10 +284,10 @@ public:
|
|||||||
ReplaceClipMediaCommand(Media *, Media *, bool);
|
ReplaceClipMediaCommand(Media *, Media *, bool);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<Clip*> clips;
|
QVector<ClipPtr> clips;
|
||||||
private:
|
private:
|
||||||
Media* old_media;
|
Media* old_media;
|
||||||
Media* new_media;
|
Media* new_media;
|
||||||
bool preserve_clip_ins;
|
bool preserve_clip_ins;
|
||||||
QVector<int> old_clip_ins;
|
QVector<int> old_clip_ins;
|
||||||
void replace(bool undo);
|
void replace(bool undo);
|
||||||
@@ -323,18 +299,18 @@ public:
|
|||||||
virtual ~EffectDeleteCommand() override;
|
virtual ~EffectDeleteCommand() override;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<Clip*> clips;
|
QVector<ClipPtr> clips;
|
||||||
QVector<int> fx;
|
QVector<int> fx;
|
||||||
private:
|
private:
|
||||||
bool done;
|
bool done;
|
||||||
QVector<Effect*> deleted_objects;
|
QVector<EffectPtr> deleted_objects;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MediaMove : public OliveAction {
|
class MediaMove : public OliveAction {
|
||||||
public:
|
public:
|
||||||
MediaMove();
|
MediaMove();
|
||||||
QVector<Media*> items;
|
QVector<Media*> items;
|
||||||
Media* to;
|
Media* to;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
@@ -343,11 +319,11 @@ private:
|
|||||||
|
|
||||||
class MediaRename : public OliveAction {
|
class MediaRename : public OliveAction {
|
||||||
public:
|
public:
|
||||||
MediaRename(Media* iitem, QString to);
|
MediaRename(Media* iitem, QString to);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
QString from;
|
QString from;
|
||||||
QString to;
|
QString to;
|
||||||
};
|
};
|
||||||
@@ -395,7 +371,7 @@ public:
|
|||||||
SetAutoscaleAction();
|
SetAutoscaleAction();
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<Clip*> clips;
|
QVector<ClipPtr> clips;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddMarkerAction : public OliveAction {
|
class AddMarkerAction : public OliveAction {
|
||||||
@@ -436,11 +412,11 @@ private:
|
|||||||
|
|
||||||
class SetSpeedAction : public OliveAction {
|
class SetSpeedAction : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetSpeedAction(Clip* c, double speed);
|
SetSpeedAction(ClipPtr c, double speed);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Clip* clip;
|
ClipPtr clip;
|
||||||
double old_speed;
|
double old_speed;
|
||||||
double new_speed;
|
double new_speed;
|
||||||
};
|
};
|
||||||
@@ -458,19 +434,19 @@ private:
|
|||||||
|
|
||||||
class SetSelectionsCommand : public OliveAction {
|
class SetSelectionsCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetSelectionsCommand(Sequence *s);
|
SetSelectionsCommand(SequencePtr s);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
QVector<Selection> old_data;
|
QVector<Selection> old_data;
|
||||||
QVector<Selection> new_data;
|
QVector<Selection> new_data;
|
||||||
private:
|
private:
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditSequenceCommand : public OliveAction {
|
class EditSequenceCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
EditSequenceCommand(Media *i, Sequence* s);
|
EditSequenceCommand(Media *i, SequencePtr s);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
void update();
|
void update();
|
||||||
@@ -482,8 +458,8 @@ public:
|
|||||||
int audio_frequency;
|
int audio_frequency;
|
||||||
int audio_layout;
|
int audio_layout;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
|
|
||||||
QString old_name;
|
QString old_name;
|
||||||
int old_width;
|
int old_width;
|
||||||
@@ -545,11 +521,11 @@ public:
|
|||||||
|
|
||||||
class UpdateFootageTooltip : public OliveAction {
|
class UpdateFootageTooltip : public OliveAction {
|
||||||
public:
|
public:
|
||||||
UpdateFootageTooltip(Media* i);
|
UpdateFootageTooltip(Media* i);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* item;
|
Media* item;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MoveEffectCommand : public OliveAction {
|
class MoveEffectCommand : public OliveAction {
|
||||||
@@ -557,7 +533,7 @@ public:
|
|||||||
MoveEffectCommand();
|
MoveEffectCommand();
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
Clip* clip;
|
ClipPtr clip;
|
||||||
int from;
|
int from;
|
||||||
int to;
|
int to;
|
||||||
};
|
};
|
||||||
@@ -570,14 +546,14 @@ public:
|
|||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
int pos;
|
int pos;
|
||||||
Clip* clip;
|
ClipPtr clip;
|
||||||
bool done;
|
bool done;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenameClipCommand : public OliveAction {
|
class RenameClipCommand : public OliveAction {
|
||||||
public:
|
public:
|
||||||
RenameClipCommand();
|
RenameClipCommand();
|
||||||
QVector<Clip*> clips;
|
QVector<ClipPtr> clips;
|
||||||
QString new_name;
|
QString new_name;
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
@@ -626,11 +602,11 @@ private:
|
|||||||
|
|
||||||
class RefreshClips : public OliveAction {
|
class RefreshClips : public OliveAction {
|
||||||
public:
|
public:
|
||||||
RefreshClips(Media* m);
|
RefreshClips(Media* m);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Media* media;
|
Media* media;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UpdateViewer : public OliveAction {
|
class UpdateViewer : public OliveAction {
|
||||||
@@ -641,11 +617,11 @@ public:
|
|||||||
|
|
||||||
class SetEffectData : public OliveAction {
|
class SetEffectData : public OliveAction {
|
||||||
public:
|
public:
|
||||||
SetEffectData(Effect* e, const QByteArray &s);
|
SetEffectData(EffectPtr e, const QByteArray &s);
|
||||||
virtual void doUndo() override;
|
virtual void doUndo() override;
|
||||||
virtual void doRedo() override;
|
virtual void doRedo() override;
|
||||||
private:
|
private:
|
||||||
Effect* effect;
|
EffectPtr effect;
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
QByteArray old_data;
|
QByteArray old_data;
|
||||||
};
|
};
|
||||||
|
|||||||
+4
-4
@@ -106,15 +106,15 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
|||||||
visible_out = 0;
|
visible_out = 0;
|
||||||
|
|
||||||
for (int j=0;j<panel_effect_controls->selected_clips.size();j++) {
|
for (int j=0;j<panel_effect_controls->selected_clips.size();j++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(panel_effect_controls->selected_clips.at(j));
|
ClipPtr c = olive::ActiveSequence->clips.at(panel_effect_controls->selected_clips.at(j));
|
||||||
visible_in = qMin(visible_in, c->timeline_in);
|
visible_in = qMin(visible_in, c->timeline_in);
|
||||||
visible_out = qMax(visible_out, c->timeline_out);
|
visible_out = qMax(visible_out, c->timeline_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j=0;j<panel_effect_controls->selected_clips.size();j++) {
|
for (int j=0;j<panel_effect_controls->selected_clips.size();j++) {
|
||||||
Clip* c = olive::ActiveSequence->clips.at(panel_effect_controls->selected_clips.at(j));
|
ClipPtr c = olive::ActiveSequence->clips.at(panel_effect_controls->selected_clips.at(j));
|
||||||
for (int i=0;i<c->effects.size();i++) {
|
for (int i=0;i<c->effects.size();i++) {
|
||||||
Effect* e = c->effects.at(i);
|
EffectPtr e = c->effects.at(i);
|
||||||
if (e->container->is_expanded()) {
|
if (e->container->is_expanded()) {
|
||||||
for (int j=0;j<e->row_count();j++) {
|
for (int j=0;j<e->row_count();j++) {
|
||||||
EffectRow* row = e->row(j);
|
EffectRow* row = e->row(j);
|
||||||
@@ -373,7 +373,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
|||||||
if (panel_timeline->snapping) {
|
if (panel_timeline->snapping) {
|
||||||
for (int i=0;i<selected_keyframes.size();i++) {
|
for (int i=0;i<selected_keyframes.size();i++) {
|
||||||
EffectField* field = selected_fields.at(i);
|
EffectField* field = selected_fields.at(i);
|
||||||
Clip* c = field->parent_row->parent_effect->parent_clip;
|
ClipPtr c = field->parent_row->parent_effect->parent_clip;
|
||||||
long key_time = old_key_vals.at(i) + frame_diff - c->clip_in + c->timeline_in;
|
long key_time = old_key_vals.at(i) + frame_diff - c->clip_in + c->timeline_in;
|
||||||
long key_eval = key_time;
|
long key_eval = key_time;
|
||||||
if (panel_timeline->snap_to_point(olive::ActiveSequence->playhead, &key_eval)) {
|
if (panel_timeline->snap_to_point(olive::ActiveSequence->playhead, &key_eval)) {
|
||||||
|
|||||||
+12
-12
@@ -100,8 +100,8 @@ GLuint draw_clip(QOpenGLFramebufferObject* fbo, GLuint texture, bool clear) {
|
|||||||
return fbo->texture();
|
return fbo->texture();
|
||||||
}
|
}
|
||||||
|
|
||||||
void process_effect(Clip* c,
|
void process_effect(ClipPtr c,
|
||||||
Effect* e,
|
EffectPtr e,
|
||||||
double timecode,
|
double timecode,
|
||||||
GLTextureCoords& coords,
|
GLTextureCoords& coords,
|
||||||
GLuint& composite_texture,
|
GLuint& composite_texture,
|
||||||
@@ -151,7 +151,7 @@ void process_effect(Clip* c,
|
|||||||
GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||||
GLuint final_fbo = params.main_buffer;
|
GLuint final_fbo = params.main_buffer;
|
||||||
|
|
||||||
Sequence* s = params.seq;
|
SequencePtr s = params.seq;
|
||||||
long playhead = s->playhead;
|
long playhead = s->playhead;
|
||||||
|
|
||||||
if (!params.nests.isEmpty()) {
|
if (!params.nests.isEmpty()) {
|
||||||
@@ -170,12 +170,12 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
|
|
||||||
int audio_track_count = 0;
|
int audio_track_count = 0;
|
||||||
|
|
||||||
QVector<Clip*> current_clips;
|
QVector<ClipPtr> current_clips;
|
||||||
|
|
||||||
// loop through clips, find currently active, and sort by track
|
// loop through clips, find currently active, and sort by track
|
||||||
for (int i=0;i<s->clips.size();i++) {
|
for (int i=0;i<s->clips.size();i++) {
|
||||||
|
|
||||||
Clip* c = s->clips.at(i);
|
ClipPtr c = s->clips.at(i);
|
||||||
|
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
|
|
||||||
// is the clip a "footage" clip?
|
// is the clip a "footage" clip?
|
||||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||||
Footage* m = c->media->to_footage();
|
FootagePtr m = c->media->to_footage();
|
||||||
|
|
||||||
// does the clip have a valid media source?
|
// does the clip have a valid media source?
|
||||||
if (!m->invalid && !(c->track >= 0 && !is_audio_device_set())) {
|
if (!m->invalid && !(c->track >= 0 && !is_audio_device_set())) {
|
||||||
@@ -273,7 +273,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
|
|
||||||
// loop through current clips
|
// loop through current clips
|
||||||
for (int i=0;i<current_clips.size();i++) {
|
for (int i=0;i<current_clips.size();i++) {
|
||||||
Clip* c = current_clips.at(i);
|
ClipPtr c = current_clips.at(i);
|
||||||
|
|
||||||
// check if this clip was successfully opened by earlier function
|
// check if this clip was successfully opened by earlier function
|
||||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE && !c->finished_opening) {
|
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE && !c->finished_opening) {
|
||||||
@@ -395,12 +395,12 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
double timecode = get_timecode(c, playhead);
|
double timecode = get_timecode(c, playhead);
|
||||||
|
|
||||||
// set up variables for gizmos later
|
// set up variables for gizmos later
|
||||||
Effect* first_gizmo_effect = nullptr;
|
EffectPtr first_gizmo_effect = nullptr;
|
||||||
Effect* selected_effect = nullptr;
|
EffectPtr selected_effect = nullptr;
|
||||||
|
|
||||||
// run through all of the clip's effects
|
// run through all of the clip's effects
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
Effect* e = c->effects.at(j);
|
EffectPtr e = c->effects.at(j);
|
||||||
process_effect(c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, TA_NO_TRANSITION);
|
process_effect(c, e, timecode, coords, textureID, fbo_switcher, params.texture_failed, TA_NO_TRANSITION);
|
||||||
|
|
||||||
// retrieve gizmo data from effect
|
// retrieve gizmo data from effect
|
||||||
@@ -601,7 +601,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
if (c->sequence == params.seq) { // only if you can currently see them
|
if (c->sequence == params.seq) { // only if you can currently see them
|
||||||
double ts = (playhead - c->get_timeline_in_with_transition() + c->get_clip_in_with_transition())/s->frame_rate;
|
double ts = (playhead - c->get_timeline_in_with_transition() + c->get_clip_in_with_transition())/s->frame_rate;
|
||||||
for (int i=0;i<c->effects.size();i++) {
|
for (int i=0;i<c->effects.size();i++) {
|
||||||
Effect* e = c->effects.at(i);
|
EffectPtr e = c->effects.at(i);
|
||||||
for (int j=0;j<e->row_count();j++) {
|
for (int j=0;j<e->row_count();j++) {
|
||||||
EffectRow* r = e->row(j);
|
EffectRow* r = e->row(j);
|
||||||
for (int k=0;k<r->fieldCount();k++) {
|
for (int k=0;k<r->fieldCount();k++) {
|
||||||
@@ -630,7 +630,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void compose_audio(Viewer* viewer, Sequence* seq, int playback_speed) {
|
void compose_audio(Viewer* viewer, SequencePtr seq, int playback_speed) {
|
||||||
ComposeSequenceParams params;
|
ComposeSequenceParams params;
|
||||||
params.viewer = viewer;
|
params.viewer = viewer;
|
||||||
params.ctx = nullptr;
|
params.ctx = nullptr;
|
||||||
|
|||||||
@@ -23,12 +23,12 @@
|
|||||||
|
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QOpenGLShaderProgram>
|
||||||
|
|
||||||
class Effect;
|
#include "project/sequence.h"
|
||||||
class Viewer;
|
#include "project/effect.h"
|
||||||
class QOpenGLShaderProgram;
|
|
||||||
struct Sequence;
|
#include "panels/viewer.h"
|
||||||
class Clip;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The ComposeSequenceParams struct
|
* @brief The ComposeSequenceParams struct
|
||||||
@@ -59,7 +59,7 @@ struct ComposeSequenceParams {
|
|||||||
* In addition to clips, sequences also contain the playhead position so compose_sequence() knows which frame
|
* In addition to clips, sequences also contain the playhead position so compose_sequence() knows which frame
|
||||||
* to render.
|
* to render.
|
||||||
*/
|
*/
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Array to store the nested sequence hierarchy
|
* @brief Array to store the nested sequence hierarchy
|
||||||
@@ -67,7 +67,7 @@ struct ComposeSequenceParams {
|
|||||||
* Should be left empty. This array gets passed around compose_sequence() as it calls itself recursively to
|
* Should be left empty. This array gets passed around compose_sequence() as it calls itself recursively to
|
||||||
* handle nested sequences.
|
* handle nested sequences.
|
||||||
*/
|
*/
|
||||||
QVector<Clip*> nests;
|
QVector<ClipPtr> nests;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set compose mode to video or audio
|
* @brief Set compose mode to video or audio
|
||||||
@@ -82,7 +82,7 @@ struct ComposeSequenceParams {
|
|||||||
* A pointer to a pointer that will be set to the Effect whose gizmos are being rendered and should therefore
|
* A pointer to a pointer that will be set to the Effect whose gizmos are being rendered and should therefore
|
||||||
* be interacted with if the user uses them.
|
* be interacted with if the user uses them.
|
||||||
*/
|
*/
|
||||||
Effect** gizmos;
|
EffectPtr* gizmos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A variable that compose_sequence() will set to **TRUE** if any of the clips couldn't be shown.
|
* @brief A variable that compose_sequence() will set to **TRUE** if any of the clips couldn't be shown.
|
||||||
@@ -260,6 +260,6 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms);
|
|||||||
*
|
*
|
||||||
* The current playback speed (controlled by Shuttle Left/Right)
|
* The current playback speed (controlled by Shuttle Left/Right)
|
||||||
*/
|
*/
|
||||||
void compose_audio(Viewer* viewer, Sequence* seq, int playback_speed);
|
void compose_audio(Viewer* viewer, SequencePtr seq, int playback_speed);
|
||||||
|
|
||||||
#endif // RENDERFUNCTIONS_H
|
#endif // RENDERFUNCTIONS_H
|
||||||
|
|||||||
+1
-1
@@ -235,7 +235,7 @@ void RenderThread::paint() {
|
|||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QString& save, GLvoid* pixels, int pixel_linesize, int idivider) {
|
void RenderThread::start_render(QOpenGLContext *share, SequencePtr s, const QString& save, GLvoid* pixels, int pixel_linesize, int idivider) {
|
||||||
Q_UNUSED(idivider);
|
Q_UNUSED(idivider);
|
||||||
|
|
||||||
seq = s;
|
seq = s;
|
||||||
|
|||||||
+8
-8
@@ -29,14 +29,14 @@
|
|||||||
#include <QOpenGLFramebufferObject>
|
#include <QOpenGLFramebufferObject>
|
||||||
#include <QOpenGLShaderProgram>
|
#include <QOpenGLShaderProgram>
|
||||||
|
|
||||||
|
#include "project/sequence.h"
|
||||||
|
#include "project/effect.h"
|
||||||
|
|
||||||
// copied from source code to OCIODisplay
|
// copied from source code to OCIODisplay
|
||||||
#define LUT3D_EDGE_SIZE 32
|
const int LUT3D_EDGE_SIZE = 32;
|
||||||
|
|
||||||
// copied from source code to OCIODisplay, expanded from 3*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE
|
// copied from source code to OCIODisplay, expanded from 3*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE
|
||||||
#define NUM_3D_ENTRIES 98304
|
const int NUM_3D_ENTRIES = 98304;
|
||||||
|
|
||||||
struct Sequence;
|
|
||||||
class Effect;
|
|
||||||
|
|
||||||
class RenderThread : public QThread {
|
class RenderThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -47,9 +47,9 @@ public:
|
|||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
GLuint front_buffer;
|
GLuint front_buffer;
|
||||||
GLuint front_texture;
|
GLuint front_texture;
|
||||||
Effect* gizmos;
|
EffectPtr gizmos;
|
||||||
void paint();
|
void paint();
|
||||||
void start_render(QOpenGLContext* share, Sequence* s, const QString &save = nullptr, GLvoid *pixels = nullptr, int pixel_linesize = 0, int idivider = 0);
|
void start_render(QOpenGLContext* share, SequencePtr s, const QString &save = nullptr, GLvoid *pixels = nullptr, int pixel_linesize = 0, int idivider = 0);
|
||||||
bool did_texture_fail();
|
bool did_texture_fail();
|
||||||
void cancel();
|
void cancel();
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
|
|
||||||
float ocio_lut_data[NUM_3D_ENTRIES];
|
float ocio_lut_data[NUM_3D_ENTRIES];
|
||||||
|
|
||||||
Sequence* seq;
|
SequencePtr seq;
|
||||||
int divider;
|
int divider;
|
||||||
int tex_width;
|
int tex_width;
|
||||||
int tex_height;
|
int tex_height;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user