added proper timecodes in the timeline
This commit is contained in:
+3
-2
@@ -82,6 +82,7 @@ Timeline::Timeline(QWidget *parent) :
|
||||
int timeline_area_height = (ui->timeline_area->height()>>1);
|
||||
ui->videoScrollArea->resize(ui->videoScrollArea->width(), timeline_area_height);
|
||||
ui->audioScrollArea->resize(ui->audioScrollArea->width(), timeline_area_height);
|
||||
ui->headerScrollArea->setMaximumHeight(ui->headers->minimumHeight());
|
||||
connect(ui->audioScrollArea->horizontalScrollBar(), SIGNAL(valueChanged(int)), ui->videoScrollArea->horizontalScrollBar(), SLOT(setValue(int)));
|
||||
connect(ui->audioScrollArea->horizontalScrollBar(), SIGNAL(valueChanged(int)), ui->headerScrollArea->horizontalScrollBar(), SLOT(setValue(int)));
|
||||
|
||||
@@ -1095,7 +1096,7 @@ void Timeline::deselect() {
|
||||
}
|
||||
|
||||
long getFrameFromScreenPoint(double zoom, int x) {
|
||||
long f = round((float) x / zoom);
|
||||
long f = qRound((float) x / zoom);
|
||||
if (f < 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1103,7 +1104,7 @@ long getFrameFromScreenPoint(double zoom, int x) {
|
||||
}
|
||||
|
||||
int getScreenPointFromFrame(double zoom, long frame) {
|
||||
return (int) round(frame*zoom);
|
||||
return (int) qRound(frame*zoom);
|
||||
}
|
||||
|
||||
long Timeline::getTimelineFrameFromScreenPoint(int x) {
|
||||
|
||||
+9
-26
@@ -304,17 +304,11 @@
|
||||
<item>
|
||||
<widget class="QScrollArea" name="headerScrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
@@ -327,18 +321,13 @@
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>821</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
@@ -369,12 +358,6 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
@@ -389,7 +372,7 @@
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
@@ -422,8 +405,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>807</width>
|
||||
<height>163</height>
|
||||
<width>817</width>
|
||||
<height>174</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
@@ -473,8 +456,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>807</width>
|
||||
<height>377</height>
|
||||
<width>817</width>
|
||||
<height>339</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
|
||||
+6
-6
@@ -5,6 +5,7 @@
|
||||
#include "timeline.h"
|
||||
#include "project/sequence.h"
|
||||
#include "panels/panels.h"
|
||||
#include "io/config.h"
|
||||
|
||||
#define FRAMES_IN_ONE_MINUTE 1798 // 1800 - 2
|
||||
#define FRAMES_IN_TEN_MINUTES 17978 // (FRAMES_IN_ONE_MINUTE * 10) - 2
|
||||
@@ -22,7 +23,6 @@ Viewer::Viewer(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
ui->glViewerPane->child = ui->openGLWidget;
|
||||
viewer_widget = ui->openGLWidget;
|
||||
timecode_view = TIMECODE_DROP;
|
||||
update_sequence();
|
||||
|
||||
update_playhead_timecode(0);
|
||||
@@ -99,14 +99,14 @@ bool frame_rate_is_droppable(float rate) {
|
||||
}
|
||||
|
||||
void Viewer::update_playhead_timecode(long p) {
|
||||
ui->currentTimecode->setText(frame_to_timecode(p, timecode_view, (sequence != NULL) ? sequence->frame_rate : 30));
|
||||
ui->currentTimecode->setText(frame_to_timecode(p, config.timecode_view, (sequence != NULL) ? sequence->frame_rate : 30));
|
||||
}
|
||||
|
||||
void Viewer::update_end_timecode() {
|
||||
if (sequence == NULL) {
|
||||
ui->endTimecode->setText(frame_to_timecode(0, timecode_view, 30));
|
||||
ui->endTimecode->setText(frame_to_timecode(0, config.timecode_view, 30));
|
||||
} else {
|
||||
ui->endTimecode->setText(frame_to_timecode(sequence->getEndFrame(), timecode_view, sequence->frame_rate));
|
||||
ui->endTimecode->setText(frame_to_timecode(sequence->getEndFrame(), config.timecode_view, sequence->frame_rate));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,9 +125,9 @@ void Viewer::update_sequence() {
|
||||
|
||||
if (!null_sequence) {
|
||||
if (frame_rate_is_droppable(sequence->frame_rate)) {
|
||||
timecode_view = TIMECODE_DROP;
|
||||
config.timecode_view = TIMECODE_DROP;
|
||||
} else {
|
||||
timecode_view = TIMECODE_NONDROP;
|
||||
config.timecode_view = TIMECODE_NONDROP;
|
||||
}
|
||||
|
||||
update_playhead_timecode(panel_timeline->playhead);
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#ifndef VIEWER_H
|
||||
#define VIEWER_H
|
||||
|
||||
#define TIMECODE_DROP 0
|
||||
#define TIMECODE_NONDROP 1
|
||||
#define TIMECODE_FRAMES 2
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
class Timeline;
|
||||
@@ -28,7 +24,6 @@ public:
|
||||
void update_sequence();
|
||||
void compose();
|
||||
void set_playpause_icon(bool play);
|
||||
int timecode_view;
|
||||
void update_playhead_timecode(long p);
|
||||
void update_end_timecode();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user