support for premultipled alpha
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QGroupBox>
|
||||
#include <QListWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QSpinBox>
|
||||
|
||||
#include "project/footage.h"
|
||||
@@ -19,7 +20,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
QDialog(parent),
|
||||
item(i)
|
||||
{
|
||||
setWindowTitle(tr("\"%1\" Properties").arg(i->get_name()));
|
||||
setWindowTitle(tr("\"%1\" Properties").arg(i->get_name()));
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
QGridLayout* grid = new QGridLayout();
|
||||
@@ -29,21 +30,21 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
|
||||
Footage* f = item->to_footage();
|
||||
|
||||
grid->addWidget(new QLabel(tr("Tracks:")), row, 0, 1, 2);
|
||||
grid->addWidget(new QLabel(tr("Tracks:")), row, 0, 1, 2);
|
||||
row++;
|
||||
|
||||
track_list = new QListWidget();
|
||||
for (int i=0;i<f->video_tracks.size();i++) {
|
||||
const FootageStream& fs = f->video_tracks.at(i);
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Video %1: %2x%3 %4FPS").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.video_width),
|
||||
QString::number(fs.video_height),
|
||||
QString::number(fs.video_frame_rate)
|
||||
)
|
||||
);
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Video %1: %2x%3 %4FPS").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.video_width),
|
||||
QString::number(fs.video_height),
|
||||
QString::number(fs.video_frame_rate)
|
||||
)
|
||||
);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole+1, fs.file_index);
|
||||
@@ -51,13 +52,13 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
}
|
||||
for (int i=0;i<f->audio_tracks.size();i++) {
|
||||
const FootageStream& fs = f->audio_tracks.at(i);
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Audio %1: %2Hz %3 channels").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.audio_frequency),
|
||||
QString::number(fs.audio_channels)
|
||||
)
|
||||
);
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Audio %1: %2Hz %3 channels").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.audio_frequency),
|
||||
QString::number(fs.audio_channels)
|
||||
)
|
||||
);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole+1, fs.file_index);
|
||||
@@ -69,7 +70,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
if (f->video_tracks.size() > 0) {
|
||||
// frame conforming
|
||||
if (!f->video_tracks.at(0).infinite_length) {
|
||||
grid->addWidget(new QLabel(tr("Conform to Frame Rate:")), row, 0);
|
||||
grid->addWidget(new QLabel(tr("Conform to Frame Rate:")), row, 0);
|
||||
conform_fr = new QDoubleSpinBox();
|
||||
conform_fr->setMinimum(0.01);
|
||||
conform_fr->setValue(f->video_tracks.at(0).video_frame_rate * f->speed);
|
||||
@@ -78,30 +79,37 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
|
||||
row++;
|
||||
|
||||
// premultiplied alpha mode
|
||||
premultiply_alpha_setting = new QCheckBox(tr("Alpha is Premultiplied"));
|
||||
premultiply_alpha_setting->setChecked(f->alpha_is_premultiplied);
|
||||
grid->addWidget(premultiply_alpha_setting, row, 0);
|
||||
|
||||
row++;
|
||||
|
||||
// deinterlacing mode
|
||||
interlacing_box = new QComboBox();
|
||||
interlacing_box->addItem(
|
||||
tr("Auto (%1)").arg(
|
||||
get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing)
|
||||
)
|
||||
);
|
||||
interlacing_box = new QComboBox();
|
||||
interlacing_box->addItem(
|
||||
tr("Auto (%1)").arg(
|
||||
get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing)
|
||||
)
|
||||
);
|
||||
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(
|
||||
(f->video_tracks.at(0).video_auto_interlacing == f->video_tracks.at(0).video_interlacing)
|
||||
? 0
|
||||
: f->video_tracks.at(0).video_interlacing + 1);
|
||||
interlacing_box->setCurrentIndex(
|
||||
(f->video_tracks.at(0).video_auto_interlacing == f->video_tracks.at(0).video_interlacing)
|
||||
? 0
|
||||
: f->video_tracks.at(0).video_interlacing + 1);
|
||||
|
||||
grid->addWidget(new QLabel(tr("Interlacing:")), row, 0);
|
||||
grid->addWidget(new QLabel(tr("Interlacing:")), row, 0);
|
||||
grid->addWidget(interlacing_box, row, 1);
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
name_box = new QLineEdit(item->get_name());
|
||||
grid->addWidget(new QLabel(tr("Name:")), row, 0);
|
||||
grid->addWidget(new QLabel(tr("Name:")), row, 0);
|
||||
grid->addWidget(name_box, row, 1);
|
||||
row++;
|
||||
|
||||
@@ -160,6 +168,9 @@ void MediaPropertiesDialog::accept() {
|
||||
refresh_clips = true;
|
||||
}
|
||||
}
|
||||
|
||||
// set premultiplied alpha
|
||||
f->alpha_is_premultiplied = premultiply_alpha_setting->isChecked();
|
||||
}
|
||||
|
||||
// set name
|
||||
@@ -168,7 +179,10 @@ void MediaPropertiesDialog::accept() {
|
||||
ca->append(mr);
|
||||
ca->appendPost(new CloseAllClipsCommand());
|
||||
ca->appendPost(new UpdateFootageTooltip(item));
|
||||
if (refresh_clips) ca->appendPost(new RefreshClips(item));
|
||||
if (refresh_clips) {
|
||||
ca->appendPost(new RefreshClips(item));
|
||||
}
|
||||
ca->appendPost(new UpdateViewer());
|
||||
|
||||
undo_stack.push(ca);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ class QLineEdit;
|
||||
class Media;
|
||||
class QListWidget;
|
||||
class QDoubleSpinBox;
|
||||
class QCheckBox;
|
||||
|
||||
class MediaPropertiesDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
@@ -20,6 +21,7 @@ private:
|
||||
Media* item;
|
||||
QListWidget* track_list;
|
||||
QDoubleSpinBox* conform_fr;
|
||||
QCheckBox* premultiply_alpha_setting;
|
||||
private slots:
|
||||
void accept();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user