LCOV - code coverage report
Current view: top level - muse/framework/interactive/qml/Muse/Interactive - progressdialogmodel.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 48 0
Test Date: 2026-11-05 04:07:02

            Line data    Source code
       1              : /*
       2              :  * SPDX-License-Identifier: GPL-3.0-only
       3              :  * MuseScore-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              : #include "progressdialogmodel.h"
      24              : 
      25              : #include "progress.h"
      26              : 
      27              : #include "log.h"
      28              : 
      29              : using namespace muse::interactive;
      30              : 
      31            0 : ProgressDialogModel::ProgressDialogModel(QObject* parent)
      32            0 :     : QObject(parent)
      33              : {
      34            0 : }
      35              : 
      36            0 : int ProgressDialogModel::from() const
      37              : {
      38            0 :     return m_from;
      39              : }
      40              : 
      41            0 : int ProgressDialogModel::value() const
      42              : {
      43            0 :     return m_value;
      44              : }
      45              : 
      46            0 : int ProgressDialogModel::to() const
      47              : {
      48            0 :     return m_to;
      49              : }
      50              : 
      51            0 : QString ProgressDialogModel::statusMessage() const
      52              : {
      53            0 :     return m_statusMessage;
      54              : }
      55              : 
      56            0 : void ProgressDialogModel::load(const QVariant& progressObj)
      57              : {
      58            0 :     IF_ASSERT_FAILED(progressObj.canConvert<Progress>()) {
      59            0 :         return;
      60              :     }
      61              : 
      62            0 :     m_progress = progressObj.value<Progress>();
      63              : 
      64            0 :     m_progress.progressChanged().onReceive(this, [this](int64_t current, int64_t total, const std::string& status) {
      65            0 :         setValue(current);
      66            0 :         setTo(total);
      67            0 :         setStatusMessage(QString::fromStdString(status));
      68            0 :     });
      69              : 
      70            0 :     m_progress.finished().onReceive(this, [this](const ProgressResult& res) {
      71            0 :         if (!res.ret) {
      72            0 :             LOGE() << res.ret.toString();
      73              :         }
      74              : 
      75            0 :         emit finished();
      76            0 :     });
      77              : }
      78              : 
      79            0 : void ProgressDialogModel::cancel()
      80              : {
      81            0 :     m_progress.cancel();
      82            0 : }
      83              : 
      84            0 : void ProgressDialogModel::setFrom(int value)
      85              : {
      86            0 :     if (m_from == value) {
      87            0 :         return;
      88              :     }
      89              : 
      90            0 :     m_from = value;
      91            0 :     emit fromChanged();
      92              : }
      93              : 
      94            0 : void ProgressDialogModel::setValue(int value)
      95              : {
      96            0 :     if (m_value == value) {
      97            0 :         return;
      98              :     }
      99              : 
     100            0 :     m_value = value;
     101            0 :     emit valueChanged();
     102              : }
     103              : 
     104            0 : void ProgressDialogModel::setTo(int value)
     105              : {
     106            0 :     if (m_to == value) {
     107            0 :         return;
     108              :     }
     109              : 
     110            0 :     m_to = value;
     111            0 :     emit toChanged();
     112              : }
     113              : 
     114            0 : void ProgressDialogModel::setStatusMessage(const QString& msg)
     115              : {
     116            0 :     if (m_statusMessage == msg) {
     117            0 :         return;
     118              :     }
     119              : 
     120            0 :     m_statusMessage = msg;
     121            0 :     emit statusMessageChanged();
     122              : }
        

Generated by: LCOV version 2.0-1