removed effect controls and viewer ui files
This commit is contained in:
+4
-5
@@ -1,5 +1,4 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
|
||||||
|
|
||||||
#include "io/config.h"
|
#include "io/config.h"
|
||||||
#include "io/path.h"
|
#include "io/path.h"
|
||||||
@@ -43,6 +42,9 @@
|
|||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
#include <QStatusBar>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QMenuBar>
|
||||||
|
|
||||||
MainWindow* mainWindow;
|
MainWindow* mainWindow;
|
||||||
|
|
||||||
@@ -127,8 +129,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
|
|
||||||
updateTitle("");
|
updateTitle("");
|
||||||
|
|
||||||
statusBar()->showMessage("Welcome to " + appName);
|
|
||||||
|
|
||||||
setDockNestingEnabled(true);
|
setDockNestingEnabled(true);
|
||||||
|
|
||||||
layout()->invalidate();
|
layout()->invalidate();
|
||||||
@@ -199,6 +199,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
panel_timeline = new Timeline(this);
|
panel_timeline = new Timeline(this);
|
||||||
|
|
||||||
QStatusBar* statusBar = new QStatusBar(this);
|
QStatusBar* statusBar = new QStatusBar(this);
|
||||||
|
statusBar->showMessage("Welcome to " + appName);
|
||||||
setStatusBar(statusBar);
|
setStatusBar(statusBar);
|
||||||
|
|
||||||
setup_menus();
|
setup_menus();
|
||||||
@@ -220,8 +221,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
setup_layout(false);
|
setup_layout(false);
|
||||||
|
|
||||||
init_audio();
|
init_audio();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
|
|||||||
+1
-3
@@ -8,10 +8,8 @@ class EffectControls;
|
|||||||
class Viewer;
|
class Viewer;
|
||||||
class Timeline;
|
class Timeline;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = 0);
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
void updateTitle(const QString &url);
|
void updateTitle(const QString &url);
|
||||||
|
|||||||
@@ -188,8 +188,6 @@ HEADERS += \
|
|||||||
ui/keyframenavigator.h
|
ui/keyframenavigator.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
panels/effectcontrols.ui \
|
|
||||||
panels/viewer.ui \
|
|
||||||
panels/timeline.ui \
|
panels/timeline.ui \
|
||||||
dialogs/aboutdialog.ui \
|
dialogs/aboutdialog.ui \
|
||||||
dialogs/newsequencedialog.ui \
|
dialogs/newsequencedialog.ui \
|
||||||
|
|||||||
+411
-224
@@ -1,10 +1,16 @@
|
|||||||
#include "effectcontrols.h"
|
#include "effectcontrols.h"
|
||||||
#include "ui_effectcontrols.h"
|
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QSplitter>
|
||||||
|
#include <QScrollArea>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QSpacerItem>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QIcon>
|
||||||
|
|
||||||
#include "panels/panels.h"
|
#include "panels/panels.h"
|
||||||
#include "project/effect.h"
|
#include "project/effect.h"
|
||||||
@@ -18,44 +24,44 @@
|
|||||||
#include "panels/viewer.h"
|
#include "panels/viewer.h"
|
||||||
#include "ui/viewerwidget.h"
|
#include "ui/viewerwidget.h"
|
||||||
#include "io/clipboard.h"
|
#include "io/clipboard.h"
|
||||||
|
#include "ui/timelineheader.h"
|
||||||
|
#include "ui/keyframeview.h"
|
||||||
|
#include "ui/resizablescrollbar.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
EffectControls::EffectControls(QWidget *parent) :
|
EffectControls::EffectControls(QWidget *parent) :
|
||||||
QDockWidget(parent),
|
QDockWidget(parent),
|
||||||
multiple(false),
|
multiple(false),
|
||||||
zoom(1),
|
zoom(1),
|
||||||
ui(new Ui::EffectControls),
|
panel_name("Effects: "),
|
||||||
panel_name("Effects: "),
|
mode(TA_NO_TRANSITION)
|
||||||
mode(TA_NO_TRANSITION)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
setup_ui();
|
||||||
|
|
||||||
init_effects();
|
init_effects();
|
||||||
clear_effects(false);
|
clear_effects(false);
|
||||||
ui->headers->viewer = panel_sequence_viewer;
|
headers->viewer = panel_sequence_viewer;
|
||||||
ui->headers->snapping = false;
|
headers->snapping = false;
|
||||||
|
|
||||||
ui->effects_area->parent_widget = ui->scrollArea;
|
effects_area->parent_widget = scrollArea;
|
||||||
ui->effects_area->keyframe_area = ui->keyframeView;
|
effects_area->keyframe_area = keyframeView;
|
||||||
ui->effects_area->header = ui->headers;
|
effects_area->header = headers;
|
||||||
ui->keyframeView->header = ui->headers;
|
keyframeView->header = headers;
|
||||||
|
|
||||||
ui->lblMultipleClipsSelected->setVisible(false);
|
lblMultipleClipsSelected->setVisible(false);
|
||||||
|
|
||||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
|
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
||||||
connect(ui->horizontalScrollBar, SIGNAL(resize_move(double)), ui->keyframeView, SLOT(resize_move(double)));
|
connect(horizontalScrollBar, SIGNAL(resize_move(double)), keyframeView, SLOT(resize_move(double)));
|
||||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->keyframeView, SLOT(set_x_scroll(int)));
|
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_x_scroll(int)));
|
||||||
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), ui->keyframeView, SLOT(set_y_scroll(int)));
|
connect(verticalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_y_scroll(int)));
|
||||||
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), ui->scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
connect(verticalScrollBar, SIGNAL(valueChanged(int)), scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
||||||
connect(ui->scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->verticalScrollBar, SLOT(setValue(int)));
|
connect(scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), verticalScrollBar, SLOT(setValue(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectControls::~EffectControls() {
|
EffectControls::~EffectControls() {}
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EffectControls::keyframe_focus() {
|
bool EffectControls::keyframe_focus() {
|
||||||
return ui->headers->hasFocus() || ui->keyframeView->hasFocus();
|
return headers->hasFocus() || keyframeView->hasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::set_zoom(bool in) {
|
void EffectControls::set_zoom(bool in) {
|
||||||
@@ -64,292 +70,473 @@ void EffectControls::set_zoom(bool in) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::menu_select(QAction* q) {
|
void EffectControls::menu_select(QAction* q) {
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||||
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
||||||
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
||||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||||
if (c->get_opening_transition() == NULL) {
|
if (c->get_opening_transition() == NULL) {
|
||||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_OPENING_TRANSITION, 30));
|
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_OPENING_TRANSITION, 30));
|
||||||
}
|
}
|
||||||
if (c->get_closing_transition() == NULL) {
|
if (c->get_closing_transition() == NULL) {
|
||||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_CLOSING_TRANSITION, 30));
|
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_CLOSING_TRANSITION, 30));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ca->append(new AddEffectCommand(c, NULL, meta));
|
ca->append(new AddEffectCommand(c, NULL, meta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
undo_stack.push(ca);
|
undo_stack.push(ca);
|
||||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||||
update_ui(true);
|
update_ui(true);
|
||||||
} else {
|
} else {
|
||||||
reload_clips();
|
reload_clips();
|
||||||
panel_sequence_viewer->viewer_widget->update();
|
panel_sequence_viewer->viewer_widget->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::update_keyframes() {
|
void EffectControls::update_keyframes() {
|
||||||
ui->headers->update_zoom(zoom);
|
headers->update_zoom(zoom);
|
||||||
ui->keyframeView->update();
|
keyframeView->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::delete_selected_keyframes() {
|
void EffectControls::delete_selected_keyframes() {
|
||||||
ui->keyframeView->delete_selected_keyframes();
|
keyframeView->delete_selected_keyframes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::copy(bool del) {
|
void EffectControls::copy(bool del) {
|
||||||
if (mode == TA_NO_TRANSITION) {
|
if (mode == TA_NO_TRANSITION) {
|
||||||
bool cleared = false;
|
bool cleared = false;
|
||||||
|
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : NULL;
|
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : NULL;
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
Effect* effect = c->effects.at(j);
|
Effect* effect = c->effects.at(j);
|
||||||
if (effect->container->selected) {
|
if (effect->container->selected) {
|
||||||
if (!cleared) {
|
if (!cleared) {
|
||||||
clear_clipboard();
|
clear_clipboard();
|
||||||
cleared = true;
|
cleared = true;
|
||||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
clipboard.append(effect->copy(NULL));
|
clipboard.append(effect->copy(NULL));
|
||||||
|
|
||||||
if (del_com != NULL) {
|
if (del_com != NULL) {
|
||||||
del_com->clips.append(c);
|
del_com->clips.append(c);
|
||||||
del_com->fx.append(j);
|
del_com->fx.append(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (del_com != NULL) {
|
if (del_com != NULL) {
|
||||||
if (del_com->clips.size() > 0) {
|
if (del_com->clips.size() > 0) {
|
||||||
ca->append(del_com);
|
ca->append(del_com);
|
||||||
} else {
|
} else {
|
||||||
delete del_com;
|
delete del_com;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
undo_stack.push(ca);
|
undo_stack.push(ca);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::show_effect_menu(int type, int subtype) {
|
void EffectControls::show_effect_menu(int type, int subtype) {
|
||||||
effect_menu_type = type;
|
effect_menu_type = type;
|
||||||
effect_menu_subtype = subtype;
|
effect_menu_subtype = subtype;
|
||||||
|
|
||||||
effects_loaded.lock();
|
effects_loaded.lock();
|
||||||
|
|
||||||
QMenu effects_menu(this);
|
QMenu effects_menu(this);
|
||||||
for (int i=0;i<effects.size();i++) {
|
for (int i=0;i<effects.size();i++) {
|
||||||
const EffectMeta& em = effects.at(i);
|
const EffectMeta& em = effects.at(i);
|
||||||
|
|
||||||
if (em.type == type && em.subtype == subtype) {
|
if (em.type == type && em.subtype == subtype) {
|
||||||
QAction* action = new QAction(&effects_menu);
|
QAction* action = new QAction(&effects_menu);
|
||||||
action->setText(em.name);
|
action->setText(em.name);
|
||||||
action->setData(reinterpret_cast<quintptr>(&em));
|
action->setData(reinterpret_cast<quintptr>(&em));
|
||||||
|
|
||||||
QMenu* parent = &effects_menu;
|
QMenu* parent = &effects_menu;
|
||||||
if (!em.category.isEmpty()) {
|
if (!em.category.isEmpty()) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int j=0;j<effects_menu.actions().size();j++) {
|
for (int j=0;j<effects_menu.actions().size();j++) {
|
||||||
QAction* action = effects_menu.actions().at(j);
|
QAction* action = effects_menu.actions().at(j);
|
||||||
if (action->menu() != NULL) {
|
if (action->menu() != NULL) {
|
||||||
if (action->menu()->title() == em.category) {
|
if (action->menu()->title() == em.category) {
|
||||||
parent = action->menu();
|
parent = action->menu();
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
parent = new QMenu(&effects_menu);
|
parent = new QMenu(&effects_menu);
|
||||||
parent->setTitle(em.category);
|
parent->setTitle(em.category);
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int i=0;i<effects_menu.actions().size();i++) {
|
for (int i=0;i<effects_menu.actions().size();i++) {
|
||||||
QAction* comp_action = effects_menu.actions().at(i);
|
QAction* comp_action = effects_menu.actions().at(i);
|
||||||
if (comp_action->text() > em.category) {
|
if (comp_action->text() > em.category) {
|
||||||
effects_menu.insertMenu(comp_action, parent);
|
effects_menu.insertMenu(comp_action, parent);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) effects_menu.addMenu(parent);
|
if (!found) effects_menu.addMenu(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int i=0;i<parent->actions().size();i++) {
|
for (int i=0;i<parent->actions().size();i++) {
|
||||||
QAction* comp_action = parent->actions().at(i);
|
QAction* comp_action = parent->actions().at(i);
|
||||||
if (comp_action->text() > action->text()) {
|
if (comp_action->text() > action->text()) {
|
||||||
parent->insertAction(comp_action, action);
|
parent->insertAction(comp_action, action);
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) parent->addAction(action);
|
if (!found) parent->addAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
effects_loaded.unlock();
|
effects_loaded.unlock();
|
||||||
|
|
||||||
connect(&effects_menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_select(QAction*)));
|
connect(&effects_menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_select(QAction*)));
|
||||||
effects_menu.exec(QCursor::pos());
|
effects_menu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::clear_effects(bool clear_cache) {
|
void EffectControls::clear_effects(bool clear_cache) {
|
||||||
// clear existing clips
|
// clear existing clips
|
||||||
deselect_all_effects(NULL);
|
deselect_all_effects(NULL);
|
||||||
|
|
||||||
QVBoxLayout* video_layout = static_cast<QVBoxLayout*>(ui->video_effect_area->layout());
|
QVBoxLayout* video_layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||||
QVBoxLayout* audio_layout = static_cast<QVBoxLayout*>(ui->audio_effect_area->layout());
|
QVBoxLayout* audio_layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
||||||
QLayoutItem* item;
|
QLayoutItem* item;
|
||||||
while ((item = video_layout->takeAt(0))) {
|
while ((item = video_layout->takeAt(0))) {
|
||||||
item->widget()->setParent(NULL);
|
item->widget()->setParent(NULL);
|
||||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||||
}
|
}
|
||||||
while ((item = audio_layout->takeAt(0))) {
|
while ((item = audio_layout->takeAt(0))) {
|
||||||
item->widget()->setParent(NULL);
|
item->widget()->setParent(NULL);
|
||||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||||
}
|
}
|
||||||
ui->lblMultipleClipsSelected->setVisible(false);
|
lblMultipleClipsSelected->setVisible(false);
|
||||||
ui->vcontainer->setVisible(false);
|
vcontainer->setVisible(false);
|
||||||
ui->acontainer->setVisible(false);
|
acontainer->setVisible(false);
|
||||||
ui->headers->setVisible(false);
|
headers->setVisible(false);
|
||||||
ui->keyframeView->setEnabled(false);
|
keyframeView->setEnabled(false);
|
||||||
if (clear_cache) selected_clips.clear();
|
if (clear_cache) selected_clips.clear();
|
||||||
setWindowTitle(panel_name + "(none)");
|
setWindowTitle(panel_name + "(none)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::deselect_all_effects(QWidget* sender) {
|
void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
if (c->effects.at(j)->container != sender) {
|
if (c->effects.at(j)->container != sender) {
|
||||||
c->effects.at(j)->container->header_click(false, false);
|
c->effects.at(j)->container->header_click(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panel_sequence_viewer->viewer_widget->update();
|
panel_sequence_viewer->viewer_widget->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
|
void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
|
||||||
CollapsibleWidget* container = e->container;
|
CollapsibleWidget* container = e->container;
|
||||||
layout->addWidget(container);
|
layout->addWidget(container);
|
||||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectControls::setup_ui() {
|
||||||
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
|
QWidget* contents = new QWidget();
|
||||||
|
|
||||||
|
QHBoxLayout* layout = new QHBoxLayout(contents);
|
||||||
|
layout->setSpacing(0);
|
||||||
|
layout->setMargin(0);
|
||||||
|
|
||||||
|
QSplitter* splitter = new QSplitter(contents);
|
||||||
|
splitter->setOrientation(Qt::Horizontal);
|
||||||
|
splitter->setChildrenCollapsible(false);
|
||||||
|
|
||||||
|
scrollArea = new QScrollArea(splitter);
|
||||||
|
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();
|
||||||
|
|
||||||
|
QHBoxLayout* scrollAreaLayout = new QHBoxLayout(scrollAreaWidgetContents);
|
||||||
|
scrollAreaLayout->setSpacing(0);
|
||||||
|
scrollAreaLayout->setMargin(0);
|
||||||
|
|
||||||
|
effects_area = new EffectsArea(scrollAreaWidgetContents);
|
||||||
|
|
||||||
|
QVBoxLayout* effects_area_layout = new QVBoxLayout(effects_area);
|
||||||
|
effects_area_layout->setSpacing(0);
|
||||||
|
effects_area_layout->setMargin(0);
|
||||||
|
|
||||||
|
vcontainer = new QWidget(effects_area);
|
||||||
|
QVBoxLayout* vcontainerLayout = new QVBoxLayout(vcontainer);
|
||||||
|
vcontainerLayout->setSpacing(0);
|
||||||
|
vcontainerLayout->setMargin(0);
|
||||||
|
|
||||||
|
QWidget* veHeader = new QWidget(vcontainer);
|
||||||
|
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);
|
||||||
|
|
||||||
|
QPushButton* btnAddVideoEffect = new QPushButton(veHeader);
|
||||||
|
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||||
|
btnAddVideoEffect->setToolTip("Add Video Effect");
|
||||||
|
veHeaderLayout->addWidget(btnAddVideoEffect);
|
||||||
|
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
||||||
|
|
||||||
|
veHeaderLayout->addStretch();
|
||||||
|
|
||||||
|
QLabel* lblVideoEffects = new QLabel(veHeader);
|
||||||
|
QFont font;
|
||||||
|
font.setPointSize(9);
|
||||||
|
lblVideoEffects->setFont(font);
|
||||||
|
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
||||||
|
lblVideoEffects->setText("VIDEO EFFECTS");
|
||||||
|
veHeaderLayout->addWidget(lblVideoEffects);
|
||||||
|
|
||||||
|
veHeaderLayout->addStretch();
|
||||||
|
|
||||||
|
QPushButton* btnAddVideoTransition = new QPushButton(veHeader);
|
||||||
|
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||||
|
btnAddVideoTransition->setToolTip("Add Video Transition");
|
||||||
|
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
||||||
|
|
||||||
|
veHeaderLayout->addWidget(btnAddVideoTransition);
|
||||||
|
|
||||||
|
vcontainerLayout->addWidget(veHeader);
|
||||||
|
|
||||||
|
video_effect_area = new QWidget(vcontainer);
|
||||||
|
QVBoxLayout* veAreaLayout = new QVBoxLayout(video_effect_area);
|
||||||
|
veAreaLayout->setSpacing(0);
|
||||||
|
veAreaLayout->setMargin(0);
|
||||||
|
|
||||||
|
vcontainerLayout->addWidget(video_effect_area);
|
||||||
|
|
||||||
|
effects_area_layout->addWidget(vcontainer);
|
||||||
|
|
||||||
|
acontainer = new QWidget(effects_area);
|
||||||
|
QVBoxLayout* acontainerLayout = new QVBoxLayout(acontainer);
|
||||||
|
acontainerLayout->setSpacing(0);
|
||||||
|
acontainerLayout->setMargin(0);
|
||||||
|
QWidget* aeHeader = new QWidget(acontainer);
|
||||||
|
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);
|
||||||
|
|
||||||
|
QPushButton* btnAddAudioEffect = new QPushButton(aeHeader);
|
||||||
|
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||||
|
btnAddAudioEffect->setToolTip("Add Audio Effect");
|
||||||
|
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
||||||
|
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
||||||
|
|
||||||
|
aeHeaderLayout->addStretch();
|
||||||
|
|
||||||
|
QLabel* lblAudioEffects = new QLabel(aeHeader);
|
||||||
|
lblAudioEffects->setFont(font);
|
||||||
|
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
||||||
|
lblAudioEffects->setText("AUDIO EFFECTS");
|
||||||
|
aeHeaderLayout->addWidget(lblAudioEffects);
|
||||||
|
|
||||||
|
aeHeaderLayout->addStretch();
|
||||||
|
|
||||||
|
QPushButton* btnAddAudioTransition = new QPushButton(aeHeader);
|
||||||
|
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||||
|
btnAddAudioTransition->setToolTip("Add Audio Transition");
|
||||||
|
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
||||||
|
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
||||||
|
|
||||||
|
acontainerLayout->addWidget(aeHeader);
|
||||||
|
|
||||||
|
audio_effect_area = new QWidget(acontainer);
|
||||||
|
QVBoxLayout* aeAreaLayout = new QVBoxLayout(audio_effect_area);
|
||||||
|
aeAreaLayout->setSpacing(0);
|
||||||
|
aeAreaLayout->setMargin(0);
|
||||||
|
|
||||||
|
acontainerLayout->addWidget(audio_effect_area);
|
||||||
|
|
||||||
|
effects_area_layout->addWidget(acontainer);
|
||||||
|
|
||||||
|
lblMultipleClipsSelected = new QLabel(effects_area);
|
||||||
|
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
||||||
|
lblMultipleClipsSelected->setText("(Multiple clips selected)");
|
||||||
|
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
||||||
|
|
||||||
|
effects_area_layout->addStretch();
|
||||||
|
|
||||||
|
scrollAreaLayout->addWidget(effects_area);
|
||||||
|
|
||||||
|
scrollArea->setWidget(scrollAreaWidgetContents);
|
||||||
|
splitter->addWidget(scrollArea);
|
||||||
|
QWidget* keyframeArea = new QWidget(splitter);
|
||||||
|
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);
|
||||||
|
headers = new TimelineHeader(keyframeArea);
|
||||||
|
|
||||||
|
keyframeAreaLayout->addWidget(headers);
|
||||||
|
|
||||||
|
QWidget* keyframeCenterWidget = new QWidget(keyframeArea);
|
||||||
|
|
||||||
|
QHBoxLayout* keyframeCenterLayout = new QHBoxLayout(keyframeCenterWidget);
|
||||||
|
keyframeCenterLayout->setSpacing(0);
|
||||||
|
keyframeCenterLayout->setMargin(0);
|
||||||
|
|
||||||
|
keyframeView = new KeyframeView(keyframeCenterWidget);
|
||||||
|
|
||||||
|
keyframeCenterLayout->addWidget(keyframeView);
|
||||||
|
|
||||||
|
verticalScrollBar = new QScrollBar(keyframeCenterWidget);
|
||||||
|
verticalScrollBar->setOrientation(Qt::Vertical);
|
||||||
|
|
||||||
|
keyframeCenterLayout->addWidget(verticalScrollBar);
|
||||||
|
|
||||||
|
|
||||||
|
keyframeAreaLayout->addWidget(keyframeCenterWidget);
|
||||||
|
|
||||||
|
horizontalScrollBar = new ResizableScrollBar(keyframeArea);
|
||||||
|
horizontalScrollBar->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
|
keyframeAreaLayout->addWidget(horizontalScrollBar);
|
||||||
|
|
||||||
|
splitter->addWidget(keyframeArea);
|
||||||
|
|
||||||
|
layout->addWidget(splitter);
|
||||||
|
|
||||||
|
setWidget(contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::load_effects() {
|
void EffectControls::load_effects() {
|
||||||
ui->lblMultipleClipsSelected->setVisible(multiple);
|
lblMultipleClipsSelected->setVisible(multiple);
|
||||||
|
|
||||||
if (!multiple) {
|
if (!multiple) {
|
||||||
// load in new clips
|
// load in new clips
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||||
QVBoxLayout* layout;
|
QVBoxLayout* layout;
|
||||||
if (c->track < 0) {
|
if (c->track < 0) {
|
||||||
ui->vcontainer->setVisible(true);
|
vcontainer->setVisible(true);
|
||||||
layout = static_cast<QVBoxLayout*>(ui->video_effect_area->layout());
|
layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||||
} else {
|
} else {
|
||||||
ui->acontainer->setVisible(true);
|
acontainer->setVisible(true);
|
||||||
layout = static_cast<QVBoxLayout*>(ui->audio_effect_area->layout());
|
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() != NULL) {
|
||||||
|
open_effect(layout, c->get_opening_transition());
|
||||||
|
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != NULL) {
|
||||||
|
open_effect(layout, c->get_closing_transition());
|
||||||
}
|
}
|
||||||
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() != NULL) {
|
|
||||||
open_effect(layout, c->get_opening_transition());
|
|
||||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != NULL) {
|
|
||||||
open_effect(layout, c->get_closing_transition());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (selected_clips.size() > 0) {
|
if (selected_clips.size() > 0) {
|
||||||
setWindowTitle(panel_name + sequence->clips.at(selected_clips.at(0))->name);
|
setWindowTitle(panel_name + sequence->clips.at(selected_clips.at(0))->name);
|
||||||
ui->verticalScrollBar->setMaximum(qMax(0, ui->effects_area->sizeHint().height() - ui->headers->height() + ui->scrollArea->horizontalScrollBar()->height()/* - ui->keyframeView->height() - ui->headers->height()*/));
|
verticalScrollBar->setMaximum(qMax(0, effects_area->sizeHint().height() - headers->height() + scrollArea->horizontalScrollBar()->height()/* - keyframeView->height() - headers->height()*/));
|
||||||
ui->keyframeView->setEnabled(true);
|
keyframeView->setEnabled(true);
|
||||||
ui->headers->setVisible(true);
|
headers->setVisible(true);
|
||||||
ui->keyframeView->update();
|
keyframeView->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::delete_effects() {
|
void EffectControls::delete_effects() {
|
||||||
// load in new clips
|
// load in new clips
|
||||||
if (mode == TA_NO_TRANSITION) {
|
if (mode == TA_NO_TRANSITION) {
|
||||||
EffectDeleteCommand* command = new EffectDeleteCommand();
|
EffectDeleteCommand* command = new EffectDeleteCommand();
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
Effect* effect = c->effects.at(j);
|
Effect* effect = c->effects.at(j);
|
||||||
if (effect->container->selected) {
|
if (effect->container->selected) {
|
||||||
command->clips.append(c);
|
command->clips.append(c);
|
||||||
command->fx.append(j);
|
command->fx.append(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (command->clips.size() > 0) {
|
if (command->clips.size() > 0) {
|
||||||
undo_stack.push(command);
|
undo_stack.push(command);
|
||||||
panel_sequence_viewer->viewer_widget->update();
|
panel_sequence_viewer->viewer_widget->update();
|
||||||
} else {
|
} else {
|
||||||
delete command;
|
delete command;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::reload_clips() {
|
void EffectControls::reload_clips() {
|
||||||
clear_effects(false);
|
clear_effects(false);
|
||||||
load_effects();
|
load_effects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::set_clips(QVector<int>& clips, int m) {
|
void EffectControls::set_clips(QVector<int>& clips, int m) {
|
||||||
clear_effects(true);
|
clear_effects(true);
|
||||||
|
|
||||||
// replace clip vector
|
// replace clip vector
|
||||||
selected_clips = clips;
|
selected_clips = clips;
|
||||||
mode = m;
|
mode = m;
|
||||||
|
|
||||||
load_effects();
|
load_effects();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectControls::on_btnAddVideoEffect_clicked() {
|
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::on_btnAddAudioEffect_clicked() {
|
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::on_btnAddVideoTransition_clicked() {
|
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::on_btnAddAudioTransition_clicked() {
|
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*) {
|
void EffectControls::resizeEvent(QResizeEvent*) {
|
||||||
ui->verticalScrollBar->setMaximum(qMax(0, ui->effects_area->height() - ui->keyframeView->height() - ui->headers->height()));
|
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EffectControls::is_focused() {
|
bool EffectControls::is_focused() {
|
||||||
if (this->hasFocus()) return true;
|
if (this->hasFocus()) return true;
|
||||||
for (int i=0;i<selected_clips.size();i++) {
|
for (int i=0;i<selected_clips.size();i++) {
|
||||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
for (int j=0;j<c->effects.size();j++) {
|
for (int j=0;j<c->effects.size();j++) {
|
||||||
if (c->effects.at(j)->container->is_focused()) {
|
if (c->effects.at(j)->container->is_focused()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dout << "[WARNING] Tried to check focus of a NULL clip";
|
dout << "[WARNING] Tried to check focus of a NULL clip";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EffectsArea::EffectsArea(QWidget* parent) : QWidget(parent) {}
|
EffectsArea::EffectsArea(QWidget* parent) : QWidget(parent) {}
|
||||||
|
|||||||
+37
-24
@@ -11,6 +11,10 @@ class TimelineHeader;
|
|||||||
class QScrollArea;
|
class QScrollArea;
|
||||||
class KeyframeView;
|
class KeyframeView;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
class ResizableScrollBar;
|
||||||
|
class QLabel;
|
||||||
|
class KeyframeView;
|
||||||
|
class QScrollBar;
|
||||||
|
|
||||||
class EffectsArea : public QWidget {
|
class EffectsArea : public QWidget {
|
||||||
public:
|
public:
|
||||||
@@ -21,10 +25,6 @@ public:
|
|||||||
TimelineHeader* header;
|
TimelineHeader* header;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class EffectControls;
|
|
||||||
}
|
|
||||||
|
|
||||||
class EffectControls : public QDockWidget
|
class EffectControls : public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -32,45 +32,58 @@ class EffectControls : public QDockWidget
|
|||||||
public:
|
public:
|
||||||
explicit EffectControls(QWidget *parent = 0);
|
explicit EffectControls(QWidget *parent = 0);
|
||||||
~EffectControls();
|
~EffectControls();
|
||||||
void set_clips(QVector<int>& clips, int mode);
|
void set_clips(QVector<int>& clips, int mode);
|
||||||
void clear_effects(bool clear_cache);
|
void clear_effects(bool clear_cache);
|
||||||
void delete_effects();
|
void delete_effects();
|
||||||
bool is_focused();
|
bool is_focused();
|
||||||
void reload_clips();
|
void reload_clips();
|
||||||
void set_zoom(bool in);
|
void set_zoom(bool in);
|
||||||
bool keyframe_focus();
|
bool keyframe_focus();
|
||||||
void delete_selected_keyframes();
|
void delete_selected_keyframes();
|
||||||
void copy(bool del);
|
void copy(bool del);
|
||||||
bool multiple;
|
bool multiple;
|
||||||
|
|
||||||
QVector<int> selected_clips;
|
QVector<int> selected_clips;
|
||||||
|
|
||||||
double zoom;
|
double zoom;
|
||||||
|
|
||||||
Ui::EffectControls *ui;
|
ResizableScrollBar* horizontalScrollBar;
|
||||||
|
QScrollBar* verticalScrollBar;
|
||||||
public slots:
|
public slots:
|
||||||
void update_keyframes();
|
void update_keyframes();
|
||||||
private slots:
|
private slots:
|
||||||
void menu_select(QAction* q);
|
void menu_select(QAction* q);
|
||||||
|
|
||||||
void on_btnAddVideoEffect_clicked();
|
void video_effect_click();
|
||||||
void on_btnAddAudioEffect_clicked();
|
void audio_effect_click();
|
||||||
void on_btnAddVideoTransition_clicked();
|
void video_transition_click();
|
||||||
void on_btnAddAudioTransition_clicked();
|
void audio_transition_click();
|
||||||
|
|
||||||
void deselect_all_effects(QWidget*);
|
void deselect_all_effects(QWidget*);
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event);
|
void resizeEvent(QResizeEvent *event);
|
||||||
private:
|
private:
|
||||||
void show_effect_menu(int type, int subtype);
|
void show_effect_menu(int type, int subtype);
|
||||||
void load_effects();
|
void load_effects();
|
||||||
void load_keyframes();
|
void load_keyframes();
|
||||||
void open_effect(QVBoxLayout* layout, Effect* e);
|
void open_effect(QVBoxLayout* layout, Effect* e);
|
||||||
|
|
||||||
int effect_menu_type;
|
void setup_ui();
|
||||||
int effect_menu_subtype;
|
|
||||||
QString panel_name;
|
int effect_menu_type;
|
||||||
int mode;
|
int effect_menu_subtype;
|
||||||
|
QString panel_name;
|
||||||
|
int mode;
|
||||||
|
|
||||||
|
TimelineHeader* headers;
|
||||||
|
EffectsArea* effects_area;
|
||||||
|
QScrollArea* scrollArea;
|
||||||
|
QLabel* lblMultipleClipsSelected;
|
||||||
|
KeyframeView* keyframeView;
|
||||||
|
QWidget* video_effect_area;
|
||||||
|
QWidget* audio_effect_area;
|
||||||
|
QWidget* vcontainer;
|
||||||
|
QWidget* acontainer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EFFECTCONTROLS_H
|
#endif // EFFECTCONTROLS_H
|
||||||
|
|||||||
@@ -1,554 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>EffectControls</class>
|
|
||||||
<widget class="QDockWidget" name="EffectControls">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>621</width>
|
|
||||||
<height>510</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="features">
|
|
||||||
<set>QDockWidget::AllDockWidgetFeatures</set>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Effect Controls</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QSplitter" name="splitter">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="verticalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
|
||||||
</property>
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>189</width>
|
|
||||||
<height>483</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="EffectsArea" name="effects_area" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="vcontainer" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="veHeader" native="true">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">#veHeader {
|
|
||||||
background: rgba(0, 0, 0, 0.25);
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnAddVideoEffect">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Add Video Effect</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normalon>:/icons/add-effect.png</normalon>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="hsLeftVideoEffects">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="lblVideoEffects">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>9</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>VIDEO EFFECTS</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="hsRightVideoEffects">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnAddVideoTransition">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Add Video Transition</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normalon>:/icons/add-transition.png</normalon>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="video_effect_area" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="acontainer" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="aeHeader" native="true">
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">#aeHeader {
|
|
||||||
background: rgba(0, 0, 0, 0.25);
|
|
||||||
}</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnAddAudioEffect">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Add Audio Effect</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normalon>:/icons/add-effect.png</normalon>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="hsLeftAudioEffects">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="lblAudioEffects">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>9</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>AUDIO EFFECTS</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="hsRightAudioEffects">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnAddAudioTransition">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Add Audio Transition</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normalon>:/icons/add-transition.png</normalon>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="audio_effect_area" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="lblMultipleClipsSelected">
|
|
||||||
<property name="text">
|
|
||||||
<string>(Multiple clips selected)</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="keyframeArea" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>1</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="TimelineHeader" name="headers" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="keyframeCenterWidget" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="KeyframeView" name="keyframeView" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QScrollBar" name="verticalScrollBar">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>1826</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="ResizableScrollBar" name="horizontalScrollBar">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>1826</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>KeyframeView</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>ui/keyframeview.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>TimelineHeader</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>ui/timelineheader.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>EffectsArea</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>panels/effectcontrols.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>ResizableScrollBar</class>
|
|
||||||
<extends>QScrollBar</extends>
|
|
||||||
<header>ui/resizablescrollbar.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
+1
-7
@@ -60,13 +60,7 @@ QString recent_proj_file;
|
|||||||
Project::Project(QWidget *parent) :
|
Project::Project(QWidget *parent) :
|
||||||
QDockWidget(parent)
|
QDockWidget(parent)
|
||||||
{
|
{
|
||||||
setObjectName("Project");
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
resize(504, 371);
|
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
|
||||||
sizePolicy.setHorizontalStretch(0);
|
|
||||||
sizePolicy.setVerticalStretch(0);
|
|
||||||
sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
|
|
||||||
setSizePolicy(sizePolicy);
|
|
||||||
|
|
||||||
QWidget* dockWidgetContents = new QWidget();
|
QWidget* dockWidgetContents = new QWidget();
|
||||||
QVBoxLayout* verticalLayout = new QVBoxLayout(dockWidgetContents);
|
QVBoxLayout* verticalLayout = new QVBoxLayout(dockWidgetContents);
|
||||||
|
|||||||
+728
-729
File diff suppressed because it is too large
Load Diff
+370
-274
@@ -1,5 +1,4 @@
|
|||||||
#include "viewer.h"
|
#include "viewer.h"
|
||||||
#include "ui_viewer.h"
|
|
||||||
|
|
||||||
#include "playback/audio.h"
|
#include "playback/audio.h"
|
||||||
#include "timeline.h"
|
#include "timeline.h"
|
||||||
@@ -15,6 +14,8 @@
|
|||||||
#include "ui_timeline.h"
|
#include "ui_timeline.h"
|
||||||
#include "playback/playback.h"
|
#include "playback/playback.h"
|
||||||
#include "ui/viewerwidget.h"
|
#include "ui/viewerwidget.h"
|
||||||
|
#include "ui/viewercontainer.h"
|
||||||
|
#include "ui/labelslider.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
#define FRAMES_IN_ONE_MINUTE 1798 // 1800 - 2
|
#define FRAMES_IN_ONE_MINUTE 1798 // 1800 - 2
|
||||||
@@ -32,62 +33,60 @@ extern "C" {
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
Viewer::Viewer(QWidget *parent) :
|
Viewer::Viewer(QWidget *parent) :
|
||||||
QDockWidget(parent),
|
QDockWidget(parent),
|
||||||
playing(false),
|
playing(false),
|
||||||
just_played(false),
|
just_played(false),
|
||||||
media(NULL),
|
media(NULL),
|
||||||
seq(NULL),
|
seq(NULL),
|
||||||
ui(new Ui::Viewer),
|
created_sequence(false),
|
||||||
created_sequence(false),
|
cue_recording_internal(false),
|
||||||
cue_recording_internal(false),
|
panel_name("Viewer: "),
|
||||||
panel_name("Viewer: "),
|
minimum_zoom(1.0)
|
||||||
minimum_zoom(1.0)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
setup_ui();
|
||||||
ui->headers->viewer = this;
|
|
||||||
ui->headers->snapping = false;
|
|
||||||
ui->headers->show_text(false);
|
|
||||||
ui->glViewerPane->viewer = this;
|
|
||||||
viewer_widget = ui->glViewerPane->child;
|
|
||||||
viewer_widget->viewer = this;
|
|
||||||
set_media(NULL);
|
|
||||||
|
|
||||||
ui->currentTimecode->setEnabled(false);
|
headers->viewer = this;
|
||||||
ui->currentTimecode->set_minimum_value(0);
|
headers->snapping = false;
|
||||||
ui->currentTimecode->set_default_value(qSNaN());
|
headers->show_text(false);
|
||||||
ui->currentTimecode->set_value(0, false);
|
glViewerPane->viewer = this;
|
||||||
ui->currentTimecode->set_display_type(LABELSLIDER_FRAMENUMBER);
|
viewer_widget = glViewerPane->child;
|
||||||
connect(ui->currentTimecode, SIGNAL(valueChanged()), this, SLOT(update_playhead()));
|
viewer_widget->viewer = this;
|
||||||
|
set_media(NULL);
|
||||||
|
|
||||||
|
currentTimecode->setEnabled(false);
|
||||||
|
currentTimecode->set_minimum_value(0);
|
||||||
|
currentTimecode->set_default_value(qSNaN());
|
||||||
|
currentTimecode->set_value(0, false);
|
||||||
|
currentTimecode->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||||
|
connect(currentTimecode, SIGNAL(valueChanged()), this, SLOT(update_playhead()));
|
||||||
|
|
||||||
recording_flasher.setInterval(500);
|
recording_flasher.setInterval(500);
|
||||||
|
|
||||||
connect(&playback_updater, SIGNAL(timeout()), this, SLOT(timer_update()));
|
connect(&playback_updater, SIGNAL(timeout()), this, SLOT(timer_update()));
|
||||||
connect(&recording_flasher, SIGNAL(timeout()), this, SLOT(recording_flasher_update()));
|
connect(&recording_flasher, SIGNAL(timeout()), this, SLOT(recording_flasher_update()));
|
||||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
|
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
||||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), viewer_widget, SLOT(set_waveform_scroll(int)));
|
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), viewer_widget, SLOT(set_waveform_scroll(int)));
|
||||||
connect(ui->horizontalScrollBar, SIGNAL(resize_move(double)), this, SLOT(resize_move(double)));
|
connect(horizontalScrollBar, SIGNAL(resize_move(double)), this, SLOT(resize_move(double)));
|
||||||
|
|
||||||
update_playhead_timecode(0);
|
update_playhead_timecode(0);
|
||||||
update_end_timecode();
|
update_end_timecode();
|
||||||
}
|
}
|
||||||
|
|
||||||
Viewer::~Viewer() {
|
Viewer::~Viewer() {}
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Viewer::is_focused() {
|
bool Viewer::is_focused() {
|
||||||
return ui->headers->hasFocus()
|
return headers->hasFocus()
|
||||||
|| viewer_widget->hasFocus()
|
|| viewer_widget->hasFocus()
|
||||||
|| ui->btnSkipToStart->hasFocus()
|
|| btnSkipToStart->hasFocus()
|
||||||
|| ui->btnRewind->hasFocus()
|
|| btnRewind->hasFocus()
|
||||||
|| ui->btnPlay->hasFocus()
|
|| btnPlay->hasFocus()
|
||||||
|| ui->btnFastForward->hasFocus()
|
|| btnFastForward->hasFocus()
|
||||||
|| ui->btnSkipToEnd->hasFocus();
|
|| btnSkipToEnd->hasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_main_sequence() {
|
void Viewer::set_main_sequence() {
|
||||||
clean_created_seq();
|
clean_created_seq();
|
||||||
set_sequence(true, sequence);
|
set_sequence(true, sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::reset_all_audio() {
|
void Viewer::reset_all_audio() {
|
||||||
@@ -101,43 +100,43 @@ void Viewer::reset_all_audio() {
|
|||||||
if (c != NULL) c->reset_audio();
|
if (c != NULL) c->reset_audio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clear_audio_ibuffer();
|
clear_audio_ibuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
long timecode_to_frame(const QString& s, int view, double frame_rate) {
|
long timecode_to_frame(const QString& s, int view, double frame_rate) {
|
||||||
QList<QString> list = s.split(QRegExp("[:;]"));
|
QList<QString> list = s.split(QRegExp("[:;]"));
|
||||||
|
|
||||||
if (view == TIMECODE_FRAMES || (list.size() == 1 && view != TIMECODE_MILLISECONDS)) {
|
if (view == TIMECODE_FRAMES || (list.size() == 1 && view != TIMECODE_MILLISECONDS)) {
|
||||||
return s.toLong();
|
return s.toLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
int frRound = qRound(frame_rate);
|
int frRound = qRound(frame_rate);
|
||||||
int hours, minutes, seconds, frames;
|
int hours, minutes, seconds, frames;
|
||||||
|
|
||||||
if (view == TIMECODE_MILLISECONDS) {
|
if (view == TIMECODE_MILLISECONDS) {
|
||||||
long milliseconds = s.toLong();
|
long milliseconds = s.toLong();
|
||||||
|
|
||||||
hours = milliseconds/3600000;
|
hours = milliseconds/3600000;
|
||||||
milliseconds -= (hours*3600000);
|
milliseconds -= (hours*3600000);
|
||||||
minutes = milliseconds/60000;
|
minutes = milliseconds/60000;
|
||||||
milliseconds -= (minutes*60000);
|
milliseconds -= (minutes*60000);
|
||||||
seconds = milliseconds/1000;
|
seconds = milliseconds/1000;
|
||||||
milliseconds -= (seconds*1000);
|
milliseconds -= (seconds*1000);
|
||||||
frames = qRound64((milliseconds*0.001)*frame_rate);
|
frames = qRound64((milliseconds*0.001)*frame_rate);
|
||||||
|
|
||||||
seconds = qRound64(seconds * frame_rate);
|
seconds = qRound64(seconds * frame_rate);
|
||||||
minutes = qRound64(minutes * frame_rate * 60);
|
minutes = qRound64(minutes * frame_rate * 60);
|
||||||
hours = qRound64(hours * frame_rate * 3600);
|
hours = qRound64(hours * frame_rate * 3600);
|
||||||
} else {
|
} else {
|
||||||
hours = ((list.size() > 0) ? list.at(0).toInt() : 0) * frRound * 3600;
|
hours = ((list.size() > 0) ? list.at(0).toInt() : 0) * frRound * 3600;
|
||||||
minutes = ((list.size() > 1) ? list.at(1).toInt() : 0) * frRound * 60;
|
minutes = ((list.size() > 1) ? list.at(1).toInt() : 0) * frRound * 60;
|
||||||
seconds = ((list.size() > 2) ? list.at(2).toInt() : 0) * frRound;
|
seconds = ((list.size() > 2) ? list.at(2).toInt() : 0) * frRound;
|
||||||
frames = (list.size() > 3) ? list.at(3).toInt() : 0;
|
frames = (list.size() > 3) ? list.at(3).toInt() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int f = (frames + seconds + minutes + hours);
|
int f = (frames + seconds + minutes + hours);
|
||||||
|
|
||||||
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) {
|
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) {
|
||||||
// return drop
|
// return drop
|
||||||
int d;
|
int d;
|
||||||
int m;
|
int m;
|
||||||
@@ -161,69 +160,69 @@ long timecode_to_frame(const QString& s, int view, double frame_rate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString frame_to_timecode(long f, int view, double frame_rate) {
|
QString frame_to_timecode(long f, int view, double frame_rate) {
|
||||||
if (view == TIMECODE_FRAMES) {
|
if (view == TIMECODE_FRAMES) {
|
||||||
return QString::number(f);
|
return QString::number(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return timecode
|
// return timecode
|
||||||
int hours = 0;
|
int hours = 0;
|
||||||
int mins = 0;
|
int mins = 0;
|
||||||
int secs = 0;
|
int secs = 0;
|
||||||
int frames = 0;
|
int frames = 0;
|
||||||
QString token = ":";
|
QString token = ":";
|
||||||
|
|
||||||
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) {
|
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) {
|
||||||
//CONVERT A FRAME NUMBER TO DROP FRAME TIMECODE
|
//CONVERT A FRAME NUMBER TO DROP FRAME TIMECODE
|
||||||
//Code by David Heidelberger, adapted from Andrew Duncan, further adapted for Olive by Olive Team
|
//Code by David Heidelberger, adapted from Andrew Duncan, further adapted for Olive by Olive Team
|
||||||
//Given an int called framenumber and a double called framerate
|
//Given an int called framenumber and a double called framerate
|
||||||
//Framerate should be 29.97, 59.94, or 23.976, otherwise the calculations will be off.
|
//Framerate should be 29.97, 59.94, or 23.976, otherwise the calculations will be off.
|
||||||
|
|
||||||
int d;
|
int d;
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
int dropFrames = round(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate
|
int dropFrames = round(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate
|
||||||
int framesPerHour = round(frame_rate*60*60); //Number of frqRound64ames in an hour
|
int framesPerHour = round(frame_rate*60*60); //Number of frqRound64ames in an hour
|
||||||
int framesPer24Hours = framesPerHour*24; //Number of frames in a day - timecode rolls over after 24 hours
|
int framesPer24Hours = framesPerHour*24; //Number of frames in a day - timecode rolls over after 24 hours
|
||||||
int framesPer10Minutes = round(frame_rate * 60 * 10); //Number of frames per ten minutes
|
int framesPer10Minutes = round(frame_rate * 60 * 10); //Number of frames per ten minutes
|
||||||
int framesPerMinute = (round(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames
|
int framesPerMinute = (round(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames
|
||||||
|
|
||||||
//If framenumber is greater than 24 hrs, next operation will rollover clock
|
//If framenumber is greater than 24 hrs, next operation will rollover clock
|
||||||
f = f % framesPer24Hours; //% is the modulus operator, which returns a remainder. a % b = the remainder of a/b
|
f = f % framesPer24Hours; //% is the modulus operator, which returns a remainder. a % b = the remainder of a/b
|
||||||
|
|
||||||
d = f / framesPer10Minutes; // \ means integer division, which is a/b without a remainder. Some languages you could use floor(a/b)
|
d = f / framesPer10Minutes; // \ means integer division, which is a/b without a remainder. Some languages you could use floor(a/b)
|
||||||
m = f % framesPer10Minutes;
|
m = f % framesPer10Minutes;
|
||||||
|
|
||||||
//In the original post, the next line read m>1, which only worked for 29.97. Jean-Baptiste Mardelle correctly pointed out that m should be compared to dropFrames.
|
//In the original post, the next line read m>1, which only worked for 29.97. Jean-Baptiste Mardelle correctly pointed out that m should be compared to dropFrames.
|
||||||
if (m > dropFrames) {
|
if (m > dropFrames) {
|
||||||
f = f + (dropFrames*9*d) + dropFrames * ((m - dropFrames) / framesPerMinute);
|
f = f + (dropFrames*9*d) + dropFrames * ((m - dropFrames) / framesPerMinute);
|
||||||
} else {
|
} else {
|
||||||
f = f + dropFrames*9*d;
|
f = f + dropFrames*9*d;
|
||||||
}
|
}
|
||||||
|
|
||||||
int frRound = round(frame_rate);
|
int frRound = round(frame_rate);
|
||||||
frames = f % frRound;
|
frames = f % frRound;
|
||||||
secs = (f / frRound) % 60;
|
secs = (f / frRound) % 60;
|
||||||
mins = ((f / frRound) / 60) % 60;
|
mins = ((f / frRound) / 60) % 60;
|
||||||
hours = (((f / frRound) / 60) / 60);
|
hours = (((f / frRound) / 60) / 60);
|
||||||
|
|
||||||
token = ";";
|
token = ";";
|
||||||
} else {
|
} else {
|
||||||
// non-drop timecode
|
// non-drop timecode
|
||||||
|
|
||||||
int int_fps = qRound(frame_rate);
|
int int_fps = qRound(frame_rate);
|
||||||
hours = f / (3600 * int_fps);
|
hours = f / (3600 * int_fps);
|
||||||
mins = f / (60*int_fps) % 60;
|
mins = f / (60*int_fps) % 60;
|
||||||
secs = f/int_fps % 60;
|
secs = f/int_fps % 60;
|
||||||
frames = f%int_fps;
|
frames = f%int_fps;
|
||||||
}
|
}
|
||||||
if (view == TIMECODE_MILLISECONDS) {
|
if (view == TIMECODE_MILLISECONDS) {
|
||||||
return QString::number((hours*3600000)+(mins*60000)+(secs*1000)+qCeil(frames*1000/frame_rate));
|
return QString::number((hours*3600000)+(mins*60000)+(secs*1000)+qCeil(frames*1000/frame_rate));
|
||||||
}
|
}
|
||||||
return QString(QString::number(hours).rightJustified(2, '0') +
|
return QString(QString::number(hours).rightJustified(2, '0') +
|
||||||
":" + QString::number(mins).rightJustified(2, '0') +
|
":" + QString::number(mins).rightJustified(2, '0') +
|
||||||
":" + QString::number(secs).rightJustified(2, '0') +
|
":" + QString::number(secs).rightJustified(2, '0') +
|
||||||
token + QString::number(frames).rightJustified(2, '0')
|
token + QString::number(frames).rightJustified(2, '0')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool frame_rate_is_droppable(float rate) {
|
bool frame_rate_is_droppable(float rate) {
|
||||||
@@ -234,8 +233,8 @@ void Viewer::seek(long p) {
|
|||||||
pause();
|
pause();
|
||||||
seq->playhead = p;
|
seq->playhead = p;
|
||||||
update_parents();
|
update_parents();
|
||||||
reset_all_audio();
|
reset_all_audio();
|
||||||
audio_scrub = true;
|
audio_scrub = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::go_to_start() {
|
void Viewer::go_to_start() {
|
||||||
@@ -278,7 +277,7 @@ void Viewer::cue_recording(long start, long end, int track) {
|
|||||||
void Viewer::uncue_recording() {
|
void Viewer::uncue_recording() {
|
||||||
cue_recording_internal = false;
|
cue_recording_internal = false;
|
||||||
recording_flasher.stop();
|
recording_flasher.stop();
|
||||||
ui->btnPlay->setStyleSheet(QString());
|
btnPlay->setStyleSheet(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Viewer::is_recording_cued() {
|
bool Viewer::is_recording_cued() {
|
||||||
@@ -298,7 +297,7 @@ void Viewer::play() {
|
|||||||
if (panel_footage_viewer->playing) panel_footage_viewer->pause();
|
if (panel_footage_viewer->playing) panel_footage_viewer->pause();
|
||||||
|
|
||||||
if (seq != NULL) {
|
if (seq != NULL) {
|
||||||
reset_all_audio();
|
reset_all_audio();
|
||||||
if (is_recording_cued() && !start_recording()) {
|
if (is_recording_cued() && !start_recording()) {
|
||||||
dout << "[ERROR] Failed to record audio";
|
dout << "[ERROR] Failed to record audio";
|
||||||
return;
|
return;
|
||||||
@@ -316,7 +315,7 @@ void Viewer::play_wake() {
|
|||||||
if (just_played) {
|
if (just_played) {
|
||||||
start_msecs = QDateTime::currentMSecsSinceEpoch();
|
start_msecs = QDateTime::currentMSecsSinceEpoch();
|
||||||
playback_updater.start();
|
playback_updater.start();
|
||||||
if (audio_thread != NULL) audio_thread->notifyReceiver();
|
if (audio_thread != NULL) audio_thread->notifyReceiver();
|
||||||
just_played = false;
|
just_played = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,27 +335,27 @@ void Viewer::pause() {
|
|||||||
// import audio
|
// import audio
|
||||||
QStringList file_list;
|
QStringList file_list;
|
||||||
file_list.append(get_recorded_audio_filename());
|
file_list.append(get_recorded_audio_filename());
|
||||||
panel_project->process_file_list(file_list);
|
panel_project->process_file_list(file_list);
|
||||||
|
|
||||||
// add it to the sequence
|
// add it to the sequence
|
||||||
Clip* c = new Clip(seq);
|
Clip* c = new Clip(seq);
|
||||||
Media* m = panel_project->last_imported_media.at(0);
|
Media* m = panel_project->last_imported_media.at(0);
|
||||||
Footage* f = m->to_footage();
|
Footage* f = m->to_footage();
|
||||||
|
|
||||||
f->ready_lock.lock();
|
f->ready_lock.lock();
|
||||||
|
|
||||||
c->media = m; // latest media
|
c->media = m; // latest media
|
||||||
c->media_stream = 0;
|
c->media_stream = 0;
|
||||||
c->timeline_in = recording_start;
|
c->timeline_in = recording_start;
|
||||||
c->timeline_out = f->get_length_in_frames(seq->frame_rate);
|
c->timeline_out = f->get_length_in_frames(seq->frame_rate);
|
||||||
c->clip_in = 0;
|
c->clip_in = 0;
|
||||||
c->track = recording_track;
|
c->track = recording_track;
|
||||||
c->color_r = 128;
|
c->color_r = 128;
|
||||||
c->color_g = 192;
|
c->color_g = 192;
|
||||||
c->color_b = 128;
|
c->color_b = 128;
|
||||||
c->name = m->get_name();
|
c->name = m->get_name();
|
||||||
|
|
||||||
f->ready_lock.unlock();
|
f->ready_lock.unlock();
|
||||||
|
|
||||||
QVector<Clip*> add_clips;
|
QVector<Clip*> add_clips;
|
||||||
add_clips.append(c);
|
add_clips.append(c);
|
||||||
@@ -366,24 +365,24 @@ void Viewer::pause() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::update_playhead_timecode(long p) {
|
void Viewer::update_playhead_timecode(long p) {
|
||||||
ui->currentTimecode->set_value(p, false);
|
currentTimecode->set_value(p, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::update_end_timecode() {
|
void Viewer::update_end_timecode() {
|
||||||
ui->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 == NULL) ? frame_to_timecode(0, config.timecode_view, 30) : frame_to_timecode(seq->getEndFrame(), config.timecode_view, seq->frame_rate));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::update_header_zoom() {
|
void Viewer::update_header_zoom() {
|
||||||
if (seq != NULL) {
|
if (seq != NULL) {
|
||||||
long sequenceEndFrame = seq->getEndFrame();
|
long sequenceEndFrame = seq->getEndFrame();
|
||||||
if (cached_end_frame != sequenceEndFrame) {
|
if (cached_end_frame != sequenceEndFrame) {
|
||||||
minimum_zoom = (sequenceEndFrame > 0) ? ((double) ui->headers->width() / (double) sequenceEndFrame) : 1;
|
minimum_zoom = (sequenceEndFrame > 0) ? ((double) headers->width() / (double) sequenceEndFrame) : 1;
|
||||||
ui->headers->update_zoom(qMax(ui->headers->get_zoom(), minimum_zoom));
|
headers->update_zoom(qMax(headers->get_zoom(), minimum_zoom));
|
||||||
set_sb_max();
|
set_sb_max();
|
||||||
viewer_widget->waveform_zoom = ui->headers->get_zoom();
|
viewer_widget->waveform_zoom = headers->get_zoom();
|
||||||
} else {
|
} else {
|
||||||
ui->headers->update();
|
headers->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,137 +391,234 @@ void Viewer::update_parents() {
|
|||||||
update_ui(false);
|
update_ui(false);
|
||||||
} else {
|
} else {
|
||||||
update_viewer();
|
update_viewer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::resizeEvent(QResizeEvent *event) {
|
void Viewer::resizeEvent(QResizeEvent *event) {
|
||||||
if (seq != NULL) {
|
if (seq != NULL) {
|
||||||
set_sb_max();
|
set_sb_max();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::update_viewer() {
|
void Viewer::update_viewer() {
|
||||||
update_header_zoom();
|
update_header_zoom();
|
||||||
viewer_widget->update();
|
viewer_widget->update();
|
||||||
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
||||||
update_end_timecode();
|
update_end_timecode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::clear_inout_point() {
|
void Viewer::clear_inout_point() {
|
||||||
if (seq->using_workarea) {
|
if (seq->using_workarea) {
|
||||||
undo_stack.push(new SetTimelineInOutCommand(seq, false, 0, 0));
|
undo_stack.push(new SetTimelineInOutCommand(seq, false, 0, 0));
|
||||||
update_parents();
|
update_parents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_in_point() {
|
void Viewer::set_in_point() {
|
||||||
ui->headers->set_in_point(seq->playhead);
|
headers->set_in_point(seq->playhead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_out_point() {
|
void Viewer::set_out_point() {
|
||||||
ui->headers->set_out_point(seq->playhead);
|
headers->set_out_point(seq->playhead);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_zoom(bool in) {
|
void Viewer::set_zoom(bool in) {
|
||||||
if (seq != NULL) {
|
if (seq != NULL) {
|
||||||
set_zoom_value(in ? ui->headers->get_zoom()*2 : qMax(minimum_zoom, ui->headers->get_zoom()*0.5));
|
set_zoom_value(in ? headers->get_zoom()*2 : qMax(minimum_zoom, headers->get_zoom()*0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_zoom_value(double d) {
|
void Viewer::set_zoom_value(double d) {
|
||||||
ui->headers->update_zoom(d);
|
headers->update_zoom(d);
|
||||||
if (viewer_widget->waveform) {
|
if (viewer_widget->waveform) {
|
||||||
viewer_widget->waveform_zoom = d;
|
viewer_widget->waveform_zoom = d;
|
||||||
viewer_widget->update();
|
viewer_widget->update();
|
||||||
}
|
}
|
||||||
if (seq != NULL) {
|
if (seq != NULL) {
|
||||||
set_sb_max();
|
set_sb_max();
|
||||||
if (!ui->horizontalScrollBar->is_resizing())
|
if (!horizontalScrollBar->is_resizing())
|
||||||
center_scroll_to_playhead(ui->horizontalScrollBar, ui->headers->get_zoom(), seq->playhead);
|
center_scroll_to_playhead(horizontalScrollBar, headers->get_zoom(), seq->playhead);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_sb_max() {
|
void Viewer::set_sb_max() {
|
||||||
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, seq->getEndFrame(), ui->headers->width());
|
headers->set_scrollbar_max(horizontalScrollBar, seq->getEndFrame(), headers->width());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Viewer::setup_ui() {
|
||||||
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
|
QWidget* contents = new QWidget();
|
||||||
|
|
||||||
|
QVBoxLayout* layout = new QVBoxLayout(contents);
|
||||||
|
layout->setSpacing(0);
|
||||||
|
layout->setMargin(0);
|
||||||
|
|
||||||
|
glViewerPane = new ViewerContainer(contents);
|
||||||
|
glViewerPane->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
layout->addWidget(glViewerPane);
|
||||||
|
|
||||||
|
headers = new TimelineHeader(contents);
|
||||||
|
layout->addWidget(headers);
|
||||||
|
|
||||||
|
horizontalScrollBar = new ResizableScrollBar(contents);
|
||||||
|
horizontalScrollBar->setSingleStep(20);
|
||||||
|
horizontalScrollBar->setOrientation(Qt::Horizontal);
|
||||||
|
layout->addWidget(horizontalScrollBar);
|
||||||
|
|
||||||
|
|
||||||
|
QWidget* lower_controls = new QWidget(contents);
|
||||||
|
|
||||||
|
QHBoxLayout* lower_control_layout = new QHBoxLayout(lower_controls);
|
||||||
|
lower_control_layout->setMargin(0);
|
||||||
|
|
||||||
|
// current time code
|
||||||
|
QWidget* current_timecode_container = new QWidget(lower_controls);
|
||||||
|
QHBoxLayout* current_timecode_container_layout = new QHBoxLayout(current_timecode_container);
|
||||||
|
current_timecode_container_layout->setSpacing(0);
|
||||||
|
current_timecode_container_layout->setMargin(0);
|
||||||
|
currentTimecode = new LabelSlider(current_timecode_container);
|
||||||
|
current_timecode_container_layout->addWidget(currentTimecode);
|
||||||
|
lower_control_layout->addWidget(current_timecode_container);
|
||||||
|
|
||||||
|
QWidget* playback_controls = new QWidget(lower_controls);
|
||||||
|
|
||||||
|
QHBoxLayout* playback_control_layout = new QHBoxLayout(playback_controls);
|
||||||
|
playback_control_layout->setSpacing(0);
|
||||||
|
playback_control_layout->setMargin(0);
|
||||||
|
|
||||||
|
btnSkipToStart = new QPushButton(playback_controls);
|
||||||
|
QIcon goToStartIcon;
|
||||||
|
goToStartIcon.addFile(QStringLiteral(":/icons/prev.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||||
|
goToStartIcon.addFile(QStringLiteral(":/icons/prev-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||||
|
btnSkipToStart->setIcon(goToStartIcon);
|
||||||
|
playback_control_layout->addWidget(btnSkipToStart);
|
||||||
|
|
||||||
|
btnRewind = new QPushButton(playback_controls);
|
||||||
|
QIcon rewindIcon;
|
||||||
|
rewindIcon.addFile(QStringLiteral(":/icons/rew.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||||
|
rewindIcon.addFile(QStringLiteral(":/icons/rew-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||||
|
btnRewind->setIcon(rewindIcon);
|
||||||
|
playback_control_layout->addWidget(btnRewind);
|
||||||
|
|
||||||
|
btnPlay = new QPushButton(playback_controls);
|
||||||
|
QIcon playIcon;
|
||||||
|
playIcon.addFile(QStringLiteral(":/icons/play.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||||
|
playIcon.addFile(QStringLiteral(":/icons/play-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||||
|
btnPlay->setIcon(playIcon);
|
||||||
|
playback_control_layout->addWidget(btnPlay);
|
||||||
|
|
||||||
|
btnFastForward = new QPushButton(playback_controls);
|
||||||
|
QIcon ffIcon;
|
||||||
|
ffIcon.addFile(QStringLiteral(":/icons/ff.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||||
|
ffIcon.addFile(QStringLiteral(":/icons/ff-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||||
|
btnFastForward->setIcon(ffIcon);
|
||||||
|
playback_control_layout->addWidget(btnFastForward);
|
||||||
|
|
||||||
|
btnSkipToEnd = new QPushButton(playback_controls);
|
||||||
|
QIcon nextIcon;
|
||||||
|
nextIcon.addFile(QStringLiteral(":/icons/next.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||||
|
nextIcon.addFile(QStringLiteral(":/icons/next-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||||
|
btnSkipToEnd->setIcon(nextIcon);
|
||||||
|
playback_control_layout->addWidget(btnSkipToEnd);
|
||||||
|
|
||||||
|
lower_control_layout->addWidget(playback_controls);
|
||||||
|
|
||||||
|
QWidget* end_timecode_container = new QWidget(lower_controls);
|
||||||
|
|
||||||
|
QHBoxLayout* end_timecode_layout = new QHBoxLayout(end_timecode_container);
|
||||||
|
end_timecode_layout->setSpacing(0);
|
||||||
|
end_timecode_layout->setMargin(0);
|
||||||
|
|
||||||
|
endTimecode = new QLabel(end_timecode_container);
|
||||||
|
endTimecode->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||||
|
|
||||||
|
end_timecode_layout->addWidget(endTimecode);
|
||||||
|
|
||||||
|
lower_control_layout->addWidget(end_timecode_container);
|
||||||
|
|
||||||
|
layout->addWidget(lower_controls);
|
||||||
|
|
||||||
|
setWidget(contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_media(Media* m) {
|
void Viewer::set_media(Media* m) {
|
||||||
main_sequence = false;
|
main_sequence = false;
|
||||||
media = m;
|
media = m;
|
||||||
clean_created_seq();
|
clean_created_seq();
|
||||||
if (media != NULL) {
|
if (media != NULL) {
|
||||||
switch (media->get_type()) {
|
switch (media->get_type()) {
|
||||||
case MEDIA_TYPE_FOOTAGE:
|
case MEDIA_TYPE_FOOTAGE:
|
||||||
{
|
{
|
||||||
Footage* footage = media->to_footage();
|
Footage* footage = media->to_footage();
|
||||||
|
|
||||||
seq = new Sequence();
|
seq = new Sequence();
|
||||||
created_sequence = true;
|
created_sequence = true;
|
||||||
seq->wrapper_sequence = true;
|
seq->wrapper_sequence = true;
|
||||||
seq->name = footage->name;
|
seq->name = footage->name;
|
||||||
|
|
||||||
seq->using_workarea = footage->using_inout;
|
seq->using_workarea = footage->using_inout;
|
||||||
if (footage->using_inout) {
|
if (footage->using_inout) {
|
||||||
seq->workarea_in = footage->in;
|
seq->workarea_in = footage->in;
|
||||||
seq->workarea_out = footage->out;
|
seq->workarea_out = footage->out;
|
||||||
}
|
}
|
||||||
|
|
||||||
seq->frame_rate = 30;
|
seq->frame_rate = 30;
|
||||||
|
|
||||||
if (footage->video_tracks.size() > 0) {
|
if (footage->video_tracks.size() > 0) {
|
||||||
FootageStream* video_stream = footage->video_tracks.at(0);
|
FootageStream* video_stream = footage->video_tracks.at(0);
|
||||||
seq->width = video_stream->video_width;
|
seq->width = video_stream->video_width;
|
||||||
seq->height = video_stream->video_height;
|
seq->height = video_stream->video_height;
|
||||||
if (video_stream->video_frame_rate > 0 && !video_stream->infinite_length) seq->frame_rate = video_stream->video_frame_rate;
|
if (video_stream->video_frame_rate > 0 && !video_stream->infinite_length) seq->frame_rate = video_stream->video_frame_rate;
|
||||||
|
|
||||||
Clip* c = new Clip(seq);
|
Clip* c = new Clip(seq);
|
||||||
c->media = media;
|
c->media = media;
|
||||||
c->media_stream = video_stream->file_index;
|
c->media_stream = video_stream->file_index;
|
||||||
c->timeline_in = 0;
|
c->timeline_in = 0;
|
||||||
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
||||||
if (c->timeline_out <= 0) c->timeline_out = 150;
|
if (c->timeline_out <= 0) c->timeline_out = 150;
|
||||||
c->track = -1;
|
c->track = -1;
|
||||||
c->clip_in = 0;
|
c->clip_in = 0;
|
||||||
c->recalculateMaxLength();
|
c->recalculateMaxLength();
|
||||||
seq->clips.append(c);
|
seq->clips.append(c);
|
||||||
} else {
|
} else {
|
||||||
seq->width = 1920;
|
seq->width = 1920;
|
||||||
seq->height = 1080;
|
seq->height = 1080;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (footage->audio_tracks.size() > 0) {
|
if (footage->audio_tracks.size() > 0) {
|
||||||
FootageStream* audio_stream = footage->audio_tracks.at(0);
|
FootageStream* audio_stream = footage->audio_tracks.at(0);
|
||||||
seq->audio_frequency = audio_stream->audio_frequency;
|
seq->audio_frequency = audio_stream->audio_frequency;
|
||||||
|
|
||||||
Clip* c = new Clip(seq);
|
Clip* c = new Clip(seq);
|
||||||
c->media = media;
|
c->media = media;
|
||||||
c->media_stream = audio_stream->file_index;
|
c->media_stream = audio_stream->file_index;
|
||||||
c->timeline_in = 0;
|
c->timeline_in = 0;
|
||||||
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
||||||
c->track = 0;
|
c->track = 0;
|
||||||
c->clip_in = 0;
|
c->clip_in = 0;
|
||||||
c->recalculateMaxLength();
|
c->recalculateMaxLength();
|
||||||
seq->clips.append(c);
|
seq->clips.append(c);
|
||||||
|
|
||||||
if (footage->video_tracks.size() == 0) {
|
if (footage->video_tracks.size() == 0) {
|
||||||
viewer_widget->waveform = true;
|
viewer_widget->waveform = true;
|
||||||
viewer_widget->waveform_clip = c;
|
viewer_widget->waveform_clip = c;
|
||||||
viewer_widget->waveform_ms = audio_stream;
|
viewer_widget->waveform_ms = audio_stream;
|
||||||
viewer_widget->update();
|
viewer_widget->update();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seq->audio_frequency = 48000;
|
seq->audio_frequency = 48000;
|
||||||
}
|
}
|
||||||
|
|
||||||
seq->audio_layout = AV_CH_LAYOUT_STEREO;
|
seq->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MEDIA_TYPE_SEQUENCE:
|
case MEDIA_TYPE_SEQUENCE:
|
||||||
seq = media->to_sequence();
|
seq = media->to_sequence();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set_sequence(false, seq);
|
set_sequence(false, seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::on_btnSkipToStart_clicked() {
|
void Viewer::on_btnSkipToStart_clicked() {
|
||||||
@@ -546,45 +642,45 @@ void Viewer::on_btnPlay_clicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::update_playhead() {
|
void Viewer::update_playhead() {
|
||||||
seek(ui->currentTimecode->value());
|
seek(currentTimecode->value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::timer_update() {
|
void Viewer::timer_update() {
|
||||||
long previous_playhead = seq->playhead;
|
long previous_playhead = seq->playhead;
|
||||||
|
|
||||||
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
||||||
update_parents();
|
update_parents();
|
||||||
|
|
||||||
long end_frame = (seq->using_workarea && previous_playhead < seq->workarea_out) ? seq->workarea_out : seq->getEndFrame();
|
long end_frame = (seq->using_workarea && previous_playhead < seq->workarea_out) ? seq->workarea_out : seq->getEndFrame();
|
||||||
if ((!recording
|
if ((!recording
|
||||||
&& playing
|
&& playing
|
||||||
&& seq->playhead >= end_frame
|
&& seq->playhead >= end_frame
|
||||||
&& previous_playhead < end_frame)
|
&& previous_playhead < end_frame)
|
||||||
|| (recording && recording_start != recording_end && seq->playhead >= recording_end)) {
|
|| (recording && recording_start != recording_end && seq->playhead >= recording_end)) {
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::recording_flasher_update() {
|
void Viewer::recording_flasher_update() {
|
||||||
if (ui->btnPlay->styleSheet().isEmpty()) {
|
if (btnPlay->styleSheet().isEmpty()) {
|
||||||
ui->btnPlay->setStyleSheet("background: red;");
|
btnPlay->setStyleSheet("background: red;");
|
||||||
} else {
|
} else {
|
||||||
ui->btnPlay->setStyleSheet(QString());
|
btnPlay->setStyleSheet(QString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::resize_move(double d) {
|
void Viewer::resize_move(double d) {
|
||||||
set_zoom_value(ui->headers->get_zoom()*d);
|
set_zoom_value(headers->get_zoom()*d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::clean_created_seq() {
|
void Viewer::clean_created_seq() {
|
||||||
viewer_widget->waveform = false;
|
viewer_widget->waveform = false;
|
||||||
|
|
||||||
if (created_sequence) {
|
if (created_sequence) {
|
||||||
// TODO delete undo commands referencing this sequence to avoid crashes
|
// TODO delete undo commands referencing this sequence to avoid crashes
|
||||||
/*for (int i=0;i<undo_stack.count();i++) {
|
/*for (int i=0;i<undo_stack.count();i++) {
|
||||||
undo_stack.command(i)
|
undo_stack.command(i)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
delete seq;
|
delete seq;
|
||||||
seq = NULL;
|
seq = NULL;
|
||||||
@@ -592,49 +688,49 @@ void Viewer::clean_created_seq() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_sequence(bool main, Sequence *s) {
|
void Viewer::set_sequence(bool main, Sequence *s) {
|
||||||
reset_all_audio();
|
reset_all_audio();
|
||||||
|
|
||||||
main_sequence = main;
|
main_sequence = main;
|
||||||
seq = (main) ? sequence : s;
|
seq = (main) ? sequence : s;
|
||||||
|
|
||||||
bool null_sequence = (seq == NULL);
|
bool null_sequence = (seq == NULL);
|
||||||
|
|
||||||
ui->headers->setEnabled(!null_sequence);
|
headers->setEnabled(!null_sequence);
|
||||||
ui->currentTimecode->setEnabled(!null_sequence);
|
currentTimecode->setEnabled(!null_sequence);
|
||||||
viewer_widget->setEnabled(!null_sequence);
|
viewer_widget->setEnabled(!null_sequence);
|
||||||
viewer_widget->setVisible(!null_sequence);
|
viewer_widget->setVisible(!null_sequence);
|
||||||
ui->btnSkipToStart->setEnabled(!null_sequence);
|
btnSkipToStart->setEnabled(!null_sequence);
|
||||||
ui->btnRewind->setEnabled(!null_sequence);
|
btnRewind->setEnabled(!null_sequence);
|
||||||
ui->btnPlay->setEnabled(!null_sequence);
|
btnPlay->setEnabled(!null_sequence);
|
||||||
ui->btnFastForward->setEnabled(!null_sequence);
|
btnFastForward->setEnabled(!null_sequence);
|
||||||
ui->btnSkipToEnd->setEnabled(!null_sequence);
|
btnSkipToEnd->setEnabled(!null_sequence);
|
||||||
|
|
||||||
if (!null_sequence) {
|
if (!null_sequence) {
|
||||||
ui->currentTimecode->set_frame_rate(seq->frame_rate);
|
currentTimecode->set_frame_rate(seq->frame_rate);
|
||||||
|
|
||||||
playback_updater.setInterval(qFloor(1000 / seq->frame_rate));
|
playback_updater.setInterval(qFloor(1000 / seq->frame_rate));
|
||||||
|
|
||||||
update_playhead_timecode(seq->playhead);
|
update_playhead_timecode(seq->playhead);
|
||||||
update_end_timecode();
|
update_end_timecode();
|
||||||
|
|
||||||
ui->glViewerPane->adjust();
|
glViewerPane->adjust();
|
||||||
|
|
||||||
setWindowTitle(panel_name + seq->name);
|
setWindowTitle(panel_name + seq->name);
|
||||||
} else {
|
} else {
|
||||||
update_playhead_timecode(0);
|
update_playhead_timecode(0);
|
||||||
update_end_timecode();
|
update_end_timecode();
|
||||||
|
|
||||||
setWindowTitle(panel_name + "(none)");
|
setWindowTitle(panel_name + "(none)");
|
||||||
}
|
}
|
||||||
|
|
||||||
update_header_zoom();
|
update_header_zoom();
|
||||||
|
|
||||||
viewer_widget->update();
|
viewer_widget->update();
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::set_playpause_icon(bool play) {
|
void Viewer::set_playpause_icon(bool play) {
|
||||||
ui->btnPlay->setIcon(QIcon((play) ? ":/icons/play.png" : ":/icons/pause.png"));
|
btnPlay->setIcon(QIcon((play) ? ":/icons/play.png" : ":/icons/pause.png"));
|
||||||
}
|
}
|
||||||
|
|||||||
+45
-31
@@ -8,10 +8,12 @@ class Timeline;
|
|||||||
class ViewerWidget;
|
class ViewerWidget;
|
||||||
class Media;
|
class Media;
|
||||||
struct Sequence;
|
struct Sequence;
|
||||||
|
class TimelineHeader;
|
||||||
namespace Ui {
|
class ResizableScrollBar;
|
||||||
class Viewer;
|
class ViewerContainer;
|
||||||
}
|
class LabelSlider;
|
||||||
|
class QPushButton;
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
bool frame_rate_is_droppable(float rate);
|
bool frame_rate_is_droppable(float rate);
|
||||||
long timecode_to_frame(const QString& s, int view, double frame_rate);
|
long timecode_to_frame(const QString& s, int view, double frame_rate);
|
||||||
@@ -26,18 +28,18 @@ public:
|
|||||||
~Viewer();
|
~Viewer();
|
||||||
|
|
||||||
bool is_focused();
|
bool is_focused();
|
||||||
void set_main_sequence();
|
void set_main_sequence();
|
||||||
void set_media(Media *m);
|
void set_media(Media *m);
|
||||||
void compose();
|
void compose();
|
||||||
void set_playpause_icon(bool play);
|
void set_playpause_icon(bool play);
|
||||||
void update_playhead_timecode(long p);
|
void update_playhead_timecode(long p);
|
||||||
void update_end_timecode();
|
void update_end_timecode();
|
||||||
void update_header_zoom();
|
void update_header_zoom();
|
||||||
void update_viewer();
|
void update_viewer();
|
||||||
void clear_inout_point();
|
void clear_inout_point();
|
||||||
void set_in_point();
|
void set_in_point();
|
||||||
void set_out_point();
|
void set_out_point();
|
||||||
void set_zoom(bool in);
|
void set_zoom(bool in);
|
||||||
|
|
||||||
// playback functions
|
// playback functions
|
||||||
void go_to_start();
|
void go_to_start();
|
||||||
@@ -56,51 +58,63 @@ public:
|
|||||||
|
|
||||||
void cue_recording(long start, long end, int track);
|
void cue_recording(long start, long end, int track);
|
||||||
void uncue_recording();
|
void uncue_recording();
|
||||||
bool is_recording_cued();
|
bool is_recording_cued();
|
||||||
long recording_start;
|
long recording_start;
|
||||||
long recording_end;
|
long recording_end;
|
||||||
int recording_track;
|
int recording_track;
|
||||||
|
|
||||||
void reset_all_audio();
|
void reset_all_audio();
|
||||||
void update_parents();
|
void update_parents();
|
||||||
|
|
||||||
ViewerWidget* viewer_widget;
|
ViewerWidget* viewer_widget;
|
||||||
|
|
||||||
Media* media;
|
Media* media;
|
||||||
Sequence* seq;
|
Sequence* seq;
|
||||||
|
|
||||||
Ui::Viewer *ui;
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *event);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void play_wake();
|
void play_wake();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_btnSkipToStart_clicked();
|
void on_btnSkipToStart_clicked();
|
||||||
void on_btnRewind_clicked();
|
void on_btnRewind_clicked();
|
||||||
void on_btnPlay_clicked();
|
void on_btnPlay_clicked();
|
||||||
void on_btnFastForward_clicked();
|
void on_btnFastForward_clicked();
|
||||||
void on_btnSkipToEnd_clicked();
|
void on_btnSkipToEnd_clicked();
|
||||||
|
|
||||||
void update_playhead();
|
void update_playhead();
|
||||||
void timer_update();
|
void timer_update();
|
||||||
void recording_flasher_update();
|
void recording_flasher_update();
|
||||||
void resize_move(double d);
|
void resize_move(double d);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clean_created_seq();
|
void clean_created_seq();
|
||||||
void set_sequence(bool main, Sequence* s);
|
void set_sequence(bool main, Sequence* s);
|
||||||
bool main_sequence;
|
bool main_sequence;
|
||||||
bool created_sequence;
|
bool created_sequence;
|
||||||
long cached_end_frame;
|
long cached_end_frame;
|
||||||
QString panel_name;
|
QString panel_name;
|
||||||
double minimum_zoom;
|
double minimum_zoom;
|
||||||
void set_zoom_value(double d);
|
void set_zoom_value(double d);
|
||||||
void set_sb_max();
|
void set_sb_max();
|
||||||
|
|
||||||
|
void setup_ui();
|
||||||
|
|
||||||
|
TimelineHeader* headers;
|
||||||
|
ResizableScrollBar* horizontalScrollBar;
|
||||||
|
ViewerContainer* glViewerPane;
|
||||||
|
LabelSlider* currentTimecode;
|
||||||
|
QLabel* endTimecode;
|
||||||
|
|
||||||
|
QPushButton* btnSkipToStart;
|
||||||
|
QPushButton* btnRewind;
|
||||||
|
QPushButton* btnPlay;
|
||||||
|
QPushButton* btnFastForward;
|
||||||
|
QPushButton* btnSkipToEnd;
|
||||||
|
|
||||||
bool cue_recording_internal;
|
bool cue_recording_internal;
|
||||||
QTimer recording_flasher;
|
QTimer recording_flasher;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VIEWER_H
|
#endif // VIEWER_H
|
||||||
|
|||||||
@@ -1,259 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Viewer</class>
|
|
||||||
<widget class="QDockWidget" name="Viewer">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>583</width>
|
|
||||||
<height>396</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Viewer</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="dockWidgetContents">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="ViewerContainer" name="glViewerPane" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="TimelineHeader" name="headers" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="ResizableScrollBar" name="horizontalScrollBar">
|
|
||||||
<property name="maximum">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>20</number>
|
|
||||||
</property>
|
|
||||||
<property name="pageStep">
|
|
||||||
<number>1826</number>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="playbackControls" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="LabelSlider" name="currentTimecode">
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget_2" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnSkipToStart">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../icons/icons.qrc">
|
|
||||||
<normaloff>:/icons/prev.png</normaloff>
|
|
||||||
<disabledoff>:/icons/prev-disabled.png</disabledoff>:/icons/prev.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnRewind">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../icons/icons.qrc">
|
|
||||||
<normaloff>:/icons/rew.png</normaloff>
|
|
||||||
<disabledoff>:/icons/rew-disabled.png</disabledoff>:/icons/rew.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnPlay">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../icons/icons.qrc">
|
|
||||||
<normaloff>:/icons/play.png</normaloff>
|
|
||||||
<disabledoff>:/icons/play-disabled.png</disabledoff>:/icons/play.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnFastForward">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normalon>:/icons/ff.png</normalon>
|
|
||||||
<disabledoff>:/icons/ff-disabled.png</disabledoff>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="btnSkipToEnd">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../icons/icons.qrc">
|
|
||||||
<normaloff>:/icons/next.png</normaloff>
|
|
||||||
<disabledoff>:/icons/next-disabled.png</disabledoff>:/icons/next.png</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget_3" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="endTimecode">
|
|
||||||
<property name="text">
|
|
||||||
<string>0</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>TimelineHeader</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>ui/timelineheader.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>ResizableScrollBar</class>
|
|
||||||
<extends>QScrollBar</extends>
|
|
||||||
<header>ui/resizablescrollbar.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>ViewerContainer</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>ui/viewercontainer.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>LabelSlider</class>
|
|
||||||
<extends>QLabel</extends>
|
|
||||||
<header>ui/labelslider.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources>
|
|
||||||
<include location="../icons/icons.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
+109
-109
@@ -11,7 +11,7 @@
|
|||||||
#include "panels/viewer.h"
|
#include "panels/viewer.h"
|
||||||
#include "ui/viewerwidget.h"
|
#include "ui/viewerwidget.h"
|
||||||
#include "project/sequence.h"
|
#include "project/sequence.h"
|
||||||
#include "ui_effectcontrols.h"
|
#include "ui/resizablescrollbar.h"
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
@@ -27,44 +27,44 @@ long KeyframeView::adjust_row_keyframe(EffectRow* row, long time) {
|
|||||||
|
|
||||||
KeyframeView::KeyframeView(QWidget *parent) :
|
KeyframeView::KeyframeView(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
visible_in(0),
|
visible_in(0),
|
||||||
visible_out(0),
|
visible_out(0),
|
||||||
mousedown(false),
|
mousedown(false),
|
||||||
dragging(false),
|
dragging(false),
|
||||||
keys_selected(false),
|
keys_selected(false),
|
||||||
select_rect(false),
|
select_rect(false),
|
||||||
x_scroll(0),
|
x_scroll(0),
|
||||||
y_scroll(0),
|
y_scroll(0),
|
||||||
scroll_drag(false)
|
scroll_drag(false)
|
||||||
{
|
{
|
||||||
setFocusPolicy(Qt::ClickFocus);
|
setFocusPolicy(Qt::ClickFocus);
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
|
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyframeView::show_context_menu(const QPoint& pos) {
|
void KeyframeView::show_context_menu(const QPoint& pos) {
|
||||||
if (selected_rows.size() > 0) {
|
if (selected_rows.size() > 0) {
|
||||||
QMenu menu(this);
|
QMenu menu(this);
|
||||||
QAction* linear = menu.addAction("Linear");
|
QAction* linear = menu.addAction("Linear");
|
||||||
linear->setData(KEYFRAME_TYPE_LINEAR);
|
linear->setData(KEYFRAME_TYPE_LINEAR);
|
||||||
QAction* smooth = menu.addAction("Smooth");
|
QAction* smooth = menu.addAction("Smooth");
|
||||||
smooth->setData(KEYFRAME_TYPE_SMOOTH);
|
smooth->setData(KEYFRAME_TYPE_SMOOTH);
|
||||||
/*QAction* bezier = menu.addAction("Bezier");
|
/*QAction* bezier = menu.addAction("Bezier");
|
||||||
bezier->setData(KEYFRAME_TYPE_BEZIER);*/
|
bezier->setData(KEYFRAME_TYPE_BEZIER);*/
|
||||||
connect(&menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_set_key_type(QAction*)));
|
connect(&menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_set_key_type(QAction*)));
|
||||||
menu.exec(mapToGlobal(pos));
|
menu.exec(mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyframeView::menu_set_key_type(QAction* a) {
|
void KeyframeView::menu_set_key_type(QAction* a) {
|
||||||
ComboAction* ca = new ComboAction();
|
ComboAction* ca = new ComboAction();
|
||||||
for (int i=0;i<selected_rows.size();i++) {
|
for (int i=0;i<selected_rows.size();i++) {
|
||||||
ca->append(new SetInt(&selected_rows.at(i)->keyframe_types[selected_keyframes.at(i)], a->data().toInt()));
|
ca->append(new SetInt(&selected_rows.at(i)->keyframe_types[selected_keyframes.at(i)], a->data().toInt()));
|
||||||
}
|
}
|
||||||
undo_stack.push(ca);
|
undo_stack.push(ca);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyframeView::paintEvent(QPaintEvent*) {
|
void KeyframeView::paintEvent(QPaintEvent*) {
|
||||||
@@ -99,7 +99,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
|||||||
bool keyframe_selected = keyframeIsSelected(row, k);
|
bool keyframe_selected = keyframeIsSelected(row, k);
|
||||||
long keyframe_frame = adjust_row_keyframe(row, row->keyframe_times.at(k));
|
long keyframe_frame = adjust_row_keyframe(row, row->keyframe_times.at(k));
|
||||||
if (dragging && keyframe_selected) keyframe_frame += frame_diff;
|
if (dragging && keyframe_selected) keyframe_frame += frame_diff;
|
||||||
draw_keyframe(p, row->keyframe_types.at(k), getScreenPointFromFrame(panel_effect_controls->zoom, keyframe_frame) - x_scroll, keyframe_y, keyframe_selected);
|
draw_keyframe(p, row->keyframe_types.at(k), getScreenPointFromFrame(panel_effect_controls->zoom, keyframe_frame) - x_scroll, keyframe_y, keyframe_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
rows.append(row);
|
rows.append(row);
|
||||||
@@ -113,7 +113,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
|||||||
if (max_width < width()) {
|
if (max_width < width()) {
|
||||||
p.fillRect(QRect(max_width, 0, width(), height()), QColor(0, 0, 0, 64));
|
p.fillRect(QRect(max_width, 0, width(), height()), QColor(0, 0, 0, 64));
|
||||||
}
|
}
|
||||||
panel_effect_controls->ui->horizontalScrollBar->setMaximum(qMax(max_width - width(), 0));
|
panel_effect_controls->horizontalScrollBar->setMaximum(qMax(max_width - width(), 0));
|
||||||
header->set_visible_in(visible_in);
|
header->set_visible_in(visible_in);
|
||||||
|
|
||||||
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, sequence->playhead-visible_in) - x_scroll;
|
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, sequence->playhead-visible_in) - x_scroll;
|
||||||
@@ -129,9 +129,9 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
|||||||
draw_selection_rectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
|
draw_selection_rectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (mouseover && mouseover_row < rowY.size()) {
|
/*if (mouseover && mouseover_row < rowY.size()) {
|
||||||
draw_keyframe(p, getScreenPointFromFrame(panel_effect_controls->zoom, mouseover_frame - visible_in), rowY.at(mouseover_row), true);
|
draw_keyframe(p, getScreenPointFromFrame(panel_effect_controls->zoom, mouseover_frame - visible_in), rowY.at(mouseover_row), true);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KeyframeView::keyframeIsSelected(EffectRow *row, int keyframe) {
|
bool KeyframeView::keyframeIsSelected(EffectRow *row, int keyframe) {
|
||||||
@@ -173,98 +173,98 @@ void KeyframeView::set_y_scroll(int s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void KeyframeView::draw_keyframe(QPainter &p, int type, int x, int y, bool darker) {
|
void KeyframeView::draw_keyframe(QPainter &p, int type, int x, int y, bool darker) {
|
||||||
int color = (darker) ? 100 : 160;
|
int color = (darker) ? 100 : 160;
|
||||||
p.setPen(QColor(0, 0, 0));
|
p.setPen(QColor(0, 0, 0));
|
||||||
p.setBrush(QColor(color, color, color));
|
p.setBrush(QColor(color, color, color));
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case KEYFRAME_TYPE_LINEAR:
|
case KEYFRAME_TYPE_LINEAR:
|
||||||
{
|
{
|
||||||
QPoint points[KEYFRAME_POINT_COUNT] = {QPoint(x-KEYFRAME_SIZE, y), QPoint(x, y-KEYFRAME_SIZE), QPoint(x+KEYFRAME_SIZE, y), QPoint(x, y+KEYFRAME_SIZE)};
|
QPoint points[KEYFRAME_POINT_COUNT] = {QPoint(x-KEYFRAME_SIZE, y), QPoint(x, y-KEYFRAME_SIZE), QPoint(x+KEYFRAME_SIZE, y), QPoint(x, y+KEYFRAME_SIZE)};
|
||||||
p.drawPolygon(points, KEYFRAME_POINT_COUNT);
|
p.drawPolygon(points, KEYFRAME_POINT_COUNT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KEYFRAME_TYPE_SMOOTH:
|
case KEYFRAME_TYPE_SMOOTH:
|
||||||
p.drawEllipse(QPoint(x, y), KEYFRAME_SIZE, KEYFRAME_SIZE);
|
p.drawEllipse(QPoint(x, y), KEYFRAME_SIZE, KEYFRAME_SIZE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyframeView::resize_move(double d) {
|
void KeyframeView::resize_move(double d) {
|
||||||
header->update_zoom(header->get_zoom()*d);
|
header->update_zoom(header->get_zoom()*d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyframeView::mousePressEvent(QMouseEvent *event) {
|
void KeyframeView::mousePressEvent(QMouseEvent *event) {
|
||||||
rect_select_x = event->x();
|
rect_select_x = event->x();
|
||||||
rect_select_y = event->y();
|
rect_select_y = event->y();
|
||||||
|
|
||||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND || event->buttons() & Qt::MiddleButton) {
|
if (panel_timeline->tool == TIMELINE_TOOL_HAND || event->buttons() & Qt::MiddleButton) {
|
||||||
scroll_drag = true;
|
scroll_drag = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mouse_x = event->x() + x_scroll;
|
int mouse_x = event->x() + x_scroll;
|
||||||
int mouse_y = event->y();
|
int mouse_y = event->y();
|
||||||
int row_index = -1;
|
int row_index = -1;
|
||||||
int keyframe_index = -1;
|
int keyframe_index = -1;
|
||||||
long frame_diff = 0;
|
long frame_diff = 0;
|
||||||
long frame_min = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x-KEYFRAME_SIZE);
|
long frame_min = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x-KEYFRAME_SIZE);
|
||||||
drag_frame_start = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x);
|
drag_frame_start = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x);
|
||||||
long frame_max = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x+KEYFRAME_SIZE);
|
long frame_max = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x+KEYFRAME_SIZE);
|
||||||
for (int i=0;i<rowY.size();i++) {
|
for (int i=0;i<rowY.size();i++) {
|
||||||
if (mouse_y > rowY.at(i)-KEYFRAME_SIZE-KEYFRAME_SIZE && mouse_y < rowY.at(i)+KEYFRAME_SIZE+KEYFRAME_SIZE) {
|
if (mouse_y > rowY.at(i)-KEYFRAME_SIZE-KEYFRAME_SIZE && mouse_y < rowY.at(i)+KEYFRAME_SIZE+KEYFRAME_SIZE) {
|
||||||
EffectRow* row = rows.at(i);
|
EffectRow* row = rows.at(i);
|
||||||
for (int j=0;j<row->keyframe_times.size();j++) {
|
for (int j=0;j<row->keyframe_times.size();j++) {
|
||||||
long eval_keyframe_time = row->keyframe_times.at(j)-row->parent_effect->parent_clip->clip_in+(row->parent_effect->parent_clip->timeline_in-visible_in);
|
long eval_keyframe_time = row->keyframe_times.at(j)-row->parent_effect->parent_clip->clip_in+(row->parent_effect->parent_clip->timeline_in-visible_in);
|
||||||
if (eval_keyframe_time >= frame_min && eval_keyframe_time <= frame_max) {
|
if (eval_keyframe_time >= frame_min && eval_keyframe_time <= frame_max) {
|
||||||
long eval_frame_diff = qAbs(eval_keyframe_time - drag_frame_start);
|
long eval_frame_diff = qAbs(eval_keyframe_time - drag_frame_start);
|
||||||
if (keyframe_index == -1 || eval_frame_diff < frame_diff) {
|
if (keyframe_index == -1 || eval_frame_diff < frame_diff) {
|
||||||
row_index = i;
|
row_index = i;
|
||||||
keyframe_index = j;
|
keyframe_index = j;
|
||||||
frame_diff = eval_frame_diff;
|
frame_diff = eval_frame_diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool already_selected = false;
|
bool already_selected = false;
|
||||||
keys_selected = false;
|
keys_selected = false;
|
||||||
if (keyframe_index > -1) already_selected = keyframeIsSelected(rows.at(row_index), keyframe_index);
|
if (keyframe_index > -1) already_selected = keyframeIsSelected(rows.at(row_index), keyframe_index);
|
||||||
if (!already_selected) {
|
if (!already_selected) {
|
||||||
if (!(event->modifiers() & Qt::ShiftModifier)) {
|
if (!(event->modifiers() & Qt::ShiftModifier)) {
|
||||||
selected_rows.clear();
|
selected_rows.clear();
|
||||||
selected_keyframes.clear();
|
selected_keyframes.clear();
|
||||||
}
|
}
|
||||||
if (keyframe_index > -1) {
|
if (keyframe_index > -1) {
|
||||||
selected_rows.append(rows.at(row_index));
|
selected_rows.append(rows.at(row_index));
|
||||||
selected_keyframes.append(keyframe_index);
|
selected_keyframes.append(keyframe_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected_rows.size() > 0) {
|
if (selected_rows.size() > 0) {
|
||||||
keys_selected = true;
|
keys_selected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
mousedown = true;
|
mousedown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
||||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
if (panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||||
setCursor(Qt::OpenHandCursor);
|
setCursor(Qt::OpenHandCursor);
|
||||||
} else {
|
} else {
|
||||||
unsetCursor();
|
unsetCursor();
|
||||||
}
|
}
|
||||||
if (scroll_drag) {
|
if (scroll_drag) {
|
||||||
panel_effect_controls->ui->horizontalScrollBar->setValue(panel_effect_controls->ui->horizontalScrollBar->value() + rect_select_x - event->pos().x());
|
panel_effect_controls->horizontalScrollBar->setValue(panel_effect_controls->horizontalScrollBar->value() + rect_select_x - event->pos().x());
|
||||||
panel_effect_controls->ui->verticalScrollBar->setValue(panel_effect_controls->ui->verticalScrollBar->value() + rect_select_y - event->pos().y());
|
panel_effect_controls->verticalScrollBar->setValue(panel_effect_controls->verticalScrollBar->value() + rect_select_y - event->pos().y());
|
||||||
rect_select_x = event->pos().x();
|
rect_select_x = event->pos().x();
|
||||||
rect_select_y = event->pos().y();
|
rect_select_y = event->pos().y();
|
||||||
} else if (mousedown) {
|
} else if (mousedown) {
|
||||||
int mouse_x = event->x() + x_scroll;
|
int mouse_x = event->x() + x_scroll;
|
||||||
if (keys_selected) {
|
if (keys_selected) {
|
||||||
// move keyframes
|
// move keyframes
|
||||||
@@ -333,7 +333,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
|||||||
select_rect = true;
|
select_rect = true;
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeyframeView::mouseReleaseEvent(QMouseEvent*) {
|
void KeyframeView::mouseReleaseEvent(QMouseEvent*) {
|
||||||
@@ -347,8 +347,8 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent*) {
|
|||||||
|
|
||||||
select_rect = false;
|
select_rect = false;
|
||||||
dragging = false;
|
dragging = false;
|
||||||
mousedown = false;
|
mousedown = false;
|
||||||
scroll_drag = false;
|
scroll_drag = false;
|
||||||
panel_timeline->snapped = false;
|
panel_timeline->snapped = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|||||||
+68
-66
@@ -9,96 +9,98 @@
|
|||||||
#define RESIZE_HANDLE_SIZE 10
|
#define RESIZE_HANDLE_SIZE 10
|
||||||
|
|
||||||
ResizableScrollBar::ResizableScrollBar(QWidget *parent) :
|
ResizableScrollBar::ResizableScrollBar(QWidget *parent) :
|
||||||
QScrollBar(parent),
|
QScrollBar(parent),
|
||||||
resize_init(false),
|
resize_init(false),
|
||||||
resize_proc(false)
|
resize_proc(false)
|
||||||
{
|
{
|
||||||
setMouseTracking(true);
|
setSingleStep(20);
|
||||||
|
setMaximum(0);
|
||||||
|
setMouseTracking(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResizableScrollBar::is_resizing() {
|
bool ResizableScrollBar::is_resizing() {
|
||||||
return resize_proc;
|
return resize_proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizableScrollBar::resizeEvent(QResizeEvent *event) {
|
void ResizableScrollBar::resizeEvent(QResizeEvent *event) {
|
||||||
setPageStep(event->size().width());
|
setPageStep(event->size().width());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizableScrollBar::mousePressEvent(QMouseEvent *e) {
|
void ResizableScrollBar::mousePressEvent(QMouseEvent *e) {
|
||||||
if (resize_init) {
|
if (resize_init) {
|
||||||
QStyleOptionSlider opt;
|
QStyleOptionSlider opt;
|
||||||
initStyleOption(&opt);
|
initStyleOption(&opt);
|
||||||
|
|
||||||
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||||
QStyle::SC_ScrollBarSlider, this);
|
QStyle::SC_ScrollBarSlider, this);
|
||||||
|
|
||||||
resize_proc = true;
|
resize_proc = true;
|
||||||
resize_start = e->pos().x();
|
resize_start = e->pos().x();
|
||||||
|
|
||||||
resize_start_max = maximum();
|
resize_start_max = maximum();
|
||||||
resize_start_width = sr.width();
|
resize_start_width = sr.width();
|
||||||
} else {
|
} else {
|
||||||
QScrollBar::mousePressEvent(e);
|
QScrollBar::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizableScrollBar::mouseMoveEvent(QMouseEvent *e) {
|
void ResizableScrollBar::mouseMoveEvent(QMouseEvent *e) {
|
||||||
QStyleOptionSlider opt;
|
QStyleOptionSlider opt;
|
||||||
initStyleOption(&opt);
|
initStyleOption(&opt);
|
||||||
|
|
||||||
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||||
QStyle::SC_ScrollBarSlider, this);
|
QStyle::SC_ScrollBarSlider, this);
|
||||||
QRect gr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
QRect gr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||||
QStyle::SC_ScrollBarGroove, this);
|
QStyle::SC_ScrollBarGroove, this);
|
||||||
|
|
||||||
if (resize_proc) {
|
if (resize_proc) {
|
||||||
int diff = (e->pos().x() - resize_start);
|
int diff = (e->pos().x() - resize_start);
|
||||||
if (resize_top) diff = -diff;
|
if (resize_top) diff = -diff;
|
||||||
double scale = double(sr.width())/double(sr.width()+diff);
|
double scale = double(sr.width())/double(sr.width()+diff);
|
||||||
if (!qIsInf(scale) && !qIsNull(scale)) {
|
if (!qIsInf(scale) && !qIsNull(scale)) {
|
||||||
emit resize_move(scale);
|
emit resize_move(scale);
|
||||||
resize_start = e->pos().x();
|
resize_start = e->pos().x();
|
||||||
|
|
||||||
if (resize_top) {
|
if (resize_top) {
|
||||||
int slider_min = gr.x();
|
int slider_min = gr.x();
|
||||||
int slider_max = gr.right() - (sr.width()+diff);
|
int slider_max = gr.right() - (sr.width()+diff);
|
||||||
int val = QStyle::sliderValueFromPosition(minimum(), maximum(), e->pos().x() - slider_min, slider_max - slider_min, opt.upsideDown);
|
int val = QStyle::sliderValueFromPosition(minimum(), maximum(), e->pos().x() - slider_min, slider_max - slider_min, opt.upsideDown);
|
||||||
|
|
||||||
setValue(val);
|
setValue(val);
|
||||||
} else {
|
} else {
|
||||||
setValue(qRound(value() * scale));
|
setValue(qRound(value() * scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bool new_resize_init = false;
|
bool new_resize_init = false;
|
||||||
|
|
||||||
if ((orientation() == Qt::Horizontal && e->pos().x() > sr.left()-RESIZE_HANDLE_SIZE && e->pos().x() < sr.left()+RESIZE_HANDLE_SIZE)
|
if ((orientation() == Qt::Horizontal && e->pos().x() > sr.left()-RESIZE_HANDLE_SIZE && e->pos().x() < sr.left()+RESIZE_HANDLE_SIZE)
|
||||||
|| (orientation() == Qt::Vertical && e->pos().y() > sr.top()-RESIZE_HANDLE_SIZE && e->pos().y() < sr.top()+RESIZE_HANDLE_SIZE)) {
|
|| (orientation() == Qt::Vertical && e->pos().y() > sr.top()-RESIZE_HANDLE_SIZE && e->pos().y() < sr.top()+RESIZE_HANDLE_SIZE)) {
|
||||||
new_resize_init = true;
|
new_resize_init = true;
|
||||||
resize_top = true;
|
resize_top = true;
|
||||||
} else if ((orientation() == Qt::Horizontal && e->pos().x() > sr.right()-RESIZE_HANDLE_SIZE && e->pos().x() < sr.right()+RESIZE_HANDLE_SIZE)
|
} else if ((orientation() == Qt::Horizontal && e->pos().x() > sr.right()-RESIZE_HANDLE_SIZE && e->pos().x() < sr.right()+RESIZE_HANDLE_SIZE)
|
||||||
|| (orientation() == Qt::Vertical && e->pos().y() > sr.bottom()-RESIZE_HANDLE_SIZE && e->pos().y() < sr.bottom()+RESIZE_HANDLE_SIZE)) {
|
|| (orientation() == Qt::Vertical && e->pos().y() > sr.bottom()-RESIZE_HANDLE_SIZE && e->pos().y() < sr.bottom()+RESIZE_HANDLE_SIZE)) {
|
||||||
new_resize_init = true;
|
new_resize_init = true;
|
||||||
resize_top = false;
|
resize_top = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resize_init != new_resize_init) {
|
if (resize_init != new_resize_init) {
|
||||||
if (new_resize_init) {
|
if (new_resize_init) {
|
||||||
setCursor(Qt::SizeHorCursor);
|
setCursor(Qt::SizeHorCursor);
|
||||||
} else {
|
} else {
|
||||||
unsetCursor();
|
unsetCursor();
|
||||||
}
|
}
|
||||||
resize_init = new_resize_init;
|
resize_init = new_resize_init;
|
||||||
}
|
}
|
||||||
|
|
||||||
QScrollBar::mouseMoveEvent(e);
|
QScrollBar::mouseMoveEvent(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResizableScrollBar::mouseReleaseEvent(QMouseEvent *e) {
|
void ResizableScrollBar::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
if (resize_proc) {
|
if (resize_proc) {
|
||||||
resize_proc = false;
|
resize_proc = false;
|
||||||
} else {
|
} else {
|
||||||
QScrollBar::mouseReleaseEvent(e);
|
QScrollBar::mouseReleaseEvent(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user