Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
track_operator.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <stdexcept>
7
8#include "structure/tracks/track_all.h"
9#include "undo/undo_stack.h"
10
11#include <QtQmlIntegration/qqmlintegration.h>
12
13namespace zrythm::actions
14{
15class TrackOperator : public QObject
16{
17 Q_OBJECT
18 Q_PROPERTY (
19 zrythm::structure::tracks::Track * track READ track WRITE setTrack NOTIFY
20 trackChanged)
21 Q_PROPERTY (
22 zrythm::undo::UndoStack * undoStack READ undoStack WRITE setUndoStack NOTIFY
23 undoStackChanged)
24 QML_ELEMENT
25
26public:
27 explicit TrackOperator (QObject * parent = nullptr) : QObject (parent) { }
28
29 structure::tracks::Track * track () const { return track_; }
30 void setTrack (structure::tracks::Track * track)
31 {
32 if (track_ != track)
33 {
34 track_ = track;
35 Q_EMIT trackChanged ();
36 }
37 }
38 Q_SIGNAL void trackChanged ();
39
40 undo::UndoStack * undoStack () const { return undo_stack_; }
41 void setUndoStack (undo::UndoStack * undoStack)
42 {
43 if (undo_stack_ != undoStack)
44 {
45 undo_stack_ = undoStack;
46 Q_EMIT undoStackChanged ();
47 }
48 }
49 Q_SIGNAL void undoStackChanged ();
50
51 Q_INVOKABLE void rename (const QString &newName);
52 Q_INVOKABLE void setColor (const QColor &color);
53
54private:
55 structure::tracks::Track * track_{};
56 undo::UndoStack * undo_stack_{};
57};
58}
Represents a track in the project.
Definition track.h:54