SEVERAL improvements to timeline behavior, drawing, tools, effects, playback and edge case crashing

This commit is contained in:
itsmattkc
2018-11-14 22:31:17 +11:00
parent 30bfeef64a
commit 5b66b223f8
8 changed files with 59 additions and 45 deletions
+1
View File
@@ -3,6 +3,7 @@
#include <QStandardPaths>
#include <QFileInfo>
#include <QCoreApplication>
#include "debug.h"
QString real_app_dir;
+2 -1
View File
@@ -81,6 +81,7 @@ MainWindow::MainWindow(QWidget *parent) :
// set up style?
qApp->setStyle(QStyleFactory::create("Fusion"));
setStyleSheet("QPushButton::checked { background: rgb(25, 25, 25); }");
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, QColor(53,53,53));
@@ -95,7 +96,7 @@ MainWindow::MainWindow(QWidget *parent) :
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(128, 128, 128));
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
darkPalette.setColor(QPalette::HighlightedText, Qt::black);
qApp->setPalette(darkPalette);
+4
View File
@@ -1405,6 +1405,9 @@ void Timeline::on_toolTransitionButton_clicked() {
}
connect(&transition_menu, SIGNAL(triggered(QAction*)), this, SLOT(transition_menu_select(QAction*)));
ui->toolTransitionButton->setChecked(false);
transition_menu.exec(QCursor::pos());
}
@@ -1420,4 +1423,5 @@ void Timeline::transition_menu_select(QAction* a) {
decheck_tool_buttons(sender());
ui->timeline_area->setCursor(Qt::CrossCursor);
tool = TIMELINE_TOOL_TRANSITION;
ui->toolTransitionButton->setChecked(true);
}
+13 -2
View File
@@ -492,12 +492,23 @@ void Viewer::on_pushButton_3_clicked() {
}
void Viewer::update_playhead() {
seek(ui->currentTimecode->value());
seek(ui->currentTimecode->value());
}
void Viewer::timer_update() {
seq->playhead = round(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
long previous_playhead = seq->playhead;
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
update_parents();
long end_frame = (seq->using_workarea && previous_playhead < seq->workarea_out) ? seq->workarea_out : seq->getEndFrame();
if ((!recording
&& playing
&& seq->playhead >= end_frame
&& previous_playhead < end_frame)
|| (recording && recording_start != recording_end && seq->playhead >= recording_end)) {
pause();
}
}
void Viewer::recording_flasher_update() {
+4 -3
View File
@@ -162,9 +162,9 @@ void load_internal_effects() {
void load_shader_effects() {
QString effects_path = get_effects_dir();
QDir effects_dir(effects_path);
if (effects_dir.exists()) {
QList<QString> entries = effects_dir.entryList(QStringList("*.xml"), QDir::Files);
QDir effects_dir(effects_path);
if (effects_dir.exists()) {
QList<QString> entries = effects_dir.entryList(QStringList("*.xml"), QDir::Files);
for (int i=0;i<entries.size();i++) {
QFile file(effects_path + "/" + entries.at(i));
if (!file.open(QIODevice::ReadOnly)) {
@@ -187,6 +187,7 @@ void load_shader_effects() {
}
if (!effect_name.isEmpty()) {
EffectMeta em;
em.type = EFFECT_TYPE_EFFECT;
em.name = effect_name;
em.category = effect_cat;
em.filename = entries.at(i);
+2
View File
@@ -115,6 +115,8 @@ void DeleteClipAction::undo() {
void DeleteClipAction::redo() {
// remove ref to clip
ref = seq->clips.at(index);
close_clip(ref);
if (ref->multithreaded) ref->cacher->wait();
seq->clips[index] = NULL;
// delete link to this clip
+32 -29
View File
@@ -2026,35 +2026,38 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
draw_checkerboard = true;
} else if (ms->preview_done) {
// draw top and tail triangles
int triangle_size = TRACK_MIN_HEIGHT >> 2;
p.setPen(Qt::NoPen);
p.setBrush(QColor(80, 80, 80));
if (clip->clip_in == 0
&& clip_rect.x() + triangle_size > 0
&& clip_rect.y() + triangle_size > 0
&& clip_rect.x() < width()
&& clip_rect.y() < height()) {
const QPoint points[3] = {
QPoint(clip_rect.x(), clip_rect.y()),
QPoint(clip_rect.x() + triangle_size, clip_rect.y()),
QPoint(clip_rect.x(), clip_rect.y() + triangle_size)
};
p.drawPolygon(points, 3);
text_rect.setLeft(text_rect.left() + (triangle_size >> 2));
}
if (clip->timeline_out - clip->timeline_in + clip->clip_in == clip->getMaximumLength()
&& clip_rect.right() - triangle_size < width()
&& clip_rect.y() + triangle_size > 0
&& clip_rect.right() > 0
&& clip_rect.y() < height()) {
const QPoint points[3] = {
QPoint(clip_rect.right(), clip_rect.y()),
QPoint(clip_rect.right() - triangle_size, clip_rect.y()),
QPoint(clip_rect.right(), clip_rect.y() + triangle_size)
};
p.drawPolygon(points, 3);
text_rect.setRight(text_rect.right() - (triangle_size >> 2));
}
int triangle_size = TRACK_MIN_HEIGHT >> 2;
if (!ms->infinite_length && clip_rect.width() > triangle_size) {
p.setPen(Qt::NoPen);
p.setBrush(QColor(80, 80, 80));
if (clip->clip_in == 0
&& clip_rect.x() + triangle_size > 0
&& clip_rect.y() + triangle_size > 0
&& clip_rect.x() < width()
&& clip_rect.y() < height()) {
const QPoint points[3] = {
QPoint(clip_rect.x(), clip_rect.y()),
QPoint(clip_rect.x() + triangle_size, clip_rect.y()),
QPoint(clip_rect.x(), clip_rect.y() + triangle_size)
};
p.drawPolygon(points, 3);
text_rect.setLeft(text_rect.left() + (triangle_size >> 2));
}
if (clip->timeline_out - clip->timeline_in + clip->clip_in == clip->getMaximumLength()
&& clip_rect.right() - triangle_size < width()
&& clip_rect.y() + triangle_size > 0
&& clip_rect.right() > 0
&& clip_rect.y() < height()) {
const QPoint points[3] = {
QPoint(clip_rect.right(), clip_rect.y()),
QPoint(clip_rect.right() - triangle_size, clip_rect.y()),
QPoint(clip_rect.right(), clip_rect.y() + triangle_size)
};
p.drawPolygon(points, 3);
text_rect.setRight(text_rect.right() - (triangle_size >> 2));
}
}
p.setBrush(Qt::NoBrush);
// draw thumbnail/waveform
+1 -10
View File
@@ -656,14 +656,5 @@ void ViewerWidget::paintGL() {
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
} while (loop);
// TODO this could be cleaned up but it's not a priority rn
if (!recording
&& viewer->playing
&& (viewer->seq->playhead == viewer->seq->getEndFrame() || (viewer->seq->using_workarea && viewer->seq->playhead >= viewer->seq->workarea_out))) {
viewer->pause();
} else if (recording && viewer->recording_start != viewer->recording_end && viewer->seq->playhead >= viewer->recording_end) {
viewer->pause();
}
} while (loop);
}