Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::tracks::TrackCollection Class Reference

A collection of tracks that provides a QAbstractListModel interface. More...

#include <src/structure/tracks/track_collection.h>

Inheritance diagram for zrythm::structure::tracks::TrackCollection:
Collaboration diagram for zrythm::structure::tracks::TrackCollection:

Public Types

enum  TrackRoles { TrackPtrRole = Qt::UserRole + 1 , TrackFoldableRole , TrackExpandedRole , TrackDepthRole }

Public Member Functions

 TrackCollection (TrackRegistry &track_registry, QObject *parent=nullptr) noexcept
QHash< int, QByteArray > roleNames () const override
int rowCount (const QModelIndex &parent=QModelIndex()) const override
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
Q_INVOKABLE void setTrackExpanded (const Track *track, bool expanded)
int numSoloedTracks () const
Q_SIGNAL void numSoloedTracksChanged ()
int numMutedTracks () const
Q_SIGNAL void numMutedTracksChanged ()
int numListenedTracks () const
Q_SIGNAL void numListenedTracksChanged ()
TrackPtrVariant get_track_at_index (size_t index) const
 Get the track at the given index.
TrackUuidReference get_track_ref_at_index (size_t index) const
 Get the track reference at the given index.
auto get_track_index (const Track::Uuid &track_id) const
 Get the index of the track with the given UUID.
TrackUuidReference track_ref_at_id (const Track::Uuid &track_id) const
auto track_count () const
 Get the number of tracks in the collection.
bool contains (const Track::Uuid &track_id) const
 Check if the collection contains a track with the given UUID.
void add_track (const TrackUuidReference &track_id)
 Add a track to the collection.
void insert_track (const TrackUuidReference &track_id, int pos)
 Insert a track at the given position.
void remove_track (const Track::Uuid &track_id)
 Remove a track from the collection.
void move_track (const Track::Uuid &track_id, int pos)
 Move a track from one position to another.
void clear ()
 Clear all tracks from the collection.
auto get_track_span () const
 Get a span view of all tracks.
const std::vector< TrackUuidReference > & tracks () const
 Get the underlying tracks vector.
TrackRegistry & get_track_registry () const
 Get the track registry.
void set_track_expanded (const Track::Uuid &track_id, bool expanded)
 Set the expanded state of a foldable track.
bool get_track_expanded (const Track::Uuid &track_id) const
 Get the expanded state of a foldable track.
void set_folder_parent (const Track::Uuid &child_id, const Track::Uuid &parent_id)
 Set the folder parent for a track.
std::optional< Track::Uuidget_folder_parent (const Track::Uuid &child_id) const
 Get the folder parent for a track.
void remove_folder_parent (const Track::Uuid &child_id)
 Remove the folder parent for a track.
bool is_track_foldable (const Track::Uuid &track_id) const
 Check if a track is foldable.
size_t get_child_count (const Track::Uuid &parent_id) const
 Get the number of children for a foldable track.
size_t get_last_child_index (const Track::Uuid &parent_id) const
 Get the last child index for a foldable track.

Properties

int numSoloedTracks
int numMutedTracks
int numListenedTracks

Friends

void to_json (nlohmann::json &j, const TrackCollection &collection)
void from_json (const nlohmann::json &j, TrackCollection &collection)

Detailed Description

A collection of tracks that provides a QAbstractListModel interface.

Tracks are stored in a flat list, and the model provides facilities to get whether a track is foldable, expanded, and its depth (0 means not part of a foldable parent).

Definition at line 20 of file track_collection.h.

Member Enumeration Documentation

◆ TrackRoles

enum zrythm::structure::tracks::TrackCollection::TrackRoles

Definition at line 30 of file track_collection.h.

Member Function Documentation

◆ get_track_index()

auto zrythm::structure::tracks::TrackCollection::get_track_index ( const Track::Uuid & track_id) const
inline

Get the index of the track with the given UUID.

Definition at line 86 of file track_collection.h.

◆ get_track_registry()

TrackRegistry & zrythm::structure::tracks::TrackCollection::get_track_registry ( ) const
inline

Get the track registry.

Definition at line 146 of file track_collection.h.

◆ get_track_span()

auto zrythm::structure::tracks::TrackCollection::get_track_span ( ) const
inline

Get a span view of all tracks.

Definition at line 136 of file track_collection.h.

◆ track_count()

auto zrythm::structure::tracks::TrackCollection::track_count ( ) const
inline

Get the number of tracks in the collection.

Definition at line 101 of file track_collection.h.

◆ track_ref_at_id()

TrackUuidReference zrythm::structure::tracks::TrackCollection::track_ref_at_id ( const Track::Uuid & track_id) const
inline

Definition at line 93 of file track_collection.h.

◆ tracks()

const std::vector< TrackUuidReference > & zrythm::structure::tracks::TrackCollection::tracks ( ) const
inline

Get the underlying tracks vector.

Definition at line 141 of file track_collection.h.

Property Documentation

◆ numListenedTracks

int zrythm::structure::tracks::TrackCollection::numListenedTracks
read

Definition at line 25 of file track_collection.h.

◆ numMutedTracks

int zrythm::structure::tracks::TrackCollection::numMutedTracks
read

Definition at line 24 of file track_collection.h.

◆ numSoloedTracks

int zrythm::structure::tracks::TrackCollection::numSoloedTracks
read

Definition at line 23 of file track_collection.h.


The documentation for this class was generated from the following file: