new undo system

Also enables undoing when working with node input arrays
This commit is contained in:
itsmattkc
2021-01-29 16:10:34 +11:00
parent 4e5db91c17
commit ad4b83a098
69 changed files with 1218 additions and 837 deletions
+3 -5
View File
@@ -139,9 +139,7 @@ void SequenceDialog::accept()
SequenceDialog::SequenceParamCommand::SequenceParamCommand(Sequence* s,
const VideoParams& video_params,
const AudioParams &audio_params,
const QString& name,
QUndoCommand* parent) :
UndoCommand(parent),
const QString& name) :
sequence_(s),
new_video_params_(video_params),
new_audio_params_(audio_params),
@@ -157,14 +155,14 @@ Project *SequenceDialog::SequenceParamCommand::GetRelevantProject() const
return sequence_->project();
}
void SequenceDialog::SequenceParamCommand::redo_internal()
void SequenceDialog::SequenceParamCommand::redo()
{
sequence_->set_video_params(new_video_params_);
sequence_->set_audio_params(new_audio_params_);
sequence_->set_name(new_name_);
}
void SequenceDialog::SequenceParamCommand::undo_internal()
void SequenceDialog::SequenceParamCommand::undo()
{
sequence_->set_video_params(old_video_params_);
sequence_->set_audio_params(old_audio_params_);
+5 -7
View File
@@ -38,7 +38,7 @@ namespace olive {
* This dialog exposes all the parameters of a Sequence to users allowing them to set up a Sequence however they wish.
* A Sequence can be sent to this dialog through the constructor. All fields will be filled using that Sequence's
* parameters, allowing the user to view and edit them. Accepting the dialog will apply them back to that Sequence,
* either directly or using a QUndoCommand (see SetUndoable()).
* either directly or using an UndoCommand (see SetUndoable()).
*
* If creating a new Sequence, the Sequence must still be constructed first before sending it to SequenceDialog.
* SequenceDialog does not create any new objects. In most cases when creating a new Sequence, editing its parameters
@@ -104,21 +104,19 @@ private:
QLineEdit* name_field_;
/**
* @brief A QUndoCommand for setting the parameters on a sequence
* @brief An UndoCommand for setting the parameters on a sequence
*/
class SequenceParamCommand : public UndoCommand {
public:
SequenceParamCommand(Sequence* s,
const VideoParams& video_params,
const AudioParams& audio_params,
const QString& name,
QUndoCommand* parent = nullptr);
const QString& name);
virtual Project* GetRelevantProject() const override;
protected:
virtual void redo_internal() override;
virtual void undo_internal() override;
virtual void redo() override;
virtual void undo() override;
private:
Sequence* sequence_;