LCOV - code coverage report
Current view: top level - muse/framework/ui/qml/Muse/Ui - navigationcontrol.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 57.5 % 80 46
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              : #include "navigationcontrol.h"
      23              : 
      24              : #include "navigationpanel.h"
      25              : 
      26              : #include "log.h"
      27              : 
      28              : using namespace muse;
      29              : using namespace muse::ui;
      30              : using namespace muse::accessibility;
      31              : 
      32            0 : NavigationControl::NavigationControl(QObject* parent)
      33            0 :     : AbstractNavigation(parent)
      34              : {
      35            0 : }
      36              : 
      37          372 : NavigationControl::NavigationControl(const muse::modularity::ContextPtr& iocCtx, QObject* parent)
      38          372 :     : AbstractNavigation(iocCtx, parent)
      39              : {
      40          372 : }
      41              : 
      42          744 : NavigationControl::~NavigationControl()
      43              : {
      44          372 :     if (m_panel) {
      45            1 :         m_panel->removeControl(this);
      46              :     }
      47          744 : }
      48              : 
      49            0 : void NavigationControl::componentComplete()
      50              : {
      51            0 :     AbstractNavigation::componentComplete();
      52            0 : }
      53              : 
      54            0 : QString NavigationControl::name() const
      55              : {
      56            0 :     return AbstractNavigation::name();
      57              : }
      58              : 
      59          459 : const INavigation::Index& NavigationControl::index() const
      60              : {
      61          459 :     return AbstractNavigation::index();
      62              : }
      63              : 
      64            0 : void NavigationControl::setIndex(const Index& index)
      65              : {
      66            0 :     AbstractNavigation::setIndex(index);
      67            0 : }
      68              : 
      69            0 : async::Channel<INavigation::Index> NavigationControl::indexChanged() const
      70              : {
      71            0 :     return AbstractNavigation::indexChanged();
      72              : }
      73              : 
      74          384 : bool NavigationControl::enabled() const
      75              : {
      76          384 :     return AbstractNavigation::enabled();
      77              : }
      78              : 
      79            0 : async::Channel<bool> NavigationControl::enabledChanged() const
      80              : {
      81            0 :     return AbstractNavigation::enabledChanged();
      82              : }
      83              : 
      84          593 : bool NavigationControl::active() const
      85              : {
      86          593 :     return AbstractNavigation::active();
      87              : }
      88              : 
      89          473 : void NavigationControl::setActive(bool arg)
      90              : {
      91          473 :     AbstractNavigation::setActive(arg);
      92          473 :     if (m_accessible) {
      93          101 :         m_accessible->setState(IAccessible::State::Focused, arg);
      94              :     }
      95          473 : }
      96              : 
      97            0 : async::Channel<bool> NavigationControl::activeChanged() const
      98              : {
      99            0 :     return AbstractNavigation::activeChanged();
     100              : }
     101              : 
     102            5 : void NavigationControl::onEvent(EventPtr e)
     103              : {
     104            5 :     AbstractNavigation::onEvent(e);
     105            5 : }
     106              : 
     107            0 : QWindow* NavigationControl::window() const
     108              : {
     109            0 :     return AbstractNavigation::window();
     110              : }
     111              : 
     112            0 : QQuickItem* muse::ui::NavigationControl::visualItem() const
     113              : {
     114            0 :     return AbstractNavigation::visualItem();
     115              : }
     116              : 
     117            0 : void NavigationControl::trigger()
     118              : {
     119            0 :     emit triggered();
     120            0 : }
     121              : 
     122            0 : async::Notification NavigationControl::triggered() const
     123              : {
     124            0 :     return m_triggeed;
     125              : }
     126              : 
     127           11 : void NavigationControl::requestActive(bool enableHighlight)
     128              : {
     129           11 :     if (m_panel) {
     130           11 :         m_panel->requestActive(this, enableHighlight);
     131              :     }
     132           11 : }
     133              : 
     134            2 : void NavigationControl::requestActiveByInteraction(bool enableHighlight)
     135              : {
     136            2 :     if (m_panel) {
     137            2 :         m_panel->requestActive(this, enableHighlight, INavigation::ActivationType::ByMouse);
     138              :     }
     139            2 : }
     140              : 
     141            0 : void NavigationControl::notifyAboutControlWasTriggered()
     142              : {
     143            0 :     m_triggeed.notify();
     144            0 : }
     145              : 
     146          372 : void NavigationControl::setPanel(NavigationPanel* panel)
     147              : {
     148          373 :     TRACEFUNC;
     149          372 :     if (m_panel == panel) {
     150            0 :         return;
     151              :     }
     152              : 
     153          372 :     if (m_panel) {
     154            0 :         m_panel->removeControl(this);
     155            0 :         m_panel->disconnect(this);
     156              :     }
     157              : 
     158          372 :     m_panel = panel;
     159              : 
     160          372 :     setAccessibleParent(m_panel ? m_panel->accessible() : nullptr);
     161              : 
     162          372 :     if (m_panel) {
     163          372 :         m_panel->addControl(this);
     164          372 :         connect(m_panel, &NavigationPanel::destroyed, this, &NavigationControl::onPanelDestroyed);
     165              :     }
     166              : 
     167          372 :     emit panelChanged(m_panel);
     168          372 : }
     169              : 
     170          371 : void NavigationControl::onPanelDestroyed()
     171              : {
     172          371 :     m_panel = nullptr;
     173          371 :     setAccessibleParent(nullptr);
     174          371 : }
     175              : 
     176            0 : NavigationPanel* NavigationControl::panel_property() const
     177              : {
     178            0 :     return m_panel;
     179              : }
     180              : 
     181            2 : INavigationPanel* NavigationControl::panel() const
     182              : {
     183            2 :     return m_panel;
     184              : }
        

Generated by: LCOV version 2.0-1