began transition rewrite
This commit is contained in:
+394
-394
@@ -52,567 +52,567 @@
|
||||
#include "debug.h"
|
||||
|
||||
EffectControls::EffectControls(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
multiple(false),
|
||||
zoom(1),
|
||||
panel_name(tr("Effects: ")),
|
||||
mode(TA_NO_TRANSITION)
|
||||
QDockWidget(parent),
|
||||
multiple(false),
|
||||
zoom(1),
|
||||
panel_name(tr("Effects: ")),
|
||||
mode(kTransitionNone)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
setup_ui();
|
||||
setup_ui();
|
||||
|
||||
clear_effects(false);
|
||||
headers->viewer = panel_sequence_viewer;
|
||||
headers->snapping = false;
|
||||
clear_effects(false);
|
||||
headers->viewer = panel_sequence_viewer;
|
||||
headers->snapping = false;
|
||||
|
||||
effects_area->parent_widget = scrollArea;
|
||||
effects_area->keyframe_area = keyframeView;
|
||||
effects_area->header = headers;
|
||||
keyframeView->header = headers;
|
||||
effects_area->parent_widget = scrollArea;
|
||||
effects_area->keyframe_area = keyframeView;
|
||||
effects_area->header = headers;
|
||||
keyframeView->header = headers;
|
||||
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
|
||||
connect(keyframeView, SIGNAL(wheel_event_signal(QWheelEvent*)), effects_area, SLOT(receive_wheel_event(QWheelEvent*)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
||||
connect(horizontalScrollBar, SIGNAL(resize_move(double)), keyframeView, SLOT(resize_move(double)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_x_scroll(int)));
|
||||
connect(verticalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_y_scroll(int)));
|
||||
connect(verticalScrollBar, SIGNAL(valueChanged(int)), scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
||||
connect(scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), verticalScrollBar, SLOT(setValue(int)));
|
||||
connect(keyframeView, SIGNAL(wheel_event_signal(QWheelEvent*)), effects_area, SLOT(receive_wheel_event(QWheelEvent*)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
||||
connect(horizontalScrollBar, SIGNAL(resize_move(double)), keyframeView, SLOT(resize_move(double)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_x_scroll(int)));
|
||||
connect(verticalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_y_scroll(int)));
|
||||
connect(verticalScrollBar, SIGNAL(valueChanged(int)), scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
||||
connect(scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), verticalScrollBar, SLOT(setValue(int)));
|
||||
}
|
||||
|
||||
EffectControls::~EffectControls() {}
|
||||
|
||||
int EffectControls::get_mode() {
|
||||
return mode;
|
||||
return mode;
|
||||
}
|
||||
|
||||
bool EffectControls::keyframe_focus() {
|
||||
return headers->hasFocus() || keyframeView->hasFocus();
|
||||
return headers->hasFocus() || keyframeView->hasFocus();
|
||||
}
|
||||
|
||||
void EffectControls::set_zoom(bool in) {
|
||||
zoom *= (in) ? 2 : 0.5;
|
||||
update_keyframes();
|
||||
zoom *= (in) ? 2 : 0.5;
|
||||
update_keyframes();
|
||||
}
|
||||
|
||||
void EffectControls::menu_select(QAction* q) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
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() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, TA_OPENING_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, nullptr, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||
update_ui(true);
|
||||
} else {
|
||||
reload_clips();
|
||||
panel_sequence_viewer->viewer_widget->frame_update();
|
||||
}
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
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->opening_transition == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, kTransitionOpening, 30));
|
||||
}
|
||||
if (c->closing_transition == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, kTransitionClosing, 30));
|
||||
}
|
||||
} else {
|
||||
ca->append(new AddEffectCommand(c, nullptr, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||
update_ui(true);
|
||||
} else {
|
||||
reload_clips();
|
||||
panel_sequence_viewer->viewer_widget->frame_update();
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::update_keyframes() {
|
||||
headers->update_zoom(zoom);
|
||||
keyframeView->update();
|
||||
headers->update_zoom(zoom);
|
||||
keyframeView->update();
|
||||
}
|
||||
|
||||
void EffectControls::delete_selected_keyframes() {
|
||||
keyframeView->delete_selected_keyframes();
|
||||
keyframeView->delete_selected_keyframes();
|
||||
}
|
||||
|
||||
void EffectControls::copy(bool del) {
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
bool cleared = false;
|
||||
if (mode == kTransitionNone) {
|
||||
bool cleared = false;
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
EffectPtr effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
if (!cleared) {
|
||||
clear_clipboard();
|
||||
cleared = true;
|
||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||
}
|
||||
ComboAction* ca = new ComboAction();
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
EffectPtr effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
if (!cleared) {
|
||||
clear_clipboard();
|
||||
cleared = true;
|
||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
clipboard.append(EffectPtr(effect->copy(nullptr)));
|
||||
clipboard.append(EffectPtr(effect->copy(nullptr)));
|
||||
|
||||
if (del_com != nullptr) {
|
||||
del_com->clips.append(c);
|
||||
del_com->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (del_com != nullptr) {
|
||||
if (del_com->clips.size() > 0) {
|
||||
ca->append(del_com);
|
||||
} else {
|
||||
delete del_com;
|
||||
}
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
}
|
||||
if (del_com != nullptr) {
|
||||
del_com->clips.append(c);
|
||||
del_com->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (del_com != nullptr) {
|
||||
if (del_com->clips.size() > 0) {
|
||||
ca->append(del_com);
|
||||
} else {
|
||||
delete del_com;
|
||||
}
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::scroll_to_frame(long frame) {
|
||||
scroll_to_frame_internal(horizontalScrollBar, frame, zoom, keyframeView->width());
|
||||
scroll_to_frame_internal(horizontalScrollBar, frame, zoom, keyframeView->width());
|
||||
}
|
||||
|
||||
void EffectControls::add_effect_paste_action(QMenu *menu) {
|
||||
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
||||
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
||||
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
||||
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
||||
}
|
||||
|
||||
void EffectControls::cut() {
|
||||
copy(true);
|
||||
copy(true);
|
||||
}
|
||||
|
||||
void EffectControls::show_effect_menu(int type, int subtype) {
|
||||
effect_menu_type = type;
|
||||
effect_menu_subtype = subtype;
|
||||
effect_menu_type = type;
|
||||
effect_menu_subtype = subtype;
|
||||
|
||||
effects_loaded.lock();
|
||||
effects_loaded.lock();
|
||||
|
||||
QMenu effects_menu(this);
|
||||
effects_menu.setToolTipsVisible(true);
|
||||
QMenu effects_menu(this);
|
||||
effects_menu.setToolTipsVisible(true);
|
||||
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
const EffectMeta& em = effects.at(i);
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
const EffectMeta& em = effects.at(i);
|
||||
|
||||
if (em.type == type && em.subtype == subtype) {
|
||||
QAction* action = new QAction(&effects_menu);
|
||||
action->setText(em.name);
|
||||
action->setData(reinterpret_cast<quintptr>(&em));
|
||||
if (!em.tooltip.isEmpty()) {
|
||||
action->setToolTip(em.tooltip);
|
||||
if (em.type == type && em.subtype == subtype) {
|
||||
QAction* action = new QAction(&effects_menu);
|
||||
action->setText(em.name);
|
||||
action->setData(reinterpret_cast<quintptr>(&em));
|
||||
if (!em.tooltip.isEmpty()) {
|
||||
action->setToolTip(em.tooltip);
|
||||
}
|
||||
|
||||
QMenu* parent = &effects_menu;
|
||||
if (!em.category.isEmpty()) {
|
||||
bool found = false;
|
||||
for (int j=0;j<effects_menu.actions().size();j++) {
|
||||
QAction* action = effects_menu.actions().at(j);
|
||||
if (action->menu() != nullptr) {
|
||||
if (action->menu()->title() == em.category) {
|
||||
parent = action->menu();
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
QMenu* parent = &effects_menu;
|
||||
if (!em.category.isEmpty()) {
|
||||
bool found = false;
|
||||
for (int j=0;j<effects_menu.actions().size();j++) {
|
||||
QAction* action = effects_menu.actions().at(j);
|
||||
if (action->menu() != nullptr) {
|
||||
if (action->menu()->title() == em.category) {
|
||||
parent = action->menu();
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
parent = new QMenu(&effects_menu);
|
||||
parent->setToolTipsVisible(true);
|
||||
parent->setTitle(em.category);
|
||||
|
||||
bool found = false;
|
||||
for (int i=0;i<effects_menu.actions().size();i++) {
|
||||
QAction* comp_action = effects_menu.actions().at(i);
|
||||
if (comp_action->text() > em.category) {
|
||||
effects_menu.insertMenu(comp_action, parent);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) effects_menu.addMenu(parent);
|
||||
}
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
for (int i=0;i<parent->actions().size();i++) {
|
||||
QAction* comp_action = parent->actions().at(i);
|
||||
if (comp_action->text() > action->text()) {
|
||||
parent->insertAction(comp_action, action);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) parent->addAction(action);
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
parent = new QMenu(&effects_menu);
|
||||
parent->setToolTipsVisible(true);
|
||||
parent->setTitle(em.category);
|
||||
|
||||
bool found = false;
|
||||
for (int i=0;i<effects_menu.actions().size();i++) {
|
||||
QAction* comp_action = effects_menu.actions().at(i);
|
||||
if (comp_action->text() > em.category) {
|
||||
effects_menu.insertMenu(comp_action, parent);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) effects_menu.addMenu(parent);
|
||||
}
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
for (int i=0;i<parent->actions().size();i++) {
|
||||
QAction* comp_action = parent->actions().at(i);
|
||||
if (comp_action->text() > action->text()) {
|
||||
parent->insertAction(comp_action, action);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) parent->addAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
effects_loaded.unlock();
|
||||
effects_loaded.unlock();
|
||||
|
||||
connect(&effects_menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_select(QAction*)));
|
||||
effects_menu.exec(QCursor::pos());
|
||||
connect(&effects_menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_select(QAction*)));
|
||||
effects_menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void EffectControls::clear_effects(bool clear_cache) {
|
||||
// clear existing clips
|
||||
deselect_all_effects(nullptr);
|
||||
// clear existing clips
|
||||
deselect_all_effects(nullptr);
|
||||
|
||||
// clear graph editor
|
||||
if (panel_graph_editor != nullptr) panel_graph_editor->set_row(nullptr);
|
||||
// clear graph editor
|
||||
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(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(nullptr);
|
||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
vcontainer->setVisible(false);
|
||||
acontainer->setVisible(false);
|
||||
headers->setVisible(false);
|
||||
keyframeView->setEnabled(false);
|
||||
if (clear_cache) selected_clips.clear();
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
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(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(nullptr);
|
||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
vcontainer->setVisible(false);
|
||||
acontainer->setVisible(false);
|
||||
headers->setVisible(false);
|
||||
keyframeView->setEnabled(false);
|
||||
if (clear_cache) selected_clips.clear();
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
}
|
||||
|
||||
void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container != sender) {
|
||||
c->effects.at(j)->container->header_click(false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
const ClipPtr& c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container != sender) {
|
||||
c->effects.at(j)->container->header_click(false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
}
|
||||
|
||||
void EffectControls::open_effect(QVBoxLayout* layout, EffectPtr e) {
|
||||
CollapsibleWidget* container = e->container;
|
||||
layout->addWidget(container);
|
||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
CollapsibleWidget* container = e->container;
|
||||
layout->addWidget(container);
|
||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
|
||||
void EffectControls::setup_ui() {
|
||||
QWidget* contents = new QWidget(this);
|
||||
QWidget* contents = new QWidget(this);
|
||||
|
||||
QHBoxLayout* hlayout = new QHBoxLayout(contents);
|
||||
hlayout->setSpacing(0);
|
||||
hlayout->setMargin(0);
|
||||
QHBoxLayout* hlayout = new QHBoxLayout(contents);
|
||||
hlayout->setSpacing(0);
|
||||
hlayout->setMargin(0);
|
||||
|
||||
QSplitter* splitter = new QSplitter();
|
||||
splitter->setOrientation(Qt::Horizontal);
|
||||
splitter->setChildrenCollapsible(false);
|
||||
QSplitter* splitter = new QSplitter();
|
||||
splitter->setOrientation(Qt::Horizontal);
|
||||
splitter->setChildrenCollapsible(false);
|
||||
|
||||
scrollArea = new QScrollArea();
|
||||
scrollArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||
scrollArea->setFrameShape(QFrame::NoFrame);
|
||||
scrollArea->setFrameShadow(QFrame::Plain);
|
||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea = new QScrollArea();
|
||||
scrollArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||
scrollArea->setFrameShape(QFrame::NoFrame);
|
||||
scrollArea->setFrameShadow(QFrame::Plain);
|
||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
|
||||
QWidget* scrollAreaWidgetContents = new QWidget();
|
||||
QWidget* scrollAreaWidgetContents = new QWidget();
|
||||
|
||||
QHBoxLayout* scrollAreaLayout = new QHBoxLayout(scrollAreaWidgetContents);
|
||||
scrollAreaLayout->setSpacing(0);
|
||||
scrollAreaLayout->setMargin(0);
|
||||
QHBoxLayout* scrollAreaLayout = new QHBoxLayout(scrollAreaWidgetContents);
|
||||
scrollAreaLayout->setSpacing(0);
|
||||
scrollAreaLayout->setMargin(0);
|
||||
|
||||
effects_area = new EffectsArea();
|
||||
effects_area->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(effects_area, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(effects_area_context_menu()));
|
||||
effects_area = new EffectsArea();
|
||||
effects_area->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(effects_area, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(effects_area_context_menu()));
|
||||
|
||||
QVBoxLayout* effects_area_layout = new QVBoxLayout(effects_area);
|
||||
effects_area_layout->setSpacing(0);
|
||||
effects_area_layout->setMargin(0);
|
||||
QVBoxLayout* effects_area_layout = new QVBoxLayout(effects_area);
|
||||
effects_area_layout->setSpacing(0);
|
||||
effects_area_layout->setMargin(0);
|
||||
|
||||
vcontainer = new QWidget();
|
||||
QVBoxLayout* vcontainerLayout = new QVBoxLayout(vcontainer);
|
||||
vcontainerLayout->setSpacing(0);
|
||||
vcontainerLayout->setMargin(0);
|
||||
vcontainer = new QWidget();
|
||||
QVBoxLayout* vcontainerLayout = new QVBoxLayout(vcontainer);
|
||||
vcontainerLayout->setSpacing(0);
|
||||
vcontainerLayout->setMargin(0);
|
||||
|
||||
QWidget* veHeader = new QWidget();
|
||||
veHeader->setObjectName(QStringLiteral("veHeader"));
|
||||
veHeader->setStyleSheet(QLatin1String("#veHeader { background: rgba(0, 0, 0, 0.25); }"));
|
||||
QWidget* veHeader = new QWidget();
|
||||
veHeader->setObjectName(QStringLiteral("veHeader"));
|
||||
veHeader->setStyleSheet(QLatin1String("#veHeader { background: rgba(0, 0, 0, 0.25); }"));
|
||||
|
||||
QHBoxLayout* veHeaderLayout = new QHBoxLayout(veHeader);
|
||||
veHeaderLayout->setSpacing(0);
|
||||
veHeaderLayout->setMargin(0);
|
||||
QHBoxLayout* veHeaderLayout = new QHBoxLayout(veHeader);
|
||||
veHeaderLayout->setSpacing(0);
|
||||
veHeaderLayout->setMargin(0);
|
||||
|
||||
QPushButton* btnAddVideoEffect = new QPushButton();
|
||||
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddVideoEffect->setToolTip(tr("Add Video Effect"));
|
||||
veHeaderLayout->addWidget(btnAddVideoEffect);
|
||||
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
||||
QPushButton* btnAddVideoEffect = new QPushButton();
|
||||
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddVideoEffect->setToolTip(tr("Add Video Effect"));
|
||||
veHeaderLayout->addWidget(btnAddVideoEffect);
|
||||
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
||||
|
||||
veHeaderLayout->addStretch();
|
||||
veHeaderLayout->addStretch();
|
||||
|
||||
QLabel* lblVideoEffects = new QLabel();
|
||||
QFont font;
|
||||
font.setPointSize(9);
|
||||
lblVideoEffects->setFont(font);
|
||||
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
||||
lblVideoEffects->setText(tr("VIDEO EFFECTS"));
|
||||
veHeaderLayout->addWidget(lblVideoEffects);
|
||||
QLabel* lblVideoEffects = new QLabel();
|
||||
QFont font;
|
||||
font.setPointSize(9);
|
||||
lblVideoEffects->setFont(font);
|
||||
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
||||
lblVideoEffects->setText(tr("VIDEO EFFECTS"));
|
||||
veHeaderLayout->addWidget(lblVideoEffects);
|
||||
|
||||
veHeaderLayout->addStretch();
|
||||
veHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddVideoTransition = new QPushButton();
|
||||
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddVideoTransition->setToolTip(tr("Add Video Transition"));
|
||||
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
||||
veHeaderLayout->addWidget(btnAddVideoTransition);
|
||||
QPushButton* btnAddVideoTransition = new QPushButton();
|
||||
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddVideoTransition->setToolTip(tr("Add Video Transition"));
|
||||
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
||||
veHeaderLayout->addWidget(btnAddVideoTransition);
|
||||
|
||||
vcontainerLayout->addWidget(veHeader);
|
||||
vcontainerLayout->addWidget(veHeader);
|
||||
|
||||
video_effect_area = new QWidget();
|
||||
QVBoxLayout* veAreaLayout = new QVBoxLayout(video_effect_area);
|
||||
veAreaLayout->setSpacing(0);
|
||||
veAreaLayout->setMargin(0);
|
||||
video_effect_area = new QWidget();
|
||||
QVBoxLayout* veAreaLayout = new QVBoxLayout(video_effect_area);
|
||||
veAreaLayout->setSpacing(0);
|
||||
veAreaLayout->setMargin(0);
|
||||
|
||||
vcontainerLayout->addWidget(video_effect_area);
|
||||
vcontainerLayout->addWidget(video_effect_area);
|
||||
|
||||
effects_area_layout->addWidget(vcontainer);
|
||||
effects_area_layout->addWidget(vcontainer);
|
||||
|
||||
acontainer = new QWidget();
|
||||
QVBoxLayout* acontainerLayout = new QVBoxLayout(acontainer);
|
||||
acontainerLayout->setSpacing(0);
|
||||
acontainerLayout->setMargin(0);
|
||||
QWidget* aeHeader = new QWidget();
|
||||
aeHeader->setObjectName(QStringLiteral("aeHeader"));
|
||||
aeHeader->setStyleSheet(QLatin1String("#aeHeader { background: rgba(0, 0, 0, 0.25); }"));
|
||||
acontainer = new QWidget();
|
||||
QVBoxLayout* acontainerLayout = new QVBoxLayout(acontainer);
|
||||
acontainerLayout->setSpacing(0);
|
||||
acontainerLayout->setMargin(0);
|
||||
QWidget* aeHeader = new QWidget();
|
||||
aeHeader->setObjectName(QStringLiteral("aeHeader"));
|
||||
aeHeader->setStyleSheet(QLatin1String("#aeHeader { background: rgba(0, 0, 0, 0.25); }"));
|
||||
|
||||
QHBoxLayout* aeHeaderLayout = new QHBoxLayout(aeHeader);
|
||||
aeHeaderLayout->setSpacing(0);
|
||||
aeHeaderLayout->setMargin(0);
|
||||
QHBoxLayout* aeHeaderLayout = new QHBoxLayout(aeHeader);
|
||||
aeHeaderLayout->setSpacing(0);
|
||||
aeHeaderLayout->setMargin(0);
|
||||
|
||||
QPushButton* btnAddAudioEffect = new QPushButton();
|
||||
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddAudioEffect->setToolTip(tr("Add Audio Effect"));
|
||||
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
||||
QPushButton* btnAddAudioEffect = new QPushButton();
|
||||
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddAudioEffect->setToolTip(tr("Add Audio Effect"));
|
||||
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
||||
|
||||
aeHeaderLayout->addStretch();
|
||||
aeHeaderLayout->addStretch();
|
||||
|
||||
QLabel* lblAudioEffects = new QLabel();
|
||||
lblAudioEffects->setFont(font);
|
||||
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
||||
lblAudioEffects->setText(tr("AUDIO EFFECTS"));
|
||||
aeHeaderLayout->addWidget(lblAudioEffects);
|
||||
QLabel* lblAudioEffects = new QLabel();
|
||||
lblAudioEffects->setFont(font);
|
||||
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
||||
lblAudioEffects->setText(tr("AUDIO EFFECTS"));
|
||||
aeHeaderLayout->addWidget(lblAudioEffects);
|
||||
|
||||
aeHeaderLayout->addStretch();
|
||||
aeHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddAudioTransition = new QPushButton();
|
||||
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddAudioTransition->setToolTip(tr("Add Audio Transition"));
|
||||
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
||||
QPushButton* btnAddAudioTransition = new QPushButton();
|
||||
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddAudioTransition->setToolTip(tr("Add Audio Transition"));
|
||||
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
||||
|
||||
acontainerLayout->addWidget(aeHeader);
|
||||
acontainerLayout->addWidget(aeHeader);
|
||||
|
||||
audio_effect_area = new QWidget();
|
||||
QVBoxLayout* aeAreaLayout = new QVBoxLayout(audio_effect_area);
|
||||
aeAreaLayout->setSpacing(0);
|
||||
aeAreaLayout->setMargin(0);
|
||||
audio_effect_area = new QWidget();
|
||||
QVBoxLayout* aeAreaLayout = new QVBoxLayout(audio_effect_area);
|
||||
aeAreaLayout->setSpacing(0);
|
||||
aeAreaLayout->setMargin(0);
|
||||
|
||||
acontainerLayout->addWidget(audio_effect_area);
|
||||
acontainerLayout->addWidget(audio_effect_area);
|
||||
|
||||
effects_area_layout->addWidget(acontainer);
|
||||
effects_area_layout->addWidget(acontainer);
|
||||
|
||||
lblMultipleClipsSelected = new QLabel();
|
||||
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
||||
lblMultipleClipsSelected->setText(tr("(Multiple clips selected)"));
|
||||
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
||||
lblMultipleClipsSelected = new QLabel();
|
||||
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
||||
lblMultipleClipsSelected->setText(tr("(Multiple clips selected)"));
|
||||
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
||||
|
||||
effects_area_layout->addStretch();
|
||||
effects_area_layout->addStretch();
|
||||
|
||||
scrollAreaLayout->addWidget(effects_area);
|
||||
scrollAreaLayout->addWidget(effects_area);
|
||||
|
||||
scrollArea->setWidget(scrollAreaWidgetContents);
|
||||
splitter->addWidget(scrollArea);
|
||||
scrollArea->setWidget(scrollAreaWidgetContents);
|
||||
splitter->addWidget(scrollArea);
|
||||
|
||||
QWidget* keyframeArea = new QWidget();
|
||||
QWidget* keyframeArea = new QWidget();
|
||||
|
||||
QSizePolicy keyframe_sp;
|
||||
keyframe_sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
||||
keyframe_sp.setVerticalPolicy(QSizePolicy::Preferred);
|
||||
keyframe_sp.setHorizontalStretch(1);
|
||||
keyframeArea->setSizePolicy(keyframe_sp);
|
||||
QSizePolicy keyframe_sp;
|
||||
keyframe_sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
||||
keyframe_sp.setVerticalPolicy(QSizePolicy::Preferred);
|
||||
keyframe_sp.setHorizontalStretch(1);
|
||||
keyframeArea->setSizePolicy(keyframe_sp);
|
||||
|
||||
QVBoxLayout* keyframeAreaLayout = new QVBoxLayout(keyframeArea);
|
||||
keyframeAreaLayout->setSpacing(0);
|
||||
keyframeAreaLayout->setMargin(0);
|
||||
QVBoxLayout* keyframeAreaLayout = new QVBoxLayout(keyframeArea);
|
||||
keyframeAreaLayout->setSpacing(0);
|
||||
keyframeAreaLayout->setMargin(0);
|
||||
|
||||
headers = new TimelineHeader();
|
||||
keyframeAreaLayout->addWidget(headers);
|
||||
headers = new TimelineHeader();
|
||||
keyframeAreaLayout->addWidget(headers);
|
||||
|
||||
QWidget* keyframeCenterWidget = new QWidget();
|
||||
QWidget* keyframeCenterWidget = new QWidget();
|
||||
|
||||
QHBoxLayout* keyframeCenterLayout = new QHBoxLayout(keyframeCenterWidget);
|
||||
keyframeCenterLayout->setSpacing(0);
|
||||
keyframeCenterLayout->setMargin(0);
|
||||
QHBoxLayout* keyframeCenterLayout = new QHBoxLayout(keyframeCenterWidget);
|
||||
keyframeCenterLayout->setSpacing(0);
|
||||
keyframeCenterLayout->setMargin(0);
|
||||
|
||||
keyframeView = new KeyframeView();
|
||||
keyframeView = new KeyframeView();
|
||||
|
||||
keyframeCenterLayout->addWidget(keyframeView);
|
||||
keyframeCenterLayout->addWidget(keyframeView);
|
||||
|
||||
verticalScrollBar = new QScrollBar();
|
||||
verticalScrollBar->setOrientation(Qt::Vertical);
|
||||
verticalScrollBar = new QScrollBar();
|
||||
verticalScrollBar->setOrientation(Qt::Vertical);
|
||||
|
||||
keyframeCenterLayout->addWidget(verticalScrollBar);
|
||||
keyframeCenterLayout->addWidget(verticalScrollBar);
|
||||
|
||||
|
||||
keyframeAreaLayout->addWidget(keyframeCenterWidget);
|
||||
keyframeAreaLayout->addWidget(keyframeCenterWidget);
|
||||
|
||||
horizontalScrollBar = new ResizableScrollBar();
|
||||
horizontalScrollBar->setOrientation(Qt::Horizontal);
|
||||
horizontalScrollBar = new ResizableScrollBar();
|
||||
horizontalScrollBar->setOrientation(Qt::Horizontal);
|
||||
|
||||
keyframeAreaLayout->addWidget(horizontalScrollBar);
|
||||
keyframeAreaLayout->addWidget(horizontalScrollBar);
|
||||
|
||||
splitter->addWidget(keyframeArea);
|
||||
splitter->addWidget(keyframeArea);
|
||||
|
||||
hlayout->addWidget(splitter);
|
||||
hlayout->addWidget(splitter);
|
||||
|
||||
setWidget(contents);
|
||||
setWidget(contents);
|
||||
}
|
||||
|
||||
void EffectControls::update_scrollbar() {
|
||||
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
||||
verticalScrollBar->setPageStep(verticalScrollBar->height());
|
||||
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
||||
verticalScrollBar->setPageStep(verticalScrollBar->height());
|
||||
}
|
||||
|
||||
void EffectControls::queue_post_update() {
|
||||
keyframeView->update();
|
||||
update_scrollbar();
|
||||
keyframeView->update();
|
||||
update_scrollbar();
|
||||
}
|
||||
|
||||
void EffectControls::effects_area_context_menu() {
|
||||
QMenu menu(this);
|
||||
QMenu menu(this);
|
||||
|
||||
add_effect_paste_action(&menu);
|
||||
add_effect_paste_action(&menu);
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void EffectControls::load_effects() {
|
||||
lblMultipleClipsSelected->setVisible(multiple);
|
||||
lblMultipleClipsSelected->setVisible(multiple);
|
||||
|
||||
if (!multiple) {
|
||||
// load in new clips
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
QVBoxLayout* layout;
|
||||
if (c->track < 0) {
|
||||
vcontainer->setVisible(true);
|
||||
layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||
} else {
|
||||
acontainer->setVisible(true);
|
||||
layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
||||
}
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
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() != nullptr) {
|
||||
open_effect(layout, c->get_opening_transition());
|
||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != nullptr) {
|
||||
open_effect(layout, c->get_closing_transition());
|
||||
}
|
||||
}
|
||||
if (selected_clips.size() > 0) {
|
||||
setWindowTitle(panel_name + olive::ActiveSequence->clips.at(selected_clips.at(0))->name);
|
||||
keyframeView->setEnabled(true);
|
||||
headers->setVisible(true);
|
||||
if (!multiple) {
|
||||
// load in new clips
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
QVBoxLayout* layout;
|
||||
if (c->track < 0) {
|
||||
vcontainer->setVisible(true);
|
||||
layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||
} else {
|
||||
acontainer->setVisible(true);
|
||||
layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
||||
}
|
||||
if (mode == kTransitionNone) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
open_effect(layout, c->effects.at(j));
|
||||
}
|
||||
} else if (mode == kTransitionOpening && c->opening_transition != nullptr) {
|
||||
open_effect(layout, c->opening_transition);
|
||||
} else if (mode == kTransitionClosing && c->closing_transition != nullptr) {
|
||||
open_effect(layout, c->closing_transition);
|
||||
}
|
||||
}
|
||||
if (selected_clips.size() > 0) {
|
||||
setWindowTitle(panel_name + olive::ActiveSequence->clips.at(selected_clips.at(0))->name);
|
||||
keyframeView->setEnabled(true);
|
||||
headers->setVisible(true);
|
||||
|
||||
QTimer::singleShot(50, this, SLOT(queue_post_update()));
|
||||
}
|
||||
}
|
||||
QTimer::singleShot(50, this, SLOT(queue_post_update()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::delete_effects() {
|
||||
// load in new clips
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
EffectDeleteCommand* command = new EffectDeleteCommand();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
EffectPtr effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
command->clips.append(c);
|
||||
command->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (command->clips.size() > 0) {
|
||||
olive::UndoStack.push(command);
|
||||
panel_sequence_viewer->viewer_widget->frame_update();
|
||||
} else {
|
||||
delete command;
|
||||
}
|
||||
}
|
||||
// load in new clips
|
||||
if (mode == kTransitionNone) {
|
||||
EffectDeleteCommand* command = new EffectDeleteCommand();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
EffectPtr effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
command->clips.append(c);
|
||||
command->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (command->clips.size() > 0) {
|
||||
olive::UndoStack.push(command);
|
||||
panel_sequence_viewer->viewer_widget->frame_update();
|
||||
} else {
|
||||
delete command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::reload_clips() {
|
||||
clear_effects(false);
|
||||
load_effects();
|
||||
clear_effects(false);
|
||||
load_effects();
|
||||
}
|
||||
|
||||
void EffectControls::set_clips(QVector<int>& clips, int m) {
|
||||
clear_effects(true);
|
||||
clear_effects(true);
|
||||
|
||||
// replace clip vector
|
||||
selected_clips = clips;
|
||||
mode = m;
|
||||
// replace clip vector
|
||||
selected_clips = clips;
|
||||
mode = m;
|
||||
|
||||
load_effects();
|
||||
load_effects();
|
||||
}
|
||||
|
||||
void EffectControls::video_effect_click() {
|
||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_VIDEO);
|
||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_VIDEO);
|
||||
}
|
||||
|
||||
void EffectControls::audio_effect_click() {
|
||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_AUDIO);
|
||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_AUDIO);
|
||||
}
|
||||
|
||||
void EffectControls::video_transition_click() {
|
||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_VIDEO);
|
||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_VIDEO);
|
||||
}
|
||||
|
||||
void EffectControls::audio_transition_click() {
|
||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_AUDIO);
|
||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_AUDIO);
|
||||
}
|
||||
|
||||
void EffectControls::resizeEvent(QResizeEvent*) {
|
||||
update_scrollbar();
|
||||
update_scrollbar();
|
||||
}
|
||||
|
||||
bool EffectControls::is_focused() {
|
||||
if (this->hasFocus()) return true;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container->is_focused()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qWarning() << "Tried to check focus of a nullptr clip";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
if (this->hasFocus()) return true;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(selected_clips.at(i));
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container->is_focused()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
qWarning() << "Tried to check focus of a nullptr clip";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
EffectsArea::EffectsArea(QWidget* parent) :
|
||||
QWidget(parent)
|
||||
QWidget(parent)
|
||||
{}
|
||||
|
||||
void EffectsArea::receive_wheel_event(QWheelEvent *e) {
|
||||
QApplication::sendEvent(this, e);
|
||||
QApplication::sendEvent(this, e);
|
||||
}
|
||||
|
||||
+6
-6
@@ -47,7 +47,7 @@ void update_effect_controls() {
|
||||
int vclip = -1;
|
||||
int aclip = -1;
|
||||
QVector<int> selected_clips;
|
||||
int mode = TA_NO_TRANSITION;
|
||||
int mode = kTransitionNone;
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
|
||||
ClipPtr clip = olive::ActiveSequence->clips.at(i);
|
||||
@@ -56,11 +56,11 @@ void update_effect_controls() {
|
||||
const Selection& s = olive::ActiveSequence->selections.at(j);
|
||||
bool add = true;
|
||||
if (clip->timeline_in >= s.in && clip->timeline_out <= s.out && clip->track == s.track) {
|
||||
mode = TA_NO_TRANSITION;
|
||||
} else if (selection_contains_transition(s, clip, TA_OPENING_TRANSITION)) {
|
||||
mode = TA_OPENING_TRANSITION;
|
||||
} else if (selection_contains_transition(s, clip, TA_CLOSING_TRANSITION)) {
|
||||
mode = TA_CLOSING_TRANSITION;
|
||||
mode = kTransitionNone;
|
||||
} else if (selection_contains_transition(s, clip, kTransitionOpening)) {
|
||||
mode = kTransitionOpening;
|
||||
} else if (selection_contains_transition(s, clip, kTransitionClosing)) {
|
||||
mode = kTransitionClosing;
|
||||
} else {
|
||||
add = false;
|
||||
}
|
||||
|
||||
@@ -1081,6 +1081,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
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++) {
|
||||
TransitionPtr t = s->transitions.at(j);
|
||||
if (t != nullptr) {
|
||||
@@ -1091,6 +1092,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeEndElement(); // transition
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
const ClipPtr& c = s->clips.at(j);
|
||||
@@ -1103,8 +1105,10 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeAttribute("in", QString::number(c->timeline_in));
|
||||
stream.writeAttribute("out", QString::number(c->timeline_out));
|
||||
stream.writeAttribute("track", QString::number(c->track));
|
||||
/*
|
||||
stream.writeAttribute("opening", QString::number(c->opening_transition));
|
||||
stream.writeAttribute("closing", QString::number(c->closing_transition));
|
||||
*/
|
||||
|
||||
stream.writeAttribute("r", QString::number(c->color_r));
|
||||
stream.writeAttribute("g", QString::number(c->color_g));
|
||||
|
||||
+17
-19
@@ -371,11 +371,11 @@ void Timeline::add_transition() {
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
int transition_to_add = (c->track < 0) ? TRANSITION_INTERNAL_CROSSDISSOLVE : TRANSITION_INTERNAL_LINEARFADE;
|
||||
if (c->get_opening_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(transition_to_add, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(transition_to_add, EFFECT_TYPE_TRANSITION), kTransitionOpening, 30));
|
||||
adding = true;
|
||||
}
|
||||
if (c->get_closing_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(transition_to_add, EFFECT_TYPE_TRANSITION), TA_CLOSING_TRANSITION, 30));
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(transition_to_add, EFFECT_TYPE_TRANSITION), kTransitionClosing, 30));
|
||||
adding = true;
|
||||
}
|
||||
}
|
||||
@@ -843,19 +843,17 @@ ClipPtr Timeline::split_clip(ComboAction* ca, bool transitions, int p, long fram
|
||||
// }
|
||||
|
||||
if (pre->get_opening_transition()->get_true_length() > new_clip_length) {
|
||||
ca->append(new ModifyTransitionCommand(pre, TA_OPENING_TRANSITION, new_clip_length));
|
||||
}
|
||||
|
||||
post->sequence->hard_delete_transition(post, TA_OPENING_TRANSITION);
|
||||
ca->append(new ModifyTransitionCommand(pre->get_opening_transition(), new_clip_length));
|
||||
}
|
||||
}
|
||||
if (pre->get_closing_transition() != nullptr) {
|
||||
if (splitting_closing_dual_transition) {
|
||||
// just move closing transition to post clip
|
||||
|
||||
// WORKAROUND
|
||||
ca->append(new DeleteTransitionCommand(pre->sequence, pre->closing_transition));
|
||||
ca->append(new DeleteTransitionCommand(pre->closing_transition));
|
||||
} else {
|
||||
ca->append(new DeleteTransitionCommand(pre->sequence, pre->closing_transition));
|
||||
ca->append(new DeleteTransitionCommand(pre->closing_transition));
|
||||
|
||||
if (post->get_closing_transition() != nullptr) {
|
||||
if (pre->get_closing_transition()->secondary_clip == nullptr) {
|
||||
@@ -964,7 +962,7 @@ void Timeline::clean_up_selections(QVector<Selection>& areas) {
|
||||
}
|
||||
|
||||
bool selection_contains_transition(const Selection& s, ClipPtr c, int type) {
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
if (type == kTransitionOpening) {
|
||||
return c->get_opening_transition() != nullptr
|
||||
&& s.out == c->timeline_in + c->get_opening_transition()->get_true_length()
|
||||
&& ((c->get_opening_transition()->secondary_clip == nullptr && s.in == c->timeline_in)
|
||||
@@ -989,12 +987,12 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
for (int j=0;j<olive::ActiveSequence->clips.size();j++) {
|
||||
ClipPtr c = olive::ActiveSequence->clips.at(j);
|
||||
if (c != nullptr && c->track == s.track && !c->undeletable) {
|
||||
if (selection_contains_transition(s, c, TA_OPENING_TRANSITION)) {
|
||||
if (selection_contains_transition(s, c, kTransitionOpening)) {
|
||||
// delete opening transition
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
||||
} else if (selection_contains_transition(s, c, TA_CLOSING_TRANSITION)) {
|
||||
ca->append(new DeleteTransitionCommand(c->opening_transition));
|
||||
} else if (selection_contains_transition(s, c, kTransitionClosing)) {
|
||||
// delete closing transition
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
||||
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));
|
||||
@@ -1012,9 +1010,9 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
|
||||
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));
|
||||
ca->append(new DeleteTransitionCommand(c->closing_transition));
|
||||
} else {
|
||||
ca->append(new ModifyTransitionCommand(c, TA_CLOSING_TRANSITION, c->get_closing_transition()->get_true_length() - (c->timeline_out - s.in)));
|
||||
ca->append(new ModifyTransitionCommand(c->closing_transition, c->get_closing_transition()->get_true_length() - (c->timeline_out - s.in)));
|
||||
}
|
||||
}
|
||||
} else if (c->timeline_in < s.out && c->timeline_out > s.out) {
|
||||
@@ -1023,9 +1021,9 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
|
||||
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));
|
||||
ca->append(new DeleteTransitionCommand(c->opening_transition));
|
||||
} else {
|
||||
ca->append(new ModifyTransitionCommand(c, TA_OPENING_TRANSITION, c->get_opening_transition()->get_true_length() - (s.out - c->timeline_in)));
|
||||
ca->append(new ModifyTransitionCommand(c->opening_transition, c->get_opening_transition()->get_true_length() - (s.out - c->timeline_in)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2070,13 +2068,13 @@ void move_clip(ComboAction* ca, ClipPtr c, long iin, long iout, long iclip_in, i
|
||||
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(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));
|
||||
ca->append(new AddTransitionCommand(c->get_opening_transition()->secondary_clip, nullptr, c->get_opening_transition(), nullptr, kTransitionClosing, 0));
|
||||
}
|
||||
|
||||
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(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));
|
||||
ca->append(new AddTransitionCommand(c, nullptr, c->get_closing_transition(), nullptr, kTransitionClosing, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user