SEVERAL bug fixes

This commit is contained in:
itsmattkc
2018-10-12 18:48:14 +11:00
parent caee50a943
commit cdbec85a81
30 changed files with 444 additions and 149 deletions
+35
View File
@@ -0,0 +1,35 @@
#include "mediapropertiesdialog.h"
#include <QGridLayout>
#include <QLabel>
#include <QComboBox>
#include <QLineEdit>
#include <QDialogButtonBox>
#include "io/media.h"
#include "panels/project.h"
MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent) {
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QGridLayout* grid = new QGridLayout();
setLayout(grid);
interlacing_box = new QComboBox();
interlacing_box->addItem(get_interlacing_name(VIDEO_PROGRESSIVE), VIDEO_PROGRESSIVE);
interlacing_box->addItem(get_interlacing_name(VIDEO_TOP_FIELD_FIRST), VIDEO_TOP_FIELD_FIRST);
interlacing_box->addItem(get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST), VIDEO_BOTTOM_FIELD_FIRST);
grid->addWidget(new QLabel("Interlacing:"), 0, 0);
grid->addWidget(interlacing_box, 0, 1);
grid->addWidget(new QLabel("Name:"), 1, 0);
grid->addWidget(new QLineEdit("h"), 1, 1);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
buttons->setCenterButtons(true);
grid->addWidget(buttons, 2, 0, 1, 2);
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
}
+16
View File
@@ -0,0 +1,16 @@
#ifndef MEDIAPROPERTIESDIALOG_H
#define MEDIAPROPERTIESDIALOG_H
#include <QDialog>
class QComboBox;
class MediaPropertiesDialog : public QDialog {
Q_OBJECT
public:
explicit MediaPropertiesDialog(QWidget *parent = 0);
private:
QComboBox* interlacing_box;
};
#endif // MEDIAPROPERTIESDIALOG_H
+32 -7
View File
@@ -15,6 +15,7 @@ extern "C" {
NewSequenceDialog::NewSequenceDialog(QWidget *parent) :
QDialog(parent),
existing_sequence(NULL),
ui(new Ui::NewSequenceDialog)
{
ui->setupUi(this);
@@ -51,20 +52,44 @@ void NewSequenceDialog::set_sequence_name(const QString& s) {
ui->lineEdit->setText(s);
}
void NewSequenceDialog::on_buttonBox_accepted()
{
Sequence* s = new Sequence();
void NewSequenceDialog::showEvent(QShowEvent *) {
if (existing_sequence != NULL) {
ui->width_numeric->setValue(existing_sequence->width);
ui->height_numeric->setValue(existing_sequence->height);
int comp_rate = qRound(existing_sequence->frame_rate*100);
for (int i=0;i<ui->frame_rate_combobox->count();i++) {
if (qRound(ui->frame_rate_combobox->itemData(i).toDouble()*100) == comp_rate) {
ui->frame_rate_combobox->setCurrentIndex(i);
break;
}
}
ui->lineEdit->setText(existing_sequence->name);
for (int i=0;i<ui->audio_frequency_combobox->count();i++) {
if (ui->audio_frequency_combobox->itemData(i) == existing_sequence->audio_frequency) {
ui->audio_frequency_combobox->setCurrentIndex(i);
break;
}
}
}
}
void NewSequenceDialog::on_buttonBox_accepted() {
Sequence* s = (existing_sequence != NULL) ? existing_sequence : new Sequence();
s->name = ui->lineEdit->text();
s->width = ui->width_numeric->value();
s->height = ui->height_numeric->value();
s->frame_rate = ui->frame_rate_combobox->currentData().toDouble();
s->frame_rate = ui->frame_rate_combobox->currentData().toDouble();
s->audio_frequency = ui->audio_frequency_combobox->currentData().toInt();
s->audio_layout = AV_CH_LAYOUT_STEREO;
ComboAction* ca = new ComboAction();
panel_project->new_sequence(ca, s, true, NULL);
undo_stack.push(ca);
if (existing_sequence == NULL) {
ComboAction* ca = new ComboAction();
panel_project->new_sequence(ca, s, true, NULL);
undo_stack.push(ca);
} else {
// TODO make editing undoable
}
}
void NewSequenceDialog::on_comboBox_currentIndexChanged(int index)
+5
View File
@@ -4,6 +4,7 @@
#include <QDialog>
class Project;
struct Sequence;
namespace Ui {
class NewSequenceDialog;
@@ -16,8 +17,12 @@ class NewSequenceDialog : public QDialog
public:
explicit NewSequenceDialog(QWidget *parent = 0);
~NewSequenceDialog();
Sequence* existing_sequence;
void set_sequence_name(const QString& s);
protected:
void showEvent(QShowEvent *);
private slots:
void on_buttonBox_accepted();
+2 -1
View File
@@ -320,7 +320,8 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
for (int j=0;j<e->row_count();j++) {
EffectRow* r = e->row(j);
for (int k=0;k<r->keyframe_times.size();k++) {
long new_pos = r->keyframe_times.at(k) / speed;
long new_pos = r->keyframe_times.at(k) * c->speed / speed;
qDebug() << "old key" << r->keyframe_times.at(k) << "new key" << new_pos;
KeyframeMove* km = new KeyframeMove();
km->movement = new_pos - r->keyframe_times.at(k);
km->rows.append(r);