got a LOT of work down on the footage viewer
This commit is contained in:
@@ -82,7 +82,7 @@ void EffectControls::menu_select(QAction* q) {
|
||||
}
|
||||
undo_stack.push(ca);
|
||||
if (transition_menu) {
|
||||
panel_timeline->repaint_timeline(true);
|
||||
update_ui(true);
|
||||
} else {
|
||||
reload_clips();
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@
|
||||
#include "timeline.h"
|
||||
#include "effectcontrols.h"
|
||||
#include "viewer.h"
|
||||
#include "project/sequence.h"
|
||||
|
||||
Project* panel_project = 0;
|
||||
EffectControls* panel_effect_controls = 0;
|
||||
@@ -10,7 +11,7 @@ Viewer* panel_sequence_viewer = 0;
|
||||
Viewer* panel_footage_viewer = 0;
|
||||
Timeline* panel_timeline = 0;
|
||||
|
||||
void Timeline::update_effect_controls() {
|
||||
void update_effect_controls() {
|
||||
// SEND CLIPS TO EFFECT CONTROLS
|
||||
// find out how many clips are selected
|
||||
// limits to one video clip and one audio clip and only if they're linked
|
||||
|
||||
@@ -12,4 +12,6 @@ extern Viewer* panel_sequence_viewer;
|
||||
extern Viewer* panel_footage_viewer;
|
||||
extern Timeline* panel_timeline;
|
||||
|
||||
void update_ui(bool modified);
|
||||
|
||||
#endif // PANELS_H
|
||||
|
||||
+4
-4
@@ -356,7 +356,7 @@ void Project::delete_selected_media() {
|
||||
|
||||
// redraw clips
|
||||
if (redraw) {
|
||||
panel_timeline->repaint_timeline(true);
|
||||
update_ui(true);
|
||||
}
|
||||
} else {
|
||||
delete ca;
|
||||
@@ -622,7 +622,7 @@ void Project::delete_clips_using_selected_media() {
|
||||
}
|
||||
if (deleted) {
|
||||
undo_stack.push(ca);
|
||||
panel_timeline->repaint_timeline(true);
|
||||
update_ui(true);
|
||||
} else {
|
||||
delete ca;
|
||||
}
|
||||
@@ -1040,7 +1040,7 @@ void Project::load_project() {
|
||||
if (cont) {
|
||||
if (open_seq != NULL) set_sequence(open_seq);
|
||||
|
||||
panel_timeline->repaint_timeline(false);
|
||||
update_ui(false);
|
||||
mainWindow->setWindowModified(false);
|
||||
} else {
|
||||
new_project();
|
||||
@@ -1347,7 +1347,7 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
}
|
||||
|
||||
// redraw clips
|
||||
panel_timeline->repaint_timeline(replace);
|
||||
update_ui(replace);
|
||||
|
||||
panel_project->source_table->viewport()->update();
|
||||
deleteLater();
|
||||
|
||||
+14
-14
@@ -169,7 +169,7 @@ void Timeline::add_transition() {
|
||||
delete ca;
|
||||
}
|
||||
|
||||
repaint_timeline(true);
|
||||
update_ui(true);
|
||||
}
|
||||
|
||||
int Timeline::calculate_track_height(int track, int value) {
|
||||
@@ -208,7 +208,7 @@ void Timeline::update_sequence() {
|
||||
setWindowTitle("Timeline: <none>");
|
||||
} else {
|
||||
setWindowTitle("Timeline: " + sequence->name);
|
||||
repaint_timeline(false);
|
||||
update_ui(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ void Timeline::select_all() {
|
||||
sequence->selections.append(s);
|
||||
}
|
||||
}
|
||||
repaint_timeline(false);
|
||||
repaint_timeline();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ void Timeline::delete_in_out(bool ripple) {
|
||||
if (ripple) ca->append(new RippleCommand(sequence, sequence->workarea_in, sequence->workarea_in - sequence->workarea_out));
|
||||
ca->append(new SetTimelineInOutCommand(sequence, false, 0, 0));
|
||||
undo_stack.push(ca);
|
||||
repaint_timeline(true);
|
||||
update_ui(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ void Timeline::delete_selection(bool ripple_delete) {
|
||||
|
||||
undo_stack.push(ca);
|
||||
|
||||
repaint_timeline(true);
|
||||
update_ui(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ int lerp(int a, int b, double t) {
|
||||
void Timeline::set_zoom(bool in) {
|
||||
zoom *= (in) ? 2 : 0.5;
|
||||
ui->headers->update_zoom(zoom);
|
||||
repaint_timeline(false);
|
||||
repaint_timeline();
|
||||
|
||||
// TODO find a way to gradually move towards target_scroll instead of just setting it?
|
||||
int target_scroll = getScreenPointFromFrame(zoom, sequence->playhead)-(ui->editAreas->width()>>1);
|
||||
@@ -690,7 +690,7 @@ void Timeline::paste() {
|
||||
|
||||
undo_stack.push(ca);
|
||||
|
||||
repaint_timeline(true);
|
||||
update_ui(true);
|
||||
|
||||
if (config.paste_seeks) {
|
||||
panel_sequence_viewer->seek(paste_end);
|
||||
@@ -749,7 +749,7 @@ void Timeline::ripple_to_in_point(bool in) {
|
||||
ca->append(new RippleCommand(sequence, in_point, (in) ? (in_point - sequence->playhead) : (sequence->playhead - in_point)));
|
||||
undo_stack.push(ca);
|
||||
|
||||
repaint_timeline(true);
|
||||
update_ui(true);
|
||||
|
||||
if (in) panel_sequence_viewer->seek(in_point);
|
||||
}
|
||||
@@ -882,7 +882,7 @@ void Timeline::split_at_playhead() {
|
||||
|
||||
if (split_selected) {
|
||||
undo_stack.push(ca);
|
||||
repaint_timeline(true);
|
||||
update_ui(true);
|
||||
} else {
|
||||
delete ca;
|
||||
}
|
||||
@@ -1006,7 +1006,7 @@ void Timeline::toggle_links() {
|
||||
}
|
||||
if (command->clips.size() > 0) {
|
||||
undo_stack.push(command);
|
||||
repaint_timeline(true);
|
||||
repaint_timeline();
|
||||
} else {
|
||||
delete command;
|
||||
}
|
||||
@@ -1019,7 +1019,7 @@ void Timeline::increase_track_height() {
|
||||
for (int i=0;i<audio_track_heights.size();i++) {
|
||||
audio_track_heights[i] += TRACK_HEIGHT_INCREMENT;
|
||||
}
|
||||
repaint_timeline(false);
|
||||
repaint_timeline();
|
||||
}
|
||||
|
||||
void Timeline::decrease_track_height() {
|
||||
@@ -1031,12 +1031,12 @@ void Timeline::decrease_track_height() {
|
||||
audio_track_heights[i] -= TRACK_HEIGHT_INCREMENT;
|
||||
if (audio_track_heights[i] < TRACK_MIN_HEIGHT) audio_track_heights[i] = TRACK_MIN_HEIGHT;
|
||||
}
|
||||
repaint_timeline(false);
|
||||
repaint_timeline();
|
||||
}
|
||||
|
||||
void Timeline::deselect() {
|
||||
sequence->selections.clear();
|
||||
repaint_timeline(false);
|
||||
repaint_timeline();
|
||||
}
|
||||
|
||||
long getFrameFromScreenPoint(double zoom, int x) {
|
||||
@@ -1154,5 +1154,5 @@ void Timeline::addMenuItem(QAction* action) {
|
||||
void Timeline::setScroll(int s) {
|
||||
scroll = s;
|
||||
ui->headers->set_scroll(s);
|
||||
repaint_timeline(false);
|
||||
repaint_timeline();
|
||||
}
|
||||
|
||||
+22
-19
@@ -16,6 +16,7 @@
|
||||
QString panel_name = "Viewer: ";
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
|
||||
@@ -26,7 +27,6 @@ Viewer::Viewer(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::Viewer),
|
||||
seq(NULL),
|
||||
queue_audio_reset(false),
|
||||
playing(false),
|
||||
created_sequence(false)
|
||||
{
|
||||
@@ -35,6 +35,7 @@ Viewer::Viewer(QWidget *parent) :
|
||||
ui->headers->snapping = false;
|
||||
ui->headers->show_text(false);
|
||||
ui->glViewerPane->child = ui->openGLWidget;
|
||||
ui->openGLWidget->viewer = this;
|
||||
viewer_widget = ui->openGLWidget;
|
||||
set_media(MEDIA_TYPE_SEQUENCE, NULL);
|
||||
|
||||
@@ -72,7 +73,6 @@ void Viewer::reset_all_audio() {
|
||||
}
|
||||
}
|
||||
}
|
||||
// panel_timeline->ui->audio_monitor->reset();
|
||||
clear_audio_ibuffer();
|
||||
}
|
||||
|
||||
@@ -146,8 +146,7 @@ bool frame_rate_is_droppable(float rate) {
|
||||
void Viewer::seek(long p) {
|
||||
pause();
|
||||
seq->playhead = p;
|
||||
queue_audio_reset = true;
|
||||
panel_timeline->repaint_timeline(false);
|
||||
update_parents();
|
||||
}
|
||||
|
||||
void Viewer::go_to_start() {
|
||||
@@ -171,10 +170,11 @@ void Viewer::toggle_play() {
|
||||
}
|
||||
|
||||
void Viewer::play() {
|
||||
if (queue_audio_reset) {
|
||||
reset_all_audio();
|
||||
queue_audio_reset = false;
|
||||
if (audio_output->format().sampleRate() != seq->audio_frequency
|
||||
|| audio_output->format().channelCount() != av_get_channel_layout_nb_channels(seq->audio_layout)) {
|
||||
init_audio(seq);
|
||||
}
|
||||
reset_all_audio();
|
||||
playhead_start = seq->playhead;
|
||||
start_msecs = QDateTime::currentMSecsSinceEpoch();
|
||||
playback_updater.start();
|
||||
@@ -207,15 +207,23 @@ void Viewer::update_header_zoom() {
|
||||
if (sequenceEndFrame > 0) {
|
||||
ui->headers->update_zoom((double) ui->headers->width() / (double) sequenceEndFrame);
|
||||
} else {
|
||||
ui->headers->update_zoom(1);
|
||||
}
|
||||
ui->headers->update_zoom((sequenceEndFrame > 0) ? ((double) ui->headers->width() / (double) sequenceEndFrame) : 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::update_parents() {
|
||||
if (main_sequence) {
|
||||
update_ui(false);
|
||||
} else {
|
||||
update_viewer();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::update_viewer() {
|
||||
viewer_widget->update();
|
||||
update_header_zoom();
|
||||
update_playhead_timecode(seq->playhead);
|
||||
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
||||
}
|
||||
|
||||
void Viewer::set_media(int type, void* media) {
|
||||
@@ -259,10 +267,10 @@ void Viewer::set_media(int type, void* media) {
|
||||
Clip* c = new Clip(seq);
|
||||
c->media = footage;
|
||||
c->media_type = type;
|
||||
c->media_stream = footage->video_tracks.at(0)->file_index;
|
||||
c->media_stream = audio_stream->file_index;
|
||||
c->timeline_in = 0;
|
||||
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
||||
c->track = -1;
|
||||
c->track = 0;
|
||||
c->clip_in = 0;
|
||||
c->recalculateMaxLength();
|
||||
seq->clips.append(c);
|
||||
@@ -307,10 +315,7 @@ void Viewer::update_playhead() {
|
||||
|
||||
void Viewer::timer_update() {
|
||||
seq->playhead = round(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
||||
update_viewer();
|
||||
if (main_sequence) {
|
||||
panel_timeline->repaint_timeline(false);
|
||||
}
|
||||
update_parents();
|
||||
}
|
||||
|
||||
void Viewer::clean_created_seq() {
|
||||
@@ -325,13 +330,11 @@ void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
reset_all_audio();
|
||||
|
||||
main_sequence = main;
|
||||
seq = (main) ? sequence : s;
|
||||
viewer_widget->display_sequence = seq;
|
||||
seq = (main) ? sequence : s;
|
||||
|
||||
bool null_sequence = (seq == NULL);
|
||||
|
||||
ui->headers->setEnabled(!null_sequence);
|
||||
qDebug() << "headers enabled:" << ui->headers->isEnabled();
|
||||
ui->headers->setEnabled(!null_sequence);
|
||||
ui->currentTimecode->setEnabled(!null_sequence);
|
||||
ui->openGLWidget->setEnabled(!null_sequence);
|
||||
ui->openGLWidget->setVisible(!null_sequence);
|
||||
|
||||
+3
-2
@@ -47,12 +47,14 @@ public:
|
||||
QTimer playback_updater;
|
||||
|
||||
void reset_all_audio();
|
||||
void update_parents();
|
||||
|
||||
ViewerWidget* viewer_widget;
|
||||
|
||||
Sequence* seq;
|
||||
|
||||
Ui::Viewer *ui;
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
@@ -66,9 +68,8 @@ private slots:
|
||||
private:
|
||||
void clean_created_seq();
|
||||
void set_sequence(bool main, Sequence* s);
|
||||
bool main_sequence;
|
||||
bool main_sequence;
|
||||
bool created_sequence;
|
||||
bool queue_audio_reset;
|
||||
};
|
||||
|
||||
#endif // VIEWER_H
|
||||
|
||||
Reference in New Issue
Block a user