LCOV - code coverage report
Current view: top level - src/playback/qml/MuseScore/Playback - mixerpanelmodel.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 1 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-Studio-CLA-applies
       4              :  *
       5              :  * MuseScore Studio
       6              :  * Music Composition & Notation
       7              :  *
       8              :  * Copyright (C) 2021 MuseScore Limited and others
       9              :  *
      10              :  * This program is free software: you can redistribute it and/or modify
      11              :  * it under the terms of the GNU General Public License version 3 as
      12              :  * published by the Free Software Foundation.
      13              :  *
      14              :  * This program is distributed in the hope that it will be useful,
      15              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      16              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17              :  * GNU General Public License for more details.
      18              :  *
      19              :  * You should have received a copy of the GNU General Public License
      20              :  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
      21              :  */
      22              : 
      23              : #pragma once
      24              : 
      25              : #include <QAbstractListModel>
      26              : #include <QQmlParserStatus>
      27              : #include <QList>
      28              : #include <qqmlintegration.h>
      29              : 
      30              : #include "modularity/ioc.h"
      31              : #include "async/asyncable.h"
      32              : #include "audio/main/iplayback.h"
      33              : #include "project/iprojectsession.h"
      34              : #include "playback/iplaybackconfiguration.h"
      35              : #include "project/iprojectaudiosettings.h"
      36              : #include "ui/qml/Muse/Ui/navigationsection.h"
      37              : 
      38              : #include "iplaybackcontroller.h"
      39              : #include "mixerchannelitem.h"
      40              : 
      41              : namespace mu::playback {
      42              : class MixerPanelModel : public QAbstractListModel, public QQmlParserStatus, public muse::async::Asyncable, public muse::Contextable
      43              : {
      44              :     Q_OBJECT
      45              :     Q_INTERFACES(QQmlParserStatus)
      46              : 
      47              :     Q_PROPERTY(
      48              :         muse::ui::NavigationSection * navigationSection READ navigationSection WRITE setNavigationSection NOTIFY navigationSectionChanged)
      49              :     Q_PROPERTY(int navigationOrderStart READ navigationOrderStart WRITE setNavigationOrderStart NOTIFY navigationOrderStartChanged)
      50              : 
      51              :     Q_PROPERTY(int count READ rowCount NOTIFY rowCountChanged)
      52              : 
      53              :     QML_ELEMENT
      54              : 
      55              :     muse::GlobalInject<IPlaybackConfiguration> configuration;
      56              :     muse::ContextInject<muse::audio::IPlayback> playback = { this };
      57              :     muse::ContextInject<IPlaybackController> controller = { this };
      58              :     muse::ContextInject<project::IProjectSession> context = { this };
      59              : 
      60              : public:
      61              :     explicit MixerPanelModel(QObject* parent = nullptr);
      62              : 
      63              :     Q_INVOKABLE QVariantMap get(int index);
      64              : 
      65              :     QVariant data(const QModelIndex& index, int role) const override;
      66              :     int rowCount(const QModelIndex& parent = QModelIndex()) const override;
      67              :     QHash<int, QByteArray> roleNames() const override;
      68              : 
      69              :     muse::ui::NavigationSection* navigationSection() const;
      70              :     void setNavigationSection(muse::ui::NavigationSection* navigationSection);
      71              : 
      72              :     int navigationOrderStart() const;
      73              :     void setNavigationOrderStart(int navigationOrderStart);
      74              : 
      75              : signals:
      76              :     void navigationSectionChanged();
      77              :     void navigationOrderStartChanged();
      78              :     void rowCountChanged();
      79              : 
      80              : private:
      81            0 :     void classBegin() override {}
      82              :     void componentComplete() override;
      83              :     void init();
      84              : 
      85              :     enum Roles {
      86              :         ChannelItemRole = Qt::UserRole + 1
      87              :     };
      88              : 
      89              :     void reload();
      90              :     void reloadItems();
      91              :     void onTrackAdded(const muse::audio::TrackId& trackId);
      92              :     void addItem(MixerChannelItem* item, int index);
      93              :     void removeItem(const muse::audio::TrackId trackId);
      94              :     void updateItemsPanelsOrder();
      95              :     void clear();
      96              :     void setupConnections();
      97              : 
      98              :     void subscribeOnAutomationChanges();
      99              : 
     100              :     int resolveInsertIndex(const engraving::InstrumentTrackId& instrumentTrackId) const;
     101              :     int indexOf(const muse::audio::TrackId trackId) const;
     102              : 
     103              :     MixerChannelItem* buildInstrumentChannelItem(const muse::audio::TrackId trackId, const engraving::InstrumentTrackId& instrumentTrackId,
     104              :                                                  bool isPrimary = true);
     105              :     MixerChannelItem* buildAuxChannelItem(muse::audio::aux_channel_idx_t index, const muse::audio::TrackId trackId);
     106              :     MixerChannelItem* buildMasterChannelItem();
     107              : 
     108              :     int masterChannelIndex() const;
     109              : 
     110              :     MixerChannelItem* findChannelItem(const muse::audio::TrackId& trackId) const;
     111              : 
     112              :     void loadOutputParams(MixerChannelItem* item, const project::AudioOutputParams& params);
     113              :     void updateOutputResourceItemCount();
     114              : 
     115              :     project::INotationProjectPtr currentProject() const;
     116              :     project::IProjectAudioSettingsPtr audioSettings() const;
     117              :     notation::INotationPlaybackPtr notationPlayback() const;
     118              :     notation::INotationPartsPtr masterNotationParts() const;
     119              : 
     120              :     QList<MixerChannelItem*> m_mixerChannelList;
     121              :     MixerChannelItem* m_masterChannelItem = nullptr;
     122              : 
     123              :     muse::ui::NavigationSection* m_navigationSection = nullptr;
     124              :     int m_navigationOrderStart = 1;
     125              : };
     126              : }
        

Generated by: LCOV version 2.0-1