MoveTimelineCommand.h header

#include <ew/core/timeline/MoveTimelineCommand.h>

Namespace ew::core::timeline

MoveTimelineCommand class

class ew::core::timeline::MoveTimelineCommand

Command that moves a timeline to a new position in the project's timeline order, renumbering every timeline's Timeline::sortIndex so the indices stay contiguous. Undo restores the sort index of every timeline the move touched.

The order this writes is the one the Timeline dock stacks its lanes in and the one the MCP listing tools report – both sort by sortIndex, then by title. Before this command existed nothing in the product ever set that field: it was persisted, loaded, and sorted on, and left at 0 on every timeline, so the tie-break did all the work and the lane order was permanently alphabetical. A writer whose story runs Court, then Siege, then Aftermath had no way to say so.

Members

ew::core::timeline::MoveTimelineCommand::MoveTimelineCommand(ew::core::project::Project &project, ew::core::foundation::ContentId timelineId, int targetIndex)

Creates a command that, when applied, moves timelineId to targetIndex (clamped to the timeline count) within project's timeline order.

ew::core::timeline::MoveTimelineCommand::~MoveTimelineCommand() override

Destroys the command.

void ew::core::timeline::MoveTimelineCommand::apply() override

Applies the move, recording the previous sort index of every timeline it renumbers.

void ew::core::timeline::MoveTimelineCommand::undo() override

Restores the sort index of every timeline the move touched.

QString ew::core::timeline::MoveTimelineCommand::description() const override

Returns a short description for the undo/redo UI.

ew::core::foundation::OperationSubject ew::core::timeline::MoveTimelineCommand::subject() const override

Returns the subject this command changes. See Command::subject().