fixed cache interrupts
This commit is contained in:
+12
-12
@@ -65,8 +65,9 @@ Clip* Clip::copy(Sequence* s) {
|
||||
copy->effects.append(effects.at(i)->copy(copy));
|
||||
}
|
||||
|
||||
if (opening_transition != -1) copy->opening_transition = this->sequence->transitions.at(opening_transition)->copy(copy);
|
||||
if (closing_transition != -1) copy->closing_transition = this->sequence->transitions.at(closing_transition)->copy(copy);
|
||||
// TODO make a replacemennt for this somehow
|
||||
//if (opening_transition != -1) copy->opening_transition = this->sequence->transitions.at(opening_transition)->copy(copy);
|
||||
//if (closing_transition != -1) copy->closing_transition = this->sequence->transitions.at(closing_transition)->copy(copy);
|
||||
|
||||
copy->recalculateMaxLength();
|
||||
|
||||
@@ -178,21 +179,20 @@ Clip::~Clip() {
|
||||
}
|
||||
|
||||
long Clip::get_timeline_in_with_transition() {
|
||||
/*if (opening_transition != NULL && opening_transition->tlink != NULL) {
|
||||
return timeline_in - this->sequence->transitions(opening_transition)->tlink->length;
|
||||
} else {
|
||||
return timeline_in;
|
||||
}*/
|
||||
return 0;
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
|
||||
// we must be the secondary clip, so return (timeline in - length)
|
||||
return timeline_in - get_opening_transition()->length;
|
||||
}
|
||||
return timeline_in;
|
||||
}
|
||||
|
||||
long Clip::get_timeline_out_with_transition() {
|
||||
/*if (closing_transition != NULL && closing_transition->tlink != NULL) {
|
||||
return timeline_out + closing_transition->tlink->length;
|
||||
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip != NULL) {
|
||||
// we must be the primary clip, so return (timeline out + length2)
|
||||
return timeline_out + get_closing_transition()->length2;
|
||||
} else {
|
||||
return timeline_out;
|
||||
}*/
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// timeline functions
|
||||
|
||||
+16
-14
@@ -467,26 +467,28 @@ void Effect::field_changed() {
|
||||
}
|
||||
|
||||
void Effect::show_context_menu(const QPoint& pos) {
|
||||
QMenu menu(mainWindow);
|
||||
if (meta->type == EFFECT_TYPE_EFFECT) {
|
||||
QMenu menu(mainWindow);
|
||||
|
||||
int index = get_index_in_clip();
|
||||
int index = get_index_in_clip();
|
||||
|
||||
if (index > 0) {
|
||||
QAction* move_up = menu.addAction("Move &Up");
|
||||
connect(move_up, SIGNAL(triggered(bool)), this, SLOT(move_up()));
|
||||
}
|
||||
if (index > 0) {
|
||||
QAction* move_up = menu.addAction("Move &Up");
|
||||
connect(move_up, SIGNAL(triggered(bool)), this, SLOT(move_up()));
|
||||
}
|
||||
|
||||
if (index < parent_clip->effects.size() - 1) {
|
||||
QAction* move_down = menu.addAction("Move &Down");
|
||||
connect(move_down, SIGNAL(triggered(bool)), this, SLOT(move_down()));
|
||||
}
|
||||
if (index < parent_clip->effects.size() - 1) {
|
||||
QAction* move_down = menu.addAction("Move &Down");
|
||||
connect(move_down, SIGNAL(triggered(bool)), this, SLOT(move_down()));
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* del_action = menu.addAction("D&elete");
|
||||
connect(del_action, SIGNAL(triggered(bool)), this, SLOT(delete_self()));
|
||||
QAction* del_action = menu.addAction("D&elete");
|
||||
connect(del_action, SIGNAL(triggered(bool)), this, SLOT(delete_self()));
|
||||
|
||||
menu.exec(container->title_bar->mapToGlobal(pos));
|
||||
menu.exec(container->title_bar->mapToGlobal(pos));
|
||||
}
|
||||
}
|
||||
|
||||
void Effect::delete_self() {
|
||||
|
||||
@@ -111,6 +111,7 @@ public:
|
||||
Clip* parent_clip;
|
||||
const EffectMeta* meta;
|
||||
long length; // used only for transitions
|
||||
long length2; // used only for transitions
|
||||
int id;
|
||||
QString name;
|
||||
CollapsibleWidget* container;
|
||||
|
||||
+12
-12
@@ -80,12 +80,12 @@ QVariant EffectField::get_previous_data() {
|
||||
|
||||
QVariant EffectField::get_current_data() {
|
||||
switch (type) {
|
||||
case EFFECT_FIELD_DOUBLE: return static_cast<LabelSlider*>(ui_element)->value(); break;
|
||||
case EFFECT_FIELD_COLOR: return static_cast<ColorButton*>(ui_element)->get_color(); break;
|
||||
case EFFECT_FIELD_STRING: return static_cast<TextEditEx*>(ui_element)->getPlainTextEx(); break;
|
||||
case EFFECT_FIELD_BOOL: return static_cast<QCheckBox*>(ui_element)->isChecked(); break;
|
||||
case EFFECT_FIELD_COMBO: return static_cast<ComboBoxEx*>(ui_element)->currentIndex(); break;
|
||||
case EFFECT_FIELD_FONT: return static_cast<FontCombobox*>(ui_element)->currentText(); break;
|
||||
case EFFECT_FIELD_DOUBLE: return static_cast<LabelSlider*>(ui_element)->value();
|
||||
case EFFECT_FIELD_COLOR: return static_cast<ColorButton*>(ui_element)->get_color();
|
||||
case EFFECT_FIELD_STRING: return static_cast<TextEditEx*>(ui_element)->getPlainTextEx();
|
||||
case EFFECT_FIELD_BOOL: return static_cast<QCheckBox*>(ui_element)->isChecked();
|
||||
case EFFECT_FIELD_COMBO: return static_cast<ComboBoxEx*>(ui_element)->currentIndex();
|
||||
case EFFECT_FIELD_FONT: return static_cast<FontCombobox*>(ui_element)->currentText();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
@@ -100,12 +100,12 @@ long EffectField::timecodeToFrame(double timecode) {
|
||||
|
||||
void EffectField::set_current_data(const QVariant& data) {
|
||||
switch (type) {
|
||||
case EFFECT_FIELD_DOUBLE: return static_cast<LabelSlider*>(ui_element)->set_value(data.toDouble(), false); break;
|
||||
case EFFECT_FIELD_COLOR: return static_cast<ColorButton*>(ui_element)->set_color(data.value<QColor>()); break;
|
||||
case EFFECT_FIELD_STRING: return static_cast<TextEditEx*>(ui_element)->setPlainTextEx(data.toString()); break;
|
||||
case EFFECT_FIELD_BOOL: return static_cast<QCheckBox*>(ui_element)->setChecked(data.toBool()); break;
|
||||
case EFFECT_FIELD_COMBO: return static_cast<ComboBoxEx*>(ui_element)->setCurrentIndexEx(data.toInt()); break;
|
||||
case EFFECT_FIELD_FONT: return static_cast<FontCombobox*>(ui_element)->setCurrentTextEx(data.toString()); break;
|
||||
case EFFECT_FIELD_DOUBLE: return static_cast<LabelSlider*>(ui_element)->set_value(data.toDouble(), false);
|
||||
case EFFECT_FIELD_COLOR: return static_cast<ColorButton*>(ui_element)->set_color(data.value<QColor>());
|
||||
case EFFECT_FIELD_STRING: return static_cast<TextEditEx*>(ui_element)->setPlainTextEx(data.toString());
|
||||
case EFFECT_FIELD_BOOL: return static_cast<QCheckBox*>(ui_element)->setChecked(data.toBool());
|
||||
case EFFECT_FIELD_COMBO: return static_cast<ComboBoxEx*>(ui_element)->setCurrentIndexEx(data.toInt());
|
||||
case EFFECT_FIELD_FONT: return static_cast<FontCombobox*>(ui_element)->setCurrentTextEx(data.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -12,27 +12,27 @@
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
Transition::Transition(Clip* c, const EffectMeta* em) : Effect(c, em) {
|
||||
Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) : Effect(c, em), secondary_clip(s) {
|
||||
add_row("Length:")->add_field(EFFECT_FIELD_DOUBLE);
|
||||
}
|
||||
|
||||
int Transition::copy(Clip *c) {
|
||||
int copy_index = create_transition(c, meta);
|
||||
int Transition::copy(Clip *c, Clip* s) {
|
||||
int copy_index = create_transition(c, s, meta);
|
||||
c->sequence->transitions.at(copy_index)->length = length;
|
||||
return copy_index;
|
||||
}
|
||||
|
||||
Transition* get_transition_from_meta(Clip* c, const EffectMeta* em) {
|
||||
Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
|
||||
if (!em->filename.isEmpty()) {
|
||||
// load effect from file
|
||||
return new Transition(c, em);
|
||||
return new Transition(c, s, em);
|
||||
} else if (em->internal >= 0 && em->internal < TRANSITION_INTERNAL_COUNT) {
|
||||
// must be an internal effect
|
||||
switch (em->internal) {
|
||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return new CrossDissolveTransition(c, em);
|
||||
case TRANSITION_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, em);
|
||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, em);
|
||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, em);
|
||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return new CrossDissolveTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, s, em);
|
||||
}
|
||||
} else {
|
||||
dout << "[ERROR] Invalid transition data";
|
||||
@@ -41,8 +41,8 @@ Transition* get_transition_from_meta(Clip* c, const EffectMeta* em) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int create_transition(Clip* c, const EffectMeta* em) {
|
||||
Transition* t = get_transition_from_meta(c, em);
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em) {
|
||||
Transition* t = get_transition_from_meta(c, s, em);
|
||||
if (t != NULL) {
|
||||
c->sequence->transitions.append(t);
|
||||
return c->sequence->transitions.size() - 1;
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
#define TRANSITION_INTERNAL_LOGARITHMICFADE 3
|
||||
#define TRANSITION_INTERNAL_COUNT 4
|
||||
|
||||
int create_transition(Clip* c, const EffectMeta* em);
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
|
||||
class Transition : public Effect {
|
||||
public:
|
||||
Transition(Clip* c, const EffectMeta* em);
|
||||
int copy(Clip* c);
|
||||
Transition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
int copy(Clip* c, Clip* s);
|
||||
Clip* secondary_clip;
|
||||
};
|
||||
|
||||
#endif // TRANSITION_H
|
||||
|
||||
+2
-2
@@ -241,11 +241,11 @@ void AddTransitionCommand::undo() {
|
||||
|
||||
void AddTransitionCommand::redo() {
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
clip->opening_transition = create_transition(clip, transition);
|
||||
clip->opening_transition = create_transition(clip, secondary, transition);
|
||||
if (secondary != NULL) secondary->closing_transition = clip->opening_transition;
|
||||
if (length > 0) clip->get_opening_transition()->length = length;
|
||||
} else {
|
||||
clip->closing_transition = create_transition(clip, transition);
|
||||
clip->closing_transition = create_transition(clip, secondary, transition);
|
||||
if (secondary != NULL) secondary->opening_transition = clip->closing_transition;
|
||||
if (length > 0) clip->get_closing_transition()->length = length;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user