reimplemented UINumeric

This commit is contained in:
itsmattkc
2018-06-20 16:08:33 -07:00
parent 6c0bf62f51
commit 22033d74df
12 changed files with 307 additions and 189 deletions
+11 -10
View File
@@ -6,6 +6,7 @@
#include <QXmlStreamWriter>
class QSpinBox;
class QCheckBox;
class LabelSlider;
enum VideoEffects {
VIDEO_TRANSFORM_EFFECT,
@@ -31,15 +32,15 @@ public:
void process_gl(int* anchor_x, int* anchor_y);
Effect* copy(Clip* c);
QSpinBox* position_x;
QSpinBox* position_y;
QSpinBox* scale_x;
QSpinBox* scale_y;
LabelSlider* position_x;
LabelSlider* position_y;
LabelSlider* scale_x;
LabelSlider* scale_y;
QCheckBox* uniform_scale_box;
QSpinBox* rotation;
QSpinBox* anchor_x_box;
QSpinBox* anchor_y_box;
QSpinBox* opacity;
LabelSlider* rotation;
LabelSlider* anchor_x_box;
LabelSlider* anchor_y_box;
LabelSlider* opacity;
public slots:
void toggle_uniform_scale(bool enabled);
private:
@@ -56,7 +57,7 @@ public:
void load(QXmlStreamReader* stream);
void save(QXmlStreamWriter* stream);
QSpinBox* volume_val;
LabelSlider* volume_val;
};
class PanEffect : public Effect {
@@ -67,7 +68,7 @@ public:
void load(QXmlStreamReader* stream);
void save(QXmlStreamWriter* stream);
QSpinBox* pan_val;
LabelSlider* pan_val;
};
#endif // EFFECTS_H
+7 -7
View File
@@ -1,10 +1,10 @@
#include "effects/effects.h"
#include <QGridLayout>
#include <QSpinBox>
#include <QLabel>
#include <cmath>
#include "ui/labelslider.h"
#include "ui/collapsiblewidget.h"
PanEffect::PanEffect(Clip* c) : Effect(c) {
@@ -13,9 +13,9 @@ PanEffect::PanEffect(Clip* c) : Effect(c) {
QGridLayout* ui_layout = new QGridLayout();
ui_layout->addWidget(new QLabel("Pan:"), 0, 0);
pan_val = new QSpinBox();
pan_val->setMinimum(-100);
pan_val->setMaximum(100);
pan_val = new LabelSlider();
pan_val->set_minimum_value(-100);
pan_val->set_maximum_value(100);
ui_layout->addWidget(pan_val, 0, 1);
ui->setLayout(ui_layout);
@@ -23,12 +23,12 @@ PanEffect::PanEffect(Clip* c) : Effect(c) {
container->setContents(ui);
// set defaults
pan_val->setValue(0);
pan_val->set_value(0);
}
Effect* PanEffect::copy(Clip* c) {
PanEffect* p = new PanEffect(c);
p->pan_val->setValue(pan_val->value());
p->pan_val->set_value(pan_val->value());
return p;
}
@@ -37,7 +37,7 @@ void PanEffect::load(QXmlStreamReader *stream) {
stream->readNext();
if (stream->isStartElement() && stream->name() == "pan") {
stream->readNext();
pan_val->setValue(stream->text().toInt());
pan_val->set_value(stream->text().toInt());
}
}
}
+40 -48
View File
@@ -12,6 +12,7 @@
#include "project/clip.h"
#include "project/sequence.h"
#include "io/media.h"
#include "ui/labelslider.h"
TransformEffect::TransformEffect(Clip* c) : Effect(c) {
setup_effect(EFFECT_TYPE_VIDEO, VIDEO_TRANSFORM_EFFECT);
@@ -19,23 +20,20 @@ TransformEffect::TransformEffect(Clip* c) : Effect(c) {
QGridLayout* ui_layout = new QGridLayout();
ui_layout->addWidget(new QLabel("Position:"), 0, 0);
position_x = new QSpinBox();
position_x->setMinimum(-QWIDGETSIZE_MAX);
position_x->setMaximum(QWIDGETSIZE_MAX);
ui_layout->addWidget(position_x, 0, 1);
position_y = new QSpinBox();
position_y->setMinimum(-QWIDGETSIZE_MAX);
position_y->setMaximum(QWIDGETSIZE_MAX);
position_x = new LabelSlider();
ui_layout->addWidget(position_x, 0, 1);
position_y = new LabelSlider();
ui_layout->addWidget(position_y, 0, 2);
ui_layout->addWidget(new QLabel("Scale:"), 1, 0);
scale_x = new QSpinBox();
scale_x->setMinimum(0);
scale_x->setMaximum(1200);
scale_x = new LabelSlider();
scale_x->set_minimum_value(0);
scale_x->set_maximum_value(1200);
ui_layout->addWidget(scale_x, 1, 1);
scale_y = new QSpinBox();
scale_y->setMinimum(0);
scale_y->setMaximum(1200);
scale_y = new LabelSlider();
scale_y->set_minimum_value(0);
scale_y->set_maximum_value(1200);
ui_layout->addWidget(scale_y, 1, 2);
uniform_scale_box = new QCheckBox();
@@ -43,25 +41,19 @@ TransformEffect::TransformEffect(Clip* c) : Effect(c) {
ui_layout->addWidget(uniform_scale_box, 2, 1);
ui_layout->addWidget(new QLabel("Rotation:"), 3, 0);
rotation = new QSpinBox();
rotation->setMinimum(-QWIDGETSIZE_MAX);
rotation->setMaximum(QWIDGETSIZE_MAX);
rotation = new LabelSlider();
ui_layout->addWidget(rotation, 3, 1);
ui_layout->addWidget(new QLabel("Anchor Point:"), 4, 0);
anchor_x_box = new QSpinBox();
anchor_x_box->setMinimum(-QWIDGETSIZE_MAX);
anchor_x_box->setMaximum(QWIDGETSIZE_MAX);
anchor_x_box = new LabelSlider();
ui_layout->addWidget(anchor_x_box, 4, 1);
anchor_y_box = new QSpinBox();
anchor_y_box->setMinimum(-QWIDGETSIZE_MAX);
anchor_y_box->setMaximum(QWIDGETSIZE_MAX);
anchor_y_box = new LabelSlider();
ui_layout->addWidget(anchor_y_box, 4, 2);
ui_layout->addWidget(new QLabel("Opacity:"), 5, 0);
opacity = new QSpinBox();
opacity->setMinimum(0);
opacity->setMaximum(100);
opacity = new LabelSlider();
opacity->set_minimum_value(0);
opacity->set_maximum_value(100);
ui_layout->addWidget(opacity, 5, 1);
ui->setLayout(ui_layout);
@@ -69,41 +61,41 @@ TransformEffect::TransformEffect(Clip* c) : Effect(c) {
container->setContents(ui);
// set defaults
position_x->setValue(c->sequence->width/2);
position_y->setValue(c->sequence->height/2);
scale_x->setValue(100);
scale_y->setValue(100);
position_x->set_default_value(c->sequence->width/2);
position_y->set_default_value(c->sequence->height/2);
scale_x->set_default_value(100);
scale_y->set_default_value(100);
scale_y->setEnabled(false);
uniform_scale_box->setChecked(true);
default_anchor_x = c->media_stream->video_width/2;
default_anchor_y = c->media_stream->video_height/2;
anchor_x_box->setValue(default_anchor_x);
anchor_y_box->setValue(default_anchor_y);
opacity->setValue(100);
anchor_x_box->set_default_value(default_anchor_x);
anchor_y_box->set_default_value(default_anchor_y);
opacity->set_default_value(100);
connect(position_x, SIGNAL(valueChanged(int)), this, SLOT(field_changed()));
connect(position_y, SIGNAL(valueChanged(int)), this, SLOT(field_changed()));
connect(rotation, SIGNAL(valueChanged(int)), this, SLOT(field_changed()));
connect(scale_x, SIGNAL(valueChanged(int)), this, SLOT(field_changed()));
connect(scale_y, SIGNAL(valueChanged(int)), this, SLOT(field_changed()));
connect(anchor_x_box, SIGNAL(valueChanged(int)), this, SLOT(field_changed()));
connect(anchor_y_box, SIGNAL(valueChanged(int)), this, SLOT(field_changed()));
connect(opacity, SIGNAL(valueChanged(int)), this, SLOT(field_changed()));
connect(position_x, SIGNAL(valueChanged()), this, SLOT(field_changed()));
connect(position_y, SIGNAL(valueChanged()), this, SLOT(field_changed()));
connect(rotation, SIGNAL(valueChanged()), this, SLOT(field_changed()));
connect(scale_x, SIGNAL(valueChanged()), this, SLOT(field_changed()));
connect(scale_y, SIGNAL(valueChanged()), this, SLOT(field_changed()));
connect(anchor_x_box, SIGNAL(valueChanged()), this, SLOT(field_changed()));
connect(anchor_y_box, SIGNAL(valueChanged()), this, SLOT(field_changed()));
connect(opacity, SIGNAL(valueChanged()), 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(field_changed()));
}
Effect* TransformEffect::copy(Clip* c) {
TransformEffect* t = new TransformEffect(c);
t->position_x->setValue(position_x->value());
t->position_y->setValue(position_y->value());
t->scale_x->setValue(scale_x->value());
t->scale_y->setValue(scale_y->value());
t->position_x->set_value(position_x->value());
t->position_y->set_value(position_y->value());
t->scale_x->set_value(scale_x->value());
t->scale_y->set_value(scale_y->value());
t->uniform_scale_box->setChecked(uniform_scale_box->isChecked());
t->rotation->setValue(rotation->value());
t->anchor_x_box->setValue(anchor_x_box->value());
t->anchor_y_box->setValue(anchor_y_box->value());
t->opacity->setValue(opacity->value());
t->rotation->set_value(rotation->value());
t->anchor_x_box->set_value(anchor_x_box->value());
t->anchor_y_box->set_value(anchor_y_box->value());
t->opacity->set_value(opacity->value());
return t;
}
+7 -7
View File
@@ -1,10 +1,10 @@
#include "effects/effects.h"
#include <QGridLayout>
#include <QSpinBox>
#include <QLabel>
#include <QDebug>
#include "ui/labelslider.h"
#include "ui/collapsiblewidget.h"
VolumeEffect::VolumeEffect(Clip* c) : Effect(c) {
@@ -13,9 +13,9 @@ VolumeEffect::VolumeEffect(Clip* c) : Effect(c) {
QGridLayout* ui_layout = new QGridLayout();
ui_layout->addWidget(new QLabel("Volume:"), 0, 0);
volume_val = new QSpinBox();
volume_val->setMinimum(0);
volume_val->setMaximum(400);
volume_val = new LabelSlider();
volume_val->set_minimum_value(0);
volume_val->set_maximum_value(400);
ui_layout->addWidget(volume_val, 0, 1);
ui->setLayout(ui_layout);
@@ -23,12 +23,12 @@ VolumeEffect::VolumeEffect(Clip* c) : Effect(c) {
container->setContents(ui);
// set defaults
volume_val->setValue(100);
volume_val->set_value(100);
}
Effect* VolumeEffect::copy(Clip* c) {
VolumeEffect* v = new VolumeEffect(c);
v->volume_val->setValue(volume_val->value());
v->volume_val->set_value(volume_val->value());
return v;
}
@@ -37,7 +37,7 @@ void VolumeEffect::load(QXmlStreamReader* stream) {
stream->readNext();
if (stream->isStartElement() && stream->name() == "volume") {
stream->readNext();
volume_val->setValue(stream->text().toInt());
volume_val->set_value(stream->text().toInt());
}
}
}