started frontend for effect keyframes

This commit is contained in:
itsmattkc
2018-08-18 20:35:19 +10:00
parent 2dde8bde77
commit 2b3d9636db
44 changed files with 1541 additions and 1203 deletions
+64 -14
View File
@@ -4,7 +4,6 @@
#include "panels/viewer.h"
#include "ui/viewerwidget.h"
#include "ui/collapsiblewidget.h"
#include "effects/effects.h"
#include "panels/project.h"
#include "project/undo.h"
#include "ui/labelslider.h"
@@ -12,19 +11,65 @@
#include "ui/comboboxex.h"
#include "ui/fontcombobox.h"
#include "ui/checkboxex.h"
#include "project/clip.h"
#include "effects/video/transformeffect.h"
#include "effects/video/inverteffect.h"
#include "effects/video/shakeeffect.h"
#include "effects/video/solideffect.h"
#include "effects/video/texteffect.h"
#include "effects/audio/paneffect.h"
#include "effects/audio/volumeeffect.h"
#include <QCheckBox>
#include <QGridLayout>
#include <QTextEdit>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
QVector<QString> video_effect_names;
QVector<QString> audio_effect_names;
void init_effects() {
video_effect_names.resize(VIDEO_EFFECT_COUNT);
audio_effect_names.resize(AUDIO_EFFECT_COUNT);
video_effect_names[VIDEO_TRANSFORM_EFFECT] = "Transform";
video_effect_names[VIDEO_SHAKE_EFFECT] = "Shake";
video_effect_names[VIDEO_TEXT_EFFECT] = "Text";
video_effect_names[VIDEO_SOLID_EFFECT] = "Solid";
video_effect_names[VIDEO_INVERT_EFFECT] = "Invert";
audio_effect_names[AUDIO_VOLUME_EFFECT] = "Volume";
audio_effect_names[AUDIO_PAN_EFFECT] = "Pan";
}
Effect* create_effect(int effect_id, Clip* c) {
if (c->track < 0) {
switch (effect_id) {
case VIDEO_TRANSFORM_EFFECT: return new TransformEffect(c); break;
case VIDEO_SHAKE_EFFECT: return new ShakeEffect(c); break;
case VIDEO_TEXT_EFFECT: return new TextEffect(c); break;
case VIDEO_SOLID_EFFECT: return new SolidEffect(c); break;
case VIDEO_INVERT_EFFECT: return new InvertEffect(c); break;
}
} else {
switch (effect_id) {
case AUDIO_VOLUME_EFFECT: return new VolumeEffect(c); break;
case AUDIO_PAN_EFFECT: return new PanEffect(c); break;
}
}
qDebug() << "[ERROR] Invalid effect ID";
return NULL;
}
Effect::Effect(Clip* c, int t, int i) :
parent_clip(c),
type(t),
id(i),
enable_ffmpeg(false),
enable_qimage(false),
enable_pre_gl(false),
enable_post_gl(false)
enable_image(false),
enable_opengl(false)
{
container = new CollapsibleWidget();
@@ -57,6 +102,10 @@ EffectRow* Effect::row(int i) {
return rows.at(i);
}
int Effect::row_count() {
return rows.size();
}
void Effect::refresh() {}
void Effect::field_changed() {
@@ -142,14 +191,15 @@ void Effect::save(QXmlStreamWriter* stream) {
}
Effect* Effect::copy(Clip*) {return NULL;}
void Effect::process_gl(int*, int*) {}
void Effect::post_gl() {}
void Effect::process_image(QImage&) {}
void Effect::process_gl(QOpenGLShaderProgram&, int*, int*) {}
void Effect::process_audio(uint8_t*, int) {}
/* Effect Row Definitions */
EffectRow::EffectRow(Effect *parent, QGridLayout *uilayout, const QString &n, int row) : parent_effect(parent), ui(uilayout), name(n), ui_row(row) {
ui->addWidget(new QLabel(name), row, 0);
label = new QLabel(name);
ui->addWidget(label, row, 0);
/*keyframe_enable = new CheckboxEx();
keyframe_enable->setToolTip("Enable Keyframes");
@@ -258,27 +308,27 @@ void EffectField::set_double_maximum_value(double v) {
}
void EffectField::add_combo_item(const QString& name, const QVariant& data) {
static_cast<QComboBox*>(ui_element)->addItem(name, data);
static_cast<ComboBoxEx*>(ui_element)->addItem(name, data);
}
int EffectField::get_combo_index() {
return static_cast<QComboBox*>(ui_element)->currentIndex();
return static_cast<ComboBoxEx*>(ui_element)->currentIndex();
}
const QVariant EffectField::get_combo_data() {
return static_cast<QComboBox*>(ui_element)->currentData();
return static_cast<ComboBoxEx*>(ui_element)->currentData();
}
const QString EffectField::get_combo_string() {
return static_cast<QComboBox*>(ui_element)->currentText();
return static_cast<ComboBoxEx*>(ui_element)->currentText();
}
void EffectField::set_combo_index(int index) {
static_cast<QComboBox*>(ui_element)->setCurrentIndex(index);
static_cast<ComboBoxEx*>(ui_element)->setCurrentIndexEx(index);
}
void EffectField::set_combo_string(const QString& s) {
static_cast<QComboBox*>(ui_element)->setCurrentText(s);
static_cast<ComboBoxEx*>(ui_element)->setCurrentTextEx(s);
}
bool EffectField::get_bool_value() {