LCOV - code coverage report
Current view: top level - src/playback/qml/MuseScore/Playback - playbackloadingmodel.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 41 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              : #include "playbackloadingmodel.h"
      23              : 
      24              : #include "log.h"
      25              : 
      26              : using namespace mu::playback;
      27              : using namespace muse;
      28              : 
      29            0 : PlaybackLoadingModel::PlaybackLoadingModel(QObject* parent)
      30            0 :     : QObject(parent), muse::Contextable(muse::iocCtxForQmlObject(this))
      31              : {
      32            0 : }
      33              : 
      34            0 : void PlaybackLoadingModel::load()
      35              : {
      36            0 :     Progress progress = playbackController()->loadingProgress();
      37              : 
      38            0 :     progress.started().onNotify(this, [this]() {
      39            0 :         emit started();
      40            0 :     });
      41              : 
      42            0 :     progress.progressChanged().onReceive(this, [this](int64_t current, int64_t total, const std::string& title) {
      43            0 :         setCurrentProgress(current);
      44            0 :         setTotalProgress(total);
      45            0 :         setProgressTitle(QString::fromStdString(title));
      46            0 :     });
      47              : 
      48            0 :     progress.finished().onReceive(this, [this](const ProgressResult& res) {
      49            0 :         const Ret& ret = res.ret;
      50              : 
      51            0 :         if (!ret && !ret.text().empty()) {
      52            0 :             LOGE() << ret.toString();
      53              :         }
      54              : 
      55            0 :         emit finished();
      56            0 :     });
      57            0 : }
      58              : 
      59            0 : int PlaybackLoadingModel::currentProgress() const
      60              : {
      61            0 :     return m_currentProgress;
      62              : }
      63              : 
      64            0 : int PlaybackLoadingModel::totalProgress() const
      65              : {
      66            0 :     return m_totalProgress;
      67              : }
      68              : 
      69            0 : QString PlaybackLoadingModel::progressTitle() const
      70              : {
      71            0 :     return m_progressTitle;
      72              : }
      73              : 
      74            0 : void PlaybackLoadingModel::setCurrentProgress(int progress)
      75              : {
      76            0 :     if (m_currentProgress == progress) {
      77            0 :         return;
      78              :     }
      79              : 
      80            0 :     m_currentProgress = progress;
      81            0 :     emit currentProgressChanged();
      82              : }
      83              : 
      84            0 : void PlaybackLoadingModel::setTotalProgress(int progress)
      85              : {
      86            0 :     if (m_totalProgress == progress) {
      87            0 :         return;
      88              :     }
      89              : 
      90            0 :     m_totalProgress = progress;
      91            0 :     emit totalProgressChanged();
      92              : }
      93              : 
      94            0 : void PlaybackLoadingModel::setProgressTitle(const QString& title)
      95              : {
      96            0 :     if (m_progressTitle == title) {
      97            0 :         return;
      98              :     }
      99              : 
     100            0 :     m_progressTitle = title;
     101            0 :     emit progressTitleChanged();
     102              : }
        

Generated by: LCOV version 2.0-1