Merge branch 'master' of https://github.com/olive-editor/olive into proxies
This commit is contained in:
+11
-29
@@ -20,7 +20,6 @@
|
||||
#define PLAYHEAD_SIZE 6
|
||||
#define LINE_MIN_PADDING 50
|
||||
#define SUBLINE_MIN_PADDING 50 // TODO play with this
|
||||
#define MARKER_SIZE 4
|
||||
|
||||
// used only if center_timeline_timecodes is FALSE
|
||||
#define TEXT_PADDING_FROM_LINE 4
|
||||
@@ -406,35 +405,18 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
// draw markers
|
||||
for (int i=0;i<viewer->seq->markers.size();i++) {
|
||||
const Marker& m = viewer->seq->markers.at(i);
|
||||
|
||||
int marker_x = getHeaderScreenPointFromFrame(m.frame);
|
||||
const QPoint points[5] = {
|
||||
QPoint(marker_x, height()-1),
|
||||
QPoint(marker_x + MARKER_SIZE, height() - MARKER_SIZE - 1),
|
||||
QPoint(marker_x + MARKER_SIZE, yoff),
|
||||
QPoint(marker_x - MARKER_SIZE, yoff),
|
||||
QPoint(marker_x - MARKER_SIZE, height() - MARKER_SIZE - 1)
|
||||
};
|
||||
/*const QPoint points[5] = {
|
||||
QPoint(marker_x, height()-1),
|
||||
QPoint(marker_x + MARKER_SIZE, height() - MARKER_SIZE - 1),
|
||||
QPoint(marker_x + MARKER_SIZE, yoff),
|
||||
QPoint(marker_x - MARKER_SIZE, yoff),
|
||||
QPoint(marker_x - MARKER_SIZE, height() - MARKER_SIZE - 1)
|
||||
};*/
|
||||
p.setPen(Qt::black);
|
||||
bool selected = false;
|
||||
for (int j=0;j<selected_markers.size();j++) {
|
||||
if (selected_markers.at(j) == i) {
|
||||
selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selected) {
|
||||
p.setBrush(QColor(208, 255, 208));
|
||||
} else {
|
||||
p.setBrush(QColor(128, 224, 128));
|
||||
}
|
||||
p.drawPolygon(points, 5);
|
||||
|
||||
bool selected = false;
|
||||
for (int j=0;j<selected_markers.size();j++) {
|
||||
if (selected_markers.at(j) == i) {
|
||||
selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
draw_marker(p, marker_x, yoff, height()-1, selected, false);
|
||||
}
|
||||
|
||||
// draw playhead triangle
|
||||
|
||||
+53
-7
@@ -1244,6 +1244,8 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
// slipping doesn't move the clips so we don't bother snapping for it
|
||||
for (int i=0;i<panel_timeline->ghosts.size();i++) {
|
||||
const Ghost& g = panel_timeline->ghosts.at(i);
|
||||
|
||||
// snap ghost's in point
|
||||
if (panel_timeline->trim_target == -1 || g.trim_in) {
|
||||
fm = g.old_in + frame_diff;
|
||||
if (panel_timeline->snap_to_timeline(&fm, true, true, true)) {
|
||||
@@ -1251,6 +1253,8 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// snap ghost's out point
|
||||
if (panel_timeline->trim_target == -1 || !g.trim_in) {
|
||||
fm = g.old_out + frame_diff;
|
||||
if (panel_timeline->snap_to_timeline(&fm, true, true, true)) {
|
||||
@@ -1258,6 +1262,19 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if the ghost is attached to a clip, snap its markers too
|
||||
if (panel_timeline->trim_target == -1 && g.clip >= 0) {
|
||||
Clip* c = sequence->clips.at(g.clip);
|
||||
for (int j=0;j<c->markers.size();j++) {
|
||||
long marker_real_time = c->markers.at(j).frame + c->timeline_in - c->clip_in;
|
||||
fm = marker_real_time + frame_diff;
|
||||
if (panel_timeline->snap_to_timeline(&fm, true, true, true)) {
|
||||
frame_diff = fm - marker_real_time;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2147,8 +2164,11 @@ void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPain
|
||||
int divider = ms->audio_channels*2;
|
||||
int channel_height = clip_rect.height()/ms->audio_channels;
|
||||
|
||||
int last_waveform_index = -1;
|
||||
|
||||
for (int i=waveform_start;i<waveform_limit;i++) {
|
||||
int waveform_index = qFloor((((clip->clip_in + ((double) i/zoom))/media_length) * ms->audio_preview.size())/divider)*divider;
|
||||
if (last_waveform_index < 0) last_waveform_index = waveform_index;
|
||||
|
||||
if (clip->reverse) {
|
||||
waveform_index = ms->audio_preview.size() - waveform_index - (ms->audio_channels * 2);
|
||||
@@ -2156,21 +2176,35 @@ void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPain
|
||||
|
||||
for (int j=0;j<ms->audio_channels;j++) {
|
||||
int mid = (config.rectified_waveforms) ? clip_rect.top()+channel_height*(j+1) : clip_rect.top()+channel_height*j+(channel_height/2);
|
||||
int offset = waveform_index+(j*2);
|
||||
|
||||
if ((offset + 1) < ms->audio_preview.size()) {
|
||||
qint8 min = (double)ms->audio_preview.at(offset) / 128.0 * (channel_height/2);
|
||||
qint8 max = (double)ms->audio_preview.at(offset+1) / 128.0 * (channel_height/2);
|
||||
int offset_range_start = last_waveform_index+(j*2);
|
||||
int offset_range_end = waveform_index+(j*2);
|
||||
|
||||
qint8 min = qint8(qRound(double(ms->audio_preview.at(offset_range_start)) / 128.0 * (channel_height/2)));
|
||||
qint8 max = qint8(qRound(double(ms->audio_preview.at(offset_range_start+1)) / 128.0 * (channel_height/2)));
|
||||
|
||||
if ((offset_range_end + 1) < ms->audio_preview.size()) {
|
||||
|
||||
// for waveform drawings, we get the maximum below 0 and maximum above 0 for this waveform range
|
||||
for (int k=offset_range_start+2;k<=offset_range_end;k+=2) {
|
||||
min = qMin(min, qint8(qRound(double(ms->audio_preview.at(k)) / 128.0 * (channel_height/2))));
|
||||
max = qMax(max, qint8(qRound(double(ms->audio_preview.at(k+1)) / 128.0 * (channel_height/2))));
|
||||
}
|
||||
|
||||
// draw waveforms
|
||||
if (config.rectified_waveforms) {
|
||||
|
||||
// rectified waveforms start from the bottom and draw upwards
|
||||
p->drawLine(clip_rect.left()+i, mid, clip_rect.left()+i, mid - (max - min));
|
||||
} else {
|
||||
|
||||
// non-rectified waveforms start from the center and draw outwards
|
||||
p->drawLine(clip_rect.left()+i, mid+min, clip_rect.left()+i, mid+max);
|
||||
|
||||
}
|
||||
}/* else {
|
||||
qWarning() << "Tried to reach" << offset + 1 << ", limit:" << ms->audio_preview.size();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
last_waveform_index = waveform_index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2394,6 +2428,18 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
}
|
||||
}
|
||||
|
||||
// draw clip markers
|
||||
for (int j=0;j<clip->markers.size();j++) {
|
||||
const Marker& m = clip->markers.at(j);
|
||||
|
||||
// convert marker time (in clip time) to sequence time
|
||||
long marker_time = m.frame + clip->timeline_in - clip->clip_in;
|
||||
int marker_x = panel_timeline->getTimelineScreenPointFromFrame(marker_time);
|
||||
if (marker_x > clip_rect.x() && marker_x < clip_rect.right()) {
|
||||
draw_marker(p, marker_x, clip_rect.bottom()-p.fontMetrics().height(), clip_rect.bottom(), false, false);
|
||||
}
|
||||
}
|
||||
|
||||
// draw clip transitions
|
||||
draw_transition(p, clip, clip_rect, text_rect, TA_OPENING_TRANSITION);
|
||||
draw_transition(p, clip, clip_rect, text_rect, TA_CLOSING_TRANSITION);
|
||||
|
||||
+15
-7
@@ -93,7 +93,20 @@ void ViewerWidget::set_waveform_scroll(int s) {
|
||||
if (waveform) {
|
||||
waveform_scroll = s;
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWidget::set_fullscreen(int screen) {
|
||||
if (screen >= 0 && screen < QGuiApplication::screens().size()) {
|
||||
QScreen* selected_screen = QGuiApplication::screens().at(screen);
|
||||
window->showFullScreen();
|
||||
window->setGeometry(selected_screen->geometry());
|
||||
|
||||
// HACK: window seems to show with distorted texture on first showing, so we queue an update after it's shown
|
||||
QTimer::singleShot(100, window, SLOT(update()));
|
||||
} else {
|
||||
qCritical() << "Failed to find requested screen" << screen << "to set fullscreen to";
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWidget::show_context_menu() {
|
||||
@@ -170,12 +183,7 @@ void ViewerWidget::fullscreen_menu_action(QAction *action) {
|
||||
if (action->data().isNull()) {
|
||||
window->hide();
|
||||
} else {
|
||||
QScreen* selected_screen = QGuiApplication::screens().at(action->data().toInt());
|
||||
window->showFullScreen();
|
||||
window->setGeometry(selected_screen->geometry());
|
||||
|
||||
// HACK: window seems to show with distorted texture on first showing, so we queue an update after it's shown
|
||||
QTimer::singleShot(100, window, SLOT(update()));
|
||||
set_fullscreen(action->data().toInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
void set_scroll(double x, double y);
|
||||
public slots:
|
||||
void set_waveform_scroll(int s);
|
||||
void set_fullscreen(int screen = 0);
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
|
||||
Reference in New Issue
Block a user