Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
move_tracks_command.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <unordered_set>
7#include <vector>
8
9#include "structure/tracks/track_collection.h"
10
11#include <QUndoCommand>
12
13namespace zrythm::commands
14{
15
25class MoveTracksCommand : public QUndoCommand
26{
27public:
43 std::vector<structure::tracks::TrackUuidReference> track_refs,
44 int target_position,
45 std::optional<structure::tracks::Track::Uuid> target_folder = std::nullopt);
46
47 void undo () override;
48 void redo () override;
49 int id () const override;
50
51private:
56 bool is_internal_parent (
57 const std::optional<structure::tracks::Track::Uuid> &parent) const;
58
59private:
61
63 std::vector<structure::tracks::TrackUuidReference> track_refs_;
64
66 std::vector<int> original_positions_;
67
69 int target_position_;
70
72 std::optional<structure::tracks::Track::Uuid> target_folder_;
73
75 std::vector<std::optional<structure::tracks::Track::Uuid>>
76 original_folder_parents_;
77
79 bool target_folder_was_expanded_{ false };
80
82 std::unordered_set<structure::tracks::Track::Uuid> moved_uuids_;
83};
84
85} // namespace zrythm::commands
MoveTracksCommand(structure::tracks::TrackCollection &collection, std::vector< structure::tracks::TrackUuidReference > track_refs, int target_position, std::optional< structure::tracks::Track::Uuid > target_folder=std::nullopt)
Constructs a new MoveTracksCommand.
A collection of tracks that provides a QAbstractListModel interface.