This commit is contained in:
itsmattkc
2018-08-03 09:51:56 +10:00
20 changed files with 197 additions and 324 deletions
+6
View File
@@ -30,5 +30,11 @@
<file>slide.png</file>
<file>slide-disabled.png</file>
<file>throbber.png</file>
<file>magnet.png</file>
<file>magnet-disabled.png</file>
<file>zoomin.png</file>
<file>zoomin-disabled.png</file>
<file>zoomout.png</file>
<file>zoomout-disabled.png</file>
</qresource>
</RCC>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

+1 -1
View File
@@ -12,7 +12,7 @@ int main(int argc, char *argv[])
// QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QApplication a(argc, argv);
QApplication a(argc, argv);
MainWindow w;
w.show();
+13 -1
View File
@@ -323,7 +323,15 @@ bool MainWindow::save_project() {
bool MainWindow::can_close_project() {
if (project_changed) {
int r = QMessageBox::question(this, "Unsaved Project", "This project has changed since it was last saved. Would you like to save it before closing?", QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes);
QMessageBox* m = new QMessageBox(
QMessageBox::Question,
"Unsaved Project",
"This project has changed since it was last saved. Would you like to save it before closing?",
QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel,
this
);
m->setWindowModality(Qt::WindowModal);
int r = m->exec();
if (r == QMessageBox::Yes) {
return save_project();
} else if (r == QMessageBox::Cancel) {
@@ -426,6 +434,10 @@ void MainWindow::on_actionCrash_triggered()
// intentionally tries to crash the program - mostly used for debugging
Timeline* temp = NULL;
temp->snapped = true;
int* kek;
kek[5] = 69;
kek[99999] = 420;
delete temp;
}
}
+2 -1
View File
@@ -8,7 +8,7 @@ QT += core gui multimedia opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = olive
TARGET = Olive
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
@@ -123,6 +123,7 @@ win32 {
}
mac {
LIBS += -L/usr/local/lib -lavutil -lavformat -lavcodec -lswscale -lswresample
INCLUDEPATH = /usr/local/include
}
+2 -1
View File
@@ -53,7 +53,8 @@ Timeline::Timeline(QWidget *parent) :
ui->video_area->bottom_align = true;
ui->splitter->setOpaqueResize(false);
ui->video_area->container = ui->videoScrollArea;
ui->audio_area->container = ui->audioScrollArea;
tool_buttons.append(ui->toolArrowButton);
tool_buttons.append(ui->toolEditButton);
+117 -133
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>523</width>
<height>376</height>
<width>901</width>
<height>592</height>
</rect>
</property>
<property name="windowTitle">
@@ -62,18 +62,6 @@
</property>
<item>
<widget class="QPushButton" name="toolArrowButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Pointer Tool (V)</string>
</property>
@@ -85,12 +73,6 @@
<normaloff>:/icons/arrow.png</normaloff>
<disabledoff>:/icons/arrow-disabled.png</disabledoff>:/icons/arrow.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@@ -98,12 +80,6 @@
</item>
<item>
<widget class="QPushButton" name="toolEditButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Edit Tool (X)</string>
</property>
@@ -115,12 +91,6 @@
<normaloff>:/icons/beam.png</normaloff>
<disabledoff>:/icons/beam-disabled.png</disabledoff>:/icons/beam.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@@ -128,12 +98,6 @@
</item>
<item>
<widget class="QPushButton" name="toolRippleButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Ripple Tool (B)</string>
</property>
@@ -145,12 +109,6 @@
<normaloff>:/icons/ripple.png</normaloff>
<disabledoff>:/icons/ripple-disabled.png</disabledoff>:/icons/ripple.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@@ -158,12 +116,6 @@
</item>
<item>
<widget class="QPushButton" name="toolRollingButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Rolling Tool (N)</string>
</property>
@@ -175,12 +127,6 @@
<normaloff>:/icons/rolling.png</normaloff>
<disabledoff>:/icons/rolling-disabled.png</disabledoff>:/icons/rolling.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@@ -188,12 +134,6 @@
</item>
<item>
<widget class="QPushButton" name="toolRazorButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Razor Tool (C)</string>
</property>
@@ -205,12 +145,6 @@
<normaloff>:/icons/razor.png</normaloff>
<disabledoff>:/icons/razor-disabled.png</disabledoff>:/icons/razor.png</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@@ -218,12 +152,6 @@
</item>
<item>
<widget class="QPushButton" name="toolSlipButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Slip Tool (Y)</string>
</property>
@@ -236,12 +164,6 @@
<disabledon>:/icons/slip-disabled.png</disabledon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@@ -249,12 +171,6 @@
</item>
<item>
<widget class="QPushButton" name="toolSlideButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Slide Tool (U)</string>
</property>
@@ -267,12 +183,6 @@
<disabledon>:/icons/slide-disabled.png</disabledon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@@ -280,14 +190,14 @@
</item>
<item>
<widget class="QPushButton" name="snappingButton">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>S</string>
<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>
@@ -299,33 +209,33 @@
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Zoom In (=)</string>
</property>
<property name="text">
<string>+</string>
<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="maximumSize">
<size>
<width>40</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Zoom Out (-)</string>
</property>
<property name="text">
<string>-</string>
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/zoomout.png</normalon>
<disabledon>:/icons/zoomout-disabled.png</disabledon>
</iconset>
</property>
</widget>
</item>
@@ -348,7 +258,7 @@
<item>
<widget class="ScrollArea" name="timeline_area">
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
@@ -361,11 +271,11 @@
<rect>
<x>0</x>
<y>0</y>
<width>408</width>
<height>327</height>
<width>819</width>
<height>551</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
@@ -399,27 +309,101 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<widget class="TimelineWidget" name="video_area" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QScrollArea" name="videoScrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>802</width>
<height>266</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<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="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="TimelineWidget" name="audio_area" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QScrollArea" name="audioScrollArea">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="focusPolicy">
<enum>Qt::ClickFocus</enum>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>802</width>
<height>265</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<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>
</layout>
</widget>
</widget>
</widget>
</item>
-135
View File
@@ -104,183 +104,48 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>36</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</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>
<property name="iconSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>36</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/rew.png</normaloff>
<disabledoff>:/icons/rew-disabled.png</disabledoff>:/icons/rew.png</iconset>
</property>
<property name="iconSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>36</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/play.png</normaloff>
<disabledoff>:/icons/play-disabled.png</disabledoff>:/icons/play.png</iconset>
</property>
<property name="iconSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>36</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/ff.png</normalon>
<disabledoff>:/icons/ff-disabled.png</disabledoff>
</iconset>
</property>
<property name="iconSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>36</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/next.png</normaloff>
<disabledoff>:/icons/next-disabled.png</disabledoff>:/icons/next.png</iconset>
</property>
<property name="iconSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
</widget>
</item>
<item>
+6 -5
View File
@@ -180,21 +180,22 @@ void reset_cache(Clip* c, long target_frame) {
if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
// seeks to nearest keyframe (target_frame represents internal clip frame)
av_seek_frame(c->formatCtx, ms->file_index, clip_frame_to_seconds(c, target_frame) / timebase, AVSEEK_FLAG_BACKWARD);
av_seek_frame(c->formatCtx, ms->file_index, (int64_t) qFloor(clip_frame_to_seconds(c, target_frame) / timebase), AVSEEK_FLAG_BACKWARD);
qDebug() << target_frame;
// play up to the frame we actually want
long retrieved_frame = 0;
AVFrame* temp = av_frame_alloc();
do {
do {
retrieve_next_frame(c, temp);
if (retrieved_frame == 0) {
if (target_frame != 0) {
retrieved_frame = floor(temp->pts * timebase * av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, temp)));
}
if (target_frame != 0) retrieved_frame = floor(temp->pts * timebase * av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, temp)));
} else {
retrieved_frame++;
}
} while (retrieved_frame < target_frame);
av_frame_free(&temp);
} else if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
// seek (target_frame represents timeline timecode in frames, not clip timecode)
+7 -14
View File
@@ -75,7 +75,7 @@ void cache_clip(Clip* clip, long playhead, bool write_A, bool write_B, bool rese
void get_clip_frame(Clip* c, long playhead) {
if (c->open) {
long clip_time = seconds_to_clip_frame(c, playhead_to_seconds(c, playhead));
long clip_time = refactor_frame_number(playhead - c->timeline_in + c->clip_in, c->sequence->frame_rate, av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame)));
// do we need to update the texture?
MediaStream* ms = static_cast<Media*>(c->media)->get_stream_from_file_index(c->media_stream);
@@ -139,15 +139,8 @@ void get_clip_frame(Clip* c, long playhead) {
bool write_A = (!using_cache_A && !c->cache_A.unread);
bool write_B = (!using_cache_B && !c->cache_B.unread);
if (write_A || write_B) {
long playhead;
if (cache_needs_reset) {
// if we have no cache and need to seek, start us at the current playhead...
playhead = clip_time;
} else {
// ...otherwise start at the end of the current cache
playhead = cache_offset + c->cache_size;
}
cache_clip(c, playhead, write_A, write_B, cache_needs_reset, NULL);
// if we have no cache and need to seek, start us at the current playhead, otherwise start at the end of the current cache
cache_clip(c, (cache_needs_reset) ? clip_time : cache_offset + c->cache_size, write_A, write_B, cache_needs_reset, NULL);
}
c->lock.unlock();
}
@@ -175,12 +168,12 @@ void get_clip_frame(Clip* c, long playhead) {
}
}
float playhead_to_seconds(Clip* c, long playhead) {
double playhead_to_seconds(Clip* c, long playhead) {
// returns time in seconds
return (qMax((long) 0, playhead - c->timeline_in) + c->clip_in)/c->sequence->frame_rate;
}
long seconds_to_clip_frame(Clip* c, float seconds) {
long seconds_to_clip_frame(Clip* c, double seconds) {
// returns time as frame number (according to clip's frame rate)
if (c->stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
return floor(seconds*av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame)));
@@ -190,9 +183,9 @@ long seconds_to_clip_frame(Clip* c, float seconds) {
}
}
float clip_frame_to_seconds(Clip* c, long clip_frame) {
double clip_frame_to_seconds(Clip* c, long clip_frame) {
// returns frame number in decimal seconds
return (float) clip_frame / c->sequence->frame_rate;
return (double) clip_frame / av_q2d(av_guess_frame_rate(c->formatCtx, c->stream, c->frame));
}
int retrieve_next_frame(Clip* c, AVFrame* f) {
+3 -3
View File
@@ -19,9 +19,9 @@ void cache_video_worker(Clip* c, long playhead, ClipCache* cache);
void handle_media(Sequence* sequence, long playhead, bool multithreaded);
void reset_cache(Clip* c, long target_frame);
void get_clip_frame(Clip* c, long playhead);
float playhead_to_seconds(Clip* c, long playhead);
long seconds_to_clip_frame(Clip* c, float seconds);
float clip_frame_to_seconds(Clip* c, long clip_frame);
double playhead_to_seconds(Clip* c, long playhead);
long seconds_to_clip_frame(Clip* c, double seconds);
double clip_frame_to_seconds(Clip* c, long clip_frame);
int retrieve_next_frame(Clip* c, AVFrame* f);
void retrieve_next_frame_raw_data(Clip* c, AVFrame* output);
bool is_clip_active(Clip* c, long playhead);
+1 -1
View File
@@ -91,7 +91,7 @@ void Clip::reset_audio() {
audio_reset = true;
frame_sample_index = 0;
audio_buffer_write = 0;
reached_end = false;
reached_end = false;
break;
case MEDIA_TYPE_SEQUENCE:
{
+33 -22
View File
@@ -1349,27 +1349,44 @@ int color_brightness(int r, int g, int b) {
void TimelineWidget::redraw_clips() {
// Draw clips
if (sequence != NULL) {
int panel_width = panel_timeline->getScreenPointFromFrame(sequence->getEndFrame()) + 100;
// get widget width and height
int video_track_limit = 0;
int audio_track_limit = 0;
long end_frame = 0;
for (int i=0;i<sequence->clip_count();i++) {
Clip* clip = sequence->get_clip(i);
if (clip != NULL) {
end_frame = qMax(end_frame, clip->timeline_out);
video_track_limit = qMin(video_track_limit, clip->track);
audio_track_limit = qMax(audio_track_limit, clip->track);
}
}
int panel_width = panel_timeline->getScreenPointFromFrame(end_frame) + 100;
int panel_height = 0;
if (bottom_align) {
for (int i=-1;i>=video_track_limit;i--) {
panel_height += panel_timeline->calculate_track_height(i, -1);
}
} else {
for (int i=0;i<=audio_track_limit;i++) {
panel_height += panel_timeline->calculate_track_height(i, -1);
}
}
if (minimumWidth() != panel_width || clip_pixmap.height() != height()) {
if (minimumWidth() != panel_width || /*clip_pixmap.height() != height() || */panel_height != minimumHeight()) {
setMinimumWidth(panel_width);
clip_pixmap = QPixmap(qMax(width(), panel_width), height());
container->setMinimumWidth(panel_width);
setMinimumHeight(panel_height);
clip_pixmap = QPixmap(qMax(width(), panel_width), qMax(height(), panel_height));
}
clip_pixmap.fill(Qt::transparent);
QPainter clip_painter(&clip_pixmap);
int video_track_limit = 0;
int audio_track_limit = 0;
QColor transition_color(255, 0, 0, 16);
for (int i=0;i<sequence->clip_count();i++) {
Clip* clip = sequence->get_clip(i);
if (clip != NULL && is_track_visible(clip->track)) {
if (clip->track < 0 && clip->track < video_track_limit) { // video clip
video_track_limit = clip->track;
} else if (clip->track > audio_track_limit) {
audio_track_limit = clip->track;
}
if (clip != NULL && is_track_visible(clip->track)) {
QRect clip_rect(panel_timeline->getScreenPointFromFrame(clip->timeline_in), getScreenPointFromTrack(clip->track), clip->getLength() * panel_timeline->zoom, panel_timeline->calculate_track_height(clip->track, -1));
clip_painter.fillRect(clip_rect, QColor(clip->color_r, clip->color_g, clip->color_b));
@@ -1378,13 +1395,8 @@ void TimelineWidget::redraw_clips() {
QRect text_rect(clip_rect.left() + CLIP_TEXT_PADDING, clip_rect.top() + CLIP_TEXT_PADDING, clip_rect.width() - CLIP_TEXT_PADDING - 1, clip_rect.height() - CLIP_TEXT_PADDING - 1);
// draw clip transitions
for (char i=0;i<2;i++) {
Transition* t;
if (i == 0) {
t = clip->opening_transition;
} else {
t = clip->closing_transition;
}
for (int i=0;i<2;i++) {
Transition* t = (i == 0) ? clip->opening_transition : clip->closing_transition;
if (t != NULL) {
int transition_width = panel_timeline->getScreenPointFromFrame(t->length);
int transition_height = clip_rect.height() * 0.6;
@@ -1522,9 +1534,8 @@ void TimelineWidget::redraw_clips() {
}
} else {
// only draw lines for audio tracks
for (int i=0;i<audio_track_limit;i++) {
// TODO just make i+1?
int line_y = getScreenPointFromTrack(i) + panel_timeline->calculate_track_height(i, -1);
for (int i=0;i<audio_track_limit;i++) {
int line_y = getScreenPointFromTrack(i) + panel_timeline->calculate_track_height(i, -1);
clip_painter.drawLine(0, line_y, rect().width(), line_y);
}
}
+4 -3
View File
@@ -19,11 +19,13 @@ class TimelineAction;
class TimelineWidget : public QWidget {
Q_OBJECT
public:
explicit TimelineWidget(QWidget *parent = 0);
explicit TimelineWidget(QWidget *parent = 0);
bool bottom_align;
void redraw_clips();
QWidget* container;
protected:
void paintEvent(QPaintEvent*);
void resizeEvent(QResizeEvent*);
@@ -60,8 +62,7 @@ private:
int predicted_video_height;
double predicted_new_frame_rate;
int predicted_audio_freq;
int predicted_audio_layout;
int predicted_audio_layout;
signals:
public slots:
+2 -4
View File
@@ -89,12 +89,10 @@ void ViewerWidget::paintEvent(QPaintEvent *e) {
void ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
Sequence* s = sequence;
long playhead = panel_timeline->playhead;
long playhead = panel_timeline->playhead;
if (nest != NULL) {
s = static_cast<Sequence*>(nest->media);
// qDebug() << "nested sequence was null:" << (s == NULL);
playhead += nest->clip_in - nest->timeline_in;
playhead = refactor_frame_number(playhead, sequence->frame_rate, s->frame_rate);
}