name every undo command

This commit is contained in:
itsmattkc
2023-03-12 00:49:03 -08:00
parent 019f095ee4
commit 2c2df99963
46 changed files with 172 additions and 122 deletions
+4 -4
View File
@@ -419,7 +419,7 @@ void Core::CreateNewFolder()
command->add_child(new NodeAddCommand(active_project, new_folder)); command->add_child(new NodeAddCommand(active_project, new_folder));
command->add_child(new FolderAddChild(folder, new_folder)); command->add_child(new FolderAddChild(folder, new_folder));
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Created New Folder"));
// Trigger an automatic rename so users can enter the folder name // Trigger an automatic rename so users can enter the folder name
active_project_panel->Edit(new_folder); active_project_panel->Edit(new_folder);
@@ -456,7 +456,7 @@ void Core::CreateNewSequence()
// Create and connect default nodes to new sequence // Create and connect default nodes to new sequence
new_sequence->add_default_nodes(command); new_sequence->add_default_nodes(command);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Created New Sequence"));
} else { } else {
@@ -575,7 +575,7 @@ void Core::ImportTaskComplete(Task* task)
d.exec(); d.exec();
} }
undo_stack_.push(command); undo_stack_.push(command, tr("Imported %1 File(s)").arg(import_task->GetImportedFootage().size()));
main_window_->SelectFootage(import_task->GetImportedFootage()); main_window_->SelectFootage(import_task->GetImportedFootage());
} }
@@ -1413,7 +1413,7 @@ bool Core::LabelNodes(const QVector<Node *> &nodes, MultiUndoCommand *parent)
if (parent) { if (parent) {
parent->add_child(rename_command); parent->add_child(rename_command);
} else { } else {
undo_stack_.push(rename_command); undo_stack_.push(rename_command, tr("Renamed %1 Node(s)").arg(nodes.size()));
} }
return true; return true;
+1 -1
View File
@@ -73,7 +73,7 @@ void ConfigDialogBase::accept()
tab->Accept(command); tab->Accept(command);
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set Configuration"));
AcceptEvent(); AcceptEvent();
@@ -192,7 +192,7 @@ void FootagePropertiesDialog::accept()
static_cast<StreamProperties*>(stacked_widget_->widget(i))->Accept(command); static_cast<StreamProperties*>(stacked_widget_->widget(i))->Accept(command);
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set Footage \"%1\" Properties").arg(footage_->GetLabel()));
QDialog::accept(); QDialog::accept();
} }
@@ -219,7 +219,7 @@ void KeyframePropertiesDialog::accept()
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set Keyframe Properties"));
QDialog::accept(); QDialog::accept();
} }
@@ -147,7 +147,7 @@ void MarkerPropertiesDialog::accept()
command->add_child(new MarkerChangeTimeCommand(markers_.front(), TimeRange(in_slider_->GetValue(), out_slider_->GetValue()))); command->add_child(new MarkerChangeTimeCommand(markers_.front(), TimeRange(in_slider_->GetValue(), out_slider_->GetValue())));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set Marker Properties"));
super::accept(); super::accept();
} }
+1 -1
View File
@@ -151,7 +151,7 @@ void SequenceDialog::accept()
name_field_->text(), name_field_->text(),
parameter_tab_->GetSelectedPreviewAutoCache()); parameter_tab_->GetSelectedPreviewAutoCache());
Core::instance()->undo_stack()->push(param_command); Core::instance()->undo_stack()->push(param_command, tr("Set Sequence Parameters For \"%1\"").arg(sequence_->GetLabel()));
} else { } else {
// Set sequence values directly with no undo command // Set sequence values directly with no undo command
@@ -251,7 +251,8 @@ void SpeedDurationDialog::accept()
} }
} }
Core::instance()->undo_stack()->push(command); QString name = (clips_.size() > 1) ? tr("Set %1 Clip Properties").arg(clips_.size()) : tr("Set Clip \"%1\" Properties").arg(clips_.first()->GetLabelOrName());
Core::instance()->undo_stack()->push(command, name);
super::accept(); super::accept();
} }
+1 -1
View File
@@ -275,7 +275,7 @@ void TextGeneratorV3::GizmoDeactivated()
void TextGeneratorV3::SetVerticalAlignmentUndoable(Qt::Alignment a) void TextGeneratorV3::SetVerticalAlignmentUndoable(Qt::Alignment a)
{ {
Core::instance()->undo_stack()->push(new NodeParamSetStandardValueCommand(NodeInput(this, kVerticalAlignmentInput), GetOurAlignmentFromQts(a))); Core::instance()->undo_stack()->push(new NodeParamSetStandardValueCommand(NodeInput(this, kVerticalAlignmentInput), GetOurAlignmentFromQts(a)), tr("Set Text Vertical Alignment"));
} }
} }
+1 -1
View File
@@ -43,7 +43,7 @@ void TextGizmo::UpdateInputHtml(const QString &s, const rational &time)
if (input_.IsValid()) { if (input_.IsValid()) {
MultiUndoCommand *command = new MultiUndoCommand(); MultiUndoCommand *command = new MultiUndoCommand();
Node::SetValueAtTime(input_.input(), time, s, input_.track(), command, true); Node::SetValueAtTime(input_.input(), time, s, input_.track(), command, true);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Edit Text"));
} }
} }
+10
View File
@@ -1763,6 +1763,16 @@ void Node::ArrayResizeInternal(const QString &id, int size)
} }
} }
QString Node::GetConnectCommandString(Node *output, const NodeInput &input)
{
return tr("Connected %1 to %2 - %3").arg(output->GetLabelAndName(), input.node()->GetLabelAndName(), input.GetInputName());
}
QString Node::GetDisconnectCommandString(Node *output, const NodeInput &input)
{
return tr("Disconnected %1 from %2 - %3").arg(output->GetLabelAndName(), input.node()->GetLabelAndName(), input.GetInputName());
}
int Node::GetInternalInputArraySize(const QString &input) int Node::GetInternalInputArraySize(const QString &input)
{ {
return array_immediates_.value(input).size(); return array_immediates_.value(input).size();
+3
View File
@@ -980,6 +980,9 @@ public:
virtual void AddedToGraphEvent(Project *p){} virtual void AddedToGraphEvent(Project *p){}
virtual void RemovedFromGraphEvent(Project *p){} virtual void RemovedFromGraphEvent(Project *p){}
static QString GetConnectCommandString(Node *output, const NodeInput &input);
static QString GetDisconnectCommandString(Node *output, const NodeInput &input);
static const QString kEnabledInput; static const QString kEnabledInput;
protected: protected:
+9
View File
@@ -78,6 +78,15 @@ InputFlags NodeInput::GetFlags() const
} }
} }
QString NodeInput::GetInputName() const
{
if (IsValid()) {
return node_->GetInputName(input_);
} else {
return QString();
}
}
Node *NodeInput::GetConnectedOutput() const Node *NodeInput::GetConnectedOutput() const
{ {
if (IsValid()) { if (IsValid()) {
+2
View File
@@ -258,6 +258,8 @@ public:
InputFlags GetFlags() const; InputFlags GetFlags() const;
QString GetInputName() const;
Node *GetConnectedOutput() const; Node *GetConnectedOutput() const;
NodeValue::Type GetDataType() const; NodeValue::Type GetDataType() const;
-12
View File
@@ -51,16 +51,6 @@ public:
virtual Project* GetRelevantProject() const = 0; virtual Project* GetRelevantProject() const = 0;
const QString& name() const
{
return name_;
}
void set_name(const QString& name)
{
name_ = name;
}
protected: protected:
virtual void prepare(){} virtual void prepare(){}
virtual void redo() = 0; virtual void redo() = 0;
@@ -69,8 +59,6 @@ protected:
private: private:
bool modified_; bool modified_;
QString name_;
Project* project_; Project* project_;
bool prepared_; bool prepared_;
+15 -17
View File
@@ -59,7 +59,7 @@ UndoStack::~UndoStack()
delete redo_action_; delete redo_action_;
} }
void UndoStack::push(UndoCommand *command) void UndoStack::push(UndoCommand *command, const QString &name)
{ {
MultiUndoCommand *mcu = dynamic_cast<MultiUndoCommand*>(command); MultiUndoCommand *mcu = dynamic_cast<MultiUndoCommand*>(command);
if (mcu && mcu->child_count() == 0) { if (mcu && mcu->child_count() == 0) {
@@ -71,7 +71,7 @@ void UndoStack::push(UndoCommand *command)
this->beginRemoveRows(QModelIndex(), commands_.size(), commands_.size() + undone_commands_.size()); this->beginRemoveRows(QModelIndex(), commands_.size(), commands_.size() + undone_commands_.size());
if (CanRedo()) { if (CanRedo()) {
for (auto it=undone_commands_.cbegin(); it!=undone_commands_.cend(); it++) { for (auto it=undone_commands_.cbegin(); it!=undone_commands_.cend(); it++) {
delete (*it); delete (*it).command;
} }
undone_commands_.clear(); undone_commands_.clear();
} }
@@ -80,13 +80,13 @@ void UndoStack::push(UndoCommand *command)
// Do command and push // Do command and push
this->beginInsertRows(QModelIndex(), commands_.size(), commands_.size()); this->beginInsertRows(QModelIndex(), commands_.size(), commands_.size());
command->redo_and_set_modified(); command->redo_and_set_modified();
commands_.push_back(command); commands_.push_back({command, name});
this->endInsertRows(); this->endInsertRows();
// Delete oldest // Delete oldest
if (commands_.size() > kMaxUndoCommands) { if (commands_.size() > kMaxUndoCommands) {
this->beginRemoveRows(QModelIndex(), 0, 0); this->beginRemoveRows(QModelIndex(), 0, 0);
delete commands_.front(); delete commands_.front().command;
commands_.pop_front(); commands_.pop_front();
this->endRemoveRows(); this->endRemoveRows();
} }
@@ -108,7 +108,7 @@ void UndoStack::undo()
{ {
if (CanUndo()) { if (CanUndo()) {
// Undo most recently done command // Undo most recently done command
commands_.back()->undo_and_set_modified(); commands_.back().command->undo_and_set_modified();
// Place at the front of the "undone commands" list // Place at the front of the "undone commands" list
undone_commands_.push_front(commands_.back()); undone_commands_.push_front(commands_.back());
@@ -125,7 +125,7 @@ void UndoStack::redo()
{ {
if (CanRedo()) { if (CanRedo()) {
// Redo most recently undone command // Redo most recently undone command
undone_commands_.front()->redo_and_set_modified(); undone_commands_.front().command->redo_and_set_modified();
// Place at the back of the done commands list // Place at the back of the done commands list
commands_.push_back(undone_commands_.front()); commands_.push_back(undone_commands_.front());
@@ -143,24 +143,22 @@ void UndoStack::clear()
this->beginResetModel(); this->beginResetModel();
for (auto it=commands_.cbegin(); it!=commands_.cend(); it++) { for (auto it=commands_.cbegin(); it!=commands_.cend(); it++) {
delete (*it); delete (*it).command;
} }
commands_.clear(); commands_.clear();
for (auto it=undone_commands_.cbegin(); it!=undone_commands_.cend(); it++) { for (auto it=undone_commands_.cbegin(); it!=undone_commands_.cend(); it++) {
delete (*it); delete (*it).command;
} }
undone_commands_.clear(); undone_commands_.clear();
this->endResetModel(); this->endResetModel();
EmptyCommand *e = new EmptyCommand(); push(new EmptyCommand(), tr("New/Open Project"));
e->set_name(tr("New/Open Project"));
push(e);
} }
bool UndoStack::CanUndo() const bool UndoStack::CanUndo() const
{ {
return !commands_.empty() && !dynamic_cast<EmptyCommand*>(commands_.back()); return !commands_.empty() && !dynamic_cast<EmptyCommand*>(commands_.back().command);
} }
void UndoStack::UpdateActions() void UndoStack::UpdateActions()
@@ -168,8 +166,8 @@ void UndoStack::UpdateActions()
undo_action_->setEnabled(CanUndo()); undo_action_->setEnabled(CanUndo());
redo_action_->setEnabled(CanRedo()); redo_action_->setEnabled(CanRedo());
undo_action_->setText(QCoreApplication::translate("UndoStack", "Undo %1").arg(CanUndo() ? commands_.back()->name() : QString())); undo_action_->setText(QCoreApplication::translate("UndoStack", "Undo %1").arg(CanUndo() ? commands_.back().name : QString()));
redo_action_->setText(QCoreApplication::translate("UndoStack", "Redo %1").arg(CanRedo() ? undone_commands_.front()->name() : QString())); redo_action_->setText(QCoreApplication::translate("UndoStack", "Redo %1").arg(CanRedo() ? undone_commands_.front().name : QString()));
emit indexChanged(commands_.size()); emit indexChanged(commands_.size());
} }
@@ -190,7 +188,7 @@ QVariant UndoStack::data(const QModelIndex &index, int role) const
return index.row() + 1; return index.row() + 1;
case 1: case 1:
{ {
std::list<UndoCommand*>::const_iterator it; std::list<CommandEntry>::const_iterator it;
size_t real_index = index.row(); size_t real_index = index.row();
if (real_index < commands_.size()) { if (real_index < commands_.size()) {
it = commands_.cbegin(); it = commands_.cbegin();
@@ -201,8 +199,8 @@ QVariant UndoStack::data(const QModelIndex &index, int role) const
for (size_t i = 0; i < real_index; i++) { for (size_t i = 0; i < real_index; i++) {
it++; it++;
} }
const QString &name = (*it)->name(); const QString &name = (*it).name;
return (name.isEmpty()) ? QStringLiteral("Command") : name; return (name.isEmpty()) ? tr("Command") : name;
} }
} }
} else if (role == Qt::ForegroundRole) { } else if (role == Qt::ForegroundRole) {
+9 -3
View File
@@ -37,7 +37,7 @@ public:
virtual ~UndoStack() override; virtual ~UndoStack() override;
void push(UndoCommand* command); void push(UndoCommand* command, const QString &name);
void jump(size_t index); void jump(size_t index);
@@ -81,9 +81,15 @@ public slots:
private: private:
static const int kMaxUndoCommands; static const int kMaxUndoCommands;
std::list<UndoCommand*> commands_; struct CommandEntry
{
UndoCommand *command;
QString name;
};
std::list<UndoCommand*> undone_commands_; std::list<CommandEntry> commands_;
std::list<CommandEntry> undone_commands_;
QAction* undo_action_; QAction* undo_action_;
+1 -1
View File
@@ -401,7 +401,7 @@ void CurveView::FirstChanceMouseRelease(QMouseEvent *event)
dragging_bezier_pt_ = nullptr; dragging_bezier_pt_ = nullptr;
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Moved Keyframe Bezier Control Point"));
} }
void CurveView::KeyframeDragStart(QMouseEvent *event) void CurveView::KeyframeDragStart(QMouseEvent *event)
+1 -1
View File
@@ -330,7 +330,7 @@ void CurveWidget::KeyframeTypeButtonTriggered(bool checked)
command->add_child(new KeyframeSetTypeCommand(item, new_type)); command->add_child(new KeyframeSetTypeCommand(item, new_type));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Changed Type of %1 Keyframe(s) to %2"));
} }
void CurveWidget::InputSelectionChanged(const NodeKeyframeTrackReference& ref) void CurveWidget::InputSelectionChanged(const NodeKeyframeTrackReference& ref)
+4 -4
View File
@@ -61,7 +61,7 @@ void KeyframeView::DeleteSelected()
command->add_child(new NodeParamRemoveKeyframeCommand(key)); command->add_child(new NodeParamRemoveKeyframeCommand(key));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Deleted %1 Keyframe(s)").arg(GetSelectedKeyframes().size()));
} }
} }
@@ -247,7 +247,7 @@ bool KeyframeView::Paste(std::function<Node *(const QString &)> find_node_functi
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Pasted %1 Keyframe(s)").arg(keys.size()));
return true; return true;
} }
@@ -319,7 +319,7 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent *event)
MultiUndoCommand* command = new MultiUndoCommand(); MultiUndoCommand* command = new MultiUndoCommand();
selection_manager_.DragStop(command); selection_manager_.DragStop(command);
KeyframeDragRelease(event, command); KeyframeDragRelease(event, command);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Moved %1 Keyframe(s)").arg(selection_manager_.GetSelectedObjects().size()));
} else if (selection_manager_.IsRubberBanding()) { } else if (selection_manager_.IsRubberBanding()) {
selection_manager_.RubberBandStop(); selection_manager_.RubberBandStop();
Redraw(); Redraw();
@@ -612,7 +612,7 @@ void KeyframeView::ShowContextMenu()
foreach (NodeKeyframe* item, GetSelectedKeyframes()) { foreach (NodeKeyframe* item, GetSelectedKeyframes()) {
command->add_child(new KeyframeSetTypeCommand(item, new_type)); command->add_child(new KeyframeSetTypeCommand(item, new_type));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set Type of %1 Keyframe(s)").arg(GetSelectedKeyframes().size()));
} }
} }
} }
+1 -1
View File
@@ -152,7 +152,7 @@ void MulticamWidget::Switch(int source, bool split_clip)
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Switched Multi-Camera Source"));
display_->update(); display_->update();
+2 -2
View File
@@ -420,7 +420,7 @@ void NodeParamView::DeleteSelected()
} }
} }
Core::instance()->undo_stack()->push(c); Core::instance()->undo_stack()->push(c, tr("Deleted %1 Node(s)").arg(selected_nodes_.size()));
} }
} }
@@ -646,7 +646,7 @@ bool NodeParamView::Paste(QWidget *parent, std::function<QHash<Node *, Node*>(co
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Pasted %1 Node(s)").arg(nodes_to_paste_as_new.size()));
return true; return true;
} }
@@ -137,7 +137,7 @@ void NodeParamViewConnectedLabel::ShowLabelContextMenu()
QAction* disconnect_action = m.addAction(tr("Disconnect")); QAction* disconnect_action = m.addAction(tr("Disconnect"));
connect(disconnect_action, &QAction::triggered, this, [this](){ connect(disconnect_action, &QAction::triggered, this, [this](){
Core::instance()->undo_stack()->push(new NodeEdgeRemoveCommand(connected_node_, input_)); Core::instance()->undo_stack()->push(new NodeEdgeRemoveCommand(connected_node_, input_), Node::GetDisconnectCommandString(connected_node_, input_));
}); });
m.exec(QCursor::pos()); m.exec(QCursor::pos());
@@ -180,7 +180,7 @@ void NodeParamViewContext::AddEffectMenuItemTriggered(QAction *a)
command->add_child(new NodeEdgeAddCommand(n, ctx_input)); command->add_child(new NodeEdgeAddCommand(n, ctx_input));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Added %1 to Node Chain").arg(n->Name()));
} }
} }
@@ -458,7 +458,8 @@ void NodeParamViewItemBody::ArrayAppendClicked()
for (auto it=array_ui_.cbegin(); it!=array_ui_.cend(); it++) { for (auto it=array_ui_.cbegin(); it!=array_ui_.cend(); it++) {
if (it.value().append_btn == sender()) { if (it.value().append_btn == sender()) {
NodeInput real_input = NodeGroup::ResolveInput(NodeInput(it.key().node, it.key().input)); NodeInput real_input = NodeGroup::ResolveInput(NodeInput(it.key().node, it.key().input));
Core::instance()->undo_stack()->push(new NodeArrayInsertCommand(real_input.node(), real_input.input(), real_input.GetArraySize())); Core::instance()->undo_stack()->push(new NodeArrayInsertCommand(real_input.node(), real_input.input(), real_input.GetArraySize()),
tr("Appended Array Element In %1 - %2").arg(real_input.node()->GetLabelAndName(), real_input.GetInputName()));
break; break;
} }
} }
@@ -470,7 +471,8 @@ void NodeParamViewItemBody::ArrayInsertClicked()
if (it.value().array_insert_btn == sender()) { if (it.value().array_insert_btn == sender()) {
// Found our input and element // Found our input and element
NodeInput ic = NodeGroup::ResolveInput(it.key()); NodeInput ic = NodeGroup::ResolveInput(it.key());
Core::instance()->undo_stack()->push(new NodeArrayInsertCommand(ic.node(), ic.input(), ic.element())); Core::instance()->undo_stack()->push(new NodeArrayInsertCommand(ic.node(), ic.input(), ic.element()),
tr("Inserted Array Element In %1 - %2").arg(ic.node()->GetLabelAndName(), ic.GetInputName()));
break; break;
} }
} }
@@ -482,7 +484,8 @@ void NodeParamViewItemBody::ArrayRemoveClicked()
if (it.value().array_remove_btn == sender()) { if (it.value().array_remove_btn == sender()) {
// Found our input and element // Found our input and element
NodeInput ic = NodeGroup::ResolveInput(it.key()); NodeInput ic = NodeGroup::ResolveInput(it.key());
Core::instance()->undo_stack()->push(new NodeArrayRemoveCommand(ic.node(), ic.input(), ic.element())); Core::instance()->undo_stack()->push(new NodeArrayRemoveCommand(ic.node(), ic.input(), ic.element()),
tr("Removed Array Element In %1 - %2").arg(ic.node()->GetLabelAndName(), ic.GetInputName()));
break; break;
} }
} }
@@ -176,7 +176,7 @@ void NodeParamViewKeyframeControl::ToggleKeyframe(bool e)
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Toggled Keyframe"));
} }
void NodeParamViewKeyframeControl::UpdateState() void NodeParamViewKeyframeControl::UpdateState()
@@ -228,6 +228,8 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
MultiUndoCommand* command = new MultiUndoCommand(); MultiUndoCommand* command = new MultiUndoCommand();
QString command_name;
if (e) { if (e) {
// Enable keyframing // Enable keyframing
command->add_child(new NodeParamSetKeyframingCommand(input_, true)); command->add_child(new NodeParamSetKeyframingCommand(input_, true));
@@ -245,6 +247,8 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
command->add_child(new NodeParamInsertKeyframeCommand(input_.node(), key)); command->add_child(new NodeParamInsertKeyframeCommand(input_.node(), key));
} }
command_name = tr("Enabled Keyframing On %1 - %2").arg(input_.node()->GetLabelAndName(), input_.GetInputName());
} else { } else {
// Confirm the user wants to clear all keyframes // Confirm the user wants to clear all keyframes
if (QMessageBox::warning(this, if (QMessageBox::warning(this,
@@ -270,13 +274,14 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
// Disable keyframing // Disable keyframing
command->add_child(new NodeParamSetKeyframingCommand(input_, false)); command->add_child(new NodeParamSetKeyframingCommand(input_, false));
command_name = tr("Disabled Keyframing On %1 - %2").arg(input_.node()->GetLabelAndName(), input_.GetInputName());
} else { } else {
// Disable action has effectively been ignored // Disable action has effectively been ignored
enable_key_btn_->setChecked(true); enable_key_btn_->setChecked(true);
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, command_name);
} }
void NodeParamViewKeyframeControl::KeyframeEnableChanged(const NodeInput &input, bool e) void NodeParamViewKeyframeControl::KeyframeEnableChanged(const NodeInput &input, bool e)
@@ -190,7 +190,7 @@ void NodeParamViewWidgetBridge::SetInputValue(const QVariant &value, int track)
SetInputValueInternal(value, track, command, true); SetInputValueInternal(value, track, command, true);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, GetCommandName());
} }
void NodeParamViewWidgetBridge::SetInputValueInternal(const QVariant &value, int track, MultiUndoCommand *command, bool insert_on_all_tracks_if_no_key) void NodeParamViewWidgetBridge::SetInputValueInternal(const QVariant &value, int track, MultiUndoCommand *command, bool insert_on_all_tracks_if_no_key)
@@ -218,7 +218,7 @@ void NodeParamViewWidgetBridge::ProcessSlider(NumericSliderBase *slider, int sli
MultiUndoCommand *command = new MultiUndoCommand(); MultiUndoCommand *command = new MultiUndoCommand();
dragger_.End(command); dragger_.End(command);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, GetCommandName());
} else { } else {
@@ -314,7 +314,7 @@ void NodeParamViewWidgetBridge::WidgetCallback()
n->SetInputProperty(GetInnerInput().input(), QStringLiteral("col_look"), c.color_output().look()); n->SetInputProperty(GetInnerInput().input(), QStringLiteral("col_look"), c.color_output().look());
n->blockSignals(false); n->blockSignals(false);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, GetCommandName());
break; break;
} }
case NodeValue::kText: case NodeValue::kText:
@@ -532,6 +532,12 @@ rational NodeParamViewWidgetBridge::GetCurrentTimeAsNodeTime() const
} }
} }
QString NodeParamViewWidgetBridge::GetCommandName() const
{
NodeInput i = GetInnerInput();
return tr("Edited Value Of %1 - %2").arg(i.node()->GetLabelAndName(), i.node()->GetInputName(i.input()));
}
void NodeParamViewWidgetBridge::SetTimebase(const rational& timebase) void NodeParamViewWidgetBridge::SetTimebase(const rational& timebase)
{ {
if (GetDataType() == NodeValue::kRational) { if (GetDataType() == NodeValue::kRational) {
@@ -93,6 +93,8 @@ private:
return input_hierarchy_.last(); return input_hierarchy_.last();
} }
QString GetCommandName() const;
NodeValue::Type GetDataType() const NodeValue::Type GetDataType() const
{ {
return GetOuterInput().GetDataType(); return GetOuterInput().GetDataType();
+17 -10
View File
@@ -141,11 +141,13 @@ void NodeView::DeleteSelected()
{ {
NodeViewDeleteCommand* command = new NodeViewDeleteCommand(); NodeViewDeleteCommand* command = new NodeViewDeleteCommand();
int count = 0;
foreach (NodeViewContext *ctx, scene_.context_map()) { foreach (NodeViewContext *ctx, scene_.context_map()) {
ctx->DeleteSelected(command); count += ctx->DeleteSelected(command);
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Deleted %1 Node(s)").arg(count));
} }
void NodeView::SelectAll() void NodeView::SelectAll()
@@ -356,7 +358,7 @@ void NodeView::SetColorLabel(int index)
command->add_child(new NodeOverrideColorCommand(node, index)); command->add_child(new NodeOverrideColorCommand(node, index));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set Color of %1 Node(s)").arg(selected_nodes_.size()));
} }
void NodeView::ZoomIn() void NodeView::ZoomIn()
@@ -411,7 +413,7 @@ void NodeView::keyPressEvent(QKeyEvent *event)
} }
} }
} }
Core::instance()->undo_stack()->push(pos_command); Core::instance()->undo_stack()->push(pos_command, tr("Moved %1 Node(s)").arg(selected_nodes_.size()));
break; break;
} }
case Qt::Key_Escape: case Qt::Key_Escape:
@@ -579,9 +581,10 @@ void NodeView::mouseReleaseEvent(QMouseEvent *event)
command->add_child(new NodeSetPositionCommand(i->GetNode(), i->GetContext(), current_pos)); command->add_child(new NodeSetPositionCommand(i->GetNode(), i->GetContext(), current_pos));
} }
} }
dragging_items_.clear();
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Moved %1 Node(s)").arg(dragging_items_.size()));
dragging_items_.clear();
if (!had_attached_items) { if (!had_attached_items) {
super::mouseReleaseEvent(event); super::mouseReleaseEvent(event);
@@ -674,7 +677,7 @@ void NodeView::dropEvent(QDropEvent *event)
if (Node *drop_ctx = GetContextAtMousePos(event->pos())) { if (Node *drop_ctx = GetContextAtMousePos(event->pos())) {
MultiUndoCommand *command = new MultiUndoCommand(); MultiUndoCommand *command = new MultiUndoCommand();
QVector<Node*> select_nodes = ProcessDroppingAttachedNodes(command, drop_ctx, event->pos()); QVector<Node*> select_nodes = ProcessDroppingAttachedNodes(command, drop_ctx, event->pos());
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Dropped %1 Node(s)").arg(select_nodes.size()));
DeselectAll(); DeselectAll();
scene_.context_map().value(drop_ctx)->Select(select_nodes); scene_.context_map().value(drop_ctx)->Select(select_nodes);
@@ -1431,7 +1434,7 @@ void NodeView::GroupNodes()
// Do command // Do command
Core::instance()->LabelNodes({group}, command); Core::instance()->LabelNodes({group}, command);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Grouped Nodes"));
} }
void NodeView::UngroupNodes() void NodeView::UngroupNodes()
@@ -1466,7 +1469,7 @@ void NodeView::UngroupNodes()
command->add_child(new NodeSetPositionCommand(it.key(), context, group->GetNodePositionDataInContext(it.key()))); command->add_child(new NodeSetPositionCommand(it.key(), context, group->GetNodePositionDataInContext(it.key())));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Ungrouped Nodes"));
} }
void NodeView::ShowNodeProperties() void NodeView::ShowNodeProperties()
@@ -1622,6 +1625,8 @@ void NodeView::EndEdgeDrag(bool cancel)
create_edge_input_item_->SetHighlighted(false); create_edge_input_item_->SetHighlighted(false);
} }
QString command_name;
NodeInput &creating_input = create_edge_input_; NodeInput &creating_input = create_edge_input_;
if (create_edge_output_item_ && create_edge_input_item_ && !cancel) { if (create_edge_output_item_ && create_edge_input_item_ && !cancel) {
if (creating_input.IsValid()) { if (creating_input.IsValid()) {
@@ -1658,6 +1663,8 @@ void NodeView::EndEdgeDrag(bool cancel)
if (!cancel) { if (!cancel) {
command->add_child(new NodeEdgeAddCommand(creating_output, creating_input)); command->add_child(new NodeEdgeAddCommand(creating_output, creating_input));
command_name = Node::GetConnectCommandString(creating_output, creating_input);
// If the output is not in the input's context, add it now. We check the item rather than // If the output is not in the input's context, add it now. We check the item rather than
// the node itself, because sometimes a node may not be in the context but another node // the node itself, because sometimes a node may not be in the context but another node
// representing it will be (e.g. groups) // representing it will be (e.g. groups)
@@ -1680,7 +1687,7 @@ void NodeView::EndEdgeDrag(bool cancel)
} }
create_edge_expanded_items_.clear(); create_edge_expanded_items_.clear();
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, command_name);
} }
void NodeView::PostPaste(const QVector<Node *> &new_nodes, const Node::PositionMap &map) void NodeView::PostPaste(const QVector<Node *> &new_nodes, const Node::PositionMap &map)
+6 -1
View File
@@ -191,8 +191,10 @@ void NodeViewContext::SetCurvedEdges(bool e)
} }
} }
void NodeViewContext::DeleteSelected(NodeViewDeleteCommand *command) int NodeViewContext::DeleteSelected(NodeViewDeleteCommand *command)
{ {
int count = 0;
// Delete any selected edges // Delete any selected edges
foreach (NodeViewEdge *edge, edges_) { foreach (NodeViewEdge *edge, edges_) {
if (edge->isSelected()) { if (edge->isSelected()) {
@@ -204,8 +206,11 @@ void NodeViewContext::DeleteSelected(NodeViewDeleteCommand *command)
foreach (NodeViewItem *node, item_map_) { foreach (NodeViewItem *node, item_map_) {
if (node->isSelected()) { if (node->isSelected()) {
command->AddNode(node->GetNode(), context_); command->AddNode(node->GetNode(), context_);
count++;
} }
} }
return count;
} }
void NodeViewContext::Select(const QVector<Node *> &nodes) void NodeViewContext::Select(const QVector<Node *> &nodes)
+1 -1
View File
@@ -30,7 +30,7 @@ public:
void SetCurvedEdges(bool e); void SetCurvedEdges(bool e);
void DeleteSelected(NodeViewDeleteCommand *command); int DeleteSelected(NodeViewDeleteCommand *command);
void Select(const QVector<Node*> &nodes); void Select(const QVector<Node*> &nodes);
@@ -487,7 +487,7 @@ void ProjectExplorer::ReplaceSelectedFootage()
p->add_child(new NodeRenameCommand(footage, QFileInfo(file).fileName())); p->add_child(new NodeRenameCommand(footage, QFileInfo(file).fileName()));
} }
Core::instance()->undo_stack()->push(p); Core::instance()->undo_stack()->push(p, tr("Replaced Footage"));
} }
} }
@@ -666,7 +666,7 @@ void ProjectExplorer::DeleteSelected()
bool check_if_item_is_in_use = true; bool check_if_item_is_in_use = true;
if (DeleteItemsInternal(selected, check_if_item_is_in_use, command)) { if (DeleteItemsInternal(selected, check_if_item_is_in_use, command)) {
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Deleted %1 Item(s)").arg(selected.size()));
} else { } else {
delete command; delete command;
} }
@@ -236,7 +236,7 @@ bool ProjectViewModel::setData(const QModelIndex &index, const QVariant &value,
nrc->AddNode(item, value.toString()); nrc->AddNode(item, value.toString());
Core::instance()->undo_stack()->push(nrc); Core::instance()->undo_stack()->push(nrc, tr("Renamed Item \"%1\" to \"%2\"").arg(item->GetLabel(), new_name));
return true; return true;
} }
@@ -357,7 +357,7 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action
// Loop through all data // Loop through all data
MultiUndoCommand* move_command = new MultiUndoCommand(); MultiUndoCommand* move_command = new MultiUndoCommand();
move_command->set_name(tr("Move Items")); int count = 0;
while (!stream.atEnd()) { while (!stream.atEnd()) {
stream >> streams >> item_ptr; stream >> streams >> item_ptr;
@@ -371,10 +371,11 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action
&& (!dynamic_cast<Folder*>(item) || !ItemIsParentOfChild(static_cast<Folder*>(item), drop_location))) { && (!dynamic_cast<Folder*>(item) || !ItemIsParentOfChild(static_cast<Folder*>(item), drop_location))) {
move_command->add_child(new NodeEdgeRemoveCommand(item, NodeInput(item->folder(), Folder::kChildInput, item->folder()->index_of_child_in_array(item)))); move_command->add_child(new NodeEdgeRemoveCommand(item, NodeInput(item->folder(), Folder::kChildInput, item->folder()->index_of_child_in_array(item))));
move_command->add_child(new FolderAddChild(drop_location, item)); move_command->add_child(new FolderAddChild(drop_location, item));
count++;
} }
} }
Core::instance()->undo_stack()->push(move_command); Core::instance()->undo_stack()->push(move_command, tr("Move %1 Item(s)").arg(count));
return true; return true;
+4 -4
View File
@@ -558,7 +558,7 @@ void TimeBasedWidget::SetPoint(Timeline::MovementMode m, const rational& time)
// Set workarea // Set workarea
command->add_child(new WorkareaSetRangeCommand(points, TimeRange(in_point, out_point))); command->add_child(new WorkareaSetRangeCommand(points, TimeRange(in_point, out_point)));
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set In/Out Point"));
} }
void TimeBasedWidget::ResetPoint(Timeline::MovementMode m) void TimeBasedWidget::ResetPoint(Timeline::MovementMode m)
@@ -581,7 +581,7 @@ void TimeBasedWidget::ResetPoint(Timeline::MovementMode m)
r.set_out(TimelineWorkArea::kResetOut); r.set_out(TimelineWorkArea::kResetOut);
} }
Core::instance()->undo_stack()->push(new WorkareaSetRangeCommand(points, r)); Core::instance()->undo_stack()->push(new WorkareaSetRangeCommand(points, r), tr("Reset In/Out Points"));
} }
void TimeBasedWidget::PageScrollInternal(QScrollBar *bar, int maximum, int screen_position, bool whole_page_scroll) void TimeBasedWidget::PageScrollInternal(QScrollBar *bar, int maximum, int screen_position, bool whole_page_scroll)
@@ -648,7 +648,7 @@ void TimeBasedWidget::ClearInOutPoints()
return; return;
} }
Core::instance()->undo_stack()->push(new WorkareaSetEnabledCommand(GetConnectedNode()->project(), GetConnectedNode()->GetWorkArea(), false)); Core::instance()->undo_stack()->push(new WorkareaSetEnabledCommand(GetConnectedNode()->project(), GetConnectedNode()->GetWorkArea(), false), tr("Cleared In/Out Points"));
} }
void TimeBasedWidget::SetMarker() void TimeBasedWidget::SetMarker()
@@ -685,7 +685,7 @@ void TimeBasedWidget::SetMarker()
} }
if (marker) { if (marker) {
Core::instance()->undo_stack()->push(new MarkerAddCommand(markers, marker)); Core::instance()->undo_stack()->push(new MarkerAddCommand(markers, marker), tr("Added Marker"));
} }
} }
} }
+20 -20
View File
@@ -451,7 +451,7 @@ void TimelineWidget::SplitAtPlayhead()
} }
if (!blocks_to_split.isEmpty()) { if (!blocks_to_split.isEmpty()) {
Core::instance()->undo_stack()->push(new BlockSplitPreservingLinksCommand(blocks_to_split, {playhead_time})); Core::instance()->undo_stack()->push(new BlockSplitPreservingLinksCommand(blocks_to_split, {playhead_time}), tr("Split Clips At Playhead"));
} }
} }
@@ -545,7 +545,7 @@ void TimelineWidget::DeleteSelected(bool ripple)
command->add_child(ripple_command); command->add_child(ripple_command);
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Deleted Clips"));
// Ensures any current drag operations are cancelled // Ensures any current drag operations are cancelled
ClearGhosts(); ClearGhosts();
@@ -583,14 +583,14 @@ void TimelineWidget::InsertFootageAtPlayhead(const QVector<ViewerOutput*>& foota
{ {
auto command = new MultiUndoCommand(); auto command = new MultiUndoCommand();
import_tool_->PlaceAt(footage, GetConnectedNode()->GetPlayhead(), true, command, 0, true); import_tool_->PlaceAt(footage, GetConnectedNode()->GetPlayhead(), true, command, 0, true);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Inserted Footage At Playhead"));
} }
void TimelineWidget::OverwriteFootageAtPlayhead(const QVector<ViewerOutput *> &footage) void TimelineWidget::OverwriteFootageAtPlayhead(const QVector<ViewerOutput *> &footage)
{ {
auto command = new MultiUndoCommand(); auto command = new MultiUndoCommand();
import_tool_->PlaceAt(footage, GetConnectedNode()->GetPlayhead(), false, command, 0, true); import_tool_->PlaceAt(footage, GetConnectedNode()->GetPlayhead(), false, command, 0, true);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Overwrote Footage At Playhead"));
} }
void TimelineWidget::ToggleLinksOnSelected() void TimelineWidget::ToggleLinksOnSelected()
@@ -616,7 +616,7 @@ void TimelineWidget::ToggleLinksOnSelected()
return; return;
} }
Core::instance()->undo_stack()->push(new NodeLinkManyCommand(blocks, link)); Core::instance()->undo_stack()->push(new NodeLinkManyCommand(blocks, link), tr("Linked Clips"));
} }
void TimelineWidget::AddDefaultTransitionsToSelected() void TimelineWidget::AddDefaultTransitionsToSelected()
@@ -631,7 +631,7 @@ void TimelineWidget::AddDefaultTransitionsToSelected()
} }
if (!blocks.isEmpty()) { if (!blocks.isEmpty()) {
Core::instance()->undo_stack()->push(new TimelineAddDefaultTransitionCommand(blocks, timebase())); Core::instance()->undo_stack()->push(new TimelineAddDefaultTransitionCommand(blocks, timebase()), tr("Added Default Transitions"));
} }
} }
@@ -755,7 +755,7 @@ void TimelineWidget::DeleteInToOut(bool ripple)
GetConnectedNode()->SetPlayhead(GetConnectedNode()->GetWorkArea()->in()); GetConnectedNode()->SetPlayhead(GetConnectedNode()->GetWorkArea()->in());
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Deleted In To Out"));
} }
void TimelineWidget::ToggleSelectedEnabled() void TimelineWidget::ToggleSelectedEnabled()
@@ -773,7 +773,7 @@ void TimelineWidget::ToggleSelectedEnabled()
!i->is_enabled())); !i->is_enabled()));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Toggled Clips Enabled"));
} }
void TimelineWidget::SetColorLabel(int index) void TimelineWidget::SetColorLabel(int index)
@@ -784,7 +784,7 @@ void TimelineWidget::SetColorLabel(int index)
command->add_child(new NodeOverrideColorCommand(b, index)); command->add_child(new NodeOverrideColorCommand(b, index));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set Colors of %1 Clips").arg(selected_blocks_.size()));
} }
void TimelineWidget::NudgeLeft() void TimelineWidget::NudgeLeft()
@@ -845,7 +845,7 @@ void TimelineWidget::RecordingCallback(const QString &filename, const TimeRange
import_command->add_child(subimport_command); import_command->add_child(subimport_command);
import_tool_->PlaceAt({task.GetImportedFootage().front()}, time.in(), false, import_command, track.index()); import_tool_->PlaceAt({task.GetImportedFootage().front()}, time.in(), false, import_command, track.index());
Core::instance()->undo_stack()->push(import_command); Core::instance()->undo_stack()->push(import_command, tr("Recorded Audio Clip"));
} }
} }
@@ -977,7 +977,7 @@ void TimelineWidget::NestSelectedClips()
// Place new sequence in this sequence // Place new sequence in this sequence
import_tool_->PlaceAt({nest}, start_time, false, meta_command, index); import_tool_->PlaceAt({nest}, start_time, false, meta_command, index);
Core::instance()->undo_stack()->push(meta_command); Core::instance()->undo_stack()->push(meta_command, tr("Nested Clips"));
} }
void TimelineWidget::ClearTentativeSubtitleTrack() void TimelineWidget::ClearTentativeSubtitleTrack()
@@ -1452,7 +1452,7 @@ void TimelineWidget::RenameSelectedBlocks()
} }
Core::instance()->LabelNodes(nodes); Core::instance()->LabelNodes(nodes);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Renamed %1 Clip(s)").arg(nodes.size()));
} }
void TimelineWidget::TrackAboutToBeDeleted(Track *track) void TimelineWidget::TrackAboutToBeDeleted(Track *track)
@@ -1461,7 +1461,7 @@ void TimelineWidget::TrackAboutToBeDeleted(Track *track)
// User is deleting the tentative subtitle track. Technically they shouldn't do this, but they // User is deleting the tentative subtitle track. Technically they shouldn't do this, but they
// might if they misinterpret it as permanent. If so, we handle it cleanly by pushing our // might if they misinterpret it as permanent. If so, we handle it cleanly by pushing our
// command as if the action really were permanent. // command as if the action really were permanent.
Core::instance()->undo_stack()->push(TakeSubtitleSectionCommand()); Core::instance()->undo_stack()->push(TakeSubtitleSectionCommand(), tr("Created Subtitle Track"));
} }
} }
@@ -1475,7 +1475,7 @@ void TimelineWidget::SetSelectedClipsAutocaching(bool e)
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, e ? tr("Enabled Auto-Caching On %1 Clip(s)").arg(selected_blocks_.size()) : tr("Disabled Auto-Caching On %1 Clip(s)").arg(selected_blocks_.size()));
} }
void TimelineWidget::CacheClips() void TimelineWidget::CacheClips()
@@ -1574,7 +1574,7 @@ void TimelineWidget::MulticamEnabledTriggered(bool e)
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, e ? tr("Multi-Cam Enabled On %1 Clip(s)").arg(selected_blocks_.size()) : tr("Multi-Cam Disabled On %1 Clip(s)").arg(selected_blocks_.size()));
} }
void TimelineWidget::ForceUpdateRubberBand() void TimelineWidget::ForceUpdateRubberBand()
@@ -1633,7 +1633,7 @@ void TimelineWidget::NudgeInternal(rational amount)
new_sel.ShiftTime(amount); new_sel.ShiftTime(amount);
command->add_child(new TimelineWidget::SetSelectionsCommand(this, new_sel, GetSelections())); command->add_child(new TimelineWidget::SetSelectionsCommand(this, new_sel, GetSelections()));
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Nudged Clips"));
} }
} }
@@ -1685,7 +1685,7 @@ void TimelineWidget::MoveToPlayheadInternal(bool out)
} }
command->add_child(new SetSelectionsCommand(this, new_sel, GetSelections())); command->add_child(new SetSelectionsCommand(this, new_sel, GetSelections()));
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Moved Clip(s) To Point"));
} }
} }
@@ -1875,7 +1875,7 @@ void TimelineWidget::RippleTo(Timeline::MovementMode mode)
in_ripple, in_ripple,
out_ripple); out_ripple);
Core::instance()->undo_stack()->push(c); Core::instance()->undo_stack()->push(c, tr("Rippled Clip(s) To Point"));
// If we rippled, ump to where new cut is if applicable // If we rippled, ump to where new cut is if applicable
if (mode == Timeline::kTrimIn) { if (mode == Timeline::kTrimIn) {
@@ -1918,7 +1918,7 @@ void TimelineWidget::EditTo(Timeline::MovementMode mode)
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Cut Clip(s) To Point"));
} }
void TimelineWidget::UpdateViewports(const Track::Type &type) void TimelineWidget::UpdateViewports(const Track::Type &type)
@@ -1986,7 +1986,7 @@ bool TimelineWidget::PasteInternal(bool insert)
paste_start + in)); paste_start + in));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Pasted %1 Clip(s)").arg(res.GetLoadData().properties.size()));
return true; return true;
} }
+1 -1
View File
@@ -114,7 +114,7 @@ void AddTool::MouseRelease(TimelineViewMouseEvent *event)
CreateAddableClip(command, s, ghost_->GetTrack(), ghost_->GetAdjustedIn(), ghost_->GetAdjustedLength(), r); CreateAddableClip(command, s, ghost_->GetTrack(), ghost_->GetAdjustedIn(), ghost_->GetAdjustedLength(), r);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, qApp->translate("AddTool", "Added Clip"));
} }
parent()->ClearGhosts(); parent()->ClearGhosts();
+1 -1
View File
@@ -184,7 +184,7 @@ void ImportTool::DragDrop(TimelineViewMouseEvent *event)
if (!dragged_footage_.isEmpty()) { if (!dragged_footage_.isEmpty()) {
auto command = new MultiUndoCommand(); auto command = new MultiUndoCommand();
DropGhosts(event->GetModifiers() & Qt::ControlModifier, command); DropGhosts(event->GetModifiers() & Qt::ControlModifier, command);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, qApp->translate("ImportTool", "Dropped Footage Into Sequence"));
event->accept(); event->accept();
} else { } else {
+1 -1
View File
@@ -815,7 +815,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, qApp->translate("PointerTool", "Moved Clips"));
} }
Timeline::MovementMode PointerTool::IsCursorInTrimHandle(Block *block, qreal cursor_x) Timeline::MovementMode PointerTool::IsCursorInTrimHandle(Block *block, qreal cursor_x)
+1 -1
View File
@@ -93,7 +93,7 @@ void RazorTool::MouseRelease(TimelineViewMouseEvent *event)
split_tracks_.clear(); split_tracks_.clear();
if (!blocks_to_split.isEmpty()) { if (!blocks_to_split.isEmpty()) {
Core::instance()->undo_stack()->push(new BlockSplitPreservingLinksCommand(blocks_to_split, {split_time})); Core::instance()->undo_stack()->push(new BlockSplitPreservingLinksCommand(blocks_to_split, {split_time}), qApp->translate("RazorTool", "Split Clips"));
} }
dragging_ = false; dragging_ = false;
+1 -1
View File
@@ -169,7 +169,7 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
} }
command->add_child(new TimelineWidget::SetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), false)); command->add_child(new TimelineWidget::SetSelectionsCommand(parent(), new_sel, parent()->GetSelections(), false));
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, qApp->translate("RippleTool", "Rippled Clips"));
} else { } else {
delete command; delete command;
} }
+1 -1
View File
@@ -80,7 +80,7 @@ void SlipTool::FinishDrag(TimelineViewMouseEvent *event)
} }
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, qApp->translate("SlipTool", "Slipped %1 Clip(s)").arg(parent()->GetGhostItems().size()));
} }
} }
@@ -157,7 +157,7 @@ void TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
command->add_child(new NodeSetPositionCommand(block_to_transition, transition, QPointF(-1, 0))); command->add_child(new NodeSetPositionCommand(block_to_transition, transition, QPointF(-1, 0)));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, qApp->translate("TransitionTool", "Created Transition"));
parent()->SetViewTransitionOverlay(nullptr, nullptr); parent()->SetViewTransitionOverlay(nullptr, nullptr);
} }
@@ -146,7 +146,7 @@ void TrackViewItem::ShowContextMenu(const QPoint &p)
void TrackViewItem::DeleteTrack() void TrackViewItem::DeleteTrack()
{ {
emit AboutToDeleteTrack(track_); emit AboutToDeleteTrack(track_);
Core::instance()->undo_stack()->push(new TimelineRemoveTrackCommand(track_)); Core::instance()->undo_stack()->push(new TimelineRemoveTrackCommand(track_), tr("Deleted Track \"%1\"").arg(track_->GetLabelOrName()));
} }
void TrackViewItem::DeleteAllEmptyTracks() void TrackViewItem::DeleteAllEmptyTracks()
@@ -172,7 +172,7 @@ void TrackViewItem::DeleteAllEmptyTracks()
foreach (Track *track, tracks_to_remove) { foreach (Track *track, tracks_to_remove) {
command->add_child(new TimelineRemoveTrackCommand(track)); command->add_child(new TimelineRemoveTrackCommand(track));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Deleted All Empty Tracks"));
} }
} }
} }
+9 -5
View File
@@ -116,7 +116,7 @@ void SeekableWidget::DeleteSelected()
command->add_child(new MarkerRemoveCommand(marker)); command->add_child(new MarkerRemoveCommand(marker));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Deleted %1 Marker(s)").arg(selection_manager_.GetSelectedObjects().size()));
} }
} }
@@ -165,7 +165,7 @@ bool SeekableWidget::PasteMarkers()
command->add_child(new MarkerAddCommand(markers_, m)); command->add_child(new MarkerAddCommand(markers_, m));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Pasted %1 Marker(s)").arg(markers.size()));
return true; return true;
} }
} }
@@ -249,7 +249,7 @@ void SeekableWidget::mouseReleaseEvent(QMouseEvent *event)
if (selection_manager_.IsDragging()) { if (selection_manager_.IsDragging()) {
MultiUndoCommand *command = new MultiUndoCommand(); MultiUndoCommand *command = new MultiUndoCommand();
selection_manager_.DragStop(command); selection_manager_.DragStop(command);
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Moved %1 Marker(s)").arg(selection_manager_.GetSelectedObjects().size()));
} }
if (GetSnapService()) { if (GetSnapService()) {
@@ -364,7 +364,7 @@ void SeekableWidget::SetMarkerColor(int c)
command->add_child(new MarkerChangeColorCommand(marker, c)); command->add_child(new MarkerChangeColorCommand(marker, c));
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Changed Color of %1 Marker(s)").arg(selection_manager_.GetSelectedObjects().size()));
} }
void SeekableWidget::ShowMarkerProperties() void SeekableWidget::ShowMarkerProperties()
@@ -608,13 +608,17 @@ void SeekableWidget::CommitResizeHandle()
{ {
MultiUndoCommand *command = new MultiUndoCommand(); MultiUndoCommand *command = new MultiUndoCommand();
QString command_name;
if (TimelineMarker *marker = dynamic_cast<TimelineMarker*>(resize_item_)) { if (TimelineMarker *marker = dynamic_cast<TimelineMarker*>(resize_item_)) {
command->add_child(new MarkerChangeTimeCommand(marker, marker->time(), resize_item_range_)); command->add_child(new MarkerChangeTimeCommand(marker, marker->time(), resize_item_range_));
command_name = tr("Changed Marker Length");
} else if (TimelineWorkArea *workarea = dynamic_cast<TimelineWorkArea*>(resize_item_)) { } else if (TimelineWorkArea *workarea = dynamic_cast<TimelineWorkArea*>(resize_item_)) {
command->add_child(new WorkareaSetRangeCommand(workarea, workarea->range(), resize_item_range_)); command->add_child(new WorkareaSetRangeCommand(workarea, workarea->range(), resize_item_range_));
command_name = tr("Changed Workarea Length");
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, command_name);
} }
} }
+2 -2
View File
@@ -557,7 +557,7 @@ void ViewerWidget::CreateAddableAt(const QRectF &f)
shape->SetRect(f, s->GetVideoParams(), command); shape->SetRect(f, s->GetVideoParams(), command);
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Created Shape"));
SetGizmos(clip); SetGizmos(clip);
} }
} }
@@ -1235,7 +1235,7 @@ void ViewerWidget::ContextMenuSetPlaybackRes(QAction *action)
vp.set_divider(div); vp.set_divider(div);
auto c = new NodeParamSetStandardValueCommand(NodeKeyframeTrackReference(NodeInput(GetConnectedNode(), ViewerOutput::kVideoParamsInput, 0)), QVariant::fromValue(vp)); auto c = new NodeParamSetStandardValueCommand(NodeKeyframeTrackReference(NodeInput(GetConnectedNode(), ViewerOutput::kVideoParamsInput, 0)), QVariant::fromValue(vp));
Core::instance()->undo_stack()->push(c); Core::instance()->undo_stack()->push(c, tr("Changed Playback Resolution"));
} }
void ViewerWidget::ContextMenuDisableSafeMargins() void ViewerWidget::ContextMenuDisableSafeMargins()
+1 -1
View File
@@ -946,7 +946,7 @@ bool ViewerDisplayWidget::OnMouseRelease(QMouseEvent *e)
if (DraggableGizmo *draggable = dynamic_cast<DraggableGizmo*>(current_gizmo_)) { if (DraggableGizmo *draggable = dynamic_cast<DraggableGizmo*>(current_gizmo_)) {
draggable->DragEnd(command); draggable->DragEnd(command);
} }
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Dragged Gizmo"));
gizmo_drag_started_ = false; gizmo_drag_started_ = false;
} }
current_gizmo_ = nullptr; current_gizmo_ = nullptr;
+1 -1
View File
@@ -535,7 +535,7 @@ void MainWindow::RevealViewerInFootageViewer(ViewerOutput *r, const TimeRange &r
command->add_child(new WorkareaSetEnabledCommand(r->project(), r->GetWorkArea(), true)); command->add_child(new WorkareaSetEnabledCommand(r->project(), r->GetWorkArea(), true));
} }
command->add_child(new WorkareaSetRangeCommand(r->GetWorkArea(), range)); command->add_child(new WorkareaSetRangeCommand(r->GetWorkArea(), range));
Core::instance()->undo_stack()->push(command); Core::instance()->undo_stack()->push(command, tr("Set Footage Workarea"));
r->SetPlayhead(range.in()); r->SetPlayhead(range.in());
} }