Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
add_track_command.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <utility>
7
8#include "structure/tracks/track_collection.h"
9
10#include <QUndoCommand>
11
12namespace zrythm::commands
13{
14class AddEmptyTrackCommand : public QUndoCommand
15{
16public:
17 static constexpr auto CommandId = 1823189;
18
19 AddEmptyTrackCommand (
21 structure::tracks::TrackUuidReference track_ref)
22 : QUndoCommand (QObject::tr ("Add Track")), collection_ (collection),
23 track_ref_ (std::move (track_ref))
24 {
25 }
26
27 int id () const override { return CommandId; }
28
29 void undo () override { collection_.remove_track (track_ref_.id ()); }
30 void redo () override { collection_.add_track (track_ref_); }
31
32private:
34 structure::tracks::TrackUuidReference track_ref_;
35};
36
37} // namespace zrythm::commands
A collection of tracks that provides a QAbstractListModel interface.