LCOV - code coverage report
Current view: top level - src/appshell/qml/MuseScore/AppShell - welcomedialogmodel.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 4 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) 2025 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 <QObject>
      26              : #include <qqmlintegration.h>
      27              : 
      28              : #include "modularity/ioc.h"
      29              : #include "iappshellconfiguration.h"
      30              : 
      31              : namespace mu::appshell {
      32              : class WelcomeDialogModel : public QObject, public muse::Contextable
      33              : {
      34              :     Q_OBJECT
      35              : 
      36              :     Q_PROPERTY(int count READ count NOTIFY itemsChanged)
      37              : 
      38              :     Q_PROPERTY(QVariant currentItem READ currentItem NOTIFY currentItemChanged)
      39              :     Q_PROPERTY(int currentIndex READ currentIndex NOTIFY currentItemChanged)
      40              : 
      41              :     Q_PROPERTY(bool showOnStartup READ showOnStartup WRITE setShowOnStartup NOTIFY showOnStartupChanged)
      42              : 
      43              :     QML_ELEMENT
      44              : 
      45              :     muse::GlobalInject<IAppShellConfiguration> configuration;
      46              : 
      47              : public:
      48              :     WelcomeDialogModel();
      49              : 
      50              :     Q_INVOKABLE void init();
      51              : 
      52            0 :     int count() const { return static_cast<int>(m_items.size()); }
      53              : 
      54              :     QVariantMap currentItem() const;
      55            0 :     int currentIndex() const { return static_cast<int>(m_currentIndex); }
      56              : 
      57              :     Q_INVOKABLE void nextItem();
      58              :     Q_INVOKABLE void prevItem();
      59              : 
      60              :     bool showOnStartup() const;
      61              :     void setShowOnStartup(bool show);
      62              : 
      63              : signals:
      64              :     void itemsChanged();
      65              :     void currentItemChanged();
      66              :     void showOnStartupChanged();
      67              : 
      68              : private:
      69            0 :     bool hasPrev() const { return m_currentIndex > 0; }
      70            0 :     bool hasNext() const { return m_currentIndex < m_items.size() - 1; }
      71              : 
      72              :     std::vector<QVariantMap> m_items;
      73              :     size_t m_currentIndex = 0;
      74              : };
      75              : }
        

Generated by: LCOV version 2.0-1