made interlacing configurable
This commit is contained in:
@@ -5,31 +5,59 @@
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
#include "io/media.h"
|
||||
#include "panels/project.h"
|
||||
#include "project/undo.h"
|
||||
|
||||
MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent) {
|
||||
MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, QTreeWidgetItem *i, Media *m) :
|
||||
QDialog(parent),
|
||||
item(i),
|
||||
media(m)
|
||||
{
|
||||
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);
|
||||
if (m->video_tracks.size() > 0) {
|
||||
interlacing_box = new QComboBox();
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_PROGRESSIVE));
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST));
|
||||
interlacing_box->setCurrentIndex(media->video_tracks.at(0)->video_interlacing);
|
||||
|
||||
grid->addWidget(new QLabel("Interlacing:"), 0, 0);
|
||||
grid->addWidget(interlacing_box, 0, 1);
|
||||
grid->addWidget(new QLabel("Interlacing:"), 0, 0);
|
||||
grid->addWidget(interlacing_box, 0, 1);
|
||||
}
|
||||
|
||||
name_box = new QLineEdit(m->name);
|
||||
grid->addWidget(new QLabel("Name:"), 1, 0);
|
||||
grid->addWidget(new QLineEdit("h"), 1, 1);
|
||||
grid->addWidget(name_box, 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()));
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
void MediaPropertiesDialog::accept() {
|
||||
ComboAction* ca = new ComboAction();
|
||||
ca->append(new SetInt(&media->video_tracks.at(0)->video_interlacing, interlacing_box->currentIndex()));
|
||||
ca->append(new SetString(&media->name, name_box->text()));
|
||||
|
||||
item->setText(0, name_box->text());
|
||||
|
||||
MediaRename* mr = new MediaRename();
|
||||
mr->from = media->name;
|
||||
mr->item = item;
|
||||
mr->to = name_box->text();
|
||||
ca->append(mr);
|
||||
|
||||
undo_stack.push(ca);
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
@@ -3,14 +3,22 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
struct Media;
|
||||
class QComboBox;
|
||||
class QLineEdit;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
class MediaPropertiesDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MediaPropertiesDialog(QWidget *parent = 0);
|
||||
MediaPropertiesDialog(QWidget *parent, QTreeWidgetItem* i, Media *m);
|
||||
private:
|
||||
QComboBox* interlacing_box;
|
||||
QLineEdit* name_box;
|
||||
QTreeWidgetItem* item;
|
||||
Media* media;
|
||||
private slots:
|
||||
void accept();
|
||||
};
|
||||
|
||||
#endif // MEDIAPROPERTIESDIALOG_H
|
||||
|
||||
@@ -173,12 +173,7 @@ void PreviewGenerator::generate_waveform() {
|
||||
s->video_preview = QImage(data, dstW, dstH, linesize[0], QImage::Format_RGB888);
|
||||
|
||||
// is video interlaced?
|
||||
if (temp_frame->interlaced_frame) {
|
||||
s->video_interlacing = (temp_frame->top_field_first) ? VIDEO_TOP_FIELD_FIRST : VIDEO_BOTTOM_FIELD_FIRST;
|
||||
s->video_frame_rate *= 2;
|
||||
} else {
|
||||
s->video_interlacing = VIDEO_PROGRESSIVE;
|
||||
}
|
||||
s->video_interlacing = (temp_frame->interlaced_frame) ? ((temp_frame->top_field_first) ? VIDEO_TOP_FIELD_FIRST : VIDEO_BOTTOM_FIELD_FIRST) : VIDEO_PROGRESSIVE;
|
||||
|
||||
s->preview_done = true;
|
||||
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ void Project::open_properties() {
|
||||
switch (get_type_from_tree(item)) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
MediaPropertiesDialog mpd(this);
|
||||
MediaPropertiesDialog mpd(this, item, get_footage_from_tree(item));
|
||||
mpd.exec();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1591,3 +1591,31 @@ void EditSequenceCommand::update() {
|
||||
set_sequence(seq);
|
||||
}
|
||||
}
|
||||
|
||||
SetInt::SetInt(int* pointer, int new_value) :
|
||||
p(pointer),
|
||||
oldval(*pointer),
|
||||
newval(new_value)
|
||||
{}
|
||||
|
||||
void SetInt::undo() {
|
||||
*p = oldval;
|
||||
}
|
||||
|
||||
void SetInt::redo() {
|
||||
*p = newval;
|
||||
}
|
||||
|
||||
SetString::SetString(QString* pointer, QString new_value) :
|
||||
p(pointer),
|
||||
oldval(*pointer),
|
||||
newval(new_value)
|
||||
{}
|
||||
|
||||
void SetString::undo() {
|
||||
*p = oldval;
|
||||
}
|
||||
|
||||
void SetString::redo() {
|
||||
*p = newval;
|
||||
}
|
||||
|
||||
@@ -493,4 +493,26 @@ private:
|
||||
int old_audio_layout;
|
||||
};
|
||||
|
||||
class SetInt : public QUndoCommand {
|
||||
public:
|
||||
SetInt(int* pointer, int new_value);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
int* p;
|
||||
int oldval;
|
||||
int newval;
|
||||
};
|
||||
|
||||
class SetString : public QUndoCommand {
|
||||
public:
|
||||
SetString(QString* pointer, QString new_value);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
QString* p;
|
||||
QString oldval;
|
||||
QString newval;
|
||||
};
|
||||
|
||||
#endif // UNDO_H
|
||||
|
||||
Reference in New Issue
Block a user