work started on media viewer panel
This commit is contained in:
+7
-17
@@ -55,7 +55,6 @@ Timeline::Timeline(QWidget *parent) :
|
||||
trim_in_point(false),
|
||||
splitting(false),
|
||||
importing(false),
|
||||
zoomChanged(false),
|
||||
ui(new Ui::Timeline),
|
||||
last_frame(0),
|
||||
creating(false),
|
||||
@@ -315,15 +314,7 @@ void Timeline::repaint_timeline(bool changed) {
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
ui->audio_monitor->update();
|
||||
last_frame = sequence->playhead;
|
||||
}
|
||||
|
||||
if (zoomChanged) {
|
||||
zoomChanged = false;
|
||||
int target_scroll = getScreenPointFromFrame(zoom, sequence->playhead)-(ui->editAreas->width()>>1);
|
||||
|
||||
// TODO find a way to gradually move towards target_scroll instead of just setting it?
|
||||
ui->horizontalScrollBar->setValue(target_scroll);
|
||||
}
|
||||
}
|
||||
|
||||
panel_sequence_viewer->update_playhead_timecode(sequence->playhead);
|
||||
|
||||
@@ -488,14 +479,13 @@ int lerp(int a, int b, double t) {
|
||||
}
|
||||
|
||||
void Timeline::set_zoom(bool in) {
|
||||
if (in) {
|
||||
zoom *= 2;
|
||||
} else {
|
||||
zoom /= 2;
|
||||
}
|
||||
zoom *= (in) ? 2 : 0.5;
|
||||
ui->headers->update_zoom(zoom);
|
||||
zoomChanged = true;
|
||||
repaint_timeline(false);
|
||||
repaint_timeline(false);
|
||||
|
||||
// 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);
|
||||
ui->horizontalScrollBar->setValue(target_scroll);
|
||||
}
|
||||
|
||||
void Timeline::decheck_tool_buttons(QObject* sender) {
|
||||
|
||||
+1
-4
@@ -173,10 +173,7 @@ public:
|
||||
QVector<int> split_cache;
|
||||
|
||||
// importing
|
||||
bool importing;
|
||||
|
||||
// zoom variables
|
||||
bool zoomChanged;
|
||||
bool importing;
|
||||
|
||||
// creating variables
|
||||
bool creating;
|
||||
|
||||
+61
-49
@@ -11,6 +11,8 @@
|
||||
#define FRAMES_IN_ONE_MINUTE 1798 // 1800 - 2
|
||||
#define FRAMES_IN_TEN_MINUTES 17978 // (FRAMES_IN_ONE_MINUTE * 10) - 2
|
||||
|
||||
QString panel_name = "Viewer: ";
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
@@ -19,13 +21,14 @@ extern "C" {
|
||||
|
||||
Viewer::Viewer(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
ui(new Ui::Viewer)
|
||||
ui(new Ui::Viewer),
|
||||
seq(NULL)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->headers->show_text(false);
|
||||
ui->glViewerPane->child = ui->openGLWidget;
|
||||
viewer_widget = ui->openGLWidget;
|
||||
update_media(MEDIA_TYPE_SEQUENCE, NULL);
|
||||
set_media(MEDIA_TYPE_SEQUENCE, NULL);
|
||||
|
||||
ui->currentTimecode->setEnabled(false);
|
||||
ui->currentTimecode->set_default_value(qSNaN());
|
||||
@@ -38,7 +41,11 @@ Viewer::Viewer(QWidget *parent) :
|
||||
}
|
||||
|
||||
Viewer::~Viewer() {
|
||||
delete ui;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void Viewer::set_main_sequence() {
|
||||
set_sequence(true, sequence);
|
||||
}
|
||||
|
||||
QString frame_to_timecode(long f, int view, double frame_rate) {
|
||||
@@ -113,80 +120,85 @@ void Viewer::update_playhead_timecode(long p) {
|
||||
}
|
||||
|
||||
void Viewer::update_end_timecode() {
|
||||
ui->endTimecode->setText((sequence == NULL) ? frame_to_timecode(0, config.timecode_view, 30) : frame_to_timecode(sequence->getEndFrame(), config.timecode_view, sequence->frame_rate));
|
||||
ui->endTimecode->setText((seq == NULL) ? frame_to_timecode(0, config.timecode_view, 30) : frame_to_timecode(seq->getEndFrame(), config.timecode_view, seq->frame_rate));
|
||||
}
|
||||
|
||||
void Viewer::update_media(int type, void* media) {
|
||||
void Viewer::set_media(int type, void* media) {
|
||||
switch (type) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = static_cast<Sequence*>(media);
|
||||
|
||||
bool null_sequence = (s == NULL);
|
||||
|
||||
ui->currentTimecode->setEnabled(!null_sequence);
|
||||
ui->openGLWidget->setEnabled(!null_sequence);
|
||||
ui->openGLWidget->setVisible(!null_sequence);
|
||||
ui->pushButton->setEnabled(!null_sequence);
|
||||
ui->pushButton_2->setEnabled(!null_sequence);
|
||||
ui->pushButton_3->setEnabled(!null_sequence);
|
||||
ui->pushButton_4->setEnabled(!null_sequence);
|
||||
ui->pushButton_5->setEnabled(!null_sequence);
|
||||
|
||||
init_audio();
|
||||
|
||||
if (!null_sequence) {
|
||||
config.timecode_view = (frame_rate_is_droppable(s->frame_rate)) ? TIMECODE_DROP : TIMECODE_NONDROP;
|
||||
|
||||
update_playhead_timecode(s->playhead);
|
||||
update_end_timecode();
|
||||
|
||||
ui->glViewerPane->aspect_ratio = (float) s->width / (float) s->height;
|
||||
ui->glViewerPane->adjust();
|
||||
} else {
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
}
|
||||
|
||||
viewer_widget->update();
|
||||
|
||||
update();
|
||||
}
|
||||
set_sequence(false, static_cast<Sequence*>(media));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::on_pushButton_clicked()
|
||||
{
|
||||
void Viewer::on_pushButton_clicked() {
|
||||
panel_timeline->go_to_start();
|
||||
}
|
||||
|
||||
void Viewer::on_pushButton_5_clicked()
|
||||
{
|
||||
void Viewer::on_pushButton_5_clicked() {
|
||||
panel_timeline->go_to_end();
|
||||
}
|
||||
|
||||
void Viewer::on_pushButton_2_clicked()
|
||||
{
|
||||
void Viewer::on_pushButton_2_clicked() {
|
||||
panel_timeline->previous_frame();
|
||||
}
|
||||
|
||||
void Viewer::on_pushButton_4_clicked()
|
||||
{
|
||||
void Viewer::on_pushButton_4_clicked() {
|
||||
panel_timeline->next_frame();
|
||||
}
|
||||
|
||||
void Viewer::on_pushButton_3_clicked()
|
||||
{
|
||||
void Viewer::on_pushButton_3_clicked() {
|
||||
panel_timeline->toggle_play();
|
||||
}
|
||||
|
||||
void Viewer::update_playhead() {
|
||||
panel_timeline->seek(ui->currentTimecode->value());
|
||||
panel_timeline->seek(ui->currentTimecode->value());
|
||||
}
|
||||
|
||||
void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
main_sequence = main;
|
||||
seq = (main) ? sequence : s;
|
||||
viewer_widget->display_sequence = seq;
|
||||
|
||||
bool null_sequence = (seq == NULL);
|
||||
|
||||
ui->headers->setEnabled(!null_sequence);
|
||||
ui->currentTimecode->setEnabled(!null_sequence);
|
||||
ui->openGLWidget->setEnabled(!null_sequence);
|
||||
ui->openGLWidget->setVisible(!null_sequence);
|
||||
ui->pushButton->setEnabled(!null_sequence);
|
||||
ui->pushButton_2->setEnabled(!null_sequence);
|
||||
ui->pushButton_3->setEnabled(!null_sequence);
|
||||
ui->pushButton_4->setEnabled(!null_sequence);
|
||||
ui->pushButton_5->setEnabled(!null_sequence);
|
||||
|
||||
init_audio();
|
||||
|
||||
if (!null_sequence) {
|
||||
config.timecode_view = (frame_rate_is_droppable(seq->frame_rate)) ? TIMECODE_DROP : TIMECODE_NONDROP;
|
||||
|
||||
update_playhead_timecode(seq->playhead);
|
||||
update_end_timecode();
|
||||
|
||||
ui->glViewerPane->aspect_ratio = (float) seq->width / (float) seq->height;
|
||||
ui->glViewerPane->adjust();
|
||||
|
||||
setWindowTitle(panel_name + seq->name);
|
||||
} else {
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
}
|
||||
|
||||
viewer_widget->update();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void Viewer::set_playpause_icon(bool play) {
|
||||
|
||||
+8
-7
@@ -21,7 +21,9 @@ class Viewer : public QDockWidget
|
||||
public:
|
||||
explicit Viewer(QWidget *parent = 0);
|
||||
~Viewer();
|
||||
void update_media(int type, void* media);
|
||||
|
||||
void set_main_sequence();
|
||||
void set_media(int type, void* media);
|
||||
void compose();
|
||||
void set_playpause_icon(bool play);
|
||||
void update_playhead_timecode(long p);
|
||||
@@ -32,16 +34,15 @@ public:
|
||||
Ui::Viewer *ui;
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
void on_pushButton_5_clicked();
|
||||
|
||||
void on_pushButton_5_clicked();
|
||||
void on_pushButton_2_clicked();
|
||||
|
||||
void on_pushButton_4_clicked();
|
||||
|
||||
void on_pushButton_3_clicked();
|
||||
|
||||
void update_playhead();
|
||||
private:
|
||||
void set_sequence(bool main, Sequence* s);
|
||||
bool main_sequence;
|
||||
Sequence* seq;
|
||||
};
|
||||
|
||||
#endif // VIEWER_H
|
||||
|
||||
Reference in New Issue
Block a user