improved effects signalling
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#include "ui/colorbutton.h"
|
#include "ui/colorbutton.h"
|
||||||
#include "ui/comboboxex.h"
|
#include "ui/comboboxex.h"
|
||||||
#include "ui/fontcombobox.h"
|
#include "ui/fontcombobox.h"
|
||||||
|
#include "ui/checkboxex.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
@@ -22,8 +23,7 @@ Effect::Effect(Clip* c, int t, int i) : parent_clip(c), type(t), id(i) {
|
|||||||
container->setText(video_effect_names[i]);
|
container->setText(video_effect_names[i]);
|
||||||
} else if (type == EFFECT_TYPE_AUDIO) {
|
} else if (type == EFFECT_TYPE_AUDIO) {
|
||||||
container->setText(audio_effect_names[i]);
|
container->setText(audio_effect_names[i]);
|
||||||
}
|
}
|
||||||
connect(container->enabled_check, SIGNAL(clicked(bool)), this, SLOT(checkbox_command()));
|
|
||||||
connect(container->enabled_check, SIGNAL(clicked(bool)), this, SLOT(field_changed()));
|
connect(container->enabled_check, SIGNAL(clicked(bool)), this, SLOT(field_changed()));
|
||||||
ui = new QWidget();
|
ui = new QWidget();
|
||||||
|
|
||||||
@@ -54,11 +54,6 @@ void Effect::field_changed() {
|
|||||||
panel_viewer->viewer_widget->update();
|
panel_viewer->viewer_widget->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect::checkbox_command() {
|
|
||||||
CheckboxCommand* c = new CheckboxCommand(static_cast<QCheckBox*>(sender()));
|
|
||||||
undo_stack.push(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Effect::is_enabled() {
|
bool Effect::is_enabled() {
|
||||||
return container->enabled_check->isChecked();
|
return container->enabled_check->isChecked();
|
||||||
}
|
}
|
||||||
@@ -66,12 +61,12 @@ bool Effect::is_enabled() {
|
|||||||
void Effect::load(QXmlStreamReader* stream) {
|
void Effect::load(QXmlStreamReader* stream) {
|
||||||
for (int i=0;i<rows.size();i++) {
|
for (int i=0;i<rows.size();i++) {
|
||||||
EffectRow* row = rows.at(i);
|
EffectRow* row = rows.at(i);
|
||||||
while (!stream->atEnd()) {
|
while (!stream->atEnd() && !(stream->name() == "effect" && stream->isEndElement())) {
|
||||||
stream->readNext();
|
stream->readNext();
|
||||||
if (stream->name() == "row" && stream->isStartElement()) {
|
if (stream->name() == "row" && stream->isStartElement()) {
|
||||||
for (int j=0;j<row->fieldCount();j++) {
|
for (int j=0;j<row->fieldCount();j++) {
|
||||||
EffectField* field = row->field(j);
|
EffectField* field = row->field(j);
|
||||||
while (!stream->atEnd()) {
|
while (!stream->atEnd() && !(stream->name() == "effect" && stream->isEndElement())) {
|
||||||
stream->readNext();
|
stream->readNext();
|
||||||
if (stream->name() == "field" && stream->isStartElement()) {
|
if (stream->name() == "field" && stream->isStartElement()) {
|
||||||
stream->readNext();
|
stream->readNext();
|
||||||
@@ -103,6 +98,7 @@ void Effect::load(QXmlStreamReader* stream) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effect::save(QXmlStreamWriter* stream) {
|
void Effect::save(QXmlStreamWriter* stream) {
|
||||||
@@ -148,7 +144,7 @@ EffectRow::EffectRow(Effect *parent, QGridLayout *uilayout, const QString &n, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
EffectField* EffectRow::add_field(int type) {
|
EffectField* EffectRow::add_field(int type) {
|
||||||
EffectField* field = new EffectField(parent_effect, type);
|
EffectField* field = new EffectField(type);
|
||||||
fields.append(field);
|
fields.append(field);
|
||||||
QWidget* element = field->get_ui_element();
|
QWidget* element = field->get_ui_element();
|
||||||
ui->addWidget(element, ui_row, fields.size());
|
ui->addWidget(element, ui_row, fields.size());
|
||||||
@@ -171,18 +167,20 @@ int EffectRow::fieldCount() {
|
|||||||
|
|
||||||
/* Effect Field Definitions */
|
/* Effect Field Definitions */
|
||||||
|
|
||||||
EffectField::EffectField(Effect *parent, int t) : type(t) {
|
EffectField::EffectField(int t) : type(t) {
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case EFFECT_FIELD_DOUBLE:
|
case EFFECT_FIELD_DOUBLE:
|
||||||
{
|
{
|
||||||
LabelSlider* ls = new LabelSlider();
|
LabelSlider* ls = new LabelSlider();
|
||||||
ui_element = ls;
|
ui_element = ls;
|
||||||
QObject::connect(ls, SIGNAL(valueChanged()), parent, SLOT(field_changed()));
|
connect(ls, SIGNAL(valueChanged()), this, SIGNAL(changed()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_FIELD_COLOR:
|
case EFFECT_FIELD_COLOR:
|
||||||
{
|
{
|
||||||
ui_element = new ColorButton();
|
ColorButton* cb = new ColorButton();
|
||||||
|
ui_element = cb;
|
||||||
|
connect(cb, SIGNAL(color_changed()), this, SIGNAL(changed()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_FIELD_STRING:
|
case EFFECT_FIELD_STRING:
|
||||||
@@ -190,24 +188,28 @@ EffectField::EffectField(Effect *parent, int t) : type(t) {
|
|||||||
QTextEdit* edit = new QTextEdit();
|
QTextEdit* edit = new QTextEdit();
|
||||||
edit->setUndoRedoEnabled(true);
|
edit->setUndoRedoEnabled(true);
|
||||||
ui_element = edit;
|
ui_element = edit;
|
||||||
|
connect(edit, SIGNAL(textChanged()), this, SIGNAL(changed()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_FIELD_BOOL:
|
case EFFECT_FIELD_BOOL:
|
||||||
{
|
{
|
||||||
QCheckBox* cb = new QCheckBox();
|
CheckboxEx* cb = new CheckboxEx();
|
||||||
ui_element = cb;
|
ui_element = cb;
|
||||||
QObject::connect(cb, SIGNAL(toggled(bool)), parent, SLOT(field_changed()));
|
connect(cb, SIGNAL(toggled(bool)), this, SIGNAL(changed()));
|
||||||
QObject::connect(cb, SIGNAL(clicked(bool)), parent, SLOT(checkbox_command()));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_FIELD_COMBO:
|
case EFFECT_FIELD_COMBO:
|
||||||
{
|
{
|
||||||
ui_element = new ComboBoxEx();
|
ComboBoxEx* cb = new ComboBoxEx();
|
||||||
|
ui_element = cb;
|
||||||
|
connect(cb, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EFFECT_FIELD_FONT:
|
case EFFECT_FIELD_FONT:
|
||||||
{
|
{
|
||||||
ui_element = new FontCombobox();
|
FontCombobox* fcb = new FontCombobox();
|
||||||
|
ui_element = fcb;
|
||||||
|
connect(fcb, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -218,14 +220,7 @@ QWidget* EffectField::get_ui_element() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EffectField::set_enabled(bool e) {
|
void EffectField::set_enabled(bool e) {
|
||||||
switch (type) {
|
ui_element->setEnabled(e);
|
||||||
case EFFECT_FIELD_DOUBLE: static_cast<LabelSlider*>(ui_element)->setEnabled(e); break;
|
|
||||||
case EFFECT_FIELD_COLOR: static_cast<ColorButton*>(ui_element)->setEnabled(e); break;
|
|
||||||
case EFFECT_FIELD_STRING: static_cast<QTextEdit*>(ui_element)->setEnabled(e); break;
|
|
||||||
case EFFECT_FIELD_BOOL: static_cast<QCheckBox*>(ui_element)->setEnabled(e); break;
|
|
||||||
case EFFECT_FIELD_COMBO: static_cast<ComboBoxEx*>(ui_element)->setEnabled(e); break;
|
|
||||||
case EFFECT_FIELD_FONT: static_cast<FontCombobox*>(ui_element)->setEnabled(e); break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double EffectField::get_double_value() {
|
double EffectField::get_double_value() {
|
||||||
@@ -233,7 +228,7 @@ double EffectField::get_double_value() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EffectField::set_double_value(double v) {
|
void EffectField::set_double_value(double v) {
|
||||||
static_cast<LabelSlider*>(ui_element)->set_value(v);
|
static_cast<LabelSlider*>(ui_element)->set_value(v, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectField::set_double_default_value(double v) {
|
void EffectField::set_double_default_value(double v) {
|
||||||
@@ -24,10 +24,19 @@ class Effect;
|
|||||||
#define EFFECT_FIELD_COMBO 4
|
#define EFFECT_FIELD_COMBO 4
|
||||||
#define EFFECT_FIELD_FONT 5
|
#define EFFECT_FIELD_FONT 5
|
||||||
|
|
||||||
class EffectField : QObject {
|
#define EFFECT_KEYFRAME_LINEAR 0
|
||||||
|
#define EFFECT_KEYFRAME_HOLD 1
|
||||||
|
#define EFFECT_KEYFRAME_BEZIER 2
|
||||||
|
|
||||||
|
class EffectKeyframe {
|
||||||
|
public:
|
||||||
|
long frame;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EffectField : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
EffectField(Effect* parent, int t);
|
EffectField(int t);
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
double get_double_value();
|
double get_double_value();
|
||||||
@@ -56,6 +65,8 @@ public:
|
|||||||
|
|
||||||
QWidget* get_ui_element();
|
QWidget* get_ui_element();
|
||||||
void set_enabled(bool e);
|
void set_enabled(bool e);
|
||||||
|
signals:
|
||||||
|
void changed();
|
||||||
private:
|
private:
|
||||||
QWidget* ui_element;
|
QWidget* ui_element;
|
||||||
};
|
};
|
||||||
@@ -106,7 +117,6 @@ public:
|
|||||||
virtual void process_audio(quint8* samples, int nb_bytes);
|
virtual void process_audio(quint8* samples, int nb_bytes);
|
||||||
public slots:
|
public slots:
|
||||||
void field_changed();
|
void field_changed();
|
||||||
void checkbox_command();
|
|
||||||
private:
|
private:
|
||||||
QVector<EffectRow*> rows;
|
QVector<EffectRow*> rows;
|
||||||
QGridLayout* ui_layout;
|
QGridLayout* ui_layout;
|
||||||
+4
-1
@@ -1,7 +1,7 @@
|
|||||||
#ifndef EFFECTS_H
|
#ifndef EFFECTS_H
|
||||||
#define EFFECTS_H
|
#define EFFECTS_H
|
||||||
|
|
||||||
#include "project/effect.h"
|
#include "effect.h"
|
||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
@@ -98,11 +98,14 @@ public:
|
|||||||
~TextEffect();
|
~TextEffect();
|
||||||
void post_gl();
|
void post_gl();
|
||||||
Effect* copy(Clip* c);
|
Effect* copy(Clip* c);
|
||||||
|
void refresh();
|
||||||
|
|
||||||
EffectField* text_val;
|
EffectField* text_val;
|
||||||
EffectField* size_val;
|
EffectField* size_val;
|
||||||
EffectField* set_color_button;
|
EffectField* set_color_button;
|
||||||
EffectField* set_font_combobox;
|
EffectField* set_font_combobox;
|
||||||
|
EffectField* halign_field;
|
||||||
|
EffectField* valign_field;
|
||||||
private slots:
|
private slots:
|
||||||
void update_texture();
|
void update_texture();
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ PanEffect::PanEffect(Clip* c) : Effect(c, EFFECT_TYPE_AUDIO, AUDIO_PAN_EFFECT) {
|
|||||||
|
|
||||||
// set defaults
|
// set defaults
|
||||||
pan_val->set_double_default_value(0);
|
pan_val->set_double_default_value(0);
|
||||||
|
|
||||||
|
connect(pan_val, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanEffect::refresh() {}
|
void PanEffect::refresh() {}
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ ShakeEffect::ShakeEffect(Clip *c) : Effect(c, EFFECT_TYPE_VIDEO, VIDEO_SHAKE_EFF
|
|||||||
frequency_val->set_double_default_value(10);
|
frequency_val->set_double_default_value(10);
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
connect(intensity_val, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(rotation_val, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(frequency_val, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShakeEffect::refresh() {
|
void ShakeEffect::refresh() {
|
||||||
|
|||||||
+52
-29
@@ -38,54 +38,77 @@ TextEffect::TextEffect(Clip *c) :
|
|||||||
EffectRow* color_row = add_row("Color:");
|
EffectRow* color_row = add_row("Color:");
|
||||||
set_color_button = color_row->add_field(EFFECT_FIELD_COLOR);
|
set_color_button = color_row->add_field(EFFECT_FIELD_COLOR);
|
||||||
|
|
||||||
connect(static_cast<QTextEdit*>(text_val->get_ui_element()), SIGNAL(textChanged()), this, SLOT(update_texture()));
|
EffectRow* alignment_row = add_row("Alignment:");
|
||||||
connect(static_cast<LabelSlider*>(size_val->get_ui_element()), SIGNAL(valueChanged()), this, SLOT(update_texture()));
|
halign_field = alignment_row->add_field(EFFECT_FIELD_COMBO);
|
||||||
connect(static_cast<ColorButton*>(set_color_button->get_ui_element()), SIGNAL(color_changed()), this, SLOT(update_texture()));
|
halign_field->add_combo_item("Left", Qt::AlignLeft);
|
||||||
connect(static_cast<FontCombobox*>(set_font_combobox->get_ui_element()), SIGNAL(currentTextChanged(QString)), this, SLOT(update_texture()));
|
halign_field->add_combo_item("Center", Qt::AlignHCenter);
|
||||||
|
halign_field->add_combo_item("Right", Qt::AlignRight);
|
||||||
|
halign_field->add_combo_item("Justify", Qt::AlignJustify);
|
||||||
|
valign_field = alignment_row->add_field(EFFECT_FIELD_COMBO);
|
||||||
|
valign_field->add_combo_item("Top", Qt::AlignTop);
|
||||||
|
valign_field->add_combo_item("Center", Qt::AlignVCenter);
|
||||||
|
valign_field->add_combo_item("Bottom", Qt::AlignBottom);
|
||||||
|
|
||||||
size_val->set_double_default_value(24);
|
size_val->set_double_default_value(48);
|
||||||
text_val->set_string_value("Sample Text");
|
text_val->set_string_value("Sample Text");
|
||||||
|
halign_field->set_combo_index(1);
|
||||||
|
valign_field->set_combo_index(1);
|
||||||
|
|
||||||
|
connect(text_val, SIGNAL(changed()), this, SLOT(update_texture()));
|
||||||
|
connect(size_val, SIGNAL(changed()), this, SLOT(update_texture()));
|
||||||
|
connect(set_color_button, SIGNAL(changed()), this, SLOT(update_texture()));
|
||||||
|
connect(set_font_combobox, SIGNAL(changed()), this, SLOT(update_texture()));
|
||||||
|
connect(halign_field, SIGNAL(changed()), this, SLOT(update_texture()));
|
||||||
|
connect(valign_field, SIGNAL(changed()), this, SLOT(update_texture()));
|
||||||
|
|
||||||
|
update_texture();
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEffect::~TextEffect() {
|
TextEffect::~TextEffect() {
|
||||||
destroy_texture();
|
destroy_texture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextEffect::refresh() {
|
||||||
|
update_texture();
|
||||||
|
}
|
||||||
|
|
||||||
void TextEffect::destroy_texture() {
|
void TextEffect::destroy_texture() {
|
||||||
texture->destroy();
|
texture->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEffect::update_texture() {
|
void TextEffect::update_texture() {
|
||||||
if (parent_clip->sequence->width != width || parent_clip->sequence->height != height) {
|
if (parent_clip->sequence != NULL) {
|
||||||
width = parent_clip->sequence->width;
|
if (parent_clip->sequence->width != width || parent_clip->sequence->height != height) {
|
||||||
height = parent_clip->sequence->height;
|
width = parent_clip->sequence->width;
|
||||||
pixmap = QImage(width, height, QImage::Format_ARGB32_Premultiplied);
|
height = parent_clip->sequence->height;
|
||||||
}
|
pixmap = QImage(width, height, QImage::Format_ARGB32_Premultiplied);
|
||||||
pixmap.fill(Qt::transparent);
|
}
|
||||||
|
pixmap.fill(Qt::transparent);
|
||||||
|
|
||||||
QPainter p(&pixmap);
|
QPainter p(&pixmap);
|
||||||
p.setRenderHint(QPainter::TextAntialiasing, true);
|
p.setRenderHint(QPainter::TextAntialiasing, true);
|
||||||
|
|
||||||
// set font
|
// set font
|
||||||
font.setFamily(set_font_combobox->get_font_name());
|
font.setFamily(set_font_combobox->get_font_name());
|
||||||
font.setPointSize(size_val->get_double_value());
|
font.setPointSize(size_val->get_double_value());
|
||||||
font.setStyleHint(QFont::Helvetica, QFont::PreferAntialias);
|
font.setStyleHint(QFont::Helvetica, QFont::PreferAntialias);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
p.setPen(set_color_button->get_color_value());
|
p.setPen(set_color_button->get_color_value());
|
||||||
p.drawText(QRect(0, 0, width, height), Qt::AlignCenter | Qt::TextWordWrap, text_val->get_string_value());
|
p.drawText(QRect(0, 0, width, height), halign_field->get_combo_data().toInt() | valign_field->get_combo_data().toInt() | Qt::TextWordWrap, text_val->get_string_value());
|
||||||
|
|
||||||
if (texture == NULL) {
|
if (texture == NULL) {
|
||||||
texture = new QOpenGLTexture(pixmap);
|
texture = new QOpenGLTexture(pixmap);
|
||||||
} else {
|
} else {
|
||||||
destroy_texture();
|
destroy_texture();
|
||||||
texture->setData(pixmap);
|
texture->setData(pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
texture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear);
|
texture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear);
|
||||||
|
|
||||||
// queue a repaint of the canvas
|
// queue a repaint of the canvas
|
||||||
field_changed();
|
field_changed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEffect::post_gl() {
|
void TextEffect::post_gl() {
|
||||||
|
|||||||
@@ -64,6 +64,16 @@ TransformEffect::TransformEffect(Clip* c) : Effect(c, EFFECT_TYPE_VIDEO, VIDEO_T
|
|||||||
blend_mode_box->set_combo_index(0);
|
blend_mode_box->set_combo_index(0);
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
connect(position_x, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(position_y, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(scale_x, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(scale_y, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(uniform_scale_field, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(rotation, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(anchor_x_box, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(anchor_y_box, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(opacity, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
|
connect(blend_mode_box, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
connect(uniform_scale_box, SIGNAL(toggled(bool)), this, SLOT(toggle_uniform_scale(bool)));
|
connect(uniform_scale_box, SIGNAL(toggled(bool)), this, SLOT(toggle_uniform_scale(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ VolumeEffect::VolumeEffect(Clip* c) : Effect(c, EFFECT_TYPE_AUDIO, AUDIO_VOLUME_
|
|||||||
|
|
||||||
// set defaults
|
// set defaults
|
||||||
volume_val->set_double_default_value(100);
|
volume_val->set_double_default_value(100);
|
||||||
|
|
||||||
|
connect(volume_val, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VolumeEffect::refresh() {}
|
void VolumeEffect::refresh() {}
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ SOURCES += \
|
|||||||
panels/panels.cpp \
|
panels/panels.cpp \
|
||||||
effects/volumeeffect.cpp \
|
effects/volumeeffect.cpp \
|
||||||
effects/paneffect.cpp \
|
effects/paneffect.cpp \
|
||||||
project/effect.cpp \
|
|
||||||
effects/effects.cpp \
|
effects/effects.cpp \
|
||||||
playback/cacher.cpp \
|
playback/cacher.cpp \
|
||||||
io/exportthread.cpp \
|
io/exportthread.cpp \
|
||||||
@@ -69,7 +68,9 @@ SOURCES += \
|
|||||||
dialogs/replaceclipmediadialog.cpp \
|
dialogs/replaceclipmediadialog.cpp \
|
||||||
effects/inverteffect.cpp \
|
effects/inverteffect.cpp \
|
||||||
effects/linearfadetransition.cpp \
|
effects/linearfadetransition.cpp \
|
||||||
ui/fontcombobox.cpp
|
ui/fontcombobox.cpp \
|
||||||
|
ui/checkboxex.cpp \
|
||||||
|
effects/effect.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
@@ -92,7 +93,6 @@ HEADERS += \
|
|||||||
ui/viewercontainer.h \
|
ui/viewercontainer.h \
|
||||||
dialogs/exportdialog.h \
|
dialogs/exportdialog.h \
|
||||||
ui/collapsiblewidget.h \
|
ui/collapsiblewidget.h \
|
||||||
project/effect.h \
|
|
||||||
panels/panels.h \
|
panels/panels.h \
|
||||||
playback/cacher.h \
|
playback/cacher.h \
|
||||||
io/exportthread.h \
|
io/exportthread.h \
|
||||||
@@ -108,7 +108,9 @@ HEADERS += \
|
|||||||
ui/comboboxex.h \
|
ui/comboboxex.h \
|
||||||
ui/colorbutton.h \
|
ui/colorbutton.h \
|
||||||
dialogs/replaceclipmediadialog.h \
|
dialogs/replaceclipmediadialog.h \
|
||||||
ui/fontcombobox.h
|
ui/fontcombobox.h \
|
||||||
|
ui/checkboxex.h \
|
||||||
|
effects/effect.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui \
|
mainwindow.ui \
|
||||||
|
|||||||
@@ -9,12 +9,14 @@
|
|||||||
#include "effects/effects.h"
|
#include "effects/effects.h"
|
||||||
#include "effects/transition.h"
|
#include "effects/transition.h"
|
||||||
#include "project/clip.h"
|
#include "project/clip.h"
|
||||||
#include "project/effect.h"
|
#include "effects/effect.h"
|
||||||
#include "ui/collapsiblewidget.h"
|
#include "ui/collapsiblewidget.h"
|
||||||
#include "project/sequence.h"
|
#include "project/sequence.h"
|
||||||
#include "project/undo.h"
|
#include "project/undo.h"
|
||||||
#include "panels/project.h"
|
#include "panels/project.h"
|
||||||
#include "panels/timeline.h"
|
#include "panels/timeline.h"
|
||||||
|
#include "panels/viewer.h"
|
||||||
|
#include "ui/viewerwidget.h"
|
||||||
|
|
||||||
EffectControls::EffectControls(QWidget *parent) :
|
EffectControls::EffectControls(QWidget *parent) :
|
||||||
QDockWidget(parent),
|
QDockWidget(parent),
|
||||||
@@ -173,6 +175,7 @@ void EffectControls::delete_effects() {
|
|||||||
}
|
}
|
||||||
if (command->clips.size() > 0) {
|
if (command->clips.size() > 0) {
|
||||||
undo_stack.push(command);
|
undo_stack.push(command);
|
||||||
|
panel_viewer->viewer_widget->update();
|
||||||
} else {
|
} else {
|
||||||
delete command;
|
delete command;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
#include "effects/effects.h"
|
#include "effects/effects.h"
|
||||||
#include "panels/timeline.h"
|
#include "panels/timeline.h"
|
||||||
#include "project/sequence.h"
|
#include "project/sequence.h"
|
||||||
#include "project/effect.h"
|
#include "effects/effect.h"
|
||||||
#include "effects/transition.h"
|
#include "effects/transition.h"
|
||||||
#include "io/previewgenerator.h"
|
#include "io/previewgenerator.h"
|
||||||
#include "project/undo.h"
|
#include "project/undo.h"
|
||||||
|
|||||||
+1
-1
@@ -96,7 +96,7 @@ void AudioSenderThread::run() {
|
|||||||
|
|
||||||
lock.lock();
|
lock.lock();
|
||||||
while (true) {
|
while (true) {
|
||||||
msleep(20);
|
msleep(15);
|
||||||
if (close) {
|
if (close) {
|
||||||
break;
|
break;
|
||||||
} else if (panel_timeline->playing) {
|
} else if (panel_timeline->playing) {
|
||||||
|
|||||||
+2
-2
@@ -789,14 +789,14 @@ void MediaRename::redo() {
|
|||||||
ValueChangeCommand::ValueChangeCommand() : done(true), old_project_changed(project_changed) {}
|
ValueChangeCommand::ValueChangeCommand() : done(true), old_project_changed(project_changed) {}
|
||||||
|
|
||||||
void ValueChangeCommand::undo() {
|
void ValueChangeCommand::undo() {
|
||||||
source->set_value(old_val);
|
source->set_value(old_val, false);
|
||||||
done = false;
|
done = false;
|
||||||
project_changed = old_project_changed;
|
project_changed = old_project_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ValueChangeCommand::redo() {
|
void ValueChangeCommand::redo() {
|
||||||
if (!done) {
|
if (!done) {
|
||||||
source->set_value(new_val);
|
source->set_value(new_val, false);
|
||||||
}
|
}
|
||||||
project_changed = true;
|
project_changed = true;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-11
@@ -37,14 +37,13 @@ void AudioMonitor::resizeEvent(QResizeEvent *e) {
|
|||||||
|
|
||||||
void AudioMonitor::paintEvent(QPaintEvent *) {
|
void AudioMonitor::paintEvent(QPaintEvent *) {
|
||||||
if (sequence != NULL) {
|
if (sequence != NULL) {
|
||||||
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
int channel_x = AUDIO_MONITOR_GAP;
|
int channel_x = AUDIO_MONITOR_GAP;
|
||||||
int channel_count = av_get_channel_layout_nb_channels(sequence->audio_layout);
|
int channel_count = av_get_channel_layout_nb_channels(sequence->audio_layout);
|
||||||
if (peaks.size() != channel_count) {
|
/*if (peaks.size() != channel_count) {
|
||||||
peaks.resize(channel_count);
|
peaks.resize(channel_count);
|
||||||
peaks.fill(false);
|
peaks.fill(false);
|
||||||
}
|
}*/
|
||||||
int channel_width = (width()/channel_count) - AUDIO_MONITOR_GAP;
|
int channel_width = (width()/channel_count) - AUDIO_MONITOR_GAP;
|
||||||
long playhead_offset = -1;
|
long playhead_offset = -1;
|
||||||
int i;
|
int i;
|
||||||
@@ -52,25 +51,25 @@ void AudioMonitor::paintEvent(QPaintEvent *) {
|
|||||||
QRect r(channel_x, AUDIO_MONITOR_PEAK_HEIGHT + AUDIO_MONITOR_GAP, channel_width, height());
|
QRect r(channel_x, AUDIO_MONITOR_PEAK_HEIGHT + AUDIO_MONITOR_GAP, channel_width, height());
|
||||||
p.fillRect(r, gradient);
|
p.fillRect(r, gradient);
|
||||||
|
|
||||||
if (sample_cache_offset != -1) {
|
if (sample_cache_offset != -1 && sample_cache.size() > 0) {
|
||||||
playhead_offset = (panel_timeline->playhead - sample_cache_offset) * channel_count;
|
playhead_offset = (panel_timeline->playhead - sample_cache_offset) * channel_count;
|
||||||
if (playhead_offset >= 0 && playhead_offset < sample_cache.size()) {
|
if (playhead_offset >= 0 && playhead_offset < sample_cache.size()) {
|
||||||
double multiplier = 1 - qAbs((double) sample_cache.at(playhead_offset+i) / 32768.0); // 16-bit int divided to float
|
double multiplier = 1 - qAbs((double) sample_cache.at(playhead_offset+i) / 32768.0); // 16-bit int divided to float
|
||||||
if (multiplier == (double) 0) {
|
/*if (multiplier == (double) 0) {
|
||||||
peaks[i] = true;
|
peaks[i] = true;
|
||||||
}
|
}*/
|
||||||
r.setHeight(r.height()*multiplier);
|
r.setHeight(r.height()*multiplier);
|
||||||
} else {
|
} else {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect peak_rect(channel_x, 0, channel_width, AUDIO_MONITOR_PEAK_HEIGHT);
|
/*QRect peak_rect(channel_x, 0, channel_width, AUDIO_MONITOR_PEAK_HEIGHT);
|
||||||
if (peaks.at(i)) {
|
if (peaks.at(i)) {
|
||||||
p.fillRect(peak_rect, QColor(255, 0, 0));
|
p.fillRect(peak_rect, QColor(255, 0, 0));
|
||||||
} else {
|
} else {
|
||||||
p.fillRect(peak_rect, QColor(64, 0, 0));
|
p.fillRect(peak_rect, QColor(64, 0, 0));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
p.fillRect(r, QColor(0, 0, 0, 160));
|
p.fillRect(r, QColor(0, 0, 0, 160));
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QLinearGradient gradient;
|
QLinearGradient gradient;
|
||||||
QVector<bool> peaks;
|
// QVector<bool> peaks;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AUDIOMONITOR_H
|
#endif // AUDIOMONITOR_H
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#include "checkboxex.h"
|
||||||
|
|
||||||
|
#include "project/undo.h"
|
||||||
|
|
||||||
|
CheckboxEx::CheckboxEx(QWidget* parent) : QCheckBox(parent) {
|
||||||
|
connect(this, SIGNAL(clicked(bool)), this, SLOT(checkbox_command()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckboxEx::checkbox_command() {
|
||||||
|
CheckboxCommand* c = new CheckboxCommand(this);
|
||||||
|
undo_stack.push(c);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef CHECKBOXEX_H
|
||||||
|
#define CHECKBOXEX_H
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
|
||||||
|
class CheckboxEx : public QCheckBox
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CheckboxEx(QWidget* parent = 0);
|
||||||
|
private slots:
|
||||||
|
void checkbox_command();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CHECKBOXEX_H
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "collapsiblewidget.h"
|
#include "collapsiblewidget.h"
|
||||||
|
|
||||||
|
#include "ui/checkboxex.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
@@ -24,7 +25,7 @@ CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
|||||||
QHBoxLayout* title_bar_layout = new QHBoxLayout();
|
QHBoxLayout* title_bar_layout = new QHBoxLayout();
|
||||||
title_bar_layout->setMargin(5);
|
title_bar_layout->setMargin(5);
|
||||||
title_bar->setLayout(title_bar_layout);
|
title_bar->setLayout(title_bar_layout);
|
||||||
enabled_check = new QCheckBox();
|
enabled_check = new CheckboxEx();
|
||||||
enabled_check->setChecked(true);
|
enabled_check->setChecked(true);
|
||||||
header = new QLabel();
|
header = new QLabel();
|
||||||
collapse_button = new QPushButton("[-]");
|
collapse_button = new QPushButton("[-]");
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class QHBoxLayout;
|
|||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QFrame;
|
class QFrame;
|
||||||
|
class CheckboxEx;
|
||||||
|
|
||||||
class CollapsibleWidgetHeader : public QWidget {
|
class CollapsibleWidgetHeader : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -30,7 +31,7 @@ public:
|
|||||||
void setText(const QString &);
|
void setText(const QString &);
|
||||||
bool is_focused();
|
bool is_focused();
|
||||||
|
|
||||||
QCheckBox* enabled_check;
|
CheckboxEx* enabled_check;
|
||||||
bool selected;
|
bool selected;
|
||||||
private:
|
private:
|
||||||
QLabel* header;
|
QLabel* header;
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,6 @@ void ColorButton::set_button_color() {
|
|||||||
QPalette pal = palette();
|
QPalette pal = palette();
|
||||||
pal.setColor(QPalette::Button, color);
|
pal.setColor(QPalette::Button, color);
|
||||||
setPalette(pal);
|
setPalette(pal);
|
||||||
emit color_changed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorButton::open_dialog() {
|
void ColorButton::open_dialog() {
|
||||||
@@ -34,6 +33,8 @@ void ColorButton::open_dialog() {
|
|||||||
undo_stack.push(command);
|
undo_stack.push(command);
|
||||||
|
|
||||||
set_button_color();
|
set_button_color();
|
||||||
|
|
||||||
|
emit color_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -14,11 +14,11 @@ LabelSlider::LabelSlider(QWidget* parent) : QLabel(parent) {
|
|||||||
setCursor(Qt::SizeHorCursor);
|
setCursor(Qt::SizeHorCursor);
|
||||||
internal_value = -1;
|
internal_value = -1;
|
||||||
set_default_value(0);
|
set_default_value(0);
|
||||||
set_value(0);
|
set_value(0, false);
|
||||||
set = false;
|
set = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabelSlider::set_value(double v) {
|
void LabelSlider::set_value(double v, bool userSet) {
|
||||||
set = true;
|
set = true;
|
||||||
if (v != internal_value) {
|
if (v != internal_value) {
|
||||||
if (min_enabled && v < min_value) {
|
if (min_enabled && v < min_value) {
|
||||||
@@ -30,7 +30,7 @@ void LabelSlider::set_value(double v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setText(QString::number(internal_value));
|
setText(QString::number(internal_value));
|
||||||
emit valueChanged();
|
if (userSet) emit valueChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ double LabelSlider::value() {
|
|||||||
void LabelSlider::set_default_value(double v) {
|
void LabelSlider::set_default_value(double v) {
|
||||||
default_value = v;
|
default_value = v;
|
||||||
if (!set) {
|
if (!set) {
|
||||||
set_value(v);
|
set_value(v, false);
|
||||||
set = false;
|
set = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ void LabelSlider::mousePressEvent(QMouseEvent *ev) {
|
|||||||
vcc->new_val = default_value;
|
vcc->new_val = default_value;
|
||||||
undo_stack.push(vcc);
|
undo_stack.push(vcc);
|
||||||
|
|
||||||
set_value(default_value);
|
set_value(default_value, true);
|
||||||
} else {
|
} else {
|
||||||
qApp->setOverrideCursor(Qt::BlankCursor);
|
qApp->setOverrideCursor(Qt::BlankCursor);
|
||||||
drag_start_value = internal_value;
|
drag_start_value = internal_value;
|
||||||
@@ -80,7 +80,7 @@ void LabelSlider::mousePressEvent(QMouseEvent *ev) {
|
|||||||
|
|
||||||
void LabelSlider::mouseMoveEvent(QMouseEvent*) {
|
void LabelSlider::mouseMoveEvent(QMouseEvent*) {
|
||||||
if (drag_start) {
|
if (drag_start) {
|
||||||
set_value(internal_value + (cursor().pos().x()-drag_start_x) + (drag_start_y-cursor().pos().y()));
|
set_value(internal_value + (cursor().pos().x()-drag_start_x) + (drag_start_y-cursor().pos().y()), true);
|
||||||
cursor().setPos(drag_start_x, drag_start_y);
|
cursor().setPos(drag_start_x, drag_start_y);
|
||||||
drag_proc = true;
|
drag_proc = true;
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
|||||||
vcc->source = this;
|
vcc->source = this;
|
||||||
vcc->old_val = internal_value;
|
vcc->old_val = internal_value;
|
||||||
|
|
||||||
set_value(d);
|
set_value(d, true);
|
||||||
|
|
||||||
vcc->new_val = internal_value;
|
vcc->new_val = internal_value;
|
||||||
undo_stack.push(vcc);
|
undo_stack.push(vcc);
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class LabelSlider : public QLabel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LabelSlider(QWidget* parent = 0);
|
LabelSlider(QWidget* parent = 0);
|
||||||
void set_value(double v);
|
void set_value(double v, bool userSet);
|
||||||
void set_default_value(double v);
|
void set_default_value(double v);
|
||||||
void set_minimum_value(double v);
|
void set_minimum_value(double v);
|
||||||
void set_maximum_value(double v);
|
void set_maximum_value(double v);
|
||||||
|
|||||||
Reference in New Issue
Block a user