added go to cut shortcuts and fixed waveform display bug
This commit is contained in:
@@ -368,3 +368,17 @@ void MainWindow::on_actionSlip_Tool_triggered()
|
||||
{
|
||||
if (panel_timeline->focused()) panel_timeline->ui->toolSlipButton->click();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionGo_to_Previous_Cut_triggered()
|
||||
{
|
||||
if (panel_timeline->focused() || panel_viewer->hasFocus()) {
|
||||
panel_timeline->previous_cut();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionGo_to_Next_Cut_triggered()
|
||||
{
|
||||
if (panel_timeline->focused() || panel_viewer->hasFocus()) {
|
||||
panel_timeline->next_cut();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,10 @@ private slots:
|
||||
|
||||
void on_actionSlip_Tool_triggered();
|
||||
|
||||
void on_actionGo_to_Previous_Cut_triggered();
|
||||
|
||||
void on_actionGo_to_Next_Cut_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
void setup_layout();
|
||||
|
||||
+20
-1
@@ -24,7 +24,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>653</width>
|
||||
<height>34</height>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
@@ -102,6 +102,9 @@
|
||||
<addaction name="actionPlay_Pause"/>
|
||||
<addaction name="actionNext_Frame"/>
|
||||
<addaction name="actionGo_to_End"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionGo_to_Previous_Cut"/>
|
||||
<addaction name="actionGo_to_Next_Cut"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Tools">
|
||||
<property name="title">
|
||||
@@ -446,6 +449,22 @@
|
||||
<string>Slip Tool</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGo_to_Previous_Cut">
|
||||
<property name="text">
|
||||
<string>Go to Previous Cut</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Up</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGo_to_Next_Cut">
|
||||
<property name="text">
|
||||
<string>Go to Next Cut</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Down</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.6.2, 2018-06-21T02:11:57. -->
|
||||
<!-- Written by QtCreator 4.6.2, 2018-06-21T10:36:29. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -64,6 +64,38 @@ void Timeline::next_frame() {
|
||||
seek(playhead+1);
|
||||
}
|
||||
|
||||
void Timeline::previous_cut() {
|
||||
bool seek_enabled = false;
|
||||
long p_cut = 0;
|
||||
for (int i=0;i<sequence->clip_count();i++) {
|
||||
Clip* c = sequence->get_clip(i);
|
||||
if (c->timeline_out > p_cut && c->timeline_out < playhead) {
|
||||
p_cut = c->timeline_out;
|
||||
seek_enabled = true;
|
||||
} else if (c->timeline_in > p_cut && c->timeline_in < playhead) {
|
||||
p_cut = c->timeline_in;
|
||||
seek_enabled = true;
|
||||
}
|
||||
}
|
||||
if (seek_enabled) seek(p_cut);
|
||||
}
|
||||
|
||||
void Timeline::next_cut() {
|
||||
bool seek_enabled = false;
|
||||
long n_cut = LONG_MAX;
|
||||
for (int i=0;i<sequence->clip_count();i++) {
|
||||
Clip* c = sequence->get_clip(i);
|
||||
if (c->timeline_out < n_cut && c->timeline_out > playhead) {
|
||||
n_cut = c->timeline_out;
|
||||
seek_enabled = true;
|
||||
} else if (c->timeline_in < n_cut && c->timeline_in > playhead) {
|
||||
n_cut = c->timeline_in;
|
||||
seek_enabled = true;
|
||||
}
|
||||
}
|
||||
if (seek_enabled) seek(n_cut);
|
||||
}
|
||||
|
||||
void Timeline::seek(long p) {
|
||||
pause();
|
||||
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
void go_to_start();
|
||||
void previous_frame();
|
||||
void next_frame();
|
||||
void previous_cut();
|
||||
void next_cut();
|
||||
void seek(long p);
|
||||
void toggle_play();
|
||||
void play();
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class Cacher : public QThread
|
||||
// Q_OBJECT
|
||||
public:
|
||||
Cacher(Clip* c);
|
||||
void run() override;
|
||||
void run();
|
||||
|
||||
bool caching;
|
||||
|
||||
|
||||
+4
-4
@@ -10,10 +10,10 @@ public:
|
||||
explicit TimelineHeader(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
void mousePressEvent(QMouseEvent*) override;
|
||||
void mouseMoveEvent(QMouseEvent*) override;
|
||||
void mouseReleaseEvent(QMouseEvent*) override;
|
||||
void paintEvent(QPaintEvent*);
|
||||
void mousePressEvent(QMouseEvent*);
|
||||
void mouseMoveEvent(QMouseEvent*);
|
||||
void mouseReleaseEvent(QMouseEvent*);
|
||||
|
||||
private:
|
||||
bool dragging;
|
||||
|
||||
+1
-13
@@ -205,7 +205,6 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
case TIMELINE_TOOL_EDIT:
|
||||
panel_timeline->seek(panel_timeline->drag_frame_start);
|
||||
panel_timeline->selecting = true;
|
||||
|
||||
break;
|
||||
case TIMELINE_TOOL_RAZOR:
|
||||
{
|
||||
@@ -807,24 +806,13 @@ void TimelineWidget::redraw_clips() {
|
||||
for (int i=0;i<clip_rect.width();i++) {
|
||||
int waveform_index = qFloor((((float)i / (float)clip_rect.width()) * clip->media_stream->audio_preview.size())/divider)*divider;
|
||||
for (int j=0;j<clip->media_stream->audio_channels;j++) {
|
||||
int mid = channel_height*j+(channel_height/2);
|
||||
int mid = clip_rect.top()+channel_height*j+(channel_height/2);
|
||||
int offset = waveform_index+(j*2);
|
||||
qint8 min = (float)clip->media_stream->audio_preview[offset] / 128.0f * (channel_height/2);
|
||||
qint8 max = (float)clip->media_stream->audio_preview[offset+1] / 128.0f * (channel_height/2);
|
||||
clip_painter.drawLine(clip_rect.left()+i, mid+min, clip_rect.left()+i, mid+max);
|
||||
}
|
||||
}
|
||||
|
||||
// for (int i=waveform_x;i<waveform_width;i+=waveform_scaled_length) {
|
||||
// for (int j=0;j<clip->media_stream->audio_channels;j++) {
|
||||
// int mid = channel_height*j+(channel_height/2);
|
||||
// int offset = i+(j*2);
|
||||
// qint8 min = (float)clip->media_stream->audio_preview[offset] / 128.0f * (channel_height/2);
|
||||
// qint8 max = (float)clip->media_stream->audio_preview[offset+1] / 128.0f * (channel_height/2);
|
||||
// clip_painter.drawLine(draw_x, mid+min, draw_x, mid+max);
|
||||
// }
|
||||
// draw_x++;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -21,13 +21,13 @@ public:
|
||||
|
||||
void redraw_clips();
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
void resizeEvent(QResizeEvent*) override;
|
||||
void paintEvent(QPaintEvent*);
|
||||
void resizeEvent(QResizeEvent*);
|
||||
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
void adjust();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
+3
-3
@@ -19,10 +19,10 @@ public:
|
||||
bool force_audio;
|
||||
bool enable_paint;
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
void initializeGL() override;
|
||||
void paintEvent(QPaintEvent *e);
|
||||
void initializeGL();
|
||||
// void resizeGL(int w, int h);
|
||||
void paintGL() override;
|
||||
void paintGL();
|
||||
private:
|
||||
QTimer retry_timer;
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user