diff --git a/app/core.cpp b/app/core.cpp index dae6b1273..e27cb4e77 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -419,7 +419,7 @@ void Core::CreateNewFolder() command->add_child(new NodeAddCommand(active_project, 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 active_project_panel->Edit(new_folder); @@ -456,7 +456,7 @@ void Core::CreateNewSequence() // Create and connect default nodes to new sequence new_sequence->add_default_nodes(command); - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Created New Sequence")); } else { @@ -575,7 +575,7 @@ void Core::ImportTaskComplete(Task* task) 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()); } @@ -1413,7 +1413,7 @@ bool Core::LabelNodes(const QVector &nodes, MultiUndoCommand *parent) if (parent) { parent->add_child(rename_command); } else { - undo_stack_.push(rename_command); + undo_stack_.push(rename_command, tr("Renamed %1 Node(s)").arg(nodes.size())); } return true; diff --git a/app/dialog/configbase/configdialogbase.cpp b/app/dialog/configbase/configdialogbase.cpp index 1d10e099e..152d5979a 100644 --- a/app/dialog/configbase/configdialogbase.cpp +++ b/app/dialog/configbase/configdialogbase.cpp @@ -73,7 +73,7 @@ void ConfigDialogBase::accept() tab->Accept(command); } - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Set Configuration")); AcceptEvent(); diff --git a/app/dialog/footageproperties/footageproperties.cpp b/app/dialog/footageproperties/footageproperties.cpp index aaf34bc06..02c355561 100644 --- a/app/dialog/footageproperties/footageproperties.cpp +++ b/app/dialog/footageproperties/footageproperties.cpp @@ -192,7 +192,7 @@ void FootagePropertiesDialog::accept() static_cast(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(); } diff --git a/app/dialog/keyframeproperties/keyframeproperties.cpp b/app/dialog/keyframeproperties/keyframeproperties.cpp index 39311f5e7..fb508e07a 100644 --- a/app/dialog/keyframeproperties/keyframeproperties.cpp +++ b/app/dialog/keyframeproperties/keyframeproperties.cpp @@ -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(); } diff --git a/app/dialog/markerproperties/markerpropertiesdialog.cpp b/app/dialog/markerproperties/markerpropertiesdialog.cpp index db6ce01ad..5d215eefe 100644 --- a/app/dialog/markerproperties/markerpropertiesdialog.cpp +++ b/app/dialog/markerproperties/markerpropertiesdialog.cpp @@ -147,7 +147,7 @@ void MarkerPropertiesDialog::accept() 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(); } diff --git a/app/dialog/sequence/sequence.cpp b/app/dialog/sequence/sequence.cpp index dd8a65c7c..d6a109f1c 100644 --- a/app/dialog/sequence/sequence.cpp +++ b/app/dialog/sequence/sequence.cpp @@ -151,7 +151,7 @@ void SequenceDialog::accept() name_field_->text(), 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 { // Set sequence values directly with no undo command diff --git a/app/dialog/speedduration/speeddurationdialog.cpp b/app/dialog/speedduration/speeddurationdialog.cpp index 818952024..367fae059 100644 --- a/app/dialog/speedduration/speeddurationdialog.cpp +++ b/app/dialog/speedduration/speeddurationdialog.cpp @@ -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(); } diff --git a/app/node/generator/text/textv3.cpp b/app/node/generator/text/textv3.cpp index ea1ad9d55..986e2f754 100644 --- a/app/node/generator/text/textv3.cpp +++ b/app/node/generator/text/textv3.cpp @@ -275,7 +275,7 @@ void TextGeneratorV3::GizmoDeactivated() 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")); } } diff --git a/app/node/gizmo/text.cpp b/app/node/gizmo/text.cpp index 5212a884f..04223a83d 100644 --- a/app/node/gizmo/text.cpp +++ b/app/node/gizmo/text.cpp @@ -43,7 +43,7 @@ void TextGizmo::UpdateInputHtml(const QString &s, const rational &time) if (input_.IsValid()) { MultiUndoCommand *command = new MultiUndoCommand(); 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")); } } diff --git a/app/node/node.cpp b/app/node/node.cpp index 61a366ddb..9930aa7e1 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -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) { return array_immediates_.value(input).size(); diff --git a/app/node/node.h b/app/node/node.h index 129b240fe..6058122de 100644 --- a/app/node/node.h +++ b/app/node/node.h @@ -980,6 +980,9 @@ public: virtual void AddedToGraphEvent(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; protected: diff --git a/app/node/param.cpp b/app/node/param.cpp index 431ce31ff..456648f50 100644 --- a/app/node/param.cpp +++ b/app/node/param.cpp @@ -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 { if (IsValid()) { diff --git a/app/node/param.h b/app/node/param.h index ae3a804e8..60a90e33d 100644 --- a/app/node/param.h +++ b/app/node/param.h @@ -258,6 +258,8 @@ public: InputFlags GetFlags() const; + QString GetInputName() const; + Node *GetConnectedOutput() const; NodeValue::Type GetDataType() const; diff --git a/app/undo/undocommand.h b/app/undo/undocommand.h index 196531150..183c5bc7a 100644 --- a/app/undo/undocommand.h +++ b/app/undo/undocommand.h @@ -51,16 +51,6 @@ public: virtual Project* GetRelevantProject() const = 0; - const QString& name() const - { - return name_; - } - - void set_name(const QString& name) - { - name_ = name; - } - protected: virtual void prepare(){} virtual void redo() = 0; @@ -69,8 +59,6 @@ protected: private: bool modified_; - QString name_; - Project* project_; bool prepared_; diff --git a/app/undo/undostack.cpp b/app/undo/undostack.cpp index 8cf317a28..ec7f39f76 100644 --- a/app/undo/undostack.cpp +++ b/app/undo/undostack.cpp @@ -59,7 +59,7 @@ UndoStack::~UndoStack() delete redo_action_; } -void UndoStack::push(UndoCommand *command) +void UndoStack::push(UndoCommand *command, const QString &name) { MultiUndoCommand *mcu = dynamic_cast(command); 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()); if (CanRedo()) { for (auto it=undone_commands_.cbegin(); it!=undone_commands_.cend(); it++) { - delete (*it); + delete (*it).command; } undone_commands_.clear(); } @@ -80,13 +80,13 @@ void UndoStack::push(UndoCommand *command) // Do command and push this->beginInsertRows(QModelIndex(), commands_.size(), commands_.size()); command->redo_and_set_modified(); - commands_.push_back(command); + commands_.push_back({command, name}); this->endInsertRows(); // Delete oldest if (commands_.size() > kMaxUndoCommands) { this->beginRemoveRows(QModelIndex(), 0, 0); - delete commands_.front(); + delete commands_.front().command; commands_.pop_front(); this->endRemoveRows(); } @@ -108,7 +108,7 @@ void UndoStack::undo() { if (CanUndo()) { // 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 undone_commands_.push_front(commands_.back()); @@ -125,7 +125,7 @@ void UndoStack::redo() { if (CanRedo()) { // 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 commands_.push_back(undone_commands_.front()); @@ -143,24 +143,22 @@ void UndoStack::clear() this->beginResetModel(); for (auto it=commands_.cbegin(); it!=commands_.cend(); it++) { - delete (*it); + delete (*it).command; } commands_.clear(); for (auto it=undone_commands_.cbegin(); it!=undone_commands_.cend(); it++) { - delete (*it); + delete (*it).command; } undone_commands_.clear(); this->endResetModel(); - EmptyCommand *e = new EmptyCommand(); - e->set_name(tr("New/Open Project")); - push(e); + push(new EmptyCommand(), tr("New/Open Project")); } bool UndoStack::CanUndo() const { - return !commands_.empty() && !dynamic_cast(commands_.back()); + return !commands_.empty() && !dynamic_cast(commands_.back().command); } void UndoStack::UpdateActions() @@ -168,8 +166,8 @@ void UndoStack::UpdateActions() undo_action_->setEnabled(CanUndo()); redo_action_->setEnabled(CanRedo()); - 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())); + 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())); emit indexChanged(commands_.size()); } @@ -190,7 +188,7 @@ QVariant UndoStack::data(const QModelIndex &index, int role) const return index.row() + 1; case 1: { - std::list::const_iterator it; + std::list::const_iterator it; size_t real_index = index.row(); if (real_index < commands_.size()) { 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++) { it++; } - const QString &name = (*it)->name(); - return (name.isEmpty()) ? QStringLiteral("Command") : name; + const QString &name = (*it).name; + return (name.isEmpty()) ? tr("Command") : name; } } } else if (role == Qt::ForegroundRole) { diff --git a/app/undo/undostack.h b/app/undo/undostack.h index 46e31d998..71928b17f 100644 --- a/app/undo/undostack.h +++ b/app/undo/undostack.h @@ -37,7 +37,7 @@ public: virtual ~UndoStack() override; - void push(UndoCommand* command); + void push(UndoCommand* command, const QString &name); void jump(size_t index); @@ -81,9 +81,15 @@ public slots: private: static const int kMaxUndoCommands; - std::list commands_; + struct CommandEntry + { + UndoCommand *command; + QString name; + }; - std::list undone_commands_; + std::list commands_; + + std::list undone_commands_; QAction* undo_action_; diff --git a/app/widget/curvewidget/curveview.cpp b/app/widget/curvewidget/curveview.cpp index 81d00bf2e..a49482057 100644 --- a/app/widget/curvewidget/curveview.cpp +++ b/app/widget/curvewidget/curveview.cpp @@ -401,7 +401,7 @@ void CurveView::FirstChanceMouseRelease(QMouseEvent *event) 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) diff --git a/app/widget/curvewidget/curvewidget.cpp b/app/widget/curvewidget/curvewidget.cpp index ca69773ec..836984a0c 100644 --- a/app/widget/curvewidget/curvewidget.cpp +++ b/app/widget/curvewidget/curvewidget.cpp @@ -330,7 +330,7 @@ void CurveWidget::KeyframeTypeButtonTriggered(bool checked) 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) diff --git a/app/widget/keyframeview/keyframeview.cpp b/app/widget/keyframeview/keyframeview.cpp index c9c103b3d..b1b93a5ba 100644 --- a/app/widget/keyframeview/keyframeview.cpp +++ b/app/widget/keyframeview/keyframeview.cpp @@ -61,7 +61,7 @@ void KeyframeView::DeleteSelected() 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 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; } @@ -319,7 +319,7 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent *event) MultiUndoCommand* command = new MultiUndoCommand(); selection_manager_.DragStop(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()) { selection_manager_.RubberBandStop(); Redraw(); @@ -612,7 +612,7 @@ void KeyframeView::ShowContextMenu() foreach (NodeKeyframe* item, GetSelectedKeyframes()) { 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())); } } } diff --git a/app/widget/multicam/multicamwidget.cpp b/app/widget/multicam/multicamwidget.cpp index 9487b16f3..bd2042e7a 100644 --- a/app/widget/multicam/multicamwidget.cpp +++ b/app/widget/multicam/multicamwidget.cpp @@ -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(); diff --git a/app/widget/nodeparamview/nodeparamview.cpp b/app/widget/nodeparamview/nodeparamview.cpp index f7ec0cbe8..a4aada805 100644 --- a/app/widget/nodeparamview/nodeparamview.cpp +++ b/app/widget/nodeparamview/nodeparamview.cpp @@ -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(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; } diff --git a/app/widget/nodeparamview/nodeparamviewconnectedlabel.cpp b/app/widget/nodeparamview/nodeparamviewconnectedlabel.cpp index c523f7912..370164f5f 100644 --- a/app/widget/nodeparamview/nodeparamviewconnectedlabel.cpp +++ b/app/widget/nodeparamview/nodeparamviewconnectedlabel.cpp @@ -137,7 +137,7 @@ void NodeParamViewConnectedLabel::ShowLabelContextMenu() QAction* disconnect_action = m.addAction(tr("Disconnect")); 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()); diff --git a/app/widget/nodeparamview/nodeparamviewcontext.cpp b/app/widget/nodeparamview/nodeparamviewcontext.cpp index 05a4ee659..477fc7765 100644 --- a/app/widget/nodeparamview/nodeparamviewcontext.cpp +++ b/app/widget/nodeparamview/nodeparamviewcontext.cpp @@ -180,7 +180,7 @@ void NodeParamViewContext::AddEffectMenuItemTriggered(QAction *a) 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())); } } diff --git a/app/widget/nodeparamview/nodeparamviewitem.cpp b/app/widget/nodeparamview/nodeparamviewitem.cpp index 304d80057..76e22da89 100644 --- a/app/widget/nodeparamview/nodeparamviewitem.cpp +++ b/app/widget/nodeparamview/nodeparamviewitem.cpp @@ -458,7 +458,8 @@ void NodeParamViewItemBody::ArrayAppendClicked() for (auto it=array_ui_.cbegin(); it!=array_ui_.cend(); it++) { if (it.value().append_btn == sender()) { 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; } } @@ -470,7 +471,8 @@ void NodeParamViewItemBody::ArrayInsertClicked() if (it.value().array_insert_btn == sender()) { // Found our input and element 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; } } @@ -482,7 +484,8 @@ void NodeParamViewItemBody::ArrayRemoveClicked() if (it.value().array_remove_btn == sender()) { // Found our input and element 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; } } diff --git a/app/widget/nodeparamview/nodeparamviewkeyframecontrol.cpp b/app/widget/nodeparamview/nodeparamviewkeyframecontrol.cpp index 7adfeb085..8d02dad74 100644 --- a/app/widget/nodeparamview/nodeparamviewkeyframecontrol.cpp +++ b/app/widget/nodeparamview/nodeparamviewkeyframecontrol.cpp @@ -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() @@ -228,6 +228,8 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e) MultiUndoCommand* command = new MultiUndoCommand(); + QString command_name; + if (e) { // Enable keyframing 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_name = tr("Enabled Keyframing On %1 - %2").arg(input_.node()->GetLabelAndName(), input_.GetInputName()); } else { // Confirm the user wants to clear all keyframes if (QMessageBox::warning(this, @@ -270,13 +274,14 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e) // Disable keyframing command->add_child(new NodeParamSetKeyframingCommand(input_, false)); + command_name = tr("Disabled Keyframing On %1 - %2").arg(input_.node()->GetLabelAndName(), input_.GetInputName()); } else { // Disable action has effectively been ignored 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) diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp index 37322ed30..585f2526e 100644 --- a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp @@ -190,7 +190,7 @@ void NodeParamViewWidgetBridge::SetInputValue(const QVariant &value, int track) 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) @@ -218,7 +218,7 @@ void NodeParamViewWidgetBridge::ProcessSlider(NumericSliderBase *slider, int sli MultiUndoCommand *command = new MultiUndoCommand(); dragger_.End(command); - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, GetCommandName()); } else { @@ -314,7 +314,7 @@ void NodeParamViewWidgetBridge::WidgetCallback() n->SetInputProperty(GetInnerInput().input(), QStringLiteral("col_look"), c.color_output().look()); n->blockSignals(false); - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, GetCommandName()); break; } 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) { if (GetDataType() == NodeValue::kRational) { diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.h b/app/widget/nodeparamview/nodeparamviewwidgetbridge.h index 457c618c6..cfea84c3f 100644 --- a/app/widget/nodeparamview/nodeparamviewwidgetbridge.h +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.h @@ -93,6 +93,8 @@ private: return input_hierarchy_.last(); } + QString GetCommandName() const; + NodeValue::Type GetDataType() const { return GetOuterInput().GetDataType(); diff --git a/app/widget/nodeview/nodeview.cpp b/app/widget/nodeview/nodeview.cpp index 821c810df..da2c3199f 100644 --- a/app/widget/nodeview/nodeview.cpp +++ b/app/widget/nodeview/nodeview.cpp @@ -141,11 +141,13 @@ void NodeView::DeleteSelected() { NodeViewDeleteCommand* command = new NodeViewDeleteCommand(); + int count = 0; + 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() @@ -356,7 +358,7 @@ void NodeView::SetColorLabel(int 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() @@ -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; } case Qt::Key_Escape: @@ -579,9 +581,10 @@ void NodeView::mouseReleaseEvent(QMouseEvent *event) 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) { super::mouseReleaseEvent(event); @@ -674,7 +677,7 @@ void NodeView::dropEvent(QDropEvent *event) if (Node *drop_ctx = GetContextAtMousePos(event->pos())) { MultiUndoCommand *command = new MultiUndoCommand(); QVector 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(); scene_.context_map().value(drop_ctx)->Select(select_nodes); @@ -1431,7 +1434,7 @@ void NodeView::GroupNodes() // Do command Core::instance()->LabelNodes({group}, command); - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Grouped Nodes")); } void NodeView::UngroupNodes() @@ -1466,7 +1469,7 @@ void NodeView::UngroupNodes() 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() @@ -1622,6 +1625,8 @@ void NodeView::EndEdgeDrag(bool cancel) create_edge_input_item_->SetHighlighted(false); } + QString command_name; + NodeInput &creating_input = create_edge_input_; if (create_edge_output_item_ && create_edge_input_item_ && !cancel) { if (creating_input.IsValid()) { @@ -1658,6 +1663,8 @@ void NodeView::EndEdgeDrag(bool cancel) if (!cancel) { 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 // the node itself, because sometimes a node may not be in the context but another node // representing it will be (e.g. groups) @@ -1680,7 +1687,7 @@ void NodeView::EndEdgeDrag(bool cancel) } create_edge_expanded_items_.clear(); - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, command_name); } void NodeView::PostPaste(const QVector &new_nodes, const Node::PositionMap &map) diff --git a/app/widget/nodeview/nodeviewcontext.cpp b/app/widget/nodeview/nodeviewcontext.cpp index 9f1dbc755..661c53bb8 100644 --- a/app/widget/nodeview/nodeviewcontext.cpp +++ b/app/widget/nodeview/nodeviewcontext.cpp @@ -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 foreach (NodeViewEdge *edge, edges_) { if (edge->isSelected()) { @@ -204,8 +206,11 @@ void NodeViewContext::DeleteSelected(NodeViewDeleteCommand *command) foreach (NodeViewItem *node, item_map_) { if (node->isSelected()) { command->AddNode(node->GetNode(), context_); + count++; } } + + return count; } void NodeViewContext::Select(const QVector &nodes) diff --git a/app/widget/nodeview/nodeviewcontext.h b/app/widget/nodeview/nodeviewcontext.h index 3c38e2036..f88f6869a 100644 --- a/app/widget/nodeview/nodeviewcontext.h +++ b/app/widget/nodeview/nodeviewcontext.h @@ -30,7 +30,7 @@ public: void SetCurvedEdges(bool e); - void DeleteSelected(NodeViewDeleteCommand *command); + int DeleteSelected(NodeViewDeleteCommand *command); void Select(const QVector &nodes); diff --git a/app/widget/projectexplorer/projectexplorer.cpp b/app/widget/projectexplorer/projectexplorer.cpp index 512541db1..04c0d71c7 100644 --- a/app/widget/projectexplorer/projectexplorer.cpp +++ b/app/widget/projectexplorer/projectexplorer.cpp @@ -487,7 +487,7 @@ void ProjectExplorer::ReplaceSelectedFootage() 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; 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 { delete command; } diff --git a/app/widget/projectexplorer/projectviewmodel.cpp b/app/widget/projectexplorer/projectviewmodel.cpp index 472a1da0d..d97f5b0c1 100644 --- a/app/widget/projectexplorer/projectviewmodel.cpp +++ b/app/widget/projectexplorer/projectviewmodel.cpp @@ -236,7 +236,7 @@ bool ProjectViewModel::setData(const QModelIndex &index, const QVariant &value, 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; } @@ -357,7 +357,7 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action // Loop through all data MultiUndoCommand* move_command = new MultiUndoCommand(); - move_command->set_name(tr("Move Items")); + int count = 0; while (!stream.atEnd()) { stream >> streams >> item_ptr; @@ -371,10 +371,11 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action && (!dynamic_cast(item) || !ItemIsParentOfChild(static_cast(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 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; diff --git a/app/widget/timebased/timebasedwidget.cpp b/app/widget/timebased/timebasedwidget.cpp index 1e5989024..b229759b0 100644 --- a/app/widget/timebased/timebasedwidget.cpp +++ b/app/widget/timebased/timebasedwidget.cpp @@ -558,7 +558,7 @@ void TimeBasedWidget::SetPoint(Timeline::MovementMode m, const rational& time) // Set workarea 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) @@ -581,7 +581,7 @@ void TimeBasedWidget::ResetPoint(Timeline::MovementMode m) 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) @@ -648,7 +648,7 @@ void TimeBasedWidget::ClearInOutPoints() 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() @@ -685,7 +685,7 @@ void TimeBasedWidget::SetMarker() } if (marker) { - Core::instance()->undo_stack()->push(new MarkerAddCommand(markers, marker)); + Core::instance()->undo_stack()->push(new MarkerAddCommand(markers, marker), tr("Added Marker")); } } } diff --git a/app/widget/timelinewidget/timelinewidget.cpp b/app/widget/timelinewidget/timelinewidget.cpp index 0e1b53e81..8d6101655 100644 --- a/app/widget/timelinewidget/timelinewidget.cpp +++ b/app/widget/timelinewidget/timelinewidget.cpp @@ -451,7 +451,7 @@ void TimelineWidget::SplitAtPlayhead() } 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); } - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Deleted Clips")); // Ensures any current drag operations are cancelled ClearGhosts(); @@ -583,14 +583,14 @@ void TimelineWidget::InsertFootageAtPlayhead(const QVector& foota { auto command = new MultiUndoCommand(); 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 &footage) { auto command = new MultiUndoCommand(); 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() @@ -616,7 +616,7 @@ void TimelineWidget::ToggleLinksOnSelected() 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() @@ -631,7 +631,7 @@ void TimelineWidget::AddDefaultTransitionsToSelected() } 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()); } - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Deleted In To Out")); } void TimelineWidget::ToggleSelectedEnabled() @@ -773,7 +773,7 @@ void TimelineWidget::ToggleSelectedEnabled() !i->is_enabled())); } - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Toggled Clips Enabled")); } void TimelineWidget::SetColorLabel(int index) @@ -784,7 +784,7 @@ void TimelineWidget::SetColorLabel(int 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() @@ -845,7 +845,7 @@ void TimelineWidget::RecordingCallback(const QString &filename, const TimeRange import_command->add_child(subimport_command); 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 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() @@ -1452,7 +1452,7 @@ void TimelineWidget::RenameSelectedBlocks() } 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) @@ -1461,7 +1461,7 @@ void TimelineWidget::TrackAboutToBeDeleted(Track *track) // 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 // 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() @@ -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() @@ -1633,7 +1633,7 @@ void TimelineWidget::NudgeInternal(rational amount) new_sel.ShiftTime(amount); 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())); - 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, 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 (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) @@ -1986,7 +1986,7 @@ bool TimelineWidget::PasteInternal(bool insert) 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; } diff --git a/app/widget/timelinewidget/tool/add.cpp b/app/widget/timelinewidget/tool/add.cpp index b3fbc8a14..0571ad882 100644 --- a/app/widget/timelinewidget/tool/add.cpp +++ b/app/widget/timelinewidget/tool/add.cpp @@ -114,7 +114,7 @@ void AddTool::MouseRelease(TimelineViewMouseEvent *event) 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(); diff --git a/app/widget/timelinewidget/tool/import.cpp b/app/widget/timelinewidget/tool/import.cpp index 1c2795c63..3e1b454fd 100644 --- a/app/widget/timelinewidget/tool/import.cpp +++ b/app/widget/timelinewidget/tool/import.cpp @@ -184,7 +184,7 @@ void ImportTool::DragDrop(TimelineViewMouseEvent *event) if (!dragged_footage_.isEmpty()) { auto command = new MultiUndoCommand(); 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(); } else { diff --git a/app/widget/timelinewidget/tool/pointer.cpp b/app/widget/timelinewidget/tool/pointer.cpp index 1d1d30662..452e8dfe9 100644 --- a/app/widget/timelinewidget/tool/pointer.cpp +++ b/app/widget/timelinewidget/tool/pointer.cpp @@ -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) diff --git a/app/widget/timelinewidget/tool/razor.cpp b/app/widget/timelinewidget/tool/razor.cpp index d2068fc0b..9a0030d83 100644 --- a/app/widget/timelinewidget/tool/razor.cpp +++ b/app/widget/timelinewidget/tool/razor.cpp @@ -93,7 +93,7 @@ void RazorTool::MouseRelease(TimelineViewMouseEvent *event) split_tracks_.clear(); 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; diff --git a/app/widget/timelinewidget/tool/ripple.cpp b/app/widget/timelinewidget/tool/ripple.cpp index 35ad7184e..7388a46b0 100644 --- a/app/widget/timelinewidget/tool/ripple.cpp +++ b/app/widget/timelinewidget/tool/ripple.cpp @@ -169,7 +169,7 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event) } 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 { delete command; } diff --git a/app/widget/timelinewidget/tool/slip.cpp b/app/widget/timelinewidget/tool/slip.cpp index 0a7c5d929..aa7447df3 100644 --- a/app/widget/timelinewidget/tool/slip.cpp +++ b/app/widget/timelinewidget/tool/slip.cpp @@ -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())); } } diff --git a/app/widget/timelinewidget/tool/transition.cpp b/app/widget/timelinewidget/tool/transition.cpp index 314ca5bee..a67496775 100644 --- a/app/widget/timelinewidget/tool/transition.cpp +++ b/app/widget/timelinewidget/tool/transition.cpp @@ -157,7 +157,7 @@ void TransitionTool::MouseRelease(TimelineViewMouseEvent *event) 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); } diff --git a/app/widget/timelinewidget/trackview/trackviewitem.cpp b/app/widget/timelinewidget/trackview/trackviewitem.cpp index 9f6a7f808..cf3330c9b 100644 --- a/app/widget/timelinewidget/trackview/trackviewitem.cpp +++ b/app/widget/timelinewidget/trackview/trackviewitem.cpp @@ -146,7 +146,7 @@ void TrackViewItem::ShowContextMenu(const QPoint &p) void TrackViewItem::DeleteTrack() { 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() @@ -172,7 +172,7 @@ void TrackViewItem::DeleteAllEmptyTracks() foreach (Track *track, tracks_to_remove) { command->add_child(new TimelineRemoveTrackCommand(track)); } - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Deleted All Empty Tracks")); } } } diff --git a/app/widget/timeruler/seekablewidget.cpp b/app/widget/timeruler/seekablewidget.cpp index d7cc2b668..02b6e90da 100644 --- a/app/widget/timeruler/seekablewidget.cpp +++ b/app/widget/timeruler/seekablewidget.cpp @@ -116,7 +116,7 @@ void SeekableWidget::DeleteSelected() 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)); } - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Pasted %1 Marker(s)").arg(markers.size())); return true; } } @@ -249,7 +249,7 @@ void SeekableWidget::mouseReleaseEvent(QMouseEvent *event) if (selection_manager_.IsDragging()) { MultiUndoCommand *command = new MultiUndoCommand(); 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()) { @@ -364,7 +364,7 @@ void SeekableWidget::SetMarkerColor(int 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() @@ -608,13 +608,17 @@ void SeekableWidget::CommitResizeHandle() { MultiUndoCommand *command = new MultiUndoCommand(); + QString command_name; + if (TimelineMarker *marker = dynamic_cast(resize_item_)) { command->add_child(new MarkerChangeTimeCommand(marker, marker->time(), resize_item_range_)); + command_name = tr("Changed Marker Length"); } else if (TimelineWorkArea *workarea = dynamic_cast(resize_item_)) { 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); } } diff --git a/app/widget/viewer/viewer.cpp b/app/widget/viewer/viewer.cpp index 33a8faf3c..bc9a4ffce 100644 --- a/app/widget/viewer/viewer.cpp +++ b/app/widget/viewer/viewer.cpp @@ -557,7 +557,7 @@ void ViewerWidget::CreateAddableAt(const QRectF &f) shape->SetRect(f, s->GetVideoParams(), command); } - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Created Shape")); SetGizmos(clip); } } @@ -1235,7 +1235,7 @@ void ViewerWidget::ContextMenuSetPlaybackRes(QAction *action) vp.set_divider(div); 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() diff --git a/app/widget/viewer/viewerdisplay.cpp b/app/widget/viewer/viewerdisplay.cpp index 7c6b78555..776399c75 100644 --- a/app/widget/viewer/viewerdisplay.cpp +++ b/app/widget/viewer/viewerdisplay.cpp @@ -946,7 +946,7 @@ bool ViewerDisplayWidget::OnMouseRelease(QMouseEvent *e) if (DraggableGizmo *draggable = dynamic_cast(current_gizmo_)) { draggable->DragEnd(command); } - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Dragged Gizmo")); gizmo_drag_started_ = false; } current_gizmo_ = nullptr; diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index 2f762b9ef..867f550a1 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -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 WorkareaSetRangeCommand(r->GetWorkArea(), range)); - Core::instance()->undo_stack()->push(command); + Core::instance()->undo_stack()->push(command, tr("Set Footage Workarea")); r->SetPlayhead(range.in()); }