reimplemented double and bool widgets separately
This commit is contained in:
@@ -543,7 +543,7 @@ void ExportDialog::export_action() {
|
||||
connect(et, SIGNAL(finished()), this, SLOT(render_thread_finished()));
|
||||
connect(et, SIGNAL(progress_changed(int, qint64)), this, SLOT(update_progress_bar(int, qint64)));
|
||||
|
||||
close_active_clips(olive::ActiveSequence);
|
||||
close_active_clips(olive::ActiveSequence.get());
|
||||
|
||||
olive::Global->set_rendering_state(true);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ private slots:
|
||||
void preset_changed(int index);
|
||||
|
||||
private:
|
||||
Sequence* existing_sequence;
|
||||
SequencePtr existing_sequence;
|
||||
Media* existing_item;
|
||||
|
||||
void setup_ui();
|
||||
|
||||
@@ -79,9 +79,9 @@ SpeedDialog::SpeedDialog(QWidget *parent, QVector<Clip*> clips) : QDialog(parent
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
|
||||
connect(percent, SIGNAL(valueChanged()), this, SLOT(percent_update()));
|
||||
connect(frame_rate, SIGNAL(valueChanged()), this, SLOT(frame_rate_update()));
|
||||
connect(duration, SIGNAL(valueChanged()), this, SLOT(duration_update()));
|
||||
connect(percent, SIGNAL(valueChanged(double)), this, SLOT(percent_update()));
|
||||
connect(frame_rate, SIGNAL(valueChanged(double)), this, SLOT(frame_rate_update()));
|
||||
connect(duration, SIGNAL(valueChanged(double)), this, SLOT(duration_update()));
|
||||
}
|
||||
|
||||
void SpeedDialog::run() {
|
||||
@@ -356,7 +356,7 @@ void SpeedDialog::accept() {
|
||||
SetClipProperty* reversed_action = new SetClipProperty(kSetClipPropertyReversed);
|
||||
|
||||
// undoable action for restoring clip selections
|
||||
SetSelectionsCommand* sel_command = new SetSelectionsCommand(olive::ActiveSequence);
|
||||
SetSelectionsCommand* sel_command = new SetSelectionsCommand(olive::ActiveSequence.get());
|
||||
sel_command->old_data = olive::ActiveSequence->selections;
|
||||
|
||||
// variables used to calculate ripples
|
||||
|
||||
@@ -137,7 +137,7 @@ TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em)
|
||||
rect_gizmo->x_field1 = position_x;
|
||||
rect_gizmo->y_field1 = position_y;
|
||||
|
||||
connect(uniform_scale_field, SIGNAL(toggled(bool)), this, SLOT(toggle_uniform_scale(bool)));
|
||||
connect(uniform_scale_field, SIGNAL(Toggled(bool)), this, SLOT(toggle_uniform_scale(bool)));
|
||||
|
||||
// set defaults
|
||||
uniform_scale_field->SetValueAt(0, true);
|
||||
|
||||
+2
-2
@@ -377,12 +377,12 @@ void ExportThread::run() {
|
||||
start_time = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
if (params.audio_enabled) {
|
||||
compose_audio(nullptr, olive::ActiveSequence, 1, true);
|
||||
compose_audio(nullptr, olive::ActiveSequence.get(), 1, true);
|
||||
}
|
||||
if (params.video_enabled) {
|
||||
do {
|
||||
// TODO optimize by rendering the next frame while encoding the last
|
||||
renderer->start_render(nullptr, olive::ActiveSequence, nullptr, video_frame->data[0], video_frame->linesize[0]/4);
|
||||
renderer->start_render(nullptr, olive::ActiveSequence.get(), nullptr, video_frame->data[0], video_frame->linesize[0]/4);
|
||||
waitCond.wait(&mutex);
|
||||
if (!continueEncode) break;
|
||||
} while (renderer->did_texture_fail());
|
||||
|
||||
+1
-1
@@ -372,7 +372,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
} else if (attr.name() == "alayout") {
|
||||
s->audio_layout = attr.value().toInt();
|
||||
} else if (attr.name() == "open") {
|
||||
open_seq = s.get();
|
||||
open_seq = s;
|
||||
} else if (attr.name() == "workarea") {
|
||||
s->using_workarea = (attr.value() == "1");
|
||||
} else if (attr.name() == "workareaIn") {
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ private:
|
||||
void read_next_start_element(QXmlStreamReader& stream);
|
||||
void update_current_element_count(QXmlStreamReader& stream);
|
||||
|
||||
Sequence* open_seq;
|
||||
SequencePtr open_seq;
|
||||
QVector<Media*> loaded_media_items;
|
||||
QDir proj_dir;
|
||||
QDir internal_proj_dir;
|
||||
|
||||
+1
-1
@@ -286,7 +286,7 @@ void OliveGlobal::open_preferences() {
|
||||
pd.exec();
|
||||
}
|
||||
|
||||
void OliveGlobal::set_sequence(Sequence* s)
|
||||
void OliveGlobal::set_sequence(SequencePtr s)
|
||||
{
|
||||
panel_effect_controls->Clear(true);
|
||||
|
||||
|
||||
+1
-1
@@ -274,7 +274,7 @@ public slots:
|
||||
*
|
||||
* The Sequence to set as the active Sequence.
|
||||
*/
|
||||
void set_sequence(Sequence *s);
|
||||
void set_sequence(SequencePtr s);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -258,12 +258,15 @@ void EffectControls::Clear(bool clear_cache) {
|
||||
deselect_all_effects(nullptr);
|
||||
|
||||
// clear graph editor
|
||||
if (panel_graph_editor != nullptr) panel_graph_editor->set_row(nullptr);
|
||||
if (panel_graph_editor != nullptr) {
|
||||
panel_graph_editor->set_row(nullptr);
|
||||
}
|
||||
|
||||
for (int i=0;i<open_effects_.size();i++) {
|
||||
delete open_effects_.at(i);
|
||||
}
|
||||
open_effects_.clear();
|
||||
keyframeView->SetEffects(open_effects_);
|
||||
|
||||
vcontainer->setVisible(false);
|
||||
acontainer->setVisible(false);
|
||||
@@ -295,14 +298,16 @@ void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||
}
|
||||
}
|
||||
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
if (panel_sequence_viewer != nullptr) {
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
|
||||
EffectUI* container = new EffectUI(e);
|
||||
|
||||
connect(container, SIGNAL(CutRequested()), this, SLOT(cut()));
|
||||
connect(container, SIGNAL(CopyRequested()), this, SLOT(copy(bool)));
|
||||
connect(container, SIGNAL(CopyRequested()), this, SLOT(copy()));
|
||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
|
||||
open_effects_.append(container);
|
||||
@@ -596,8 +601,12 @@ void EffectControls::Load() {
|
||||
open_effect(layout, c->closing_transition.get());
|
||||
}
|
||||
}
|
||||
|
||||
keyframeView->SetEffects(open_effects_);
|
||||
|
||||
if (selected_clips_.size() > 0) {
|
||||
keyframeView->setEnabled(true);
|
||||
|
||||
headers->setVisible(true);
|
||||
|
||||
QTimer::singleShot(50, this, SLOT(queue_post_update()));
|
||||
|
||||
+11
-9
@@ -292,7 +292,9 @@ SequencePtr create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* seq = media->to_sequence();
|
||||
// Clone all attributes of the original sequence (seq) into the new one (s)
|
||||
Sequence* seq = media->to_sequence().get();
|
||||
|
||||
s->width = seq->width;
|
||||
s->height = seq->height;
|
||||
s->frame_rate = seq->frame_rate;
|
||||
@@ -442,13 +444,13 @@ Media* Project::create_sequence_internal(ComboAction *ca, SequencePtr s, bool op
|
||||
ca->append(new NewSequenceCommand(item, parent));
|
||||
|
||||
if (open) {
|
||||
ca->append(new ChangeSequenceAction(s.get()));
|
||||
ca->append(new ChangeSequenceAction(s));
|
||||
}
|
||||
} else {
|
||||
olive::project_model.appendChild(parent, item);
|
||||
|
||||
if (open) {
|
||||
olive::Global->set_sequence(s.get());
|
||||
olive::Global->set_sequence(s);
|
||||
}
|
||||
}
|
||||
return item;
|
||||
@@ -535,7 +537,7 @@ void Project::delete_selected_media() {
|
||||
Footage* media = item->to_footage();
|
||||
bool confirm_delete = false;
|
||||
for (int j=0;j<sequence_items.size();j++) {
|
||||
Sequence* s = sequence_items.at(j)->to_sequence();
|
||||
Sequence* s = sequence_items.at(j)->to_sequence().get();
|
||||
for (int k=0;k<s->clips.size();k++) {
|
||||
ClipPtr c = s->clips.at(k);
|
||||
if (c != nullptr && c->media() == item) {
|
||||
@@ -621,9 +623,9 @@ void Project::delete_selected_media() {
|
||||
if (items.at(i)->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
redraw = true;
|
||||
|
||||
Sequence* s = items.at(i)->to_sequence();
|
||||
Sequence* s = items.at(i)->to_sequence().get();
|
||||
|
||||
if (s == olive::ActiveSequence) {
|
||||
if (s == olive::ActiveSequence.get()) {
|
||||
ca->append(new ChangeSequenceAction(nullptr));
|
||||
}
|
||||
|
||||
@@ -990,7 +992,7 @@ void Project::delete_clips_using_selected_media() {
|
||||
for (int j=0;j<items.size();j++) {
|
||||
Media* m = item_to_media(items.at(j));
|
||||
if (c->media() == m) {
|
||||
ca->append(new DeleteClipAction(olive::ActiveSequence, i));
|
||||
ca->append(new DeleteClipAction(olive::ActiveSequence.get(), i));
|
||||
deleted = true;
|
||||
}
|
||||
}
|
||||
@@ -1129,7 +1131,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeEndElement(); // footage
|
||||
media_id++;
|
||||
} else if (type == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = m->to_sequence();
|
||||
Sequence* s = m->to_sequence().get();
|
||||
if (set_ids_only) {
|
||||
s->save_id = sequence_id;
|
||||
sequence_id++;
|
||||
@@ -1143,7 +1145,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeAttribute("framerate", QString::number(s->frame_rate, 'f', 10));
|
||||
stream.writeAttribute("afreq", QString::number(s->audio_frequency));
|
||||
stream.writeAttribute("alayout", QString::number(s->audio_layout));
|
||||
if (s == olive::ActiveSequence) {
|
||||
if (s == olive::ActiveSequence.get()) {
|
||||
stream.writeAttribute("open", "1");
|
||||
}
|
||||
stream.writeAttribute("workarea", QString::number(s->using_workarea));
|
||||
|
||||
+25
-23
@@ -219,7 +219,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
s = medium->to_sequence();
|
||||
s = medium->to_sequence().get();
|
||||
sequence_length = s->getEndFrame();
|
||||
if (seq != nullptr) sequence_length = rescale_frame_number(sequence_length, s->frame_rate, seq->frame_rate);
|
||||
can_import = (s != seq && sequence_length != 0);
|
||||
@@ -330,8 +330,7 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) {
|
||||
// sequence (red?ish?)
|
||||
c->set_color(192, 128, 128);
|
||||
|
||||
Sequence* media = c->media()->to_sequence();
|
||||
c->set_name(media->name);
|
||||
c->set_name(c->media()->to_sequence()->name);
|
||||
}
|
||||
c->refresh();
|
||||
added_clips.append(c);
|
||||
@@ -432,7 +431,7 @@ void Timeline::nest() {
|
||||
// copy all selected clips to the nest
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
// delete clip from old sequence
|
||||
ca->append(new DeleteClipAction(olive::ActiveSequence, selected_clips.at(i)));
|
||||
ca->append(new DeleteClipAction(olive::ActiveSequence.get(), selected_clips.at(i)));
|
||||
|
||||
// copy to new
|
||||
ClipPtr copy(olive::ActiveSequence->clips.at(selected_clips.at(i))->copy(s.get()));
|
||||
@@ -450,8 +449,8 @@ void Timeline::nest() {
|
||||
// add nested sequence to active sequence
|
||||
QVector<Media*> media_list;
|
||||
media_list.append(m);
|
||||
create_ghosts_from_media(olive::ActiveSequence, earliest_point, media_list);
|
||||
add_clips_from_ghosts(ca, olive::ActiveSequence);
|
||||
create_ghosts_from_media(olive::ActiveSequence.get(), earliest_point, media_list);
|
||||
add_clips_from_ghosts(ca, olive::ActiveSequence.get());
|
||||
|
||||
panel_effect_controls->Clear(true);
|
||||
olive::ActiveSequence->selections.clear();
|
||||
@@ -648,8 +647,11 @@ void Timeline::delete_in_out_internal(bool ripple) {
|
||||
}
|
||||
ComboAction* ca = new ComboAction();
|
||||
delete_areas_and_relink(ca, areas, true);
|
||||
if (ripple) ripple_clips(ca, olive::ActiveSequence, olive::ActiveSequence->workarea_in, olive::ActiveSequence->workarea_in - olive::ActiveSequence->workarea_out);
|
||||
ca->append(new SetTimelineInOutCommand(olive::ActiveSequence, false, 0, 0));
|
||||
if (ripple) ripple_clips(ca,
|
||||
olive::ActiveSequence.get(),
|
||||
olive::ActiveSequence->workarea_in,
|
||||
olive::ActiveSequence->workarea_in - olive::ActiveSequence->workarea_out);
|
||||
ca->append(new SetTimelineInOutCommand(olive::ActiveSequence.get(), false, 0, 0));
|
||||
olive::UndoStack.push(ca);
|
||||
update_ui(true);
|
||||
}
|
||||
@@ -732,7 +734,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
||||
}
|
||||
|
||||
if (can_ripple) {
|
||||
ripple_clips(ca, olive::ActiveSequence, ripple_point, -ripple_length);
|
||||
ripple_clips(ca, olive::ActiveSequence.get(), ripple_point, -ripple_length);
|
||||
panel_sequence_viewer->seek(ripple_point-1);
|
||||
}
|
||||
|
||||
@@ -851,7 +853,7 @@ ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long fram
|
||||
if (pre->timeline_in() < frame && pre->timeline_out() > frame) {
|
||||
// duplicate clip without duplicating its transitions, we'll restore them later
|
||||
|
||||
ClipPtr post = ClipPtr(pre->copy(olive::ActiveSequence));
|
||||
ClipPtr post = pre->copy(olive::ActiveSequence.get());
|
||||
|
||||
long new_clip_length = frame - pre->timeline_in();
|
||||
|
||||
@@ -961,7 +963,7 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
||||
|
||||
relink_clips_using_ids(pre_clips, post_clips);
|
||||
}
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence, post_clips));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence.get(), post_clips));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1032,7 +1034,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
ca->append(new DeleteTransitionCommand(c->closing_transition));
|
||||
} else if (c->timeline_in() >= s.in && c->timeline_out() <= s.out) {
|
||||
// clips falls entirely within deletion area
|
||||
ca->append(new DeleteClipAction(olive::ActiveSequence, j));
|
||||
ca->append(new DeleteClipAction(olive::ActiveSequence.get(), j));
|
||||
} else if (c->timeline_in() < s.in && c->timeline_out() > s.out) {
|
||||
// middle of clip is within deletion area
|
||||
|
||||
@@ -1078,7 +1080,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
}
|
||||
|
||||
relink_clips_using_ids(pre_clips, post_clips);
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence, post_clips));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence.get(), post_clips));
|
||||
}
|
||||
|
||||
void Timeline::copy(bool del) {
|
||||
@@ -1171,7 +1173,7 @@ void Timeline::paste(bool insert) {
|
||||
ClipPtr c = std::static_pointer_cast<Clip>(clipboard.at(i));
|
||||
|
||||
// create copy of clip and offset by playhead
|
||||
ClipPtr cc(c->copy(olive::ActiveSequence));
|
||||
ClipPtr cc = c->copy(olive::ActiveSequence.get());
|
||||
|
||||
// convert frame rates
|
||||
cc->set_timeline_in(rescale_frame_number(cc->timeline_in(), c->cached_frame_rate(), olive::ActiveSequence->frame_rate));
|
||||
@@ -1198,7 +1200,7 @@ void Timeline::paste(bool insert) {
|
||||
if (insert) {
|
||||
split_cache.clear();
|
||||
split_all_clips_at_point(ca, olive::ActiveSequence->playhead);
|
||||
ripple_clips(ca, olive::ActiveSequence, paste_start, paste_end - paste_start);
|
||||
ripple_clips(ca, olive::ActiveSequence.get(), paste_start, paste_end - paste_start);
|
||||
} else {
|
||||
delete_areas_and_relink(ca, delete_areas, false);
|
||||
}
|
||||
@@ -1218,7 +1220,7 @@ void Timeline::paste(bool insert) {
|
||||
}
|
||||
}
|
||||
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence, pasted_clips));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence.get(), pasted_clips));
|
||||
|
||||
olive::UndoStack.push(ca);
|
||||
|
||||
@@ -1367,7 +1369,7 @@ void Timeline::edit_to_point_internal(bool in, bool ripple) {
|
||||
// trim and move clips around the in point
|
||||
delete_areas_and_relink(ca, areas, true);
|
||||
|
||||
if (ripple) ripple_clips(ca, olive::ActiveSequence, in_point, -1);
|
||||
if (ripple) ripple_clips(ca, olive::ActiveSequence.get(), in_point, -1);
|
||||
} else {
|
||||
push_undo = false;
|
||||
}
|
||||
@@ -1391,7 +1393,7 @@ void Timeline::edit_to_point_internal(bool in, bool ripple) {
|
||||
|
||||
// trim and move clips around the in point
|
||||
delete_areas_and_relink(ca, areas, true);
|
||||
if (ripple) ripple_clips(ca, olive::ActiveSequence, s.in, s.in - s.out);
|
||||
if (ripple) ripple_clips(ca, olive::ActiveSequence.get(), s.in, s.in - s.out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1449,8 +1451,8 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
relink_clips_using_ids(pre_splits, post_splits);
|
||||
relink_clips_using_ids(pre_splits, secondary_post_splits);
|
||||
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence, post_splits));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence, secondary_post_splits));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence.get(), post_splits));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence.get(), secondary_post_splits));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1495,7 +1497,7 @@ void Timeline::split_at_playhead() {
|
||||
if (split_selected) {
|
||||
// relink clips if we split
|
||||
relink_clips_using_ids(pre_clips, post_clips);
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence, post_clips));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence.get(), post_clips));
|
||||
} else {
|
||||
// split a selection if not
|
||||
split_selected = split_selection(ca);
|
||||
@@ -1646,7 +1648,7 @@ void Timeline::set_marker() {
|
||||
}
|
||||
|
||||
// pass off to internal set marker function
|
||||
set_marker_internal(olive::ActiveSequence, clips_selected);
|
||||
set_marker_internal(olive::ActiveSequence.get(), clips_selected);
|
||||
|
||||
}
|
||||
|
||||
@@ -1676,7 +1678,7 @@ void Timeline::edit_to_out_point() {
|
||||
|
||||
void Timeline::toggle_links() {
|
||||
LinkCommand* command = new LinkCommand();
|
||||
command->s = olive::ActiveSequence;
|
||||
command->s = olive::ActiveSequence.get();
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
Clip* c = olive::ActiveSequence->clips.at(i).get();
|
||||
if (c != nullptr && olive::ActiveSequence->IsClipSelected(c, true)) {
|
||||
|
||||
+8
-6
@@ -83,7 +83,7 @@ Viewer::Viewer(QWidget *parent) :
|
||||
current_timecode_slider->set_default_value(qSNaN());
|
||||
current_timecode_slider->set_value(0, false);
|
||||
current_timecode_slider->set_display_type(LabelSlider::LABELSLIDER_FRAMENUMBER);
|
||||
connect(current_timecode_slider, SIGNAL(valueChanged()), this, SLOT(update_playhead()));
|
||||
connect(current_timecode_slider, SIGNAL(valueChanged(double)), this, SLOT(update_playhead()));
|
||||
|
||||
recording_flasher.setInterval(500);
|
||||
|
||||
@@ -790,11 +790,11 @@ void Viewer::set_media(Media* m) {
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
seq = SequencePtr(media->to_sequence());
|
||||
seq = media->to_sequence();
|
||||
break;
|
||||
}
|
||||
}
|
||||
set_sequence(false, seq.get());
|
||||
set_sequence(false, seq);
|
||||
}
|
||||
|
||||
void Viewer::update_playhead() {
|
||||
@@ -857,17 +857,19 @@ void Viewer::clean_created_seq() {
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::set_sequence(bool main, Sequence* s) {
|
||||
void Viewer::set_sequence(bool main, SequencePtr s) {
|
||||
pause();
|
||||
|
||||
reset_all_audio();
|
||||
|
||||
main_sequence = main;
|
||||
|
||||
// If we had a current sequence open, close it
|
||||
if (seq != nullptr) {
|
||||
close_active_clips(seq.get());
|
||||
}
|
||||
|
||||
main_sequence = main;
|
||||
seq = SequencePtr((main) ? olive::ActiveSequence : s);
|
||||
seq = (main) ? olive::ActiveSequence : s;
|
||||
|
||||
bool null_sequence = (seq == nullptr);
|
||||
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ private:
|
||||
|
||||
void update_window_title();
|
||||
void clean_created_seq();
|
||||
void set_sequence(bool main, Sequence *s);
|
||||
void set_sequence(bool main, SequencePtr s);
|
||||
bool main_sequence;
|
||||
bool created_sequence;
|
||||
long cached_end_frame;
|
||||
|
||||
+9
-7
@@ -197,10 +197,12 @@ void Clip::reset_audio() {
|
||||
cacher.ResetAudio();
|
||||
}
|
||||
if (media() != nullptr && media()->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* nested_sequence = media()->to_sequence();
|
||||
Sequence* nested_sequence = media()->to_sequence().get();
|
||||
for (int i=0;i<nested_sequence->clips.size();i++) {
|
||||
ClipPtr c = nested_sequence->clips.at(i);
|
||||
if (c != nullptr) c->reset_audio();
|
||||
Clip* c = nested_sequence->clips.at(i).get();
|
||||
if (c != nullptr) {
|
||||
c->reset_audio();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -391,7 +393,7 @@ long Clip::media_length() {
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media_->to_sequence();
|
||||
Sequence* s = media_->to_sequence().get();
|
||||
return rescale_frame_number(s->getEndFrame(), s->frame_rate, fr);
|
||||
}
|
||||
}
|
||||
@@ -412,7 +414,7 @@ int Clip::media_width() {
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media_->to_sequence();
|
||||
Sequence* s = media_->to_sequence().get();
|
||||
return s->width;
|
||||
}
|
||||
}
|
||||
@@ -431,7 +433,7 @@ int Clip::media_height() {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media_->to_sequence();
|
||||
Sequence* s = media_->to_sequence().get();
|
||||
return s->height;
|
||||
}
|
||||
}
|
||||
@@ -489,7 +491,7 @@ void Clip::Close(bool wait) {
|
||||
open_ = false;
|
||||
|
||||
if (media() != nullptr && media()->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
close_active_clips(media()->to_sequence());
|
||||
close_active_clips(media()->to_sequence().get());
|
||||
}
|
||||
|
||||
// destroy opengl texture in main thread
|
||||
|
||||
+2
-6
@@ -290,10 +290,6 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (field != nullptr) {
|
||||
connect(field, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -393,7 +389,7 @@ int Effect::gizmo_count() {
|
||||
|
||||
void Effect::refresh() {}
|
||||
|
||||
void Effect::field_changed() {
|
||||
void Effect::FieldChanged() {
|
||||
panel_sequence_viewer->viewer_widget->frame_update();
|
||||
panel_graph_editor->update_panel();
|
||||
}
|
||||
@@ -465,7 +461,7 @@ void Effect::load_from_file() {
|
||||
QFile file_handle(file);
|
||||
if (file_handle.open(QFile::ReadOnly)) {
|
||||
|
||||
olive::UndoStack.push(new SetEffectData(EffectPtr(this), file_handle.readAll()));
|
||||
olive::UndoStack.push(new SetEffectData(this, file_handle.readAll()));
|
||||
|
||||
file_handle.close();
|
||||
|
||||
|
||||
+1
-1
@@ -214,7 +214,7 @@ public:
|
||||
static EffectPtr Create(Clip *c, const EffectMeta *em);
|
||||
static const EffectMeta* GetInternalMeta(int internal_id, int type);
|
||||
public slots:
|
||||
void field_changed();
|
||||
void FieldChanged();
|
||||
signals:
|
||||
void EnabledChanged(bool);
|
||||
private slots:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "boolfield.h"
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
BoolField::BoolField(EffectRow *parent, const QString &id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_BOOL)
|
||||
{}
|
||||
@@ -9,6 +11,17 @@ bool BoolField::GetBoolAt(double timecode)
|
||||
return GetValueAt(timecode).toBool();
|
||||
}
|
||||
|
||||
QWidget *BoolField::CreateWidget()
|
||||
{
|
||||
QCheckBox* cb = new QCheckBox();
|
||||
|
||||
connect(cb, SIGNAL(toggled(bool)), this, SLOT(UpdateFromWidget(bool)));
|
||||
connect(this, SIGNAL(EnabledChanged(bool)), cb, SLOT(setEnabled(bool)));
|
||||
connect(cb, SIGNAL(toggled(bool)), this, SIGNAL(Toggled(bool)));
|
||||
|
||||
return cb;
|
||||
}
|
||||
|
||||
QVariant BoolField::ConvertStringToValue(const QString &s)
|
||||
{
|
||||
return (s == "1");
|
||||
@@ -18,3 +31,8 @@ QString BoolField::ConvertValueToString(const QVariant &v)
|
||||
{
|
||||
return QString::number(v.toBool());
|
||||
}
|
||||
|
||||
void BoolField::UpdateFromWidget(bool b)
|
||||
{
|
||||
SetValueAt(Now(), b);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,14 @@ public:
|
||||
|
||||
bool GetBoolAt(double timecode);
|
||||
|
||||
virtual QWidget* CreateWidget() override;
|
||||
|
||||
virtual QVariant ConvertStringToValue(const QString& s) override;
|
||||
virtual QString ConvertValueToString(const QVariant& v) override;
|
||||
signals:
|
||||
void Toggled(bool);
|
||||
private slots:
|
||||
void UpdateFromWidget(bool b);
|
||||
};
|
||||
|
||||
#endif // BOOLFIELD_H
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
DoubleField::DoubleField(EffectRow* parent, const QString& id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_DOUBLE),
|
||||
min_(DBL_MIN),
|
||||
max_(DBL_MAX),
|
||||
min_(qSNaN()),
|
||||
max_(qSNaN()),
|
||||
default_(0),
|
||||
display_type_(LabelSlider::LABELSLIDER_NORMAL),
|
||||
frame_rate_(30),
|
||||
value_set_(false)
|
||||
{
|
||||
connect(this, SIGNAL(Changed()), this, SLOT(ValueHasBeenSet()), Qt::DirectConnection);
|
||||
@@ -54,12 +57,33 @@ QString DoubleField::ConvertValueToString(const QVariant &v)
|
||||
return QString::number(v.toDouble());
|
||||
}
|
||||
|
||||
//QWidget *DoubleField::CreateWidget()
|
||||
//{
|
||||
QWidget *DoubleField::CreateWidget()
|
||||
{
|
||||
LabelSlider* ls = new LabelSlider();
|
||||
|
||||
//}
|
||||
if (!qIsNaN(min_)) {
|
||||
ls->set_minimum_value(min_);
|
||||
}
|
||||
ls->set_default_value(default_);
|
||||
if (!qIsNaN(max_)) {
|
||||
ls->set_maximum_value(max_);
|
||||
}
|
||||
ls->set_display_type(display_type_);
|
||||
ls->set_frame_rate(frame_rate_);
|
||||
|
||||
connect(ls, SIGNAL(valueChanged(double)), this, SLOT(UpdateFromWidget(double)));
|
||||
connect(ls, SIGNAL(clicked()), this, SIGNAL(Clicked()));
|
||||
connect(this, SIGNAL(EnabledChanged(bool)), ls, SLOT(setEnabled(bool)));
|
||||
|
||||
return ls;
|
||||
}
|
||||
|
||||
void DoubleField::ValueHasBeenSet()
|
||||
{
|
||||
value_set_ = true;
|
||||
}
|
||||
|
||||
void DoubleField::UpdateFromWidget(double d)
|
||||
{
|
||||
SetValueAt(Now(), d);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
virtual QVariant ConvertStringToValue(const QString& s);
|
||||
virtual QString ConvertValueToString(const QVariant& v);
|
||||
|
||||
//virtual QWidget* CreateWidget() override;
|
||||
virtual QWidget* CreateWidget() override;
|
||||
private:
|
||||
double min_;
|
||||
double max_;
|
||||
@@ -47,6 +47,7 @@ private:
|
||||
bool value_set_;
|
||||
private slots:
|
||||
void ValueHasBeenSet();
|
||||
void UpdateFromWidget(double d);
|
||||
};
|
||||
|
||||
#endif // DOUBLEFIELD_H
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
|
||||
#include "effectfield.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QtMath>
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/colorbutton.h"
|
||||
#include "ui/texteditex.h"
|
||||
@@ -28,6 +31,8 @@
|
||||
#include "ui/fontcombobox.h"
|
||||
#include "ui/embeddedfilechooser.h"
|
||||
|
||||
#include "rendering/renderfunctions.h"
|
||||
|
||||
#include "io/config.h"
|
||||
|
||||
#include "project/effectrow.h"
|
||||
@@ -39,9 +44,6 @@
|
||||
|
||||
#include "io/math.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QtMath>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
EffectField::EffectField(EffectRow* parent, const QString &i, EffectFieldType t) :
|
||||
@@ -54,74 +56,14 @@ EffectField::EffectField(EffectRow* parent, const QString &i, EffectFieldType t)
|
||||
Q_ASSERT(parent != nullptr);
|
||||
Q_ASSERT(!i.isEmpty() || t == EFFECT_FIELD_UI);
|
||||
|
||||
// Add this field to the parent row specified
|
||||
parent->AddField(this);
|
||||
/*
|
||||
switch (t) {
|
||||
case EFFECT_FIELD_DOUBLE:
|
||||
{
|
||||
LabelSlider* ls = new LabelSlider();
|
||||
ui_element = ls;
|
||||
connect(ls, SIGNAL(valueChanged()), this, SLOT(ui_element_change()));
|
||||
connect(ls, SIGNAL(clicked()), this, SIGNAL(clicked()));
|
||||
}
|
||||
break;
|
||||
case EFFECT_FIELD_COLOR:
|
||||
{
|
||||
ColorButton* cb = new ColorButton();
|
||||
ui_element = cb;
|
||||
connect(cb, SIGNAL(color_changed()), this, SLOT(ui_element_change()));
|
||||
}
|
||||
break;
|
||||
case EFFECT_FIELD_STRING:
|
||||
{
|
||||
TextEditEx* edit = new TextEditEx();
|
||||
|
||||
// TODO magic number 2 - It seems to just be +1 for the top and +1 for the bottom, which is sort of sensible but
|
||||
// feels a little tacky?
|
||||
edit->setFixedHeight(qCeil(edit->fontMetrics().lineSpacing()*olive::CurrentConfig.effect_textbox_lines
|
||||
+ edit->document()->documentMargin()
|
||||
+ edit->document()->documentMargin()
|
||||
+ 2));
|
||||
|
||||
edit->setUndoRedoEnabled(true);
|
||||
ui_element = edit;
|
||||
connect(edit, SIGNAL(textChanged()), this, SLOT(ui_element_change()));
|
||||
}
|
||||
break;
|
||||
case EFFECT_FIELD_BOOL:
|
||||
{
|
||||
CheckboxEx* cb = new CheckboxEx();
|
||||
ui_element = cb;
|
||||
connect(cb, SIGNAL(clicked(bool)), this, SLOT(ui_element_change()));
|
||||
connect(cb, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool)));
|
||||
}
|
||||
break;
|
||||
case EFFECT_FIELD_COMBO:
|
||||
{
|
||||
ComboBoxEx* cb = new ComboBoxEx();
|
||||
ui_element = cb;
|
||||
connect(cb, SIGNAL(activated(int)), this, SLOT(ui_element_change()));
|
||||
}
|
||||
break;
|
||||
case EFFECT_FIELD_FONT:
|
||||
{
|
||||
FontCombobox* fcb = new FontCombobox();
|
||||
ui_element = fcb;
|
||||
connect(fcb, SIGNAL(activated(int)), this, SLOT(ui_element_change()));
|
||||
}
|
||||
break;
|
||||
case EFFECT_FIELD_FILE:
|
||||
{
|
||||
EmbeddedFileChooser* efc = new EmbeddedFileChooser();
|
||||
ui_element = efc;
|
||||
connect(efc, SIGNAL(changed()), this, SLOT(ui_element_change()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
// Set a very base default value
|
||||
SetValueAt(0, 0);
|
||||
|
||||
// Connect this field to the effect's changed function
|
||||
connect(this, SIGNAL(Changed()), parent->GetParentEffect(), SLOT(FieldChanged()));
|
||||
}
|
||||
|
||||
EffectField::~EffectField() {}
|
||||
@@ -223,6 +165,8 @@ QVariant EffectField::GetValueAt(double timecode)
|
||||
case EFFECT_FIELD_FONT:
|
||||
case EFFECT_FIELD_FILE:
|
||||
return before_data;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,6 +191,12 @@ void EffectField::SetValueAt(double timecode, const QVariant &value)
|
||||
emit Changed();
|
||||
}
|
||||
|
||||
double EffectField::Now()
|
||||
{
|
||||
Clip* c = GetParentRow()->GetParentEffect()->parent_clip;
|
||||
return playhead_to_clip_seconds(c, c->sequence->playhead);
|
||||
}
|
||||
|
||||
const EffectField::EffectFieldType &EffectField::type()
|
||||
{
|
||||
return type_;
|
||||
@@ -351,6 +301,7 @@ bool EffectField::HasKeyframes() {
|
||||
return (GetParentRow()->IsKeyframing() && keyframes.size() > 1);
|
||||
}
|
||||
|
||||
/*
|
||||
void EffectField::ui_element_change() {
|
||||
// TODO address this
|
||||
//bool dragging_double = (type_ == EFFECT_FIELD_DOUBLE && static_cast<LabelSlider*>(ui_element)->is_dragging());
|
||||
@@ -361,6 +312,7 @@ void EffectField::ui_element_change() {
|
||||
if (!dragging_double) olive::UndoStack.push(ca);
|
||||
emit Changed();
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
void EffectField::make_key_from_change(ComboAction* ca) {
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
QVariant GetValueAt(double timecode);
|
||||
void SetValueAt(double timecode, const QVariant& value);
|
||||
|
||||
double Now();
|
||||
|
||||
int GetColumnSpan();
|
||||
void SetColumnSpan(int i);
|
||||
|
||||
@@ -69,8 +71,6 @@ public:
|
||||
void SetEnabled(bool e);
|
||||
QVector<EffectKeyframe> keyframes;
|
||||
|
||||
public slots:
|
||||
void ui_element_change();
|
||||
private:
|
||||
EffectFieldType type_;
|
||||
QString id_;
|
||||
|
||||
+4
-4
@@ -77,8 +77,8 @@ Footage* Media::to_footage() {
|
||||
return static_cast<Footage*>(object.get());
|
||||
}
|
||||
|
||||
Sequence* Media::to_sequence() {
|
||||
return static_cast<Sequence*>(object.get());
|
||||
SequencePtr Media::to_sequence() {
|
||||
return std::static_pointer_cast<Sequence>(object);
|
||||
}
|
||||
|
||||
void Media::set_footage(FootagePtr f) {
|
||||
@@ -192,7 +192,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = to_sequence();
|
||||
Sequence* s = to_sequence().get();
|
||||
|
||||
tooltip = QCoreApplication::translate("Media", "Name: %1"
|
||||
"\nVideo Dimensions: %2x%3"
|
||||
@@ -311,7 +311,7 @@ QVariant Media::data(int column, int role) {
|
||||
case 1:
|
||||
if (root) return QCoreApplication::translate("Media", "Duration");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence();
|
||||
Sequence* s = to_sequence().get();
|
||||
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
|
||||
}
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ public:
|
||||
Media(Media* iparent);
|
||||
~Media();
|
||||
Footage *to_footage();
|
||||
Sequence *to_sequence();
|
||||
SequencePtr to_sequence();
|
||||
void set_icon(const QString& str);
|
||||
void set_icon(const QIcon &ico);
|
||||
void set_footage(FootagePtr f);
|
||||
|
||||
@@ -192,4 +192,4 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||
}
|
||||
|
||||
// static variable for the currently active sequence
|
||||
Sequence* olive::ActiveSequence = nullptr;
|
||||
SequencePtr olive::ActiveSequence = nullptr;
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
// static variable for the currently active sequence
|
||||
namespace olive {
|
||||
extern Sequence* ActiveSequence;
|
||||
extern SequencePtr ActiveSequence;
|
||||
}
|
||||
|
||||
#endif // SEQUENCE_H
|
||||
|
||||
@@ -424,7 +424,7 @@ void SourcesCommon::clear_proxies_from_selected() {
|
||||
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
// close all clips so we can delete any proxies requested to be deleted
|
||||
close_active_clips(olive::ActiveSequence);
|
||||
close_active_clips(olive::ActiveSequence.get());
|
||||
}
|
||||
|
||||
// delete proxies requested to be deleted
|
||||
|
||||
+7
-7
@@ -140,7 +140,7 @@ void DeleteClipAction::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
ChangeSequenceAction::ChangeSequenceAction(Sequence *s) {
|
||||
ChangeSequenceAction::ChangeSequenceAction(SequencePtr s) {
|
||||
new_sequence = s;
|
||||
}
|
||||
|
||||
@@ -514,7 +514,7 @@ void ReplaceMediaCommand::replace(QString& filename) {
|
||||
// close any clips currently using this media
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
for (int i=0;i<all_sequences.size();i++) {
|
||||
Sequence* s = all_sequences.at(i)->to_sequence();
|
||||
Sequence* s = all_sequences.at(i)->to_sequence().get();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
ClipPtr c = s->clips.at(j);
|
||||
if (c != nullptr && c->media() == item && c->IsOpen()) {
|
||||
@@ -879,7 +879,7 @@ void SetSelectionsCommand::doRedo() {
|
||||
}
|
||||
}
|
||||
|
||||
EditSequenceCommand::EditSequenceCommand(Media* i, Sequence *s) {
|
||||
EditSequenceCommand::EditSequenceCommand(Media* i, SequencePtr s) {
|
||||
item = i;
|
||||
seq = s;
|
||||
old_name = s->name;
|
||||
@@ -959,7 +959,7 @@ void CloseAllClipsCommand::doUndo() {
|
||||
}
|
||||
|
||||
void CloseAllClipsCommand::doRedo() {
|
||||
close_active_clips(olive::ActiveSequence);
|
||||
close_active_clips(olive::ActiveSequence.get());
|
||||
}
|
||||
|
||||
UpdateFootageTooltip::UpdateFootageTooltip(Media *i) {
|
||||
@@ -1156,9 +1156,9 @@ void RefreshClips::doRedo() {
|
||||
// close any clips currently using this media
|
||||
QVector<Media*> all_sequences = panel_project->list_all_project_sequences();
|
||||
for (int i=0;i<all_sequences.size();i++) {
|
||||
Sequence* s = all_sequences.at(i)->to_sequence();
|
||||
Sequence* s = all_sequences.at(i)->to_sequence().get();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
ClipPtr c = s->clips.at(j);
|
||||
Clip* c = s->clips.at(j).get();
|
||||
if (c != nullptr && c->media() == media) {
|
||||
c->replaced = true;
|
||||
c->refresh();
|
||||
@@ -1175,7 +1175,7 @@ void UpdateViewer::doRedo() {
|
||||
panel_sequence_viewer->viewer_widget->frame_update();
|
||||
}
|
||||
|
||||
SetEffectData::SetEffectData(EffectPtr e, const QByteArray &s) {
|
||||
SetEffectData::SetEffectData(Effect *e, const QByteArray &s) {
|
||||
effect = e;
|
||||
data = s;
|
||||
}
|
||||
|
||||
+7
-7
@@ -115,12 +115,12 @@ private:
|
||||
|
||||
class ChangeSequenceAction : public OliveAction {
|
||||
public:
|
||||
ChangeSequenceAction(Sequence* s);
|
||||
ChangeSequenceAction(SequencePtr s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
Sequence* old_sequence;
|
||||
Sequence* new_sequence;
|
||||
SequencePtr old_sequence;
|
||||
SequencePtr new_sequence;
|
||||
};
|
||||
|
||||
class AddEffectCommand : public OliveAction {
|
||||
@@ -455,7 +455,7 @@ private:
|
||||
|
||||
class EditSequenceCommand : public OliveAction {
|
||||
public:
|
||||
EditSequenceCommand(Media *i, Sequence* s);
|
||||
EditSequenceCommand(Media *i, SequencePtr s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
void update();
|
||||
@@ -468,7 +468,7 @@ public:
|
||||
int audio_layout;
|
||||
private:
|
||||
Media* item;
|
||||
Sequence* seq;
|
||||
SequencePtr seq;
|
||||
|
||||
QString old_name;
|
||||
int old_width;
|
||||
@@ -626,11 +626,11 @@ public:
|
||||
|
||||
class SetEffectData : public OliveAction {
|
||||
public:
|
||||
SetEffectData(EffectPtr e, const QByteArray &s);
|
||||
SetEffectData(Effect* e, const QByteArray &s);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
EffectPtr effect;
|
||||
Effect* effect;
|
||||
QByteArray data;
|
||||
QByteArray old_data;
|
||||
};
|
||||
|
||||
@@ -51,8 +51,6 @@ namespace OCIO = OCIO_NAMESPACE;
|
||||
#include "panels/timeline.h"
|
||||
#include "panels/viewer.h"
|
||||
|
||||
const int kMaximumRetryCount = 10;
|
||||
|
||||
void full_blit() {
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
@@ -164,7 +162,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) {
|
||||
|
||||
if (!params.nests.isEmpty()) {
|
||||
for (int i=0;i<params.nests.size();i++) {
|
||||
s = params.nests.at(i)->media()->to_sequence();
|
||||
s = params.nests.at(i)->media()->to_sequence().get();
|
||||
playhead += params.nests.at(i)->clip_in(true) - params.nests.at(i)->timeline_in(true);
|
||||
playhead = rescale_frame_number(playhead, params.nests.at(i)->sequence->frame_rate, s->frame_rate);
|
||||
}
|
||||
|
||||
+6
-3
@@ -42,7 +42,7 @@ EffectUI::EffectUI(Effect* e) :
|
||||
}
|
||||
}
|
||||
|
||||
connect(enabled_check, SIGNAL(clicked(bool)), this, SLOT(field_changed()));
|
||||
connect(enabled_check, SIGNAL(clicked(bool)), e, SLOT(FieldChanged()));
|
||||
}
|
||||
|
||||
Effect *EffectUI::GetEffect()
|
||||
@@ -64,8 +64,11 @@ void EffectUI::show_context_menu(const QPoint& pos) {
|
||||
|
||||
int index = c->IndexOfEffect(effect_);
|
||||
|
||||
menu.addAction(tr("Cu&t"), this, SIGNAL(CutRequested()));
|
||||
menu.addAction(tr("&Copy"), this, SIGNAL(CopyRequested()));
|
||||
QAction* cut_action = menu.addAction(tr("Cu&t"));
|
||||
connect(cut_action, SIGNAL(triggered(bool)), this, SIGNAL(CutRequested()));
|
||||
|
||||
QAction* copy_action = menu.addAction(tr("&Copy"));
|
||||
connect(copy_action, SIGNAL(triggered(bool)), this, SIGNAL(CopyRequested()));
|
||||
|
||||
olive::MenuHelper.create_effect_paste_action(&menu);
|
||||
|
||||
|
||||
+4
-2
@@ -73,7 +73,9 @@ void LabelSlider::set_value(double v, bool userSet) {
|
||||
}
|
||||
|
||||
setText(valueToString());
|
||||
if (userSet) emit valueChanged();
|
||||
if (userSet) {
|
||||
emit valueChanged(internal_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,7 +249,7 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
||||
|
||||
previous_value = drag_start_value;
|
||||
|
||||
emit valueChanged();
|
||||
emit valueChanged(internal_value);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
+124
-124
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -37,13 +37,13 @@ public:
|
||||
LabelSlider(QWidget* parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Set the display frame rate
|
||||
*
|
||||
* If the `display_type` is set to LABELSLIDER_FRAMENUMBER, this function sets how many frames per second the
|
||||
* timecode will be in.
|
||||
*
|
||||
* @param d
|
||||
*/
|
||||
* @brief Set the display frame rate
|
||||
*
|
||||
* If the `display_type` is set to LABELSLIDER_FRAMENUMBER, this function sets how many frames per second the
|
||||
* timecode will be in.
|
||||
*
|
||||
* @param d
|
||||
*/
|
||||
void set_frame_rate(double d);
|
||||
|
||||
enum DisplayType {
|
||||
@@ -54,134 +54,134 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Sets the way to display the value
|
||||
*
|
||||
* * `LABELSLIDER_NORMAL` - Shows the value as a normal number
|
||||
* * `LABELSLIDER_FRAMENUMBER` - Shows the number as a timecode according to `config.timecode_view`. By default,
|
||||
* will render hh:mm:ss:ff
|
||||
* * `LABELSLIDER_PERCENT` - Shows the number as a percentage. 1.0 becomes "100%", 0.5 becomes 50%, etc.
|
||||
* * `LABELSLIDER_DECIBLE` - Shows the number as a decibel. 1.0 becomes "0 dB", 2.0 becames roughly "6 dB", 0.5
|
||||
* becomes roughly "-6 dB", etc.
|
||||
*
|
||||
* @param type
|
||||
*
|
||||
* The display type to set to.
|
||||
*/
|
||||
* @brief Sets the way to display the value
|
||||
*
|
||||
* * `LABELSLIDER_NORMAL` - Shows the value as a normal number
|
||||
* * `LABELSLIDER_FRAMENUMBER` - Shows the number as a timecode according to `config.timecode_view`. By default,
|
||||
* will render hh:mm:ss:ff
|
||||
* * `LABELSLIDER_PERCENT` - Shows the number as a percentage. 1.0 becomes "100%", 0.5 becomes 50%, etc.
|
||||
* * `LABELSLIDER_DECIBLE` - Shows the number as a decibel. 1.0 becomes "0 dB", 2.0 becames roughly "6 dB", 0.5
|
||||
* becomes roughly "-6 dB", etc.
|
||||
*
|
||||
* @param type
|
||||
*
|
||||
* The display type to set to.
|
||||
*/
|
||||
void set_display_type(const DisplayType& type);
|
||||
|
||||
/**
|
||||
* @brief Set the value
|
||||
* @param v
|
||||
*
|
||||
* Value to set to.
|
||||
*
|
||||
* @param userSet
|
||||
*
|
||||
* **TRUE** if this was called through a user action, **FALSE** if this was called through some other way. The
|
||||
* only difference is **TRUE** will emit a signal (valueChanged()) indicating that the value has changed, and
|
||||
* **FALSE** will not.
|
||||
*/
|
||||
* @brief Set the value
|
||||
* @param v
|
||||
*
|
||||
* Value to set to.
|
||||
*
|
||||
* @param userSet
|
||||
*
|
||||
* **TRUE** if this was called through a user action, **FALSE** if this was called through some other way. The
|
||||
* only difference is **TRUE** will emit a signal (valueChanged()) indicating that the value has changed, and
|
||||
* **FALSE** will not.
|
||||
*/
|
||||
void set_value(double v, bool userSet);
|
||||
|
||||
/**
|
||||
* @brief Set the default value
|
||||
*
|
||||
* If a default value is set, alt+clicking the LabelSlider will return to the default value.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as default
|
||||
*/
|
||||
* @brief Set the default value
|
||||
*
|
||||
* If a default value is set, alt+clicking the LabelSlider will return to the default value.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as default
|
||||
*/
|
||||
void set_default_value(double v);
|
||||
|
||||
/**
|
||||
* @brief Set the minimum value
|
||||
*
|
||||
* If a minimum value is set, the value will never go below it. If the user manually sets a value lower than
|
||||
* the minimum, it will automatically snap to the minimum.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as minimum
|
||||
*/
|
||||
* @brief Set the minimum value
|
||||
*
|
||||
* If a minimum value is set, the value will never go below it. If the user manually sets a value lower than
|
||||
* the minimum, it will automatically snap to the minimum.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as minimum
|
||||
*/
|
||||
void set_minimum_value(double v);
|
||||
|
||||
/**
|
||||
* @brief Set the maximum value
|
||||
*
|
||||
* If a maximum value is set, the value will never go above it. If the user manually sets a value higher than
|
||||
* the maximum, it will automatically snap to the maximum.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as maximum
|
||||
*/
|
||||
* @brief Set the maximum value
|
||||
*
|
||||
* If a maximum value is set, the value will never go above it. If the user manually sets a value higher than
|
||||
* the maximum, it will automatically snap to the maximum.
|
||||
*
|
||||
* @param v
|
||||
*
|
||||
* Value to set as maximum
|
||||
*/
|
||||
void set_maximum_value(double v);
|
||||
|
||||
/**
|
||||
* @brief Returns the internal value as a double
|
||||
* @return The internal value. This will not respect the `display_type`, i.e. 100% will return as 1.0, 12dB will
|
||||
* return as 400%, and a timecode will return as a frame number.
|
||||
*/
|
||||
* @brief Returns the internal value as a double
|
||||
* @return The internal value. This will not respect the `display_type`, i.e. 100% will return as 1.0, 12dB will
|
||||
* return as 400%, and a timecode will return as a frame number.
|
||||
*/
|
||||
double value();
|
||||
|
||||
/**
|
||||
* @brief Returns whether a value has been set or not
|
||||
*
|
||||
* If a value has been entered by any means (i.e. if set_value() was called), this will be **TRUE**. If set_value()
|
||||
* has not been called and is_set() is **FALSE**, calling set_default_value() will automatically set the value
|
||||
* to the default value WITHOUT changing the is_set() state (i.e. it will still be **FALSE** and calling
|
||||
* set_default_value() again will change the current value again unless it's been changed through some other means
|
||||
* in that time).
|
||||
*
|
||||
* @return **TRUE** if a value has been set, **FALSE** if not.
|
||||
*/
|
||||
* @brief Returns whether a value has been set or not
|
||||
*
|
||||
* If a value has been entered by any means (i.e. if set_value() was called), this will be **TRUE**. If set_value()
|
||||
* has not been called and is_set() is **FALSE**, calling set_default_value() will automatically set the value
|
||||
* to the default value WITHOUT changing the is_set() state (i.e. it will still be **FALSE** and calling
|
||||
* set_default_value() again will change the current value again unless it's been changed through some other means
|
||||
* in that time).
|
||||
*
|
||||
* @return **TRUE** if a value has been set, **FALSE** if not.
|
||||
*/
|
||||
bool is_set();
|
||||
|
||||
/**
|
||||
* @brief Returns whether the user is currently dragging
|
||||
* @return **TRUE** if the user is dragging, **FALSE** if not.
|
||||
*/
|
||||
* @brief Returns whether the user is currently dragging
|
||||
* @return **TRUE** if the user is dragging, **FALSE** if not.
|
||||
*/
|
||||
bool is_dragging();
|
||||
|
||||
/**
|
||||
* @brief Convert the internal value to a displayed string according to `display_type`
|
||||
* @return The internal value as a string
|
||||
*/
|
||||
* @brief Convert the internal value to a displayed string according to `display_type`
|
||||
* @return The internal value as a string
|
||||
*/
|
||||
QString valueToString();
|
||||
|
||||
/**
|
||||
* @brief Returns whatever value was set before the last set_value()
|
||||
*
|
||||
* For various reasons (largely undo capabilities) it is helpful to retrieve whatever the value was before the
|
||||
* current one. If the user dragged the current value, this will return the value just before the user started
|
||||
* dragging.
|
||||
*
|
||||
* @return The previous value
|
||||
*/
|
||||
* @brief Returns whatever value was set before the last set_value()
|
||||
*
|
||||
* For various reasons (largely undo capabilities) it is helpful to retrieve whatever the value was before the
|
||||
* current one. If the user dragged the current value, this will return the value just before the user started
|
||||
* dragging.
|
||||
*
|
||||
* @return The previous value
|
||||
*/
|
||||
double getPreviousValue();
|
||||
|
||||
/**
|
||||
* @brief Updates previous value
|
||||
*
|
||||
* Called internally to store the current value as the previous value in anticipation of an upcoming value change.
|
||||
* Can also be called externally (mainly for dragged EffectGizmos) in anticipation of an external change.
|
||||
*/
|
||||
* @brief Updates previous value
|
||||
*
|
||||
* Called internally to store the current value as the previous value in anticipation of an upcoming value change.
|
||||
* Can also be called externally (mainly for dragged EffectGizmos) in anticipation of an external change.
|
||||
*/
|
||||
void set_previous_value();
|
||||
|
||||
/**
|
||||
* @brief Set the display color
|
||||
* @param c
|
||||
*
|
||||
* Color to set to
|
||||
*/
|
||||
* @brief Set the display color
|
||||
* @param c
|
||||
*
|
||||
* Color to set to
|
||||
*/
|
||||
void set_color(QString c = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Set how many decimal places to show for a floating-point number
|
||||
*
|
||||
* Defaults to 1
|
||||
*/
|
||||
* @brief Set how many decimal places to show for a floating-point number
|
||||
*
|
||||
* Defaults to 1
|
||||
*/
|
||||
int decimal_places;
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *ev);
|
||||
@@ -210,13 +210,13 @@ private:
|
||||
double frame_rate;
|
||||
|
||||
/**
|
||||
* @brief Internal function to set the standard cursor (usually SizeHorCursor)
|
||||
*/
|
||||
* @brief Internal function to set the standard cursor (usually SizeHorCursor)
|
||||
*/
|
||||
void set_default_cursor();
|
||||
|
||||
/**
|
||||
* @brief Internal function to set the cursor while dragging (usually NoCursor aka invisible)
|
||||
*/
|
||||
* @brief Internal function to set the cursor while dragging (usually NoCursor aka invisible)
|
||||
*/
|
||||
void set_active_cursor();
|
||||
private slots:
|
||||
/**
|
||||
@@ -243,17 +243,17 @@ private slots:
|
||||
void prompt_for_value();
|
||||
signals:
|
||||
/**
|
||||
* @brief valueChanged signal
|
||||
*
|
||||
* Emitted if the value changed at it was instigated by the user.
|
||||
*/
|
||||
void valueChanged();
|
||||
* @brief valueChanged signal
|
||||
*
|
||||
* Emitted if the value changed at it was instigated by the user.
|
||||
*/
|
||||
void valueChanged(double d);
|
||||
|
||||
/**
|
||||
* @brief clicked signal
|
||||
*
|
||||
* Emitted if the user clicks on the LabelSlider in any way
|
||||
*/
|
||||
* @brief clicked signal
|
||||
*
|
||||
* Emitted if the user clicks on the LabelSlider in any way
|
||||
*/
|
||||
void clicked();
|
||||
};
|
||||
|
||||
|
||||
+11
-13
@@ -259,8 +259,7 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) {
|
||||
}
|
||||
|
||||
if (event->source() == panel_footage_viewer->viewer_widget) {
|
||||
Sequence* proposed_seq = panel_footage_viewer->seq.get();
|
||||
if (proposed_seq != olive::ActiveSequence) { // don't allow nesting the same sequence
|
||||
if (panel_footage_viewer->seq != olive::ActiveSequence) { // don't allow nesting the same sequence
|
||||
media_list.append(panel_footage_viewer->media);
|
||||
import_init = true;
|
||||
}
|
||||
@@ -302,7 +301,7 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) {
|
||||
event->acceptProposedAction();
|
||||
|
||||
long entry_point;
|
||||
Sequence* seq = olive::ActiveSequence;
|
||||
Sequence* seq = olive::ActiveSequence.get();
|
||||
|
||||
if (seq == nullptr) {
|
||||
// if no sequence, we're going to create a new one using the clips as a reference
|
||||
@@ -486,13 +485,13 @@ void insert_clips(ComboAction* ca) {
|
||||
|
||||
long ripple_length = (latest_new_point - earliest_new_point);
|
||||
|
||||
ripple_clips(ca, olive::ActiveSequence, earliest_new_point, ripple_length, ignore_clips);
|
||||
ripple_clips(ca, olive::ActiveSequence.get(), earliest_new_point, ripple_length, ignore_clips);
|
||||
|
||||
if (ripple_old_point) {
|
||||
// works for moving later clips earlier but not earlier to later
|
||||
long second_ripple_length = (earliest_old_point - latest_old_point);
|
||||
|
||||
ripple_clips(ca, olive::ActiveSequence, latest_old_point, second_ripple_length, ignore_clips);
|
||||
ripple_clips(ca, olive::ActiveSequence.get(), latest_old_point, second_ripple_length, ignore_clips);
|
||||
|
||||
if (earliest_old_point < earliest_new_point) {
|
||||
for (int i=0;i<panel_timeline->ghosts.size();i++) {
|
||||
@@ -515,7 +514,7 @@ void TimelineWidget::dropEvent(QDropEvent* event) {
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
Sequence* s = olive::ActiveSequence;
|
||||
Sequence* s = olive::ActiveSequence.get();
|
||||
|
||||
// if we're dropping into nothing, create a new sequences based on the clip being dragged
|
||||
if (s == nullptr) {
|
||||
@@ -998,7 +997,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
panel_sequence_viewer->cue_recording(qMin(g.in, g.out), qMax(g.in, g.out), g.track);
|
||||
panel_timeline->creating = false;
|
||||
} else if (g.in != g.out) {
|
||||
ClipPtr c = std::make_shared<Clip>(olive::ActiveSequence);
|
||||
ClipPtr c = std::make_shared<Clip>(olive::ActiveSequence.get());
|
||||
c->set_media(nullptr, 0);
|
||||
c->set_timeline_in(qMin(g.in, g.out));
|
||||
c->set_timeline_out(qMax(g.in, g.out));
|
||||
@@ -1020,7 +1019,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
|
||||
QVector<ClipPtr> add;
|
||||
add.append(c);
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence, add));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence.get(), add));
|
||||
|
||||
if (c->track() < 0 && olive::CurrentConfig.add_default_effects_to_clips) {
|
||||
// default video effects (before custom effects)
|
||||
@@ -1141,7 +1140,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
if (panel_timeline->trim_type == TRIM_OUT) ripple_length = -ripple_length;
|
||||
|
||||
// finally, ripple everything
|
||||
ripple_clips(ca, olive::ActiveSequence, ripple_point, ripple_length, ignore_clips);
|
||||
ripple_clips(ca, olive::ActiveSequence.get(), ripple_point, ripple_length, ignore_clips);
|
||||
}
|
||||
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER
|
||||
@@ -1157,7 +1156,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
if (g.old_in != g.in || g.old_out != g.out || g.track != g.old_track || g.clip_in != g.old_clip_in) {
|
||||
|
||||
// create copy of clip
|
||||
ClipPtr c(olive::ActiveSequence->clips.at(g.clip)->copy(olive::ActiveSequence));
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(g.clip)->copy(olive::ActiveSequence.get());
|
||||
|
||||
c->set_timeline_in(g.in);
|
||||
c->set_timeline_out(g.out);
|
||||
@@ -1184,7 +1183,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
panel_timeline->relink_clips_using_ids(old_clips, new_clips);
|
||||
|
||||
// add them
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence, new_clips));
|
||||
ca->append(new AddClipCommand(olive::ActiveSequence.get(), new_clips));
|
||||
|
||||
}
|
||||
|
||||
@@ -2342,7 +2341,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
|
||||
// store selections
|
||||
selection_command = new SetSelectionsCommand(olive::ActiveSequence);
|
||||
selection_command = new SetSelectionsCommand(olive::ActiveSequence.get());
|
||||
selection_command->old_data = olive::ActiveSequence->selections;
|
||||
|
||||
// ready to start moving clips
|
||||
@@ -2953,7 +2952,6 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
if (clip->media() != nullptr && clip->media()->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
bool draw_checkerboard = false;
|
||||
QRect checkerboard_rect(clip_rect);
|
||||
Footage* m = clip->media()->to_footage();
|
||||
FootageStream* ms = clip->media_stream();
|
||||
if (ms == nullptr) {
|
||||
draw_checkerboard = true;
|
||||
|
||||
+1
-1
@@ -311,7 +311,7 @@ void ViewerWidget::move_gizmos(QMouseEvent *event, bool done) {
|
||||
drag_start_x = event->pos().x();
|
||||
drag_start_y = event->pos().y();
|
||||
|
||||
gizmos->field_changed();
|
||||
gizmos->FieldChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user