Merge branch 'master' into project_icons
This commit is contained in:
+36
-32
@@ -34,7 +34,7 @@ EffectControls::EffectControls(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
multiple(false),
|
||||
zoom(1),
|
||||
panel_name("Effects: "),
|
||||
panel_name(tr("Effects: ")),
|
||||
mode(TA_NO_TRANSITION)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
@@ -78,14 +78,14 @@ void EffectControls::menu_select(QAction* q) {
|
||||
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
||||
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||
if (c->get_opening_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_OPENING_TRANSITION, 30));
|
||||
if (c->get_opening_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, TA_OPENING_TRANSITION, 30));
|
||||
}
|
||||
if (c->get_closing_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_CLOSING_TRANSITION, 30));
|
||||
if (c->get_closing_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, TA_CLOSING_TRANSITION, 30));
|
||||
}
|
||||
} else {
|
||||
ca->append(new AddEffectCommand(c, NULL, meta));
|
||||
ca->append(new AddEffectCommand(c, nullptr, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ void EffectControls::copy(bool del) {
|
||||
bool cleared = false;
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : NULL;
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
@@ -124,16 +124,16 @@ void EffectControls::copy(bool del) {
|
||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
clipboard.append(effect->copy(NULL));
|
||||
clipboard.append(effect->copy(nullptr));
|
||||
|
||||
if (del_com != NULL) {
|
||||
if (del_com != nullptr) {
|
||||
del_com->clips.append(c);
|
||||
del_com->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (del_com != NULL) {
|
||||
if (del_com != nullptr) {
|
||||
if (del_com->clips.size() > 0) {
|
||||
ca->append(del_com);
|
||||
} else {
|
||||
@@ -168,7 +168,7 @@ void EffectControls::show_effect_menu(int type, int subtype) {
|
||||
bool found = false;
|
||||
for (int j=0;j<effects_menu.actions().size();j++) {
|
||||
QAction* action = effects_menu.actions().at(j);
|
||||
if (action->menu() != NULL) {
|
||||
if (action->menu() != nullptr) {
|
||||
if (action->menu()->title() == em.category) {
|
||||
parent = action->menu();
|
||||
found = true;
|
||||
@@ -214,20 +214,20 @@ void EffectControls::show_effect_menu(int type, int subtype) {
|
||||
|
||||
void EffectControls::clear_effects(bool clear_cache) {
|
||||
// clear existing clips
|
||||
deselect_all_effects(NULL);
|
||||
deselect_all_effects(nullptr);
|
||||
|
||||
// clear graph editor
|
||||
if (panel_graph_editor != NULL) panel_graph_editor->set_row(NULL);
|
||||
if (panel_graph_editor != nullptr) panel_graph_editor->set_row(nullptr);
|
||||
|
||||
QVBoxLayout* video_layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||
QVBoxLayout* audio_layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
||||
QLayoutItem* item;
|
||||
while ((item = video_layout->takeAt(0))) {
|
||||
item->widget()->setParent(NULL);
|
||||
item->widget()->setParent(nullptr);
|
||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
while ((item = audio_layout->takeAt(0))) {
|
||||
item->widget()->setParent(NULL);
|
||||
item->widget()->setParent(nullptr);
|
||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
@@ -260,9 +260,9 @@ void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
|
||||
void EffectControls::setup_ui() {
|
||||
QWidget* contents = new QWidget();
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(contents);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
QHBoxLayout* hlayout = new QHBoxLayout(contents);
|
||||
hlayout->setSpacing(0);
|
||||
hlayout->setMargin(0);
|
||||
|
||||
QSplitter* splitter = new QSplitter(contents);
|
||||
splitter->setOrientation(Qt::Horizontal);
|
||||
@@ -303,7 +303,7 @@ void EffectControls::setup_ui() {
|
||||
|
||||
QPushButton* btnAddVideoEffect = new QPushButton(veHeader);
|
||||
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddVideoEffect->setToolTip("Add Video Effect");
|
||||
btnAddVideoEffect->setToolTip(tr("Add Video Effect"));
|
||||
veHeaderLayout->addWidget(btnAddVideoEffect);
|
||||
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
||||
|
||||
@@ -314,14 +314,14 @@ void EffectControls::setup_ui() {
|
||||
font.setPointSize(9);
|
||||
lblVideoEffects->setFont(font);
|
||||
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
||||
lblVideoEffects->setText("VIDEO EFFECTS");
|
||||
lblVideoEffects->setText(tr("VIDEO EFFECTS"));
|
||||
veHeaderLayout->addWidget(lblVideoEffects);
|
||||
|
||||
veHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddVideoTransition = new QPushButton(veHeader);
|
||||
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddVideoTransition->setToolTip("Add Video Transition");
|
||||
btnAddVideoTransition->setToolTip(tr("Add Video Transition"));
|
||||
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
||||
|
||||
veHeaderLayout->addWidget(btnAddVideoTransition);
|
||||
@@ -351,7 +351,7 @@ void EffectControls::setup_ui() {
|
||||
|
||||
QPushButton* btnAddAudioEffect = new QPushButton(aeHeader);
|
||||
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddAudioEffect->setToolTip("Add Audio Effect");
|
||||
btnAddAudioEffect->setToolTip(tr("Add Audio Effect"));
|
||||
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
||||
|
||||
@@ -360,14 +360,14 @@ void EffectControls::setup_ui() {
|
||||
QLabel* lblAudioEffects = new QLabel(aeHeader);
|
||||
lblAudioEffects->setFont(font);
|
||||
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
||||
lblAudioEffects->setText("AUDIO EFFECTS");
|
||||
lblAudioEffects->setText(tr("AUDIO EFFECTS"));
|
||||
aeHeaderLayout->addWidget(lblAudioEffects);
|
||||
|
||||
aeHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddAudioTransition = new QPushButton(aeHeader);
|
||||
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddAudioTransition->setToolTip("Add Audio Transition");
|
||||
btnAddAudioTransition->setToolTip(tr("Add Audio Transition"));
|
||||
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
||||
|
||||
@@ -384,7 +384,7 @@ void EffectControls::setup_ui() {
|
||||
|
||||
lblMultipleClipsSelected = new QLabel(effects_area);
|
||||
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
||||
lblMultipleClipsSelected->setText("(Multiple clips selected)");
|
||||
lblMultipleClipsSelected->setText(tr("(Multiple clips selected)"));
|
||||
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
||||
|
||||
effects_area_layout->addStretch();
|
||||
@@ -431,7 +431,7 @@ void EffectControls::setup_ui() {
|
||||
|
||||
splitter->addWidget(keyframeArea);
|
||||
|
||||
layout->addWidget(splitter);
|
||||
hlayout->addWidget(splitter);
|
||||
|
||||
setWidget(contents);
|
||||
}
|
||||
@@ -455,9 +455,9 @@ void EffectControls::load_effects() {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
open_effect(layout, c->effects.at(j));
|
||||
}
|
||||
} else if (mode == TA_OPENING_TRANSITION && c->get_opening_transition() != NULL) {
|
||||
} else if (mode == TA_OPENING_TRANSITION && c->get_opening_transition() != nullptr) {
|
||||
open_effect(layout, c->get_opening_transition());
|
||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != NULL) {
|
||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != nullptr) {
|
||||
open_effect(layout, c->get_closing_transition());
|
||||
}
|
||||
}
|
||||
@@ -533,21 +533,25 @@ bool EffectControls::is_focused() {
|
||||
if (this->hasFocus()) return true;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container->is_focused()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dout << "[WARNING] Tried to check focus of a NULL clip";
|
||||
qWarning() << "Tried to check focus of a nullptr clip";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
EffectsArea::EffectsArea(QWidget* parent) : QWidget(parent) {}
|
||||
EffectsArea::EffectsArea(QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{}
|
||||
|
||||
void EffectsArea::resizeEvent(QResizeEvent*) {
|
||||
parent_widget->setMinimumWidth(sizeHint().width());
|
||||
// parent_widget->setMinimumWidth(sizeHint().width());
|
||||
// parent_widget->resize(sizeHint().width(), parent_widget->height());
|
||||
// parent_widget->updateGeometry();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class ResizableScrollBar;
|
||||
class QLabel;
|
||||
class KeyframeView;
|
||||
class QScrollBar;
|
||||
class QHBoxLayout;
|
||||
|
||||
class EffectsArea : public QWidget {
|
||||
public:
|
||||
@@ -53,6 +54,8 @@ public:
|
||||
QScrollBar* verticalScrollBar;
|
||||
|
||||
QMutex effects_loaded;
|
||||
|
||||
|
||||
public slots:
|
||||
void update_keyframes();
|
||||
private slots:
|
||||
@@ -70,7 +73,7 @@ private:
|
||||
void show_effect_menu(int type, int subtype);
|
||||
void load_effects();
|
||||
void load_keyframes();
|
||||
void open_effect(QVBoxLayout* layout, Effect* e);
|
||||
void open_effect(QVBoxLayout* hlayout, Effect* e);
|
||||
|
||||
void setup_ui();
|
||||
|
||||
|
||||
+14
-10
@@ -17,10 +17,10 @@
|
||||
#include "panels.h"
|
||||
#include "debug.h"
|
||||
|
||||
GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(NULL) {
|
||||
GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(nullptr) {
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
setWindowTitle("Graph Editor");
|
||||
setWindowTitle(tr("Graph Editor"));
|
||||
resize(720, 480);
|
||||
|
||||
QWidget* main_widget = new QWidget();
|
||||
@@ -58,13 +58,13 @@ GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(NULL) {
|
||||
left_tool_layout->addWidget(keyframe_nav);
|
||||
left_tool_layout->addStretch();
|
||||
|
||||
linear_button = new QPushButton("Linear");
|
||||
linear_button = new QPushButton(tr("Linear"));
|
||||
linear_button->setProperty("type", KEYFRAME_TYPE_LINEAR);
|
||||
linear_button->setCheckable(true);
|
||||
bezier_button = new QPushButton("Bezier");
|
||||
bezier_button = new QPushButton(tr("Bezier"));
|
||||
bezier_button->setProperty("type", KEYFRAME_TYPE_BEZIER);
|
||||
bezier_button->setCheckable(true);
|
||||
hold_button = new QPushButton("Hold");
|
||||
hold_button = new QPushButton(tr("Hold"));
|
||||
hold_button->setProperty("type", KEYFRAME_TYPE_HOLD);
|
||||
hold_button->setCheckable(true);
|
||||
|
||||
@@ -120,7 +120,7 @@ GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(NULL) {
|
||||
|
||||
void GraphEditor::update_panel() {
|
||||
if (isVisible()) {
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
int slider_index = 0;
|
||||
for (int i=0;i<row->fieldCount();i++) {
|
||||
EffectField* field = row->field(i);
|
||||
@@ -145,7 +145,7 @@ void GraphEditor::set_row(EffectRow *r) {
|
||||
slider_proxy_buttons.clear();
|
||||
slider_proxy_sources.clear();
|
||||
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
// clear old row connections
|
||||
disconnect(keyframe_nav, SIGNAL(goto_previous_key()), row, SLOT(goto_previous_key()));
|
||||
disconnect(keyframe_nav, SIGNAL(toggle_key()), row, SLOT(toggle_key()));
|
||||
@@ -154,7 +154,7 @@ void GraphEditor::set_row(EffectRow *r) {
|
||||
|
||||
bool found_vals = false;
|
||||
|
||||
if (r != NULL && r->isKeyframing()) {
|
||||
if (r != nullptr && r->isKeyframing()) {
|
||||
for (int i=0;i<r->fieldCount();i++) {
|
||||
EffectField* field = r->field(i);
|
||||
if (field->type == EFFECT_FIELD_DOUBLE) {
|
||||
@@ -191,7 +191,7 @@ void GraphEditor::set_row(EffectRow *r) {
|
||||
connect(keyframe_nav, SIGNAL(toggle_key()), row, SLOT(toggle_key()));
|
||||
connect(keyframe_nav, SIGNAL(goto_next_key()), row, SLOT(goto_next_key()));
|
||||
} else {
|
||||
row = NULL;
|
||||
row = nullptr;
|
||||
current_row_desc->setText(0);
|
||||
}
|
||||
view->set_row(row);
|
||||
@@ -199,7 +199,11 @@ void GraphEditor::set_row(EffectRow *r) {
|
||||
}
|
||||
|
||||
bool GraphEditor::view_is_focused() {
|
||||
return view->hasFocus() || header->hasFocus();
|
||||
return view->hasFocus() || header->hasFocus();
|
||||
}
|
||||
|
||||
bool GraphEditor::view_is_under_mouse() {
|
||||
return view->underMouse() || header->underMouse();
|
||||
}
|
||||
|
||||
void GraphEditor::delete_selected_keys() {
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
void update_panel();
|
||||
void set_row(EffectRow* r);
|
||||
bool view_is_focused();
|
||||
bool view_is_under_mouse();
|
||||
void delete_selected_keys();
|
||||
void select_all();
|
||||
private:
|
||||
|
||||
+15
-11
@@ -30,10 +30,10 @@ void update_effect_controls() {
|
||||
int aclip = -1;
|
||||
QVector<int> selected_clips;
|
||||
int mode = TA_NO_TRANSITION;
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* clip = sequence->clips.at(i);
|
||||
if (clip != NULL) {
|
||||
if (clip != nullptr) {
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
bool add = true;
|
||||
@@ -113,7 +113,7 @@ void update_ui(bool modified) {
|
||||
}
|
||||
|
||||
QDockWidget *get_focused_panel() {
|
||||
QDockWidget* w = NULL;
|
||||
QDockWidget* w = nullptr;
|
||||
if (config.hover_focus) {
|
||||
if (panel_project->underMouse()) {
|
||||
w = panel_project;
|
||||
@@ -125,9 +125,11 @@ QDockWidget *get_focused_panel() {
|
||||
w = panel_footage_viewer;
|
||||
} else if (panel_timeline->underMouse()) {
|
||||
w = panel_timeline;
|
||||
}
|
||||
} else if (panel_graph_editor->view_is_under_mouse()) {
|
||||
w = panel_graph_editor;
|
||||
}
|
||||
}
|
||||
if (w == NULL) {
|
||||
if (w == nullptr) {
|
||||
if (panel_project->is_focused()) {
|
||||
w = panel_project;
|
||||
} else if (panel_effect_controls->keyframe_focus() || panel_effect_controls->is_focused()) {
|
||||
@@ -138,7 +140,9 @@ QDockWidget *get_focused_panel() {
|
||||
w = panel_footage_viewer;
|
||||
} else if (panel_timeline->focused()) {
|
||||
w = panel_timeline;
|
||||
}
|
||||
} else if (panel_graph_editor->view_is_focused()) {
|
||||
w = panel_graph_editor;
|
||||
}
|
||||
}
|
||||
return w;
|
||||
}
|
||||
@@ -162,15 +166,15 @@ void alloc_panels(QWidget* parent) {
|
||||
|
||||
void free_panels() {
|
||||
delete panel_sequence_viewer;
|
||||
panel_sequence_viewer = NULL;
|
||||
panel_sequence_viewer = nullptr;
|
||||
delete panel_footage_viewer;
|
||||
panel_footage_viewer = NULL;
|
||||
panel_footage_viewer = nullptr;
|
||||
delete panel_project;
|
||||
panel_project = NULL;
|
||||
panel_project = nullptr;
|
||||
delete panel_effect_controls;
|
||||
panel_effect_controls = NULL;
|
||||
panel_effect_controls = nullptr;
|
||||
delete panel_timeline;
|
||||
panel_timeline = NULL;
|
||||
panel_timeline = nullptr;
|
||||
}
|
||||
|
||||
void scroll_to_frame_internal(QScrollBar* bar, long frame, double zoom, int area_width) {
|
||||
|
||||
+89
-66
@@ -203,7 +203,7 @@ Project::Project(QWidget *parent) :
|
||||
connect(icon_view, SIGNAL(changed_root()), this, SLOT(set_up_dir_enabled()));
|
||||
|
||||
//retranslateUi(Project);
|
||||
setWindowTitle(QApplication::translate("Project", "Project", nullptr));
|
||||
setWindowTitle(tr("Project"));
|
||||
|
||||
update_view_type();
|
||||
}
|
||||
@@ -213,7 +213,7 @@ Project::~Project() {
|
||||
}
|
||||
|
||||
QString Project::get_next_sequence_name(QString start) {
|
||||
if (start.isEmpty()) start = "Sequence";
|
||||
if (start.isEmpty()) start = tr("Sequence");
|
||||
|
||||
int n = 1;
|
||||
bool found = true;
|
||||
@@ -262,7 +262,7 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
const FootageStream& ms = m->video_tracks.at(j);
|
||||
s->width = ms.video_width;
|
||||
s->height = ms.video_height;
|
||||
if (ms.video_frame_rate != 0) {
|
||||
if (!qFuzzyCompare(ms.video_frame_rate, 0.0)) {
|
||||
s->frame_rate = ms.video_frame_rate * m->speed;
|
||||
|
||||
if (ms.video_interlacing != VIDEO_PROGRESSIVE) s->frame_rate *= 2;
|
||||
@@ -273,13 +273,10 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!got_audio_values) {
|
||||
for (int j=0;j<m->audio_tracks.size();j++) {
|
||||
const FootageStream& ms = m->audio_tracks.at(j);
|
||||
s->audio_frequency = ms.audio_frequency;
|
||||
got_audio_values = true;
|
||||
break;
|
||||
}
|
||||
if (!got_audio_values && m->audio_tracks.size() > 0) {
|
||||
const FootageStream& ms = m->audio_tracks.at(0);
|
||||
s->audio_frequency = ms.audio_frequency;
|
||||
got_audio_values = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,7 +306,6 @@ void Project::duplicate_selected() {
|
||||
bool duped = false;
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int j=0;j<items.size();j++) {
|
||||
dout << "duplicate called";
|
||||
Media* i = item_to_media(items.at(j));
|
||||
if (i->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
new_sequence(ca, i->to_sequence()->copy(), false, item_to_media(items.at(j).parent()));
|
||||
@@ -328,14 +324,18 @@ void Project::replace_selected_file() {
|
||||
if (selected_items.size() == 1) {
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
if (item->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
replace_media(item, 0);
|
||||
replace_media(item, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Project::replace_media(Media* item, QString filename) {
|
||||
if (filename.isEmpty()) {
|
||||
filename = QFileDialog::getOpenFileName(this, "Replace '" + item->get_name() + "'", "", "All Files (*)");
|
||||
filename = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Replace '%1'").arg(item->get_name()),
|
||||
"",
|
||||
tr("All Files") + " (*)");
|
||||
}
|
||||
if (!filename.isEmpty()) {
|
||||
ReplaceMediaCommand* rmc = new ReplaceMediaCommand(item, filename);
|
||||
@@ -344,14 +344,20 @@ void Project::replace_media(Media* item, QString filename) {
|
||||
}
|
||||
|
||||
void Project::replace_clip_media() {
|
||||
if (sequence == NULL) {
|
||||
QMessageBox::critical(this, "No active sequence", "No sequence is active, please open the sequence you want to replace clips from.", QMessageBox::Ok);
|
||||
if (sequence == nullptr) {
|
||||
QMessageBox::critical(this,
|
||||
tr("No active sequence"),
|
||||
tr("No sequence is active, please open the sequence you want to replace clips from."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
QModelIndexList selected_items = get_current_selected();
|
||||
if (selected_items.size() == 1) {
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
if (item->get_type() == MEDIA_TYPE_SEQUENCE && sequence == item->to_sequence()) {
|
||||
QMessageBox::critical(this, "Active sequence selected", "You cannot insert a sequence into itself, so no clips of this media would be in this sequence.", QMessageBox::Ok);
|
||||
QMessageBox::critical(this,
|
||||
tr("Active sequence selected"),
|
||||
tr("You cannot insert a sequence into itself, so no clips of this media would be in this sequence."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
ReplaceClipMediaDialog dialog(this, item);
|
||||
dialog.exec();
|
||||
@@ -380,7 +386,11 @@ void Project::open_properties() {
|
||||
default:
|
||||
{
|
||||
// fall back to renaming
|
||||
QString new_name = QInputDialog::getText(this, "Rename '" + item->get_name() + "'", "Enter new name:", QLineEdit::Normal, item->get_name());
|
||||
QString new_name = QInputDialog::getText(this,
|
||||
tr("Rename '%1'").arg(item->get_name()),
|
||||
tr("Enter new name:"),
|
||||
QLineEdit::Normal,
|
||||
item->get_name());
|
||||
if (!new_name.isEmpty()) {
|
||||
MediaRename* mr = new MediaRename(item, new_name);
|
||||
undo_stack.push(mr);
|
||||
@@ -391,15 +401,19 @@ void Project::open_properties() {
|
||||
}
|
||||
|
||||
Media* Project::new_sequence(ComboAction *ca, Sequence *s, bool open, Media* parent) {
|
||||
if (parent == NULL) parent = project_model.get_root();
|
||||
if (parent == nullptr) parent = project_model.get_root();
|
||||
Media* item = new Media(parent);
|
||||
item->set_sequence(s);
|
||||
|
||||
if (ca != NULL) {
|
||||
if (ca != nullptr) {
|
||||
ca->append(new NewSequenceCommand(item, parent));
|
||||
if (open) ca->append(new ChangeSequenceAction(s));
|
||||
} else {
|
||||
project_model.appendChild(NULL, item);
|
||||
if (parent == project_model.get_root()) {
|
||||
project_model.appendChild(parent, item);
|
||||
} else {
|
||||
parent->appendChild(item);
|
||||
}
|
||||
if (open) set_sequence(s);
|
||||
}
|
||||
return item;
|
||||
@@ -420,8 +434,9 @@ bool Project::is_focused() {
|
||||
}
|
||||
|
||||
Media* Project::new_folder(QString name) {
|
||||
Media* item = new Media(0);
|
||||
Media* item = new Media(nullptr);
|
||||
item->set_folder();
|
||||
item->set_name(name);
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -488,15 +503,15 @@ void Project::delete_selected_media() {
|
||||
Sequence* s = sequence_items.at(j)->to_sequence();
|
||||
for (int k=0;k<s->clips.size();k++) {
|
||||
Clip* c = s->clips.at(k);
|
||||
if (c != NULL && c->media == item) {
|
||||
if (c != nullptr && c->media == item) {
|
||||
if (!confirm_delete) {
|
||||
// we found a reference, so we know we'll need to ask if the user wants to delete it
|
||||
QMessageBox confirm(this);
|
||||
confirm.setWindowTitle("Delete media in use?");
|
||||
confirm.setText("The media '" + media->name + "' is currently used in '" + s->name + "'. Deleting it will remove all instances in the sequence. Are you sure you want to do this?");
|
||||
confirm.setWindowTitle(tr("Delete media in use?"));
|
||||
confirm.setText(tr("The media '%1' is currently used in '%2'. Deleting it will remove all instances in the sequence. Are you sure you want to do this?").arg(media->name, s->name));
|
||||
QAbstractButton* yes_button = confirm.addButton(QMessageBox::Yes);
|
||||
QAbstractButton* skip_button = NULL;
|
||||
if (items.size() > 1) skip_button = confirm.addButton("Skip", QMessageBox::NoRole);
|
||||
QAbstractButton* skip_button = nullptr;
|
||||
if (items.size() > 1) skip_button = confirm.addButton(tr("Skip"), QMessageBox::NoRole);
|
||||
QAbstractButton* abort_button = confirm.addButton(QMessageBox::Cancel);
|
||||
confirm.exec();
|
||||
if (confirm.clickedButton() == yes_button) {
|
||||
@@ -506,7 +521,7 @@ void Project::delete_selected_media() {
|
||||
} else if (confirm.clickedButton() == skip_button) {
|
||||
// remove media item and any folders containing it from the remove list
|
||||
Media* parent = item;
|
||||
while (parent != NULL) {
|
||||
while (parent != nullptr) {
|
||||
parents.append(parent);
|
||||
|
||||
// re-add item's siblings
|
||||
@@ -553,7 +568,7 @@ void Project::delete_selected_media() {
|
||||
// remove
|
||||
if (remove) {
|
||||
panel_effect_controls->clear_effects(true);
|
||||
if (sequence != NULL) sequence->selections.clear();
|
||||
if (sequence != nullptr) sequence->selections.clear();
|
||||
|
||||
// remove media and parents
|
||||
for (int m=0;m<parents.size();m++) {
|
||||
@@ -574,20 +589,18 @@ void Project::delete_selected_media() {
|
||||
Sequence* s = items.at(i)->to_sequence();
|
||||
|
||||
if (s == sequence) {
|
||||
ca->append(new ChangeSequenceAction(NULL));
|
||||
ca->append(new ChangeSequenceAction(nullptr));
|
||||
}
|
||||
|
||||
if (s == panel_footage_viewer->seq) {
|
||||
panel_footage_viewer->set_media(NULL);
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
}
|
||||
} else if (items.at(i)->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (panel_footage_viewer->seq != NULL) {
|
||||
if (panel_footage_viewer->seq != nullptr) {
|
||||
for (int j=0;j<panel_footage_viewer->seq->clips.size();j++) {
|
||||
Clip* c = panel_footage_viewer->seq->clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c->media == items.at(i)->to_object()) {
|
||||
panel_footage_viewer->set_media(NULL);
|
||||
}
|
||||
if (c != nullptr && c->media == items.at(i)) {
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -627,8 +640,8 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
|
||||
if (!recursive) last_imported_media.clear();
|
||||
|
||||
bool create_undo_action = (!recursive && replace == NULL);
|
||||
ComboAction* ca;
|
||||
bool create_undo_action = (!recursive && replace == nullptr);
|
||||
ComboAction* ca = nullptr;
|
||||
if (create_undo_action) ca = new ComboAction();
|
||||
|
||||
for (int i=0;i<files.size();i++) {
|
||||
@@ -646,7 +659,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
subdir_filenames.append(subdir_files.at(j).filePath());
|
||||
}
|
||||
|
||||
process_file_list(subdir_filenames, true, NULL, folder);
|
||||
process_file_list(subdir_filenames, true, nullptr, folder);
|
||||
|
||||
if (create_undo_action) {
|
||||
ca->append(new AddMediaCommand(folder, parent));
|
||||
@@ -721,7 +734,11 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
}
|
||||
if (!found) {
|
||||
image_sequence_urls.append(new_filename);
|
||||
if (QMessageBox::question(this, "Image sequence detected", "The file '" + file + "' appears to be part of an image sequence. Would you like to import it as such?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
|
||||
if (QMessageBox::question(this,
|
||||
tr("Image sequence detected"),
|
||||
tr("The file '%1' appears to be part of an image sequence. Would you like to import it as such?").arg(file),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::Yes) == QMessageBox::Yes) {
|
||||
file = new_filename;
|
||||
image_sequence_importassequence.append(true);
|
||||
} else {
|
||||
@@ -735,7 +752,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
Media* item;
|
||||
Footage* m;
|
||||
|
||||
if (replace != NULL) {
|
||||
if (replace != nullptr) {
|
||||
item = replace;
|
||||
m = replace->to_footage();
|
||||
m->reset();
|
||||
@@ -750,16 +767,14 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
|
||||
item->set_footage(m);
|
||||
|
||||
// generate waveform/thumbnail in another thread
|
||||
start_preview_generator(item, replace != NULL);
|
||||
|
||||
last_imported_media.append(item);
|
||||
|
||||
if (replace == NULL) {
|
||||
if (replace == nullptr) {
|
||||
if (create_undo_action) {
|
||||
ca->append(new AddMediaCommand(item, parent));
|
||||
} else {
|
||||
project_model.appendChild(parent, item);
|
||||
parent->appendChild(item);
|
||||
// project_model.appendChild(parent, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,6 +785,11 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
if (create_undo_action) {
|
||||
if (imported) {
|
||||
undo_stack.push(ca);
|
||||
|
||||
for (int i=0;i<last_imported_media.size();i++) {
|
||||
// generate waveform/thumbnail in another thread
|
||||
start_preview_generator(last_imported_media.at(i), replace != nullptr);
|
||||
}
|
||||
} else {
|
||||
delete ca;
|
||||
}
|
||||
@@ -783,7 +803,7 @@ Media* Project::get_selected_folder() {
|
||||
Media* m = item_to_media(selected_items.at(0));
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) return m;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Project::reveal_media(Media *media, QModelIndex parent) {
|
||||
@@ -821,25 +841,28 @@ bool Project::reveal_media(Media *media, QModelIndex parent) {
|
||||
}
|
||||
|
||||
void Project::import_dialog() {
|
||||
QFileDialog fd(this, "Import media...", "", "All Files (*)");
|
||||
QFileDialog fd(this, tr("Import media..."), "", tr("All Files") + " (*)");
|
||||
fd.setFileMode(QFileDialog::ExistingFiles);
|
||||
|
||||
if (fd.exec()) {
|
||||
QStringList files = fd.selectedFiles();
|
||||
process_file_list(files, false, NULL, get_selected_folder());
|
||||
process_file_list(files, false, nullptr, get_selected_folder());
|
||||
}
|
||||
}
|
||||
|
||||
void Project::delete_clips_using_selected_media() {
|
||||
if (sequence == NULL) {
|
||||
QMessageBox::critical(this, "No active sequence", "No sequence is active, please open the sequence you want to delete clips from.", QMessageBox::Ok);
|
||||
if (sequence == nullptr) {
|
||||
QMessageBox::critical(this,
|
||||
tr("No active sequence"),
|
||||
tr("No sequence is active, please open the sequence you want to delete clips from."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
ComboAction* ca = new ComboAction();
|
||||
bool deleted = false;
|
||||
QModelIndexList items = get_current_selected();
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<items.size();j++) {
|
||||
Media* m = item_to_media(items.at(j));
|
||||
if (c->media == m) {
|
||||
@@ -870,7 +893,7 @@ void Project::clear() {
|
||||
QVector<Media*> sequences = list_all_project_sequences();
|
||||
for (int i=0;i<sequences.size();i++) {
|
||||
delete sequences.at(i)->to_sequence();
|
||||
sequences.at(i)->set_sequence(NULL);
|
||||
sequences.at(i)->set_sequence(nullptr);
|
||||
}
|
||||
|
||||
// delete everything else
|
||||
@@ -879,8 +902,8 @@ void Project::clear() {
|
||||
|
||||
void Project::new_project() {
|
||||
// clear existing project
|
||||
set_sequence(NULL);
|
||||
panel_footage_viewer->set_media(NULL);
|
||||
set_sequence(nullptr);
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
clear();
|
||||
mainWindow->setWindowModified(false);
|
||||
}
|
||||
@@ -893,7 +916,6 @@ void Project::load_project(bool autorecovery) {
|
||||
}
|
||||
|
||||
void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex& parent) {
|
||||
bool root = (!parent.parent().isValid());
|
||||
for (int i=0;i<project_model.rowCount(parent);i++) {
|
||||
const QModelIndex& item = project_model.index(i, 0, parent);
|
||||
Media* m = project_model.getItem(item);
|
||||
@@ -917,7 +939,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
}
|
||||
// save_folder(stream, item, type, set_ids_only);
|
||||
} else {
|
||||
int folder = root ? 0 : project_model.getItem(parent)->temp_id;
|
||||
int folder = (m->parentItem() != nullptr) ? m->parentItem()->temp_id : 0;
|
||||
if (type == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = m->to_footage();
|
||||
f->save_id = media_id;
|
||||
@@ -971,12 +993,13 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeAttribute("open", "1");
|
||||
}
|
||||
stream.writeAttribute("workarea", QString::number(s->using_workarea));
|
||||
stream.writeAttribute("workareaEnabled", QString::number(s->enable_workarea));
|
||||
stream.writeAttribute("workareaIn", QString::number(s->workarea_in));
|
||||
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
|
||||
|
||||
for (int j=0;j<s->transitions.size();j++) {
|
||||
Transition* t = s->transitions.at(j);
|
||||
if (t != NULL) {
|
||||
if (t != nullptr) {
|
||||
stream.writeStartElement("transition");
|
||||
stream.writeAttribute("id", QString::number(j));
|
||||
stream.writeAttribute("length", QString::number(t->get_true_length()));
|
||||
@@ -987,7 +1010,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
stream.writeStartElement("clip"); // clip
|
||||
stream.writeAttribute("id", QString::number(j));
|
||||
stream.writeAttribute("enabled", QString::number(c->enabled));
|
||||
@@ -1008,7 +1031,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeAttribute("maintainpitch", QString::number(c->maintain_audio_pitch));
|
||||
stream.writeAttribute("reverse", QString::number(c->reverse));
|
||||
|
||||
if (c->media != NULL) {
|
||||
if (c->media != nullptr) {
|
||||
stream.writeAttribute("type", QString::number(c->media->get_type()));
|
||||
switch (c->media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
@@ -1063,7 +1086,7 @@ void Project::save_project(bool autorecovery) {
|
||||
|
||||
QFile file(autorecovery ? autorecovery_filename : project_url);
|
||||
if (!file.open(QIODevice::WriteOnly/* | QIODevice::Text*/)) {
|
||||
dout << "[ERROR] Could not open file";
|
||||
qCritical() << "Could not open file";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1143,7 +1166,7 @@ void Project::save_recent_projects() {
|
||||
}
|
||||
f.close();
|
||||
} else {
|
||||
dout << "[WARNING] Could not save recent projects";
|
||||
qWarning() << "Could not save recent projects";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1205,7 +1228,7 @@ void Project::list_all_sequences_worker(QVector<Media*>* list, Media* parent) {
|
||||
|
||||
QVector<Media*> Project::list_all_project_sequences() {
|
||||
QVector<Media*> list;
|
||||
list_all_sequences_worker(&list, NULL);
|
||||
list_all_sequences_worker(&list, nullptr);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1219,7 +1242,7 @@ QModelIndexList Project::get_current_selected() {
|
||||
#define THROBBER_LIMIT 20
|
||||
#define THROBBER_SIZE 50
|
||||
|
||||
MediaThrobber::MediaThrobber(Media *i) : pixmap(":/icons/throbber.png"), animation(0), item(i), animator(NULL) {}
|
||||
MediaThrobber::MediaThrobber(Media *i) : pixmap(":/icons/throbber.png"), animation(0), item(i), animator(nullptr) {}
|
||||
|
||||
void MediaThrobber::start() {
|
||||
// set up throbber
|
||||
@@ -1239,7 +1262,7 @@ void MediaThrobber::animation_update() {
|
||||
}
|
||||
|
||||
void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
if (animator != NULL) {
|
||||
if (animator != nullptr) {
|
||||
animator->stop();
|
||||
delete animator;
|
||||
}
|
||||
@@ -1257,7 +1280,7 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
Sequence* s = sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
c->refresh();
|
||||
}
|
||||
}
|
||||
@@ -1267,6 +1290,6 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
update_ui(replace);
|
||||
|
||||
panel_project->tree_view->viewport()->update();
|
||||
item->throbber = NULL;
|
||||
item->throbber = nullptr;
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public:
|
||||
void clear();
|
||||
Media* new_sequence(ComboAction *ca, Sequence* s, bool open, Media* parent);
|
||||
QString get_next_sequence_name(QString start = 0);
|
||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = NULL, Media *parent = NULL);
|
||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
|
||||
void replace_media(Media* item, QString filename);
|
||||
Media *get_selected_folder();
|
||||
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
||||
|
||||
+127
-108
@@ -40,7 +40,7 @@
|
||||
#include <QStatusBar>
|
||||
|
||||
long refactor_frame_number(long framenumber, double source_frame_rate, double target_frame_rate) {
|
||||
return qRound(((double)framenumber/source_frame_rate)*target_frame_rate);
|
||||
return qRound((double(framenumber)/source_frame_rate)*target_frame_rate);
|
||||
}
|
||||
|
||||
Timeline::Timeline(QWidget *parent) :
|
||||
@@ -78,7 +78,7 @@ Timeline::Timeline(QWidget *parent) :
|
||||
|
||||
setup_ui();
|
||||
|
||||
default_track_height = (QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * TRACK_DEFAULT_HEIGHT;
|
||||
default_track_height = qRound((QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * TRACK_DEFAULT_HEIGHT);
|
||||
|
||||
headers->viewer = panel_sequence_viewer;
|
||||
|
||||
@@ -112,7 +112,7 @@ void Timeline::previous_cut() {
|
||||
long p_cut = 0;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_out > p_cut && c->timeline_out < sequence->playhead) {
|
||||
p_cut = c->timeline_out;
|
||||
} else if (c->timeline_in > p_cut && c->timeline_in < sequence->playhead) {
|
||||
@@ -129,7 +129,7 @@ void Timeline::next_cut() {
|
||||
long n_cut = LONG_MAX;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_in < n_cut && c->timeline_in > sequence->playhead) {
|
||||
n_cut = c->timeline_in;
|
||||
seek_enabled = true;
|
||||
@@ -150,7 +150,7 @@ void Timeline::toggle_show_all() {
|
||||
showing_all = !showing_all;
|
||||
if (showing_all) {
|
||||
old_zoom = zoom;
|
||||
set_zoom_value((double) (timeline_area->width() - 200) / (double) sequence->getEndFrame());
|
||||
set_zoom_value(double(timeline_area->width() - 200) / double(sequence->getEndFrame()));
|
||||
} else {
|
||||
set_zoom_value(old_zoom);
|
||||
}
|
||||
@@ -164,17 +164,15 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
bool can_import = true;
|
||||
|
||||
Media* medium = media_list.at(i);
|
||||
Footage* m = NULL;
|
||||
Sequence* s = NULL;
|
||||
void* media = NULL;
|
||||
long sequence_length;
|
||||
Footage* m = nullptr;
|
||||
Sequence* s = nullptr;
|
||||
long sequence_length = 0;
|
||||
long default_clip_in = 0;
|
||||
long default_clip_out = 0;
|
||||
|
||||
switch (medium->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
m = medium->to_footage();
|
||||
media = m;
|
||||
can_import = m->ready;
|
||||
if (m->using_inout) {
|
||||
double source_fr = 30;
|
||||
@@ -186,8 +184,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
s = medium->to_sequence();
|
||||
sequence_length = s->getEndFrame();
|
||||
if (seq != NULL) sequence_length = refactor_frame_number(sequence_length, s->frame_rate, seq->frame_rate);
|
||||
media = s;
|
||||
if (seq != nullptr) sequence_length = refactor_frame_number(sequence_length, s->frame_rate, seq->frame_rate);
|
||||
can_import = (s != seq && sequence_length != 0);
|
||||
if (s->using_workarea) {
|
||||
default_clip_in = refactor_frame_number(s->workarea_in, s->frame_rate, seq->frame_rate);
|
||||
@@ -205,7 +202,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
g.old_clip_in = g.clip_in = default_clip_in;
|
||||
g.media = medium;
|
||||
g.in = entry_point;
|
||||
g.transition = NULL;
|
||||
g.transition = nullptr;
|
||||
|
||||
switch (medium->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
@@ -240,7 +237,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
g.out = entry_point + sequence_length - default_clip_in;
|
||||
|
||||
if (s->using_workarea) {
|
||||
if (s->using_workarea && s->enable_workarea) {
|
||||
g.out -= (sequence_length - default_clip_out);
|
||||
}
|
||||
|
||||
@@ -354,13 +351,13 @@ void Timeline::add_transition() {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && is_clip_selected(c, true)) {
|
||||
if (c->get_opening_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, get_internal_meta(TRANSITION_INTERNAL_LINEARFADE, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
if (c->get_opening_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(TRANSITION_INTERNAL_LINEARFADE, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
adding = true;
|
||||
}
|
||||
if (c->get_closing_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, get_internal_meta(TRANSITION_INTERNAL_LINEARFADE, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
if (c->get_closing_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(TRANSITION_INTERNAL_LINEARFADE, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
adding = true;
|
||||
}
|
||||
}
|
||||
@@ -388,7 +385,7 @@ int Timeline::calculate_track_height(int track, int value) {
|
||||
}
|
||||
|
||||
void Timeline::update_sequence() {
|
||||
bool null_sequence = (sequence == NULL);
|
||||
bool null_sequence = (sequence == nullptr);
|
||||
|
||||
for (int i=0;i<tool_buttons.count();i++) {
|
||||
tool_buttons[i]->setEnabled(!null_sequence);
|
||||
@@ -400,10 +397,11 @@ void Timeline::update_sequence() {
|
||||
addButton->setEnabled(!null_sequence);
|
||||
headers->setEnabled(!null_sequence);
|
||||
|
||||
QString title = tr("Timeline: ");
|
||||
if (null_sequence) {
|
||||
setWindowTitle("Timeline: <none>");
|
||||
setWindowTitle(title + tr("<none>"));
|
||||
} else {
|
||||
setWindowTitle("Timeline: " + sequence->name);
|
||||
setWindowTitle(title + sequence->name);
|
||||
update_ui(false);
|
||||
}
|
||||
}
|
||||
@@ -413,14 +411,14 @@ int Timeline::get_snap_range() {
|
||||
}
|
||||
|
||||
bool Timeline::focused() {
|
||||
return (sequence != NULL && (headers->hasFocus() || video_area->hasFocus() || audio_area->hasFocus()));
|
||||
return (sequence != nullptr && (headers->hasFocus() || video_area->hasFocus() || audio_area->hasFocus()));
|
||||
}
|
||||
|
||||
void Timeline::repaint_timeline() {
|
||||
if (!block_repaints) {
|
||||
bool draw = true;
|
||||
|
||||
if (sequence != NULL
|
||||
if (sequence != nullptr
|
||||
&& !horizontalScrollBar->isSliderDown()
|
||||
&& !horizontalScrollBar->is_resizing()
|
||||
&& panel_sequence_viewer->playing
|
||||
@@ -446,7 +444,7 @@ void Timeline::repaint_timeline() {
|
||||
video_area->update();
|
||||
audio_area->update();
|
||||
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
set_sb_max();
|
||||
|
||||
if (last_frame != sequence->playhead) {
|
||||
@@ -459,11 +457,11 @@ void Timeline::repaint_timeline() {
|
||||
}
|
||||
|
||||
void Timeline::select_all() {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
sequence->selections.clear();
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
Selection s;
|
||||
s.in = c->timeline_in;
|
||||
s.out = c->timeline_out;
|
||||
@@ -479,12 +477,28 @@ void Timeline::scroll_to_frame(long frame) {
|
||||
scroll_to_frame_internal(horizontalScrollBar, frame, zoom, timeline_area->width());
|
||||
}
|
||||
|
||||
void Timeline::resizeEvent(QResizeEvent *event) {
|
||||
if (sequence != NULL) set_sb_max();
|
||||
void Timeline::select_from_playhead() {
|
||||
sequence->selections.clear();
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != nullptr
|
||||
&& c->timeline_in <= sequence->playhead
|
||||
&& c->timeline_out > sequence->playhead) {
|
||||
Selection s;
|
||||
s.in = c->timeline_in;
|
||||
s.out = c->timeline_out;
|
||||
s.track = c->track;
|
||||
sequence->selections.append(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Timeline::resizeEvent(QResizeEvent *) {
|
||||
if (sequence != nullptr) set_sb_max();
|
||||
}
|
||||
|
||||
void Timeline::delete_in_out(bool ripple) {
|
||||
if (sequence != NULL && sequence->using_workarea) {
|
||||
if (sequence != nullptr && sequence->using_workarea) {
|
||||
QVector<Selection> areas;
|
||||
int video_tracks = 0, audio_tracks = 0;
|
||||
sequence->getTrackLimits(&video_tracks, &audio_tracks);
|
||||
@@ -529,7 +543,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
||||
bool can_ripple = true;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && 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
|
||||
bool deleted = false;
|
||||
for (int j=0;j<selections.size();j++) {
|
||||
@@ -544,7 +558,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
||||
if (!deleted) {
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* cc = sequence->clips.at(j);
|
||||
if (cc != NULL
|
||||
if (cc != nullptr
|
||||
&& cc->track == c->track
|
||||
&& cc->timeline_in > c->timeline_out
|
||||
&& cc->timeline_in < c->timeline_out + ripple_length) {
|
||||
@@ -630,7 +644,7 @@ Clip* Timeline::split_clip(ComboAction* ca, int p, long frame) {
|
||||
|
||||
Clip* Timeline::split_clip(ComboAction* ca, int p, long frame, long post_in) {
|
||||
Clip* pre = sequence->clips.at(p);
|
||||
if (pre != NULL && 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
|
||||
Clip* post = pre->copy(sequence);
|
||||
|
||||
long new_clip_length = frame - pre->timeline_in;
|
||||
@@ -640,11 +654,11 @@ Clip* Timeline::split_clip(ComboAction* ca, int p, long frame, long post_in) {
|
||||
|
||||
move_clip(ca, pre, pre->timeline_in, frame, pre->clip_in, pre->track);
|
||||
|
||||
if (pre->get_opening_transition() != NULL) {
|
||||
/*if (frame < pre->timeline_in + pre->get_opening_transition()->length && pre->get_opening_transition()->secondary_clip != NULL) {
|
||||
if (pre->get_opening_transition() != nullptr) {
|
||||
/*if (frame < pre->timeline_in + pre->get_opening_transition()->length && pre->get_opening_transition()->secondary_clip != nullptr) {
|
||||
// separate shared transition
|
||||
ca->append(new SetPointer((void**) &pre->get_opening_transition()->secondary_clip, NULL));
|
||||
pre->get_opening_transition()->secondary_clip->closing_transition = pre->get_opening_transition()->copy(pre->get_opening_transition()->secondary_clip, NULL);
|
||||
ca->append(new SetPointer((void**) &pre->get_opening_transition()->secondary_clip, nullptr));
|
||||
pre->get_opening_transition()->secondary_clip->closing_transition = pre->get_opening_transition()->copy(pre->get_opening_transition()->secondary_clip, nullptr);
|
||||
}*/
|
||||
|
||||
if (pre->get_opening_transition()->get_true_length() > new_clip_length) {
|
||||
@@ -653,14 +667,14 @@ Clip* Timeline::split_clip(ComboAction* ca, int p, long frame, long post_in) {
|
||||
|
||||
post->sequence->hard_delete_transition(post, TA_OPENING_TRANSITION);
|
||||
}
|
||||
if (pre->get_closing_transition() != NULL) {
|
||||
if (pre->get_closing_transition() != nullptr) {
|
||||
ca->append(new DeleteTransitionCommand(pre->sequence, pre->closing_transition));
|
||||
if (pre->get_closing_transition()->secondary_clip == NULL) post->get_closing_transition()->set_length(qMin((long) post->get_closing_transition()->get_true_length(), post->getLength()));
|
||||
if (pre->get_closing_transition()->secondary_clip == nullptr) post->get_closing_transition()->set_length(qMin(long(post->get_closing_transition()->get_true_length()), post->getLength()));
|
||||
}
|
||||
|
||||
return post;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Timeline::has_clip_been_split(int c) {
|
||||
@@ -681,14 +695,14 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
||||
split_cache.append(clip);
|
||||
|
||||
Clip* c = sequence->clips.at(clip);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
QVector<int> pre_clips;
|
||||
QVector<Clip*> post_clips;
|
||||
|
||||
Clip* post = split_clip(ca, clip, frame);
|
||||
|
||||
// if alt is not down, split clips links too
|
||||
if (post == NULL) {
|
||||
if (post == nullptr) {
|
||||
return false;
|
||||
} else {
|
||||
post_clips.append(post);
|
||||
@@ -705,7 +719,7 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
||||
if ((original_clip_is_selected && is_clip_selected(link, true)) || !original_clip_is_selected) {
|
||||
split_cache.append(l);
|
||||
Clip* s = split_clip(ca, l, frame);
|
||||
if (s != NULL) {
|
||||
if (s != nullptr) {
|
||||
pre_clips.append(l);
|
||||
post_clips.append(s);
|
||||
}
|
||||
@@ -754,15 +768,15 @@ void Timeline::clean_up_selections(QVector<Selection>& areas) {
|
||||
|
||||
bool selection_contains_transition(const Selection& s, Clip* c, int type) {
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
return c->get_opening_transition() != NULL
|
||||
return c->get_opening_transition() != nullptr
|
||||
&& s.out == c->timeline_in + c->get_opening_transition()->get_true_length()
|
||||
&& ((c->get_opening_transition()->secondary_clip == NULL && s.in == c->timeline_in)
|
||||
|| (c->get_opening_transition()->secondary_clip != NULL && s.in == c->timeline_in - c->get_opening_transition()->get_true_length()));
|
||||
&& ((c->get_opening_transition()->secondary_clip == nullptr && s.in == c->timeline_in)
|
||||
|| (c->get_opening_transition()->secondary_clip != nullptr && s.in == c->timeline_in - c->get_opening_transition()->get_true_length()));
|
||||
} else {
|
||||
return c->get_closing_transition() != NULL
|
||||
return c->get_closing_transition() != nullptr
|
||||
&& s.in == c->timeline_out - c->get_closing_transition()->get_true_length()
|
||||
&& ((c->get_closing_transition()->secondary_clip == NULL && s.out == c->timeline_out)
|
||||
|| (c->get_closing_transition()->secondary_clip != NULL && s.out == c->timeline_out + c->get_closing_transition()->get_true_length()));
|
||||
&& ((c->get_closing_transition()->secondary_clip == nullptr && s.out == c->timeline_out)
|
||||
|| (c->get_closing_transition()->secondary_clip != nullptr && s.out == c->timeline_out + c->get_closing_transition()->get_true_length()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,7 +790,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
const Selection& s = areas.at(i);
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
if (c != NULL && c->track == s.track && !c->undeletable) {
|
||||
if (c != nullptr && c->track == s.track && !c->undeletable) {
|
||||
if (selection_contains_transition(s, c, TA_OPENING_TRANSITION)) {
|
||||
// delete opening transition
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
||||
@@ -798,7 +812,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
// only out point is in deletion area
|
||||
move_clip(ca, c, c->timeline_in, s.in, c->clip_in, c->track);
|
||||
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (c->get_closing_transition() != nullptr) {
|
||||
if (s.in < c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
||||
} else {
|
||||
@@ -809,7 +823,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
// only in point is in deletion area
|
||||
move_clip(ca, c, s.out, c->timeline_out, c->clip_in + (s.out - c->timeline_in), c->track);
|
||||
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (c->get_opening_transition() != nullptr) {
|
||||
if (s.out > c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
||||
} else {
|
||||
@@ -832,7 +846,7 @@ void Timeline::copy(bool del) {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
if (s.track == c->track && !((c->timeline_in <= s.in && c->timeline_out <= s.in) || (c->timeline_in >= s.out && c->timeline_out >= s.out))) {
|
||||
@@ -842,7 +856,7 @@ void Timeline::copy(bool del) {
|
||||
clipboard_type = CLIPBOARD_TYPE_CLIP;
|
||||
}
|
||||
|
||||
Clip* copied_clip = c->copy(NULL);
|
||||
Clip* copied_clip = c->copy(nullptr);
|
||||
|
||||
// copy linked IDs (we correct these later in paste())
|
||||
copied_clip->linked = c->linked;
|
||||
@@ -977,7 +991,7 @@ void Timeline::paste(bool insert) {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && is_clip_selected(c, true)) {
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
for (int j=0;j<clipboard.size();j++) {
|
||||
Effect* e = static_cast<Effect*>(clipboard.at(j));
|
||||
if ((c->track < 0) == (e->meta->subtype == EFFECT_TYPE_VIDEO)) {
|
||||
@@ -994,15 +1008,15 @@ void Timeline::paste(bool insert) {
|
||||
}
|
||||
if (found >= 0 && ask_conflict) {
|
||||
QMessageBox box(this);
|
||||
box.setWindowTitle("Effect already exists");
|
||||
box.setText("Clip '" + c->name + "' already contains a '" + e->meta->name + "' effect. Would you like to replace it with the pasted one or add it as a separate effect?");
|
||||
box.setWindowTitle(tr("Effect already exists"));
|
||||
box.setText(tr("Clip '%1' already contains a '%2' effect. Would you like to replace it with the pasted one or add it as a separate effect?").arg(c->name, e->meta->name));
|
||||
box.setIcon(QMessageBox::Icon::Question);
|
||||
|
||||
box.addButton("Add", QMessageBox::YesRole);
|
||||
QPushButton* replace_button = box.addButton("Replace", QMessageBox::NoRole);
|
||||
QPushButton* skip_button = box.addButton("Skip", QMessageBox::RejectRole);
|
||||
box.addButton(tr("Add"), QMessageBox::YesRole);
|
||||
QPushButton* replace_button = box.addButton(tr("Replace"), QMessageBox::NoRole);
|
||||
QPushButton* skip_button = box.addButton(tr("Skip"), QMessageBox::RejectRole);
|
||||
|
||||
QCheckBox* future_box = new QCheckBox("Do this for all conflicts found");
|
||||
QCheckBox* future_box = new QCheckBox(tr("Do this for all conflicts found"));
|
||||
box.setCheckBox(future_box);
|
||||
|
||||
box.exec();
|
||||
@@ -1023,10 +1037,10 @@ void Timeline::paste(bool insert) {
|
||||
delcom->fx.append(found);
|
||||
ca->append(delcom);
|
||||
|
||||
ca->append(new AddEffectCommand(c, e->copy(c), NULL, found));
|
||||
ca->append(new AddEffectCommand(c, e->copy(c), nullptr, found));
|
||||
push = true;
|
||||
} else {
|
||||
ca->append(new AddEffectCommand(c, e->copy(c), NULL));
|
||||
ca->append(new AddEffectCommand(c, e->copy(c), nullptr));
|
||||
push = true;
|
||||
}
|
||||
}
|
||||
@@ -1045,7 +1059,7 @@ void Timeline::paste(bool insert) {
|
||||
}
|
||||
|
||||
void Timeline::ripple_to_in_point(bool in, bool ripple) {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
if (sequence->clips.size() > 0) {
|
||||
// get track count
|
||||
int track_min = INT_MAX;
|
||||
@@ -1060,7 +1074,7 @@ void Timeline::ripple_to_in_point(bool in, bool ripple) {
|
||||
// find closest in point to playhead
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
track_min = qMin(track_min, c->track);
|
||||
track_max = qMax(track_max, c->track);
|
||||
|
||||
@@ -1164,7 +1178,7 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
// find clips within selection and split
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* clip = sequence->clips.at(j);
|
||||
if (clip != NULL) {
|
||||
if (clip != nullptr) {
|
||||
for (int i=0;i<sequence->selections.size();i++) {
|
||||
const Selection& s = sequence->selections.at(i);
|
||||
if (s.track == clip->track) {
|
||||
@@ -1181,12 +1195,12 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
split_B->timeline_in = s.out;
|
||||
secondary_post_splits.append(split_B);
|
||||
|
||||
if (clip->get_opening_transition() != NULL) {
|
||||
if (clip->get_opening_transition() != nullptr) {
|
||||
split_B->sequence->hard_delete_transition(split_B, TA_OPENING_TRANSITION);
|
||||
split_A->sequence->hard_delete_transition(split_A, TA_OPENING_TRANSITION);
|
||||
}
|
||||
|
||||
if (clip->get_closing_transition() != NULL) {
|
||||
if (clip->get_closing_transition() != nullptr) {
|
||||
ca->append(new DeleteTransitionCommand(clip->sequence, clip->closing_transition));
|
||||
|
||||
split_A->sequence->hard_delete_transition(split_A, TA_CLOSING_TRANSITION);
|
||||
@@ -1197,13 +1211,13 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
} else {
|
||||
Clip* post_a = split_clip(ca, j, s.in);
|
||||
Clip* post_b = split_clip(ca, j, s.out);
|
||||
if (post_a != NULL) {
|
||||
if (post_a != nullptr) {
|
||||
pre_splits.append(j);
|
||||
post_splits.append(post_a);
|
||||
split = true;
|
||||
}
|
||||
if (post_b != NULL) {
|
||||
if (post_a != NULL) {
|
||||
if (post_b != nullptr) {
|
||||
if (post_a != nullptr) {
|
||||
pre_splits.append(j);
|
||||
post_splits.append(post_b);
|
||||
} else {
|
||||
@@ -1233,7 +1247,7 @@ bool Timeline::split_all_clips_at_point(ComboAction* ca, long point) {
|
||||
bool split = false;
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
// always relinks
|
||||
if (split_clip_and_relink(ca, j, point, true)) {
|
||||
split = true;
|
||||
@@ -1254,9 +1268,9 @@ void Timeline::split_at_playhead() {
|
||||
QVector<Clip*> post_clips;
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* clip = sequence->clips.at(j);
|
||||
if (clip != NULL && is_clip_selected(clip, true)) {
|
||||
if (clip != nullptr && is_clip_selected(clip, true)) {
|
||||
Clip* s = split_clip(ca, j, sequence->playhead);
|
||||
if (s != NULL) {
|
||||
if (s != nullptr) {
|
||||
pre_clips.append(j);
|
||||
post_clips.append(s);
|
||||
split_selected = true;
|
||||
@@ -1352,15 +1366,15 @@ bool Timeline::snap_to_timeline(long* l, bool use_playhead, bool use_markers, bo
|
||||
// snap to clip/transition
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (snap_to_point(c->timeline_in, l)) {
|
||||
return true;
|
||||
} else if (snap_to_point(c->timeline_out, l)) {
|
||||
return true;
|
||||
} else if (c->get_opening_transition() != NULL
|
||||
} else if (c->get_opening_transition() != nullptr
|
||||
&& snap_to_point(c->timeline_in + c->get_opening_transition()->get_true_length(), l)) {
|
||||
return true;
|
||||
} else if (c->get_closing_transition() != NULL
|
||||
} else if (c->get_closing_transition() != nullptr
|
||||
&& snap_to_point(c->timeline_out - c->get_closing_transition()->get_true_length(), l)) {
|
||||
return true;
|
||||
}
|
||||
@@ -1376,8 +1390,8 @@ void Timeline::set_marker() {
|
||||
|
||||
if (!add_marker) {
|
||||
QInputDialog d(this);
|
||||
d.setWindowTitle("Set Marker");
|
||||
d.setLabelText("Set marker name:");
|
||||
d.setWindowTitle(tr("Set Marker"));
|
||||
d.setLabelText(tr("Set marker name:"));
|
||||
d.setInputMode(QInputDialog::TextInput);
|
||||
add_marker = (d.exec() == QDialog::Accepted);
|
||||
marker_name = d.textValue();
|
||||
@@ -1394,7 +1408,7 @@ void Timeline::toggle_links() {
|
||||
command->s = sequence;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && is_clip_selected(c, true)) {
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
if (!command->clips.contains(i)) command->clips.append(i);
|
||||
|
||||
if (c->linked.size() > 0) {
|
||||
@@ -1442,7 +1456,7 @@ void Timeline::deselect() {
|
||||
}
|
||||
|
||||
long getFrameFromScreenPoint(double zoom, int x) {
|
||||
long f = qCeil((float) x / zoom);
|
||||
long f = qCeil(double(x) / zoom);
|
||||
if (f < 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1450,7 +1464,7 @@ long getFrameFromScreenPoint(double zoom, int x) {
|
||||
}
|
||||
|
||||
int getScreenPointFromFrame(double zoom, long frame) {
|
||||
return (int) qFloor(frame*zoom);
|
||||
return qFloor(double(frame)*zoom);
|
||||
}
|
||||
|
||||
long Timeline::getTimelineFrameFromScreenPoint(int x) {
|
||||
@@ -1465,29 +1479,29 @@ void Timeline::add_btn_click() {
|
||||
QMenu add_menu(this);
|
||||
|
||||
QAction* titleMenuItem = new QAction(&add_menu);
|
||||
titleMenuItem->setText("Title...");
|
||||
titleMenuItem->setText(tr("Title..."));
|
||||
titleMenuItem->setData(ADD_OBJ_TITLE);
|
||||
add_menu.addAction(titleMenuItem);
|
||||
|
||||
QAction* solidMenuItem = new QAction(&add_menu);
|
||||
solidMenuItem->setText("Solid Color...");
|
||||
solidMenuItem->setText(tr("Solid Color..."));
|
||||
solidMenuItem->setData(ADD_OBJ_SOLID);
|
||||
add_menu.addAction(solidMenuItem);
|
||||
|
||||
QAction* barsMenuItem = new QAction(&add_menu);
|
||||
barsMenuItem->setText("Bars...");
|
||||
barsMenuItem->setText(tr("Bars..."));
|
||||
barsMenuItem->setData(ADD_OBJ_BARS);
|
||||
add_menu.addAction(barsMenuItem);
|
||||
|
||||
add_menu.addSeparator();
|
||||
|
||||
QAction* toneMenuItem = new QAction(&add_menu);
|
||||
toneMenuItem->setText("Tone...");
|
||||
toneMenuItem->setText(tr("Tone..."));
|
||||
toneMenuItem->setData(ADD_OBJ_TONE);
|
||||
add_menu.addAction(toneMenuItem);
|
||||
|
||||
QAction* noiseMenuItem = new QAction(&add_menu);
|
||||
noiseMenuItem->setText("Noise...");
|
||||
noiseMenuItem->setText(tr("Noise..."));
|
||||
noiseMenuItem->setData(ADD_OBJ_NOISE);
|
||||
add_menu.addAction(noiseMenuItem);
|
||||
|
||||
@@ -1509,11 +1523,16 @@ void Timeline::setScroll(int s) {
|
||||
|
||||
void Timeline::record_btn_click() {
|
||||
if (project_url.isEmpty()) {
|
||||
QMessageBox::critical(this, "Unsaved Project", "You must save this project before you can record audio in it.", QMessageBox::Ok);
|
||||
QMessageBox::critical(this,
|
||||
tr("Unsaved Project"),
|
||||
tr("You must save this project before you can record audio in it."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
creating = true;
|
||||
creating_object = ADD_OBJ_AUDIO;
|
||||
mainWindow->statusBar()->showMessage("Click on the timeline where you want to start recording (drag to limit the recording to a certain timeframe)", 10000);
|
||||
mainWindow->statusBar()->showMessage(
|
||||
tr("Click on the timeline where you want to start recording (drag to limit the recording to a certain timeframe)"),
|
||||
10000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1592,7 +1611,7 @@ void Timeline::setup_ui() {
|
||||
arrow_icon.addFile(QStringLiteral(":/icons/arrow-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
toolArrowButton->setIcon(arrow_icon);
|
||||
toolArrowButton->setCheckable(true);
|
||||
toolArrowButton->setToolTip("Pointer Tool (V)");
|
||||
toolArrowButton->setToolTip(tr("Pointer Tool") + " (V)");
|
||||
toolArrowButton->setProperty("tool", TIMELINE_TOOL_POINTER);
|
||||
connect(toolArrowButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolArrowButton);
|
||||
@@ -1603,7 +1622,7 @@ void Timeline::setup_ui() {
|
||||
icon1.addFile(QStringLiteral(":/icons/beam-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
toolEditButton->setIcon(icon1);
|
||||
toolEditButton->setCheckable(true);
|
||||
toolEditButton->setToolTip("Edit Tool (X)");
|
||||
toolEditButton->setToolTip(tr("Edit Tool") + " (X)");
|
||||
toolEditButton->setProperty("tool", TIMELINE_TOOL_EDIT);
|
||||
connect(toolEditButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolEditButton);
|
||||
@@ -1614,7 +1633,7 @@ void Timeline::setup_ui() {
|
||||
icon2.addFile(QStringLiteral(":/icons/ripple-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
toolRippleButton->setIcon(icon2);
|
||||
toolRippleButton->setCheckable(true);
|
||||
toolRippleButton->setToolTip("Ripple Tool (B)");
|
||||
toolRippleButton->setToolTip(tr("Ripple Tool") + " (B)");
|
||||
toolRippleButton->setProperty("tool", TIMELINE_TOOL_RIPPLE);
|
||||
connect(toolRippleButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolRippleButton);
|
||||
@@ -1625,7 +1644,7 @@ void Timeline::setup_ui() {
|
||||
icon4.addFile(QStringLiteral(":/icons/razor-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
toolRazorButton->setIcon(icon4);
|
||||
toolRazorButton->setCheckable(true);
|
||||
toolRazorButton->setToolTip("Razor Tool (C)");
|
||||
toolRazorButton->setToolTip(tr("Razor Tool") + " (C)");
|
||||
toolRazorButton->setProperty("tool", TIMELINE_TOOL_RAZOR);
|
||||
connect(toolRazorButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolRazorButton);
|
||||
@@ -1636,7 +1655,7 @@ void Timeline::setup_ui() {
|
||||
icon5.addFile(QStringLiteral(":/icons/slip-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
toolSlipButton->setIcon(icon5);
|
||||
toolSlipButton->setCheckable(true);
|
||||
toolSlipButton->setToolTip("Slip Tool (Y)");
|
||||
toolSlipButton->setToolTip(tr("Slip Tool") + " (Y)");
|
||||
toolSlipButton->setProperty("tool", TIMELINE_TOOL_SLIP);
|
||||
connect(toolSlipButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolSlipButton);
|
||||
@@ -1647,7 +1666,7 @@ void Timeline::setup_ui() {
|
||||
icon6.addFile(QStringLiteral(":/icons/slide-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
toolSlideButton->setIcon(icon6);
|
||||
toolSlideButton->setCheckable(true);
|
||||
toolSlideButton->setToolTip("Slide Tool (U)");
|
||||
toolSlideButton->setToolTip(tr("Slide Tool") + " (U)");
|
||||
toolSlideButton->setProperty("tool", TIMELINE_TOOL_SLIDE);
|
||||
connect(toolSlideButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolSlideButton);
|
||||
@@ -1658,7 +1677,7 @@ void Timeline::setup_ui() {
|
||||
icon7.addFile(QStringLiteral(":/icons/hand-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
toolHandButton->setIcon(icon7);
|
||||
toolHandButton->setCheckable(true);
|
||||
toolHandButton->setToolTip("Hand Tool (H)");
|
||||
toolHandButton->setToolTip(tr("Hand Tool") + " (H)");
|
||||
toolHandButton->setProperty("tool", TIMELINE_TOOL_HAND);
|
||||
connect(toolHandButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolHandButton);
|
||||
@@ -1669,7 +1688,7 @@ void Timeline::setup_ui() {
|
||||
icon8.addFile(QStringLiteral(":/icons/transition-tool-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
toolTransitionButton->setIcon(icon8);
|
||||
toolTransitionButton->setCheckable(true);
|
||||
toolTransitionButton->setToolTip("Transition Tool (T)");
|
||||
toolTransitionButton->setToolTip(tr("Transition Tool") + " (T)");
|
||||
connect(toolTransitionButton, SIGNAL(clicked(bool)), this, SLOT(transition_tool_click()));
|
||||
tool_buttons_layout->addWidget(toolTransitionButton);
|
||||
|
||||
@@ -1680,7 +1699,7 @@ void Timeline::setup_ui() {
|
||||
snappingButton->setIcon(icon9);
|
||||
snappingButton->setCheckable(true);
|
||||
snappingButton->setChecked(true);
|
||||
snappingButton->setToolTip("Snapping (S)");
|
||||
snappingButton->setToolTip(tr("Snapping") + " (S)");
|
||||
connect(snappingButton, SIGNAL(toggled(bool)), this, SLOT(snapping_clicked(bool)));
|
||||
tool_buttons_layout->addWidget(snappingButton);
|
||||
|
||||
@@ -1689,7 +1708,7 @@ void Timeline::setup_ui() {
|
||||
icon10.addFile(QStringLiteral(":/icons/zoomin.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
icon10.addFile(QStringLiteral(":/icons/zoomin-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
zoomInButton->setIcon(icon10);
|
||||
zoomInButton->setToolTip("Zoom In (=)");
|
||||
zoomInButton->setToolTip(tr("Zoom In") + " (=)");
|
||||
connect(zoomInButton, SIGNAL(clicked(bool)), this, SLOT(zoom_in()));
|
||||
tool_buttons_layout->addWidget(zoomInButton);
|
||||
|
||||
@@ -1698,7 +1717,7 @@ void Timeline::setup_ui() {
|
||||
icon11.addFile(QStringLiteral(":/icons/zoomout.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
icon11.addFile(QStringLiteral(":/icons/zoomout-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
zoomOutButton->setIcon(icon11);
|
||||
zoomOutButton->setToolTip("Zoom Out (-)");
|
||||
zoomOutButton->setToolTip(tr("Zoom Out") + " (-)");
|
||||
connect(zoomOutButton, SIGNAL(clicked(bool)), this, SLOT(zoom_out()));
|
||||
tool_buttons_layout->addWidget(zoomOutButton);
|
||||
|
||||
@@ -1707,7 +1726,7 @@ void Timeline::setup_ui() {
|
||||
icon12.addFile(QStringLiteral(":/icons/record.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
icon12.addFile(QStringLiteral(":/icons/record-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
recordButton->setIcon(icon12);
|
||||
recordButton->setToolTip("Record audio");
|
||||
recordButton->setToolTip(tr("Record audio"));
|
||||
connect(recordButton, SIGNAL(clicked(bool)), this, SLOT(record_btn_click()));
|
||||
|
||||
tool_buttons_layout->addWidget(recordButton);
|
||||
@@ -1717,7 +1736,7 @@ void Timeline::setup_ui() {
|
||||
icon13.addFile(QStringLiteral(":/icons/add-button.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
icon13.addFile(QStringLiteral(":/icons/add-button-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
addButton->setIcon(icon13);
|
||||
addButton->setToolTip("Add title, solid, bars, etc.");
|
||||
addButton->setToolTip(tr("Add title, solid, bars, etc."));
|
||||
connect(addButton, SIGNAL(clicked()), this, SLOT(add_btn_click()));
|
||||
tool_buttons_layout->addWidget(addButton);
|
||||
|
||||
@@ -1806,16 +1825,16 @@ void move_clip(ComboAction* ca, Clip *c, long iin, long iout, long iclip_in, int
|
||||
ca->append(new MoveClipAction(c, iin, iout, iclip_in, itrack, relative));
|
||||
|
||||
if (verify_transitions) {
|
||||
if (c->get_opening_transition() != NULL && c->get_opening_transition()->secondary_clip != NULL && c->get_opening_transition()->secondary_clip->timeline_out != iin) {
|
||||
if (c->get_opening_transition() != nullptr && c->get_opening_transition()->secondary_clip != nullptr && c->get_opening_transition()->secondary_clip->timeline_out != iin) {
|
||||
// separate transition
|
||||
ca->append(new SetPointer((void**) &c->get_opening_transition()->secondary_clip, NULL));
|
||||
ca->append(new AddTransitionCommand(c->get_opening_transition()->secondary_clip, NULL, c->get_opening_transition(), NULL, TA_CLOSING_TRANSITION, 0));
|
||||
ca->append(new SetPointer(reinterpret_cast<void**>(&c->get_opening_transition()->secondary_clip), nullptr));
|
||||
ca->append(new AddTransitionCommand(c->get_opening_transition()->secondary_clip, nullptr, c->get_opening_transition(), nullptr, TA_CLOSING_TRANSITION, 0));
|
||||
}
|
||||
|
||||
if (c->get_closing_transition() != NULL && c->get_closing_transition()->secondary_clip != NULL && c->get_closing_transition()->parent_clip->timeline_in != iout) {
|
||||
if (c->get_closing_transition() != nullptr && c->get_closing_transition()->secondary_clip != nullptr && c->get_closing_transition()->parent_clip->timeline_in != iout) {
|
||||
// separate transition
|
||||
ca->append(new SetPointer((void**) &c->get_closing_transition()->secondary_clip, NULL));
|
||||
ca->append(new AddTransitionCommand(c, NULL, c->get_closing_transition(), NULL, TA_CLOSING_TRANSITION, 0));
|
||||
ca->append(new SetPointer(reinterpret_cast<void**>(&c->get_closing_transition()->secondary_clip), nullptr));
|
||||
ca->append(new AddTransitionCommand(c, nullptr, c->get_closing_transition(), nullptr, TA_CLOSING_TRANSITION, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ public:
|
||||
QPushButton* snappingButton;
|
||||
|
||||
void scroll_to_frame(long frame);
|
||||
void select_from_playhead();
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
public slots:
|
||||
|
||||
+70
-35
@@ -40,11 +40,11 @@ Viewer::Viewer(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
playing(false),
|
||||
just_played(false),
|
||||
media(NULL),
|
||||
seq(NULL),
|
||||
media(nullptr),
|
||||
seq(nullptr),
|
||||
created_sequence(false),
|
||||
cue_recording_internal(false),
|
||||
panel_name("Viewer: "),
|
||||
panel_name(tr("Viewer: ")),
|
||||
minimum_zoom(1.0)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
@@ -57,7 +57,7 @@ Viewer::Viewer(QWidget *parent) :
|
||||
viewer_container->viewer = this;
|
||||
viewer_widget = viewer_container->child;
|
||||
viewer_widget->viewer = this;
|
||||
set_media(NULL);
|
||||
set_media(nullptr);
|
||||
|
||||
currentTimecode->setEnabled(false);
|
||||
currentTimecode->set_minimum_value(0);
|
||||
@@ -90,6 +90,10 @@ bool Viewer::is_focused() {
|
||||
|| btnSkipToEnd->hasFocus();
|
||||
}
|
||||
|
||||
bool Viewer::is_main_sequence() {
|
||||
return main_sequence;
|
||||
}
|
||||
|
||||
void Viewer::set_main_sequence() {
|
||||
clean_created_seq();
|
||||
set_sequence(true, sequence);
|
||||
@@ -97,13 +101,13 @@ void Viewer::set_main_sequence() {
|
||||
|
||||
void Viewer::reset_all_audio() {
|
||||
// reset all clip audio
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
audio_ibuffer_frame = seq->playhead;
|
||||
audio_ibuffer_timecode = (double) audio_ibuffer_frame / seq->frame_rate;
|
||||
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
if (c != NULL) c->reset_audio();
|
||||
if (c != nullptr) c->reset_audio();
|
||||
}
|
||||
}
|
||||
clear_audio_ibuffer();
|
||||
@@ -238,26 +242,35 @@ bool frame_rate_is_droppable(float rate) {
|
||||
void Viewer::seek(long p) {
|
||||
pause();
|
||||
seq->playhead = p;
|
||||
bool update_fx = false;
|
||||
if (main_sequence) {
|
||||
panel_timeline->scroll_to_frame(p);
|
||||
panel_effect_controls->scroll_to_frame(p);
|
||||
if (config.seek_also_selects) {
|
||||
panel_timeline->select_from_playhead();
|
||||
update_fx = true;
|
||||
}
|
||||
}
|
||||
update_parents();
|
||||
update_parents(update_fx);
|
||||
reset_all_audio();
|
||||
audio_scrub = true;
|
||||
}
|
||||
|
||||
void Viewer::go_to_start() {
|
||||
if (seq != NULL) seek(0);
|
||||
if (seq != nullptr) seek(0);
|
||||
}
|
||||
|
||||
void Viewer::go_to_end() {
|
||||
if (seq != NULL) seek(seq->getEndFrame());
|
||||
if (seq != nullptr) seek(seq->getEndFrame());
|
||||
}
|
||||
|
||||
void Viewer::close_media() {
|
||||
set_media(nullptr);
|
||||
}
|
||||
|
||||
void Viewer::go_to_in() {
|
||||
if (seq != NULL) {
|
||||
if (seq->using_workarea) {
|
||||
if (seq != nullptr) {
|
||||
if (seq->using_workarea && seq->enable_workarea) {
|
||||
seek(seq->workarea_in);
|
||||
} else {
|
||||
go_to_start();
|
||||
@@ -266,16 +279,16 @@ void Viewer::go_to_in() {
|
||||
}
|
||||
|
||||
void Viewer::previous_frame() {
|
||||
if (seq != NULL && seq->playhead > 0) seek(seq->playhead-1);
|
||||
if (seq != nullptr && seq->playhead > 0) seek(seq->playhead-1);
|
||||
}
|
||||
|
||||
void Viewer::next_frame() {
|
||||
if (seq != NULL) seek(seq->playhead+1);
|
||||
if (seq != nullptr) seek(seq->playhead+1);
|
||||
}
|
||||
|
||||
void Viewer::go_to_out() {
|
||||
if (seq != NULL) {
|
||||
if (seq->using_workarea) {
|
||||
if (seq != nullptr) {
|
||||
if (seq->using_workarea && seq->enable_workarea) {
|
||||
seek(seq->workarea_out);
|
||||
} else {
|
||||
go_to_end();
|
||||
@@ -314,7 +327,7 @@ void Viewer::play() {
|
||||
if (panel_sequence_viewer->playing) panel_sequence_viewer->pause();
|
||||
if (panel_footage_viewer->playing) panel_footage_viewer->pause();
|
||||
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
if (!is_recording_cued()
|
||||
&& seq->playhead >= get_seq_out()
|
||||
&& (config.loop || !main_sequence)) {
|
||||
@@ -323,7 +336,7 @@ void Viewer::play() {
|
||||
|
||||
reset_all_audio();
|
||||
if (is_recording_cued() && !start_recording()) {
|
||||
dout << "[ERROR] Failed to record audio";
|
||||
qCritical() << "Failed to record audio";
|
||||
return;
|
||||
}
|
||||
playhead_start = seq->playhead;
|
||||
@@ -339,7 +352,7 @@ void Viewer::play_wake() {
|
||||
if (just_played) {
|
||||
start_msecs = QDateTime::currentMSecsSinceEpoch();
|
||||
playback_updater.start();
|
||||
if (audio_thread != NULL) audio_thread->notifyReceiver();
|
||||
if (audio_thread != nullptr) audio_thread->notifyReceiver();
|
||||
just_played = false;
|
||||
}
|
||||
}
|
||||
@@ -393,11 +406,11 @@ void Viewer::update_playhead_timecode(long p) {
|
||||
}
|
||||
|
||||
void Viewer::update_end_timecode() {
|
||||
endTimecode->setText((seq == NULL) ? frame_to_timecode(0, config.timecode_view, 30) : frame_to_timecode(seq->getEndFrame(), config.timecode_view, seq->frame_rate));
|
||||
endTimecode->setText((seq == nullptr) ? frame_to_timecode(0, config.timecode_view, 30) : frame_to_timecode(seq->getEndFrame(), config.timecode_view, seq->frame_rate));
|
||||
}
|
||||
|
||||
void Viewer::update_header_zoom() {
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
long sequenceEndFrame = seq->getEndFrame();
|
||||
if (cached_end_frame != sequenceEndFrame) {
|
||||
minimum_zoom = (sequenceEndFrame > 0) ? ((double) headers->width() / (double) sequenceEndFrame) : 1;
|
||||
@@ -410,16 +423,16 @@ void Viewer::update_header_zoom() {
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::update_parents() {
|
||||
void Viewer::update_parents(bool reload_fx) {
|
||||
if (main_sequence) {
|
||||
update_ui(false);
|
||||
update_ui(reload_fx);
|
||||
} else {
|
||||
update_viewer();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::resizeEvent(QResizeEvent *event) {
|
||||
if (seq != NULL) {
|
||||
void Viewer::resizeEvent(QResizeEvent *) {
|
||||
if (seq != nullptr) {
|
||||
set_sb_max();
|
||||
}
|
||||
}
|
||||
@@ -427,10 +440,24 @@ void Viewer::resizeEvent(QResizeEvent *event) {
|
||||
void Viewer::update_viewer() {
|
||||
update_header_zoom();
|
||||
viewer_widget->update();
|
||||
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
||||
if (seq != nullptr) update_playhead_timecode(seq->playhead);
|
||||
update_end_timecode();
|
||||
}
|
||||
|
||||
void Viewer::clear_in() {
|
||||
if (seq->using_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(seq, true, 0, seq->workarea_out));
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::clear_out() {
|
||||
if (seq->using_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(seq, true, seq->workarea_in, seq->getEndFrame()));
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::clear_inout_point() {
|
||||
if (seq->using_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(seq, false, 0, 0));
|
||||
@@ -438,6 +465,13 @@ void Viewer::clear_inout_point() {
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::toggle_enable_inout() {
|
||||
if (seq != nullptr && seq->using_workarea) {
|
||||
undo_stack.push(new SetBool(&seq->enable_workarea, !seq->enable_workarea));
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::set_in_point() {
|
||||
headers->set_in_point(seq->playhead);
|
||||
}
|
||||
@@ -447,7 +481,7 @@ void Viewer::set_out_point() {
|
||||
}
|
||||
|
||||
void Viewer::set_zoom(bool in) {
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
set_zoom_value(in ? headers->get_zoom()*2 : qMax(minimum_zoom, headers->get_zoom()*0.5));
|
||||
}
|
||||
}
|
||||
@@ -458,7 +492,7 @@ void Viewer::set_zoom_value(double d) {
|
||||
viewer_widget->waveform_zoom = d;
|
||||
viewer_widget->update();
|
||||
}
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
set_sb_max();
|
||||
if (!horizontal_bar->is_resizing())
|
||||
center_scroll_to_playhead(horizontal_bar, headers->get_zoom(), seq->playhead);
|
||||
@@ -470,13 +504,13 @@ void Viewer::set_sb_max() {
|
||||
}
|
||||
|
||||
long Viewer::get_seq_in() {
|
||||
return (seq->using_workarea)
|
||||
return (seq->using_workarea && seq->enable_workarea)
|
||||
? seq->workarea_in
|
||||
: 0;
|
||||
}
|
||||
|
||||
long Viewer::get_seq_out() {
|
||||
return (seq->using_workarea && previous_playhead < seq->workarea_out)
|
||||
return (seq->using_workarea && seq->enable_workarea && previous_playhead < seq->workarea_out)
|
||||
? seq->workarea_out
|
||||
: seq->getEndFrame();
|
||||
}
|
||||
@@ -583,7 +617,7 @@ void Viewer::set_media(Media* m) {
|
||||
main_sequence = false;
|
||||
media = m;
|
||||
clean_created_seq();
|
||||
if (media != NULL) {
|
||||
if (media != nullptr) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
@@ -666,7 +700,8 @@ void Viewer::timer_update() {
|
||||
previous_playhead = seq->playhead;
|
||||
|
||||
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
||||
update_parents();
|
||||
if (config.seek_also_selects) panel_timeline->select_from_playhead();
|
||||
update_parents(config.seek_also_selects);
|
||||
|
||||
long end_frame = get_seq_out();
|
||||
if (!recording
|
||||
@@ -706,7 +741,7 @@ void Viewer::clean_created_seq() {
|
||||
}*/
|
||||
|
||||
delete seq;
|
||||
seq = NULL;
|
||||
seq = nullptr;
|
||||
created_sequence = false;
|
||||
}
|
||||
}
|
||||
@@ -716,14 +751,14 @@ void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
|
||||
reset_all_audio();
|
||||
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
closeActiveClips(seq);
|
||||
}
|
||||
|
||||
main_sequence = main;
|
||||
seq = (main) ? sequence : s;
|
||||
|
||||
bool null_sequence = (seq == NULL);
|
||||
bool null_sequence = (seq == nullptr);
|
||||
|
||||
headers->setEnabled(!null_sequence);
|
||||
currentTimecode->setEnabled(!null_sequence);
|
||||
@@ -750,7 +785,7 @@ void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
setWindowTitle(panel_name + tr("(none)"));
|
||||
}
|
||||
|
||||
update_header_zoom();
|
||||
|
||||
+6
-1
@@ -29,6 +29,7 @@ public:
|
||||
~Viewer();
|
||||
|
||||
bool is_focused();
|
||||
bool is_main_sequence();
|
||||
void set_main_sequence();
|
||||
void set_media(Media *m);
|
||||
void compose();
|
||||
@@ -37,7 +38,10 @@ public:
|
||||
void update_end_timecode();
|
||||
void update_header_zoom();
|
||||
void update_viewer();
|
||||
void clear_in();
|
||||
void clear_out();
|
||||
void clear_inout_point();
|
||||
void toggle_enable_inout();
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
void set_zoom(bool in);
|
||||
@@ -60,7 +64,7 @@ public:
|
||||
int recording_track;
|
||||
|
||||
void reset_all_audio();
|
||||
void update_parents();
|
||||
void update_parents(bool reload_fx = false);
|
||||
|
||||
ViewerWidget* viewer_widget;
|
||||
|
||||
@@ -78,6 +82,7 @@ public slots:
|
||||
void next_frame();
|
||||
void go_to_out();
|
||||
void go_to_end();
|
||||
void close_media();
|
||||
|
||||
private slots:
|
||||
void update_playhead();
|
||||
|
||||
Reference in New Issue
Block a user