reimplemented dragging all field types
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
#include "oliveglobal.h"
|
||||
#include "global/global.h"
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
|
||||
+87
-87
@@ -25,123 +25,123 @@
|
||||
#include <QMenuBar>
|
||||
#include <QLabel>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
ActionSearch::ActionSearch(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
QDialog(parent)
|
||||
{
|
||||
setObjectName("ASDiag");
|
||||
setStyleSheet("#ASDiag{border: 2px solid #808080;}");
|
||||
setObjectName("ASDiag");
|
||||
setStyleSheet("#ASDiag{border: 2px solid #808080;}");
|
||||
|
||||
resize(parent->width()/3, parent->height()/3);
|
||||
resize(parent->width()/3, parent->height()/3);
|
||||
|
||||
setWindowFlags(Qt::Popup);
|
||||
setWindowFlags(Qt::Popup);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
ActionSearchEntry* entry_field = new ActionSearchEntry(this);
|
||||
QFont entry_field_font = entry_field->font();
|
||||
entry_field_font.setPointSize(qRound(entry_field_font.pointSize()*1.2));
|
||||
entry_field->setFont(entry_field_font);
|
||||
entry_field->setPlaceholderText(tr("Search for action..."));
|
||||
connect(entry_field, SIGNAL(textChanged(const QString&)), this, SLOT(search_update(const QString &)));
|
||||
connect(entry_field, SIGNAL(returnPressed()), this, SLOT(perform_action()));
|
||||
connect(entry_field, SIGNAL(moveSelectionUp()), this, SLOT(move_selection_up()));
|
||||
connect(entry_field, SIGNAL(moveSelectionDown()), this, SLOT(move_selection_down()));
|
||||
layout->addWidget(entry_field);
|
||||
ActionSearchEntry* entry_field = new ActionSearchEntry(this);
|
||||
QFont entry_field_font = entry_field->font();
|
||||
entry_field_font.setPointSize(qRound(entry_field_font.pointSize()*1.2));
|
||||
entry_field->setFont(entry_field_font);
|
||||
entry_field->setPlaceholderText(tr("Search for action..."));
|
||||
connect(entry_field, SIGNAL(textChanged(const QString&)), this, SLOT(search_update(const QString &)));
|
||||
connect(entry_field, SIGNAL(returnPressed()), this, SLOT(perform_action()));
|
||||
connect(entry_field, SIGNAL(moveSelectionUp()), this, SLOT(move_selection_up()));
|
||||
connect(entry_field, SIGNAL(moveSelectionDown()), this, SLOT(move_selection_down()));
|
||||
layout->addWidget(entry_field);
|
||||
|
||||
list_widget = new ActionSearchList(this);
|
||||
QFont list_widget_font = list_widget->font();
|
||||
list_widget_font.setPointSize(qRound(list_widget_font.pointSize()*1.2));
|
||||
list_widget->setFont(list_widget_font);
|
||||
layout->addWidget(list_widget);
|
||||
connect(list_widget, SIGNAL(dbl_click()), this, SLOT(perform_action()));
|
||||
list_widget = new ActionSearchList(this);
|
||||
QFont list_widget_font = list_widget->font();
|
||||
list_widget_font.setPointSize(qRound(list_widget_font.pointSize()*1.2));
|
||||
list_widget->setFont(list_widget_font);
|
||||
layout->addWidget(list_widget);
|
||||
connect(list_widget, SIGNAL(dbl_click()), this, SLOT(perform_action()));
|
||||
|
||||
entry_field->setFocus();
|
||||
entry_field->setFocus();
|
||||
}
|
||||
|
||||
void ActionSearch::search_update(const QString &s, const QString &p, QMenu *parent) {
|
||||
if (parent == nullptr) {
|
||||
list_widget->clear();
|
||||
if (parent == nullptr) {
|
||||
list_widget->clear();
|
||||
QList<QAction*> menus = olive::MainWindow->menuBar()->actions();
|
||||
for (int i=0;i<menus.size();i++) {
|
||||
QMenu* menu = menus.at(i)->menu();
|
||||
search_update(s, p, menu);
|
||||
}
|
||||
if (list_widget->count() > 0)
|
||||
list_widget->item(0)->setSelected(true);
|
||||
} else {
|
||||
QString menu_text;
|
||||
if (!p.isEmpty()) menu_text += p + " > ";
|
||||
menu_text += parent->title().replace("&", "");
|
||||
QList<QAction*> actions = parent->actions();
|
||||
for (int i=0;i<actions.size();i++) {
|
||||
QAction* a = actions.at(i);
|
||||
if (!a->isSeparator()) {
|
||||
if (a->menu() != nullptr) {
|
||||
search_update(s, menu_text, a->menu());
|
||||
} else {
|
||||
QString comp = a->text().replace("&", "");
|
||||
if (comp.contains(s, Qt::CaseInsensitive)) {
|
||||
QListWidgetItem* item = new QListWidgetItem(QString("%1\n(%2)").arg(comp, menu_text), list_widget);
|
||||
item->setData(Qt::UserRole+1, reinterpret_cast<quintptr>(a));
|
||||
list_widget->addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0;i<menus.size();i++) {
|
||||
QMenu* menu = menus.at(i)->menu();
|
||||
search_update(s, p, menu);
|
||||
}
|
||||
if (list_widget->count() > 0)
|
||||
list_widget->item(0)->setSelected(true);
|
||||
} else {
|
||||
QString menu_text;
|
||||
if (!p.isEmpty()) menu_text += p + " > ";
|
||||
menu_text += parent->title().replace("&", "");
|
||||
QList<QAction*> actions = parent->actions();
|
||||
for (int i=0;i<actions.size();i++) {
|
||||
QAction* a = actions.at(i);
|
||||
if (!a->isSeparator()) {
|
||||
if (a->menu() != nullptr) {
|
||||
search_update(s, menu_text, a->menu());
|
||||
} else {
|
||||
QString comp = a->text().replace("&", "");
|
||||
if (comp.contains(s, Qt::CaseInsensitive)) {
|
||||
QListWidgetItem* item = new QListWidgetItem(QString("%1\n(%2)").arg(comp, menu_text), list_widget);
|
||||
item->setData(Qt::UserRole+1, reinterpret_cast<quintptr>(a));
|
||||
list_widget->addItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActionSearch::perform_action() {
|
||||
QList<QListWidgetItem*> selected_items = list_widget->selectedItems();
|
||||
if (list_widget->count() > 0 && selected_items.size() > 0) {
|
||||
QListWidgetItem* item = selected_items.at(0);
|
||||
QAction* a = reinterpret_cast<QAction*>(item->data(Qt::UserRole+1).value<quintptr>());
|
||||
a->trigger();
|
||||
}
|
||||
accept();
|
||||
QList<QListWidgetItem*> selected_items = list_widget->selectedItems();
|
||||
if (list_widget->count() > 0 && selected_items.size() > 0) {
|
||||
QListWidgetItem* item = selected_items.at(0);
|
||||
QAction* a = reinterpret_cast<QAction*>(item->data(Qt::UserRole+1).value<quintptr>());
|
||||
a->trigger();
|
||||
}
|
||||
accept();
|
||||
}
|
||||
|
||||
void ActionSearch::move_selection_up() {
|
||||
int lim = list_widget->count();
|
||||
for (int i=1;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i-1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i-1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
int lim = list_widget->count();
|
||||
for (int i=1;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i-1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i-1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActionSearch::move_selection_down() {
|
||||
int lim = list_widget->count()-1;
|
||||
for (int i=0;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i+1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i+1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
int lim = list_widget->count()-1;
|
||||
for (int i=0;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i+1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i+1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ActionSearchEntry::ActionSearchEntry(QWidget *parent) : QLineEdit(parent) {}
|
||||
|
||||
void ActionSearchEntry::keyPressEvent(QKeyEvent * event) {
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Up:
|
||||
emit moveSelectionUp();
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
emit moveSelectionDown();
|
||||
break;
|
||||
default:
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
switch (event->key()) {
|
||||
case Qt::Key_Up:
|
||||
emit moveSelectionUp();
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
emit moveSelectionDown();
|
||||
break;
|
||||
default:
|
||||
QLineEdit::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
ActionSearchList::ActionSearchList(QWidget *parent) : QListWidget(parent) {}
|
||||
|
||||
void ActionSearchList::mouseDoubleClickEvent(QMouseEvent *) {
|
||||
emit dbl_click();
|
||||
emit dbl_click();
|
||||
}
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
#include <QScrollBar>
|
||||
#include <QEvent>
|
||||
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
DebugDialog* olive::DebugDialog = nullptr;
|
||||
|
||||
DebugDialog::DebugDialog(QWidget *parent) : QDialog(parent) {
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
|
||||
textEdit = new QTextEdit(this);
|
||||
textEdit->setWordWrapMode(QTextOption::NoWrap);
|
||||
textEdit = new QTextEdit(this);
|
||||
textEdit->setWordWrapMode(QTextOption::NoWrap);
|
||||
layout->addWidget(textEdit);
|
||||
|
||||
Retranslate();
|
||||
@@ -45,7 +45,7 @@ void DebugDialog::Retranslate()
|
||||
}
|
||||
|
||||
void DebugDialog::update_log() {
|
||||
textEdit->setHtml(get_debug_str());
|
||||
textEdit->setHtml(get_debug_str());
|
||||
textEdit->verticalScrollBar()->setValue(textEdit->verticalScrollBar()->maximum());
|
||||
}
|
||||
|
||||
@@ -59,5 +59,5 @@ void DebugDialog::changeEvent(QEvent *e)
|
||||
}
|
||||
|
||||
void DebugDialog::showEvent(QShowEvent *) {
|
||||
update_log();
|
||||
update_log();
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "ui/checkboxex.h"
|
||||
#include "effectfields.h"
|
||||
#include "effectrow.h"
|
||||
#include "effectgizmo.h"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <QVector>
|
||||
|
||||
#include "effects/keyframe.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
class EffectRow;
|
||||
class ComboAction;
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "effectgizmo.h"
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "effectfields/doublefield.h"
|
||||
#include "project/effect.h"
|
||||
#include "effects/fields/doublefield.h"
|
||||
#include "effects/effect.h"
|
||||
|
||||
EffectGizmo::EffectGizmo(Effect *parent, int type) :
|
||||
QObject(parent),
|
||||
|
||||
+32
-2
@@ -183,8 +183,32 @@ void EffectRow::ToggleKeyframe() {
|
||||
} else {
|
||||
|
||||
// If we DID find keyframes at this time, delete them
|
||||
for (int i=0;i<key_fields.size();i++) {
|
||||
ca->append(new KeyframeDelete(key_fields.at(i), key_field_index.at(i)));
|
||||
|
||||
QVector<EffectField*> sorted_key_fields;
|
||||
QVector<int> sorted_key_field_index;
|
||||
|
||||
// Since QVectors shift themselves when removing items, we need to sort these in reverse order
|
||||
for (int i=0;i<key_field_index.size();i++) {
|
||||
bool found = false;
|
||||
|
||||
for (int j=0;j<sorted_key_field_index.size();j++) {
|
||||
if (sorted_key_field_index.at(j) < key_field_index.at(i)) {
|
||||
sorted_key_fields.insert(j, key_fields.at(i));
|
||||
sorted_key_field_index.insert(j, key_field_index.at(i));
|
||||
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
sorted_key_fields.append(key_fields.at(i));
|
||||
sorted_key_field_index.append(key_field_index.at(i));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0;i<sorted_key_fields.size();i++) {
|
||||
ca->append(new KeyframeDelete(sorted_key_fields.at(i), sorted_key_field_index.at(i)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -215,7 +239,13 @@ void EffectRow::FocusRow() {
|
||||
void EffectRow::SetKeyframeOnAllFields(ComboAction* ca) {
|
||||
for (int i=0;i<FieldCount();i++) {
|
||||
EffectField* field = Field(i);
|
||||
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(field);
|
||||
|
||||
field->SetValueAt(field->Now(), field->GetValueAt(field->Now()));
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
ca->append(kdc);
|
||||
}
|
||||
|
||||
panel_effect_controls->update_keyframes();
|
||||
|
||||
@@ -48,5 +48,10 @@ QString BoolField::ConvertValueToString(const QVariant &v)
|
||||
|
||||
void BoolField::UpdateFromWidget(bool b)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), b);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -42,5 +42,10 @@ QString ColorField::ConvertValueToString(const QVariant &v)
|
||||
|
||||
void ColorField::UpdateFromWidget(const QColor& c)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), c);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -54,5 +54,10 @@ void ComboField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
|
||||
void ComboField::UpdateFromWidget(int index)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), items_.at(index).data);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "doublefield.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include "effects/effectrow.h"
|
||||
|
||||
DoubleField::DoubleField(EffectRow* parent, const QString& id) :
|
||||
EffectField(parent, id, EFFECT_FIELD_DOUBLE),
|
||||
@@ -9,7 +9,8 @@ DoubleField::DoubleField(EffectRow* parent, const QString& id) :
|
||||
default_(0),
|
||||
display_type_(LabelSlider::Normal),
|
||||
frame_rate_(30),
|
||||
value_set_(false)
|
||||
value_set_(false),
|
||||
kdc_(nullptr)
|
||||
{
|
||||
connect(this, SIGNAL(Changed()), this, SLOT(ValueHasBeenSet()), Qt::DirectConnection);
|
||||
}
|
||||
@@ -94,5 +95,18 @@ void DoubleField::ValueHasBeenSet()
|
||||
|
||||
void DoubleField::UpdateFromWidget(double d)
|
||||
{
|
||||
LabelSlider* ls = static_cast<LabelSlider*>(sender());
|
||||
|
||||
if (ls->IsDragging() && kdc_ == nullptr) {
|
||||
kdc_ = new KeyframeDataChange(this);
|
||||
}
|
||||
|
||||
SetValueAt(Now(), d);
|
||||
GetParentRow()->SetKeyframeOnAllFields(nullptr);
|
||||
|
||||
if (!ls->IsDragging() && kdc_ != nullptr) {
|
||||
kdc_->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc_);
|
||||
kdc_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ private:
|
||||
double frame_rate_;
|
||||
|
||||
bool value_set_;
|
||||
|
||||
KeyframeDataChange* kdc_;
|
||||
private slots:
|
||||
void ValueHasBeenSet();
|
||||
void UpdateFromWidget(double d);
|
||||
|
||||
@@ -25,5 +25,10 @@ QWidget *FileField::CreateWidget()
|
||||
|
||||
void FileField::UpdateFromWidget(const QString &s)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -54,5 +54,10 @@ void FontField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
|
||||
void FontField::UpdateFromWidget(const QString& s)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
}
|
||||
|
||||
@@ -41,5 +41,10 @@ void StringField::UpdateWidgetValue(QWidget *widget, double timecode)
|
||||
|
||||
void StringField::UpdateFromWidget(const QString &s)
|
||||
{
|
||||
KeyframeDataChange* kdc = new KeyframeDataChange(this);
|
||||
|
||||
SetValueAt(Now(), s);
|
||||
|
||||
kdc->SetNewKeyframes();
|
||||
olive::UndoStack.push(kdc);
|
||||
}
|
||||
|
||||
+3
-3
@@ -20,13 +20,13 @@
|
||||
|
||||
#include "checkboxex.h"
|
||||
|
||||
#include "project/undo.h"
|
||||
#include "undo/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);
|
||||
olive::UndoStack.push(c);
|
||||
CheckboxCommand* c = new CheckboxCommand(this);
|
||||
olive::UndoStack.push(c);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "ui/checkboxex.h"
|
||||
#include "ui/icons.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
||||
selected = false;
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
|
||||
#include "colorbutton.h"
|
||||
|
||||
#include "project/undo.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
|
||||
ColorButton::ColorButton(QWidget *parent)
|
||||
@@ -58,14 +56,3 @@ void ColorButton::open_dialog() {
|
||||
emit color_changed(color);
|
||||
}
|
||||
}
|
||||
|
||||
ColorCommand::ColorCommand(ColorButton* s, QColor o, QColor n)
|
||||
: sender(s), old_color(o), new_color(n) {}
|
||||
|
||||
void ColorCommand::undo() {
|
||||
sender->set_color(old_color);
|
||||
}
|
||||
|
||||
void ColorCommand::redo() {
|
||||
sender->set_color(new_color);
|
||||
}
|
||||
|
||||
@@ -42,15 +42,4 @@ private slots:
|
||||
void open_dialog();
|
||||
};
|
||||
|
||||
class ColorCommand : public QUndoCommand {
|
||||
public:
|
||||
ColorCommand(ColorButton* s, QColor o, QColor n);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
ColorButton* sender;
|
||||
QColor old_color;
|
||||
QColor new_color;
|
||||
};
|
||||
|
||||
#endif // COLORBUTTON_H
|
||||
|
||||
@@ -66,6 +66,8 @@ EffectUI::EffectUI(Effect* e) :
|
||||
|
||||
KeyframeNavigator* nav = new KeyframeNavigator();
|
||||
|
||||
nav->enable_keyframes(row->IsKeyframing());
|
||||
|
||||
connect(nav, SIGNAL(goto_previous_key()), row, SLOT(GoToPreviousKeyframe()));
|
||||
connect(nav, SIGNAL(toggle_key()), row, SLOT(ToggleKeyframe()));
|
||||
connect(nav, SIGNAL(goto_next_key()), row, SLOT(GoToNextKeyframe()));
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "icons.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "global/global.h"
|
||||
#include "global/config.h"
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
#include "keyframedrawing.h"
|
||||
|
||||
#include "project/effect.h"
|
||||
#include "project/clip.h"
|
||||
#include "effects/effect.h"
|
||||
#include "timeline/clip.h"
|
||||
|
||||
#define KEYFRAME_POINT_COUNT 4
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDebug>
|
||||
|
||||
#include "ui/icons.h"
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ public:
|
||||
~KeyframeNavigator();
|
||||
|
||||
void enable_keyframe_toggle(bool);
|
||||
public slots:
|
||||
void enable_keyframes(bool);
|
||||
signals:
|
||||
void goto_previous_key();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <QStyle>
|
||||
#include <QStyleOptionSlider>
|
||||
|
||||
#include "debug.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
#define RESIZE_HANDLE_SIZE 10
|
||||
|
||||
|
||||
+10
-10
@@ -30,19 +30,19 @@ class Media;
|
||||
|
||||
class SourceTable : public QTreeView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
SourceTable(QWidget* parent = 0);
|
||||
Project* project_parent;
|
||||
SourceTable(QWidget* parent = 0);
|
||||
Project* project_parent;
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent*);
|
||||
void mouseDoubleClickEvent(QMouseEvent *);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void mousePressEvent(QMouseEvent*);
|
||||
void mouseDoubleClickEvent(QMouseEvent *);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
private slots:
|
||||
void item_click(const QModelIndex& index);
|
||||
void show_context_menu();
|
||||
void item_click(const QModelIndex& index);
|
||||
void show_context_menu();
|
||||
};
|
||||
|
||||
#endif // SOURCETABLE_H
|
||||
|
||||
+26
-16
@@ -607,22 +607,6 @@ void KeyframeDelete::doRedo() {
|
||||
field->keyframes.removeAt(index);
|
||||
}
|
||||
|
||||
/*
|
||||
EffectFieldUndo::EffectFieldUndo(EffectField* f, const QVariant& old_data, const QVariant new_data) :
|
||||
field(f),
|
||||
old_val(old_data),
|
||||
new_val(new_data)
|
||||
{}
|
||||
|
||||
void EffectFieldUndo::doUndo() {
|
||||
field->SetCurrentValue(old_val);
|
||||
}
|
||||
|
||||
void EffectFieldUndo::doRedo() {
|
||||
field->SetCurrentValue(new_val);
|
||||
}
|
||||
*/
|
||||
|
||||
SetClipProperty::SetClipProperty(SetClipPropertyType type) : type_(type)
|
||||
{}
|
||||
|
||||
@@ -1169,3 +1153,29 @@ void OliveAction::redo() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
KeyframeDataChange::KeyframeDataChange(EffectField *field) :
|
||||
field_(field),
|
||||
done_(true)
|
||||
{
|
||||
old_keys_ = field_->keyframes;
|
||||
}
|
||||
|
||||
void KeyframeDataChange::SetNewKeyframes()
|
||||
{
|
||||
new_keys_ = field_->keyframes;
|
||||
}
|
||||
|
||||
void KeyframeDataChange::doUndo()
|
||||
{
|
||||
field_->keyframes = old_keys_;
|
||||
done_ = false;
|
||||
}
|
||||
|
||||
void KeyframeDataChange::doRedo()
|
||||
{
|
||||
if (!done_) {
|
||||
field_->keyframes = new_keys_;
|
||||
done_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
+39
-20
@@ -28,15 +28,30 @@
|
||||
#include <QVariant>
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "project/projectelements.h"
|
||||
#include "timeline/selection.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "effects/transition.h"
|
||||
#include "effects/effectfield.h"
|
||||
#include "comboaction.h"
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/sourcetable.h"
|
||||
#include "timeline/marker.h"
|
||||
#include "timeline/selection.h"
|
||||
#include "effects/keyframe.h"
|
||||
|
||||
class Clip;
|
||||
using ClipPtr = std::shared_ptr<Clip>;
|
||||
|
||||
class Sequence;
|
||||
using SequencePtr = std::shared_ptr<Sequence>;
|
||||
|
||||
class Media;
|
||||
using MediaPtr = std::shared_ptr<Media>;
|
||||
|
||||
class Effect;
|
||||
using EffectPtr = std::shared_ptr<Effect>;
|
||||
|
||||
class Transition;
|
||||
using TransitionPtr = std::shared_ptr<Transition>;
|
||||
|
||||
struct EffectMeta;
|
||||
class EffectRow;
|
||||
class EffectField;
|
||||
|
||||
namespace olive {
|
||||
extern QUndoStack UndoStack;
|
||||
@@ -334,18 +349,6 @@ private:
|
||||
bool done;
|
||||
};
|
||||
|
||||
class EffectFieldUndo : public OliveAction {
|
||||
public:
|
||||
EffectFieldUndo(EffectField* field, const QVariant &old_data, const QVariant new_data);
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
private:
|
||||
EffectField* field;
|
||||
QVariant old_val;
|
||||
QVariant new_val;
|
||||
bool done;
|
||||
};
|
||||
|
||||
enum SetClipPropertyType {
|
||||
kSetClipPropertyAutoscale,
|
||||
kSetClipPropertyReversed,
|
||||
@@ -620,4 +623,20 @@ private:
|
||||
QByteArray old_data;
|
||||
};
|
||||
|
||||
class KeyframeDataChange : public OliveAction {
|
||||
public:
|
||||
KeyframeDataChange(EffectField* field);
|
||||
|
||||
void SetNewKeyframes();
|
||||
|
||||
virtual void doUndo() override;
|
||||
virtual void doRedo() override;
|
||||
|
||||
private:
|
||||
EffectField* field_;
|
||||
QVector<EffectKeyframe> old_keys_;
|
||||
QVector<EffectKeyframe> new_keys_;
|
||||
bool done_;
|
||||
};
|
||||
|
||||
#endif // UNDO_H
|
||||
|
||||
Reference in New Issue
Block a user