removed all ui files

This commit is contained in:
itsmattkc
2018-12-30 20:23:57 +11:00
parent efdbeec549
commit 34fc8b81d2
28 changed files with 1777 additions and 2770 deletions
+1 -4
View File
@@ -295,10 +295,7 @@ void Project::open_properties() {
break;
case MEDIA_TYPE_SEQUENCE:
{
NewSequenceDialog nsd(this);
Sequence* s = item->to_sequence();
nsd.existing_sequence = s;
nsd.existing_item = item;
NewSequenceDialog nsd(this, item);
nsd.exec();
}
break;
-4
View File
@@ -27,10 +27,6 @@ class SourcesCommon;
#define LOAD_TYPE_VERSION 69
#define LOAD_TYPE_URL 70
namespace Ui {
class Project;
}
extern QString autorecovery_filename;
extern QString project_url;
extern QStringList recent_projects;
+309 -128
View File
@@ -1,5 +1,4 @@
#include "timeline.h"
#include "ui_timeline.h"
#include "panels/panels.h"
#include "panels/project.h"
@@ -19,6 +18,9 @@
#include "project/transition.h"
#include "project/footage.h"
#include "io/clipboard.h"
#include "ui/timelineheader.h"
#include "ui/resizablescrollbar.h"
#include "ui/audiomonitor.h"
#include "debug.h"
#include <QTime>
@@ -31,6 +33,9 @@
#include <QInputDialog>
#include <QMessageBox>
#include <QCheckBox>
#include <QPushButton>
#include <QHBoxLayout>
#include <QSplitter>
long refactor_frame_number(long framenumber, double source_frame_rate, double target_frame_rate) {
return qRound(((double)framenumber/source_frame_rate)*target_frame_rate);
@@ -70,55 +75,39 @@ Timeline::Timeline(QWidget *parent) :
transition_tool_post_clip(-1),
hand_moving(false),
block_repaints(false),
ui(new Ui::Timeline),
last_frame(0),
scroll(0)
{
setup_ui();
default_track_height = (QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * TRACK_DEFAULT_HEIGHT;
ui->setupUi(this);
headers->viewer = panel_sequence_viewer;
ui->headers->viewer = panel_sequence_viewer;
video_area->bottom_align = true;
video_area->scrollBar = videoScrollbar;
audio_area->scrollBar = audioScrollbar;
/* --- TEMPORARY ---
* I feel like the rolling edit tool is unnecessary, but just
* in case I change my mind, I'm leaving all the functionality
* intact and only hiding the UI to get to it. Still deciding
* on this one but the pointer tool literally does the same
* functionality.
*/
ui->toolRollingButton->setVisible(false);
ui->toolRollingButton->setEnabled(false);
/* --- */
tool_buttons.append(toolArrowButton);
tool_buttons.append(toolEditButton);
tool_buttons.append(toolRippleButton);
tool_buttons.append(toolRazorButton);
tool_buttons.append(toolSlipButton);
tool_buttons.append(toolSlideButton);
tool_buttons.append(toolTransitionButton);
tool_buttons.append(toolHandButton);
ui->video_area->bottom_align = true;
ui->video_area->scrollBar = ui->videoScrollbar;
ui->audio_area->scrollBar = ui->audioScrollbar;
toolArrowButton->click();
tool_buttons.append(ui->toolArrowButton);
tool_buttons.append(ui->toolEditButton);
tool_buttons.append(ui->toolRippleButton);
tool_buttons.append(ui->toolRazorButton);
tool_buttons.append(ui->toolSlipButton);
tool_buttons.append(ui->toolRollingButton);
tool_buttons.append(ui->toolSlideButton);
tool_buttons.append(ui->toolTransitionButton);
tool_buttons.append(ui->toolHandButton);
ui->toolArrowButton->click();
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(setScroll(int)));
connect(ui->videoScrollbar, SIGNAL(valueChanged(int)), ui->video_area, SLOT(setScroll(int)));
connect(ui->audioScrollbar, SIGNAL(valueChanged(int)), ui->audio_area, SLOT(setScroll(int)));
connect(ui->horizontalScrollBar, SIGNAL(resize_move(double)), this, SLOT(resize_move(double)));
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(setScroll(int)));
connect(videoScrollbar, SIGNAL(valueChanged(int)), video_area, SLOT(setScroll(int)));
connect(audioScrollbar, SIGNAL(valueChanged(int)), audio_area, SLOT(setScroll(int)));
connect(horizontalScrollBar, SIGNAL(resize_move(double)), this, SLOT(resize_move(double)));
update_sequence();
}
Timeline::~Timeline()
{
delete ui;
}
Timeline::~Timeline() {}
void Timeline::previous_cut() {
if (sequence->playhead > 0) {
@@ -159,7 +148,7 @@ void Timeline::toggle_show_all() {
showing_all = !showing_all;
if (showing_all) {
old_zoom = zoom;
set_zoom_value((double) (ui->timeline_area->width() - 200) / (double) sequence->getEndFrame());
set_zoom_value((double) (timeline_area->width() - 200) / (double) sequence->getEndFrame());
} else {
set_zoom_value(old_zoom);
}
@@ -398,12 +387,12 @@ void Timeline::update_sequence() {
for (int i=0;i<tool_buttons.count();i++) {
tool_buttons[i]->setEnabled(!null_sequence);
}
ui->snappingButton->setEnabled(!null_sequence);
ui->pushButton_4->setEnabled(!null_sequence);
ui->pushButton_5->setEnabled(!null_sequence);
ui->recordButton->setEnabled(!null_sequence);
ui->addButton->setEnabled(!null_sequence);
ui->headers->setEnabled(!null_sequence);
snappingButton->setEnabled(!null_sequence);
zoomInButton->setEnabled(!null_sequence);
zoomOutButton->setEnabled(!null_sequence);
recordButton->setEnabled(!null_sequence);
addButton->setEnabled(!null_sequence);
headers->setEnabled(!null_sequence);
if (null_sequence) {
setWindowTitle("Timeline: <none>");
@@ -418,7 +407,7 @@ int Timeline::get_snap_range() {
}
bool Timeline::focused() {
return (sequence != NULL && (ui->headers->hasFocus() || ui->video_area->hasFocus() || ui->audio_area->hasFocus()));
return (sequence != NULL && (headers->hasFocus() || video_area->hasFocus() || audio_area->hasFocus()));
}
void Timeline::repaint_timeline() {
@@ -426,19 +415,19 @@ void Timeline::repaint_timeline() {
bool draw = true;
if (sequence != NULL
&& !ui->horizontalScrollBar->isSliderDown()
&& !ui->horizontalScrollBar->is_resizing()
&& !horizontalScrollBar->isSliderDown()
&& !horizontalScrollBar->is_resizing()
&& panel_sequence_viewer->playing
&& !zoom_just_changed) {
// auto scroll
if (config.autoscroll == AUTOSCROLL_PAGE_SCROLL) {
int playhead_x = panel_timeline->getTimelineScreenPointFromFrame(sequence->playhead);
if (playhead_x < 0 || playhead_x > (ui->editAreas->width() - ui->videoScrollbar->width())) {
ui->horizontalScrollBar->setValue(getScreenPointFromFrame(zoom, sequence->playhead));
if (playhead_x < 0 || playhead_x > (editAreas->width() - videoScrollbar->width())) {
horizontalScrollBar->setValue(getScreenPointFromFrame(zoom, sequence->playhead));
draw = false;
}
} else if (config.autoscroll == AUTOSCROLL_SMOOTH_SCROLL) {
if (center_scroll_to_playhead(ui->horizontalScrollBar, zoom, sequence->playhead)) {
if (center_scroll_to_playhead(horizontalScrollBar, zoom, sequence->playhead)) {
draw = false;
}
}
@@ -447,15 +436,15 @@ void Timeline::repaint_timeline() {
zoom_just_changed = false;
if (draw) {
ui->headers->update();
ui->video_area->update();
ui->audio_area->update();
headers->update();
video_area->update();
audio_area->update();
if (sequence != NULL) {
set_sb_max();
if (last_frame != sequence->playhead) {
ui->audio_monitor->update();
audio_monitor->update();
last_frame = sequence->playhead;
}
}
@@ -573,13 +562,13 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
void Timeline::set_zoom_value(double v) {
zoom = v;
zoom_just_changed = true;
ui->headers->update_zoom(zoom);
headers->update_zoom(zoom);
repaint_timeline();
// TODO find a way to gradually move towards target_scroll instead of just centering it?
if (!ui->horizontalScrollBar->is_resizing())
center_scroll_to_playhead(ui->horizontalScrollBar, zoom, sequence->playhead);
if (!horizontalScrollBar->is_resizing())
center_scroll_to_playhead(horizontalScrollBar, zoom, sequence->playhead);
}
void Timeline::set_zoom(bool in) {
@@ -602,13 +591,11 @@ QVector<int> Timeline::get_tracks_of_linked_clips(int i) {
return tracks;
}
void Timeline::on_pushButton_4_clicked()
{
void Timeline::zoom_in() {
set_zoom(true);
}
void Timeline::on_pushButton_5_clicked()
{
void Timeline::zoom_out() {
set_zoom(false);
}
@@ -623,7 +610,7 @@ bool Timeline::is_clip_selected(Clip* clip, bool containing) {
return false;
}
void Timeline::on_snappingButton_toggled(bool checked) {
void Timeline::snapping_clicked(bool checked) {
snapping = checked;
}
@@ -1445,59 +1432,7 @@ int Timeline::getTimelineScreenPointFromFrame(long frame) {
return getScreenPointFromFrame(zoom, frame) - scroll;
}
void Timeline::on_toolArrowButton_clicked() {
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::ArrowCursor);
tool = TIMELINE_TOOL_POINTER;
creating = false;
}
void Timeline::on_toolEditButton_clicked() {
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::IBeamCursor);
tool = TIMELINE_TOOL_EDIT;
creating = false;
}
void Timeline::on_toolRippleButton_clicked() {
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::ArrowCursor);
tool = TIMELINE_TOOL_RIPPLE;
creating = false;
}
void Timeline::on_toolRollingButton_clicked() {
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::ArrowCursor);
tool = TIMELINE_TOOL_ROLLING;
creating = false;
}
void Timeline::on_toolRazorButton_clicked()
{
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::IBeamCursor);
tool = TIMELINE_TOOL_RAZOR;
creating = false;
}
void Timeline::on_toolSlipButton_clicked()
{
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::ArrowCursor);
tool = TIMELINE_TOOL_SLIP;
creating = false;
}
void Timeline::on_toolSlideButton_clicked()
{
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::ArrowCursor);
tool = TIMELINE_TOOL_SLIDE;
creating = false;
}
void Timeline::on_addButton_clicked() {
void Timeline::add_btn_click() {
QMenu add_menu(this);
QAction* titleMenuItem = new QAction(&add_menu);
@@ -1527,23 +1462,23 @@ void Timeline::on_addButton_clicked() {
noiseMenuItem->setData(ADD_OBJ_NOISE);
add_menu.addAction(noiseMenuItem);
connect(&add_menu, SIGNAL(triggered(QAction*)), this, SLOT(addMenuItem(QAction*)));
connect(&add_menu, SIGNAL(triggered(QAction*)), this, SLOT(add_menu_item(QAction*)));
add_menu.exec(QCursor::pos());
}
void Timeline::addMenuItem(QAction* action) {
void Timeline::add_menu_item(QAction* action) {
creating = true;
creating_object = action->data().toInt();
}
void Timeline::setScroll(int s) {
scroll = s;
ui->headers->set_scroll(s);
headers->set_scroll(s);
repaint_timeline();
}
void Timeline::on_recordButton_clicked() {
void Timeline::record_btn_click() {
if (project_url.isEmpty()) {
QMessageBox::critical(this, "Unsaved Project", "You must save this project before you can record audio in it.", QMessageBox::Ok);
} else {
@@ -1552,7 +1487,7 @@ void Timeline::on_recordButton_clicked() {
}
}
void Timeline::on_toolTransitionButton_clicked() {
void Timeline::transition_tool_click() {
creating = false;
QMenu transition_menu(this);
@@ -1579,7 +1514,7 @@ void Timeline::on_toolTransitionButton_clicked() {
connect(&transition_menu, SIGNAL(triggered(QAction*)), this, SLOT(transition_menu_select(QAction*)));
ui->toolTransitionButton->setChecked(false);
toolTransitionButton->setChecked(false);
transition_menu.exec(QCursor::pos());
}
@@ -1594,9 +1529,9 @@ void Timeline::transition_menu_select(QAction* a) {
}
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::CrossCursor);
timeline_area->setCursor(Qt::CrossCursor);
tool = TIMELINE_TOOL_TRANSITION;
ui->toolTransitionButton->setChecked(true);
toolTransitionButton->setChecked(true);
}
void Timeline::resize_move(double z) {
@@ -1604,7 +1539,242 @@ void Timeline::resize_move(double z) {
}
void Timeline::set_sb_max() {
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, sequence->getEndFrame(), ui->editAreas->width() - getScreenPointFromFrame(zoom, 200));
headers->set_scrollbar_max(horizontalScrollBar, sequence->getEndFrame(), editAreas->width() - getScreenPointFromFrame(zoom, 200));
}
void Timeline::setup_ui() {
QWidget* dockWidgetContents = new QWidget();
QHBoxLayout* horizontalLayout = new QHBoxLayout(dockWidgetContents);
horizontalLayout->setSpacing(0);
horizontalLayout->setContentsMargins(0, 0, 0, 0);
QWidget* tool_buttons = new QWidget(dockWidgetContents);
tool_buttons->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Minimum);
QVBoxLayout* tool_buttons_layout = new QVBoxLayout(tool_buttons);
tool_buttons_layout->setSpacing(4);
tool_buttons_layout->setContentsMargins(0, 0, 0, 0);
toolArrowButton = new QPushButton(tool_buttons);
QIcon arrow_icon;
arrow_icon.addFile(QStringLiteral(":/icons/arrow.png"), QSize(), QIcon::Normal, QIcon::Off);
arrow_icon.addFile(QStringLiteral(":/icons/arrow-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
toolArrowButton->setIcon(arrow_icon);
toolArrowButton->setCheckable(true);
toolArrowButton->setToolTip("Pointer Tool (V)");
toolArrowButton->setProperty("tool", TIMELINE_TOOL_POINTER);
connect(toolArrowButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
tool_buttons_layout->addWidget(toolArrowButton);
toolEditButton = new QPushButton(tool_buttons);
QIcon icon1;
icon1.addFile(QStringLiteral(":/icons/beam.png"), QSize(), QIcon::Normal, QIcon::Off);
icon1.addFile(QStringLiteral(":/icons/beam-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
toolEditButton->setIcon(icon1);
toolEditButton->setCheckable(true);
toolEditButton->setToolTip("Edit Tool (X)");
toolEditButton->setProperty("tool", TIMELINE_TOOL_EDIT);
connect(toolEditButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
tool_buttons_layout->addWidget(toolEditButton);
toolRippleButton = new QPushButton(tool_buttons);
QIcon icon2;
icon2.addFile(QStringLiteral(":/icons/ripple.png"), QSize(), QIcon::Normal, QIcon::Off);
icon2.addFile(QStringLiteral(":/icons/ripple-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
toolRippleButton->setIcon(icon2);
toolRippleButton->setCheckable(true);
toolRippleButton->setToolTip("Ripple Tool (B)");
toolRippleButton->setProperty("tool", TIMELINE_TOOL_RIPPLE);
connect(toolRippleButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
tool_buttons_layout->addWidget(toolRippleButton);
toolRazorButton = new QPushButton(tool_buttons);
QIcon icon4;
icon4.addFile(QStringLiteral(":/icons/razor.png"), QSize(), QIcon::Normal, QIcon::Off);
icon4.addFile(QStringLiteral(":/icons/razor-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
toolRazorButton->setIcon(icon4);
toolRazorButton->setCheckable(true);
toolRazorButton->setToolTip("Razor Tool (C)");
toolRazorButton->setProperty("tool", TIMELINE_TOOL_RAZOR);
connect(toolRazorButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
tool_buttons_layout->addWidget(toolRazorButton);
toolSlipButton = new QPushButton(tool_buttons);
QIcon icon5;
icon5.addFile(QStringLiteral(":/icons/slip.png"), QSize(), QIcon::Normal, QIcon::On);
icon5.addFile(QStringLiteral(":/icons/slip-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
toolSlipButton->setIcon(icon5);
toolSlipButton->setCheckable(true);
toolSlipButton->setToolTip("Slip Tool (Y)");
toolSlipButton->setProperty("tool", TIMELINE_TOOL_SLIP);
connect(toolSlipButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
tool_buttons_layout->addWidget(toolSlipButton);
toolSlideButton = new QPushButton(tool_buttons);
QIcon icon6;
icon6.addFile(QStringLiteral(":/icons/slide.png"), QSize(), QIcon::Normal, QIcon::On);
icon6.addFile(QStringLiteral(":/icons/slide-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
toolSlideButton->setIcon(icon6);
toolSlideButton->setCheckable(true);
toolSlideButton->setToolTip("Slide Tool (U)");
toolSlideButton->setProperty("tool", TIMELINE_TOOL_SLIDE);
connect(toolSlideButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
tool_buttons_layout->addWidget(toolSlideButton);
toolHandButton = new QPushButton(tool_buttons);
QIcon icon7;
icon7.addFile(QStringLiteral(":/icons/hand.png"), QSize(), QIcon::Normal, QIcon::On);
icon7.addFile(QStringLiteral(":/icons/hand-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
toolHandButton->setIcon(icon7);
toolHandButton->setCheckable(true);
toolHandButton->setToolTip("Hand Tool (H)");
toolHandButton->setProperty("tool", TIMELINE_TOOL_HAND);
connect(toolHandButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
tool_buttons_layout->addWidget(toolHandButton);
toolTransitionButton = new QPushButton(tool_buttons);
QIcon icon8;
icon8.addFile(QStringLiteral(":/icons/transition-tool.png"), QSize(), QIcon::Normal, QIcon::On);
icon8.addFile(QStringLiteral(":/icons/transition-tool-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
toolTransitionButton->setIcon(icon8);
toolTransitionButton->setCheckable(true);
toolTransitionButton->setToolTip("Transition Tool (T)");
connect(toolTransitionButton, SIGNAL(clicked(bool)), this, SLOT(transition_tool_click()));
tool_buttons_layout->addWidget(toolTransitionButton);
snappingButton = new QPushButton(tool_buttons);
QIcon icon9;
icon9.addFile(QStringLiteral(":/icons/magnet.png"), QSize(), QIcon::Normal, QIcon::On);
icon9.addFile(QStringLiteral(":/icons/magnet-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
snappingButton->setIcon(icon9);
snappingButton->setCheckable(true);
snappingButton->setChecked(true);
snappingButton->setToolTip("Snapping (S)");
connect(snappingButton, SIGNAL(toggled(bool)), this, SLOT(snapping_clicked(bool)));
tool_buttons_layout->addWidget(snappingButton);
zoomInButton = new QPushButton(tool_buttons);
QIcon icon10;
icon10.addFile(QStringLiteral(":/icons/zoomin.png"), QSize(), QIcon::Normal, QIcon::On);
icon10.addFile(QStringLiteral(":/icons/zoomin-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
zoomInButton->setIcon(icon10);
zoomInButton->setToolTip("Zoom In (=)");
connect(zoomInButton, SIGNAL(clicked(bool)), this, SLOT(zoom_in()));
tool_buttons_layout->addWidget(zoomInButton);
zoomOutButton = new QPushButton(tool_buttons);
QIcon icon11;
icon11.addFile(QStringLiteral(":/icons/zoomout.png"), QSize(), QIcon::Normal, QIcon::On);
icon11.addFile(QStringLiteral(":/icons/zoomout-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
zoomOutButton->setIcon(icon11);
zoomOutButton->setToolTip("Zoom Out (-)");
connect(zoomOutButton, SIGNAL(clicked(bool)), this, SLOT(zoom_out()));
tool_buttons_layout->addWidget(zoomOutButton);
recordButton = new QPushButton(tool_buttons);
QIcon icon12;
icon12.addFile(QStringLiteral(":/icons/record.png"), QSize(), QIcon::Normal, QIcon::On);
icon12.addFile(QStringLiteral(":/icons/record-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
recordButton->setIcon(icon12);
recordButton->setToolTip("Record audio");
connect(recordButton, SIGNAL(clicked(bool)), this, SLOT(record_btn_click()));
tool_buttons_layout->addWidget(recordButton);
addButton = new QPushButton(tool_buttons);
QIcon icon13;
icon13.addFile(QStringLiteral(":/icons/add-button.png"), QSize(), QIcon::Normal, QIcon::On);
icon13.addFile(QStringLiteral(":/icons/add-button-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
addButton->setIcon(icon13);
addButton->setToolTip("Add title, solid, bars, etc.");
connect(addButton, SIGNAL(clicked()), this, SLOT(add_btn_click()));
tool_buttons_layout->addWidget(addButton);
tool_buttons_layout->addStretch();
horizontalLayout->addWidget(tool_buttons);
timeline_area = new QWidget(dockWidgetContents);
QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Minimum);
sizePolicy2.setHorizontalStretch(1);
sizePolicy2.setVerticalStretch(0);
sizePolicy2.setHeightForWidth(timeline_area->sizePolicy().hasHeightForWidth());
timeline_area->setSizePolicy(sizePolicy2);
QVBoxLayout* timeline_area_layout = new QVBoxLayout(timeline_area);
timeline_area_layout->setSpacing(0);
timeline_area_layout->setContentsMargins(0, 0, 0, 0);
headers = new TimelineHeader(timeline_area);
timeline_area_layout->addWidget(headers);
editAreas = new QWidget(timeline_area);
QHBoxLayout* editAreaLayout = new QHBoxLayout(editAreas);
editAreaLayout->setSpacing(0);
editAreaLayout->setContentsMargins(0, 0, 0, 0);
QSplitter* splitter = new QSplitter(editAreas);
splitter->setOrientation(Qt::Vertical);
QWidget* videoContainer = new QWidget(splitter);
QHBoxLayout* videoContainerLayout = new QHBoxLayout(videoContainer);
videoContainerLayout->setSpacing(0);
videoContainerLayout->setObjectName(QStringLiteral("horizontalLayout_2"));
videoContainerLayout->setContentsMargins(0, 0, 0, 0);
video_area = new TimelineWidget(videoContainer);
video_area->setObjectName(QStringLiteral("video_area"));
video_area->setFocusPolicy(Qt::ClickFocus);
videoContainerLayout->addWidget(video_area);
videoScrollbar = new QScrollBar(videoContainer);
videoScrollbar->setObjectName(QStringLiteral("videoScrollbar"));
videoScrollbar->setMaximum(0);
videoScrollbar->setSingleStep(20);
videoScrollbar->setPageStep(1826);
videoScrollbar->setOrientation(Qt::Vertical);
videoContainerLayout->addWidget(videoScrollbar);
splitter->addWidget(videoContainer);
QWidget* audioContainer = new QWidget(splitter);
QHBoxLayout* audioContainerLayout = new QHBoxLayout(audioContainer);
audioContainerLayout->setSpacing(0);
audioContainerLayout->setContentsMargins(0, 0, 0, 0);
audio_area = new TimelineWidget(audioContainer);
audio_area->setObjectName(QStringLiteral("audio_area"));
audio_area->setFocusPolicy(Qt::ClickFocus);
audioContainerLayout->addWidget(audio_area);
audioScrollbar = new QScrollBar(audioContainer);
audioScrollbar->setMaximum(0);
audioScrollbar->setOrientation(Qt::Vertical);
audioContainerLayout->addWidget(audioScrollbar);
splitter->addWidget(audioContainer);
editAreaLayout->addWidget(splitter);
timeline_area_layout->addWidget(editAreas);
horizontalScrollBar = new ResizableScrollBar(timeline_area);
horizontalScrollBar->setObjectName(QStringLiteral("horizontalScrollBar"));
horizontalScrollBar->setMaximum(0);
horizontalScrollBar->setSingleStep(20);
horizontalScrollBar->setPageStep(1826);
horizontalScrollBar->setOrientation(Qt::Horizontal);
timeline_area_layout->addWidget(horizontalScrollBar);
horizontalLayout->addWidget(timeline_area);
audio_monitor = new AudioMonitor(dockWidgetContents);
audio_monitor->setMinimumSize(QSize(50, 0));
horizontalLayout->addWidget(audio_monitor);
setWidget(dockWidgetContents);
}
void move_clip(ComboAction* ca, Clip *c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions) {
@@ -1625,9 +1795,20 @@ void move_clip(ComboAction* ca, Clip *c, long iin, long iout, long iclip_in, int
}
}
void Timeline::on_toolHandButton_clicked() {
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::OpenHandCursor);
tool = TIMELINE_TOOL_HAND;
void Timeline::set_tool() {
QPushButton* button = static_cast<QPushButton*>(sender());
decheck_tool_buttons(button);
tool = button->property("tool").toInt();
creating = false;
switch (tool) {
case TIMELINE_TOOL_EDIT:
case TIMELINE_TOOL_RAZOR:
timeline_area->setCursor(Qt::IBeamCursor);
break;
case TIMELINE_TOOL_HAND:
timeline_area->setCursor(Qt::OpenHandCursor);
break;
default:
timeline_area->setCursor(Qt::ArrowCursor);
}
}
+39 -38
View File
@@ -24,6 +24,11 @@ class ComboAction;
class Effect;
class Media;
class Transition;
class TimelineHeader;
class TimelineWidget;
class ResizableScrollBar;
class AudioMonitor;
class QScrollBar;
struct EffectMeta;
struct Sequence;
struct Clip;
@@ -63,10 +68,6 @@ struct Ghost {
Transition* transition;
};
namespace Ui {
class Timeline;
}
class Timeline : public QDockWidget
{
Q_OBJECT
@@ -188,7 +189,19 @@ public:
bool block_repaints;
Ui::Timeline *ui;
TimelineHeader* headers;
AudioMonitor* audio_monitor;
ResizableScrollBar* horizontalScrollBar;
QPushButton* toolArrowButton;
QPushButton* toolEditButton;
QPushButton* toolRippleButton;
QPushButton* toolRazorButton;
QPushButton* toolSlipButton;
QPushButton* toolSlideButton;
QPushButton* toolHandButton;
QPushButton* toolTransitionButton;
QPushButton* snappingButton;
void resizeEvent(QResizeEvent *event);
public slots:
@@ -199,42 +212,17 @@ public slots:
void split_at_playhead();
private slots:
void on_pushButton_4_clicked();
void on_pushButton_5_clicked();
void on_snappingButton_toggled(bool checked);
void on_toolSlideButton_clicked();
void on_toolArrowButton_clicked();
void on_toolEditButton_clicked();
void on_toolRippleButton_clicked();
void on_toolRollingButton_clicked();
void on_toolRazorButton_clicked();
void on_toolSlipButton_clicked();
void on_addButton_clicked();
void addMenuItem(QAction*);
void zoom_in();
void zoom_out();
void snapping_clicked(bool checked);
void add_btn_click();
void add_menu_item(QAction*);
void setScroll(int);
void on_recordButton_clicked();
void on_toolTransitionButton_clicked();
void record_btn_click();
void transition_tool_click();
void transition_menu_select(QAction*);
void resize_move(double d);
void on_toolHandButton_clicked();
void set_tool();
private:
void set_zoom_value(double v);
@@ -245,7 +233,20 @@ private:
int scroll;
void set_sb_max();
void setup_ui();
int default_track_height;
QWidget* timeline_area;
TimelineWidget* video_area;
TimelineWidget* audio_area;
QWidget* editAreas;
QScrollBar* videoScrollbar;
QScrollBar* audioScrollbar;
QPushButton* zoomInButton;
QPushButton* zoomOutButton;
QPushButton* recordButton;
QPushButton* addButton;
};
#endif // TIMELINE_H
-538
View File
@@ -1,538 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Timeline</class>
<widget class="QDockWidget" name="Timeline">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>901</width>
<height>592</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Timeline</string>
</property>
<widget class="QWidget" name="dockWidgetContents">
<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="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>4</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="toolArrowButton">
<property name="toolTip">
<string>Pointer Tool (V)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/arrow.png</normaloff>
<disabledoff>:/icons/arrow-disabled.png</disabledoff>:/icons/arrow.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toolEditButton">
<property name="toolTip">
<string>Edit Tool (X)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/beam.png</normaloff>
<disabledoff>:/icons/beam-disabled.png</disabledoff>:/icons/beam.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toolRippleButton">
<property name="toolTip">
<string>Ripple Tool (B)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/ripple.png</normaloff>
<disabledoff>:/icons/ripple-disabled.png</disabledoff>:/icons/ripple.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toolRollingButton">
<property name="toolTip">
<string>Rolling Tool (N)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/rolling.png</normaloff>
<disabledoff>:/icons/rolling-disabled.png</disabledoff>:/icons/rolling.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toolRazorButton">
<property name="toolTip">
<string>Razor Tool (C)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/razor.png</normaloff>
<disabledoff>:/icons/razor-disabled.png</disabledoff>:/icons/razor.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toolSlipButton">
<property name="toolTip">
<string>Slip Tool (Y)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/slip.png</normalon>
<disabledon>:/icons/slip-disabled.png</disabledon>
</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toolSlideButton">
<property name="toolTip">
<string>Slide Tool (U)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/slide.png</normalon>
<disabledon>:/icons/slide-disabled.png</disabledon>
</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toolHandButton">
<property name="toolTip">
<string>Hand Tool (H)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/hand.png</normalon>
<disabledon>:/icons/hand-disabled.png</disabledon>
</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="toolTransitionButton">
<property name="toolTip">
<string>Transition Tool (T)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/transition-tool.png</normalon>
<disabledon>:/icons/transition-tool-disabled.png</disabledon>
</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="snappingButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/magnet.png</normalon>
<disabledon>:/icons/magnet-disabled.png</disabledon>
</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="toolTip">
<string>Zoom In (=)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/zoomin.png</normalon>
<disabledon>:/icons/zoomin-disabled.png</disabledon>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="toolTip">
<string>Zoom Out (-)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/zoomout.png</normalon>
<disabledon>:/icons/zoomout-disabled.png</disabledon>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="recordButton">
<property name="toolTip">
<string>Record audio</string>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/record.png</normalon>
<disabledon>:/icons/record-disabled.png</disabledon>
</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addButton">
<property name="toolTip">
<string>Add title, solid, bars, etc.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/add-button.png</normalon>
<disabledon>:/icons/add-button-disabled.png</disabledon>
</iconset>
</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>
<item>
<widget class="QWidget" name="timeline_area" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<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="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="editAreas" 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="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="QWidget" name="videoContainer" native="true">
<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="TimelineWidget" name="video_area" native="true">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
</widget>
</item>
<item>
<widget class="QScrollBar" name="videoScrollbar">
<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>
<widget class="QWidget" name="audioContainer" 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="TimelineWidget" name="audio_area" native="true">
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
</widget>
</item>
<item>
<widget class="QScrollBar" name="audioScrollbar">
<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>
</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>
</item>
<item>
<widget class="AudioMonitor" name="audio_monitor" native="true">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>TimelineHeader</class>
<extends>QWidget</extends>
<header>ui/timelineheader.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TimelineWidget</class>
<extends>QWidget</extends>
<header>ui/timelinewidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>AudioMonitor</class>
<extends>QWidget</extends>
<header>ui/audiomonitor.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ResizableScrollBar</class>
<extends>QScrollBar</extends>
<header>ui/resizablescrollbar.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../icons/icons.qrc"/>
</resources>
<connections/>
</ui>
+9 -2
View File
@@ -11,11 +11,12 @@
#include "project/media.h"
#include "project/undo.h"
#include "ui/audiomonitor.h"
#include "ui_timeline.h"
#include "playback/playback.h"
#include "ui/viewerwidget.h"
#include "ui/viewercontainer.h"
#include "ui/labelslider.h"
#include "ui/timelineheader.h"
#include "ui/resizablescrollbar.h"
#include "debug.h"
#define FRAMES_IN_ONE_MINUTE 1798 // 1800 - 2
@@ -31,6 +32,8 @@ extern "C" {
#include <QPainter>
#include <QStringList>
#include <QTimer>
#include <QHBoxLayout>
#include <QPushButton>
Viewer::Viewer(QWidget *parent) :
QDockWidget(parent),
@@ -466,7 +469,6 @@ void Viewer::setup_ui() {
horizontalScrollBar->setOrientation(Qt::Horizontal);
layout->addWidget(horizontalScrollBar);
QWidget* lower_controls = new QWidget(contents);
QHBoxLayout* lower_control_layout = new QHBoxLayout(lower_controls);
@@ -492,6 +494,7 @@ void Viewer::setup_ui() {
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);
connect(btnSkipToStart, SIGNAL(clicked(bool)), this, SLOT(go_to_start()));
playback_control_layout->addWidget(btnSkipToStart);
btnRewind = new QPushButton(playback_controls);
@@ -499,6 +502,7 @@ void Viewer::setup_ui() {
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);
connect(btnRewind, SIGNAL(clicked(bool)), this, SLOT(previous_frame()));
playback_control_layout->addWidget(btnRewind);
btnPlay = new QPushButton(playback_controls);
@@ -506,6 +510,7 @@ void Viewer::setup_ui() {
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);
connect(btnPlay, SIGNAL(clicked(bool)), this, SLOT(toggle_play()));
playback_control_layout->addWidget(btnPlay);
btnFastForward = new QPushButton(playback_controls);
@@ -513,6 +518,7 @@ void Viewer::setup_ui() {
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);
connect(btnFastForward, SIGNAL(clicked(bool)), this, SLOT(next_frame()));
playback_control_layout->addWidget(btnFastForward);
btnSkipToEnd = new QPushButton(playback_controls);
@@ -520,6 +526,7 @@ void Viewer::setup_ui() {
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);
connect(btnSkipToEnd, SIGNAL(clicked(bool)), this, SLOT(go_to_end()));
playback_control_layout->addWidget(btnSkipToEnd);
lower_control_layout->addWidget(playback_controls);
+5 -5
View File
@@ -42,14 +42,9 @@ public:
void set_zoom(bool in);
// playback functions
void go_to_start();
void previous_frame();
void next_frame();
void seek(long p);
void toggle_play();
void play();
void pause();
void go_to_end();
bool playing;
long playhead_start;
qint64 start_msecs;
@@ -75,6 +70,11 @@ public:
public slots:
void play_wake();
void go_to_start();
void previous_frame();
void toggle_play();
void next_frame();
void go_to_end();
private slots:
void on_btnSkipToStart_clicked();