LCOV - code coverage report
Current view: top level - muse/framework/shortcuts_v2 - shortcutsmodule.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 30 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              : #include "shortcutsmodule.h"
      23              : 
      24              : #include "modularity/ioc.h"
      25              : 
      26              : #include "internal/commandshortcutsregister.h"
      27              : #include "internal/shortcutscontroller.h"
      28              : #include "internal/shortcutsconfiguration.h"
      29              : 
      30              : #include "global/api/iapiregister.h"
      31              : #include "api/shortcutsapi.h"
      32              : 
      33              : #include "muse_framework_config.h"
      34              : 
      35              : #ifdef MUSE_MODULE_DIAGNOSTICS
      36              : #include "diagnostics/idiagnosticspathsregister.h"
      37              : #endif
      38              : 
      39              : using namespace muse::shortcuts;
      40              : using namespace muse::modularity;
      41              : using namespace muse::ui;
      42              : 
      43              : static const std::string mname("shortcuts");
      44              : 
      45            0 : std::string ShortcutsModule::moduleName() const
      46              : {
      47            0 :     return mname;
      48              : }
      49              : 
      50            0 : void ShortcutsModule::registerExports()
      51              : {
      52            0 :     m_configuration = std::make_shared<ShortcutsConfiguration>(globalCtx());
      53            0 :     m_commandShortcutsRegister = std::make_shared<CommandShortcutsRegister>();
      54              : 
      55            0 :     globalIoc()->registerExport<IShortcutsConfiguration>(mname, m_configuration);
      56            0 :     globalIoc()->registerExport<ICommandShortcutsRegister>(mname, m_commandShortcutsRegister);
      57            0 : }
      58              : 
      59            0 : void ShortcutsModule::registerApi()
      60              : {
      61              :     using namespace muse::api;
      62              : 
      63            0 :     auto api = globalIoc()->resolve<IApiRegister>(mname);
      64            0 :     if (api) {
      65            0 :         api->regApiCreator(mname, "MuseInternal.Shortcuts", new ApiCreator<api::ShortcutsApi>());
      66              :     }
      67            0 : }
      68              : 
      69            0 : void ShortcutsModule::onInit(const IApplication::RunMode&)
      70              : {
      71            0 :     m_configuration->init();
      72            0 :     m_commandShortcutsRegister->init();
      73              : 
      74              : #ifdef MUSE_MODULE_DIAGNOSTICS
      75            0 :     auto pr = globalIoc()->resolve<muse::diagnostics::IDiagnosticsPathsRegister>(mname);
      76            0 :     if (pr) {
      77            0 :         pr->reg("shortcutsUserAppDataPath", m_configuration->shortcutsUserAppDataPath());
      78            0 :         pr->reg("shortcutsAppDataPath", m_configuration->shortcutsAppDataPath());
      79              :     }
      80              : #endif
      81            0 : }
      82              : 
      83            0 : IContextSetup* ShortcutsModule::newContext(const modularity::ContextPtr& ctx) const
      84              : {
      85            0 :     return new ShortcutsContext(ctx);
      86              : }
      87              : 
      88            0 : void ShortcutsContext::registerExports()
      89              : {
      90            0 :     m_shortcutsController = std::make_shared<ShortcutsController>(iocContext());
      91              : 
      92            0 :     ioc()->registerExport<IShortcutsController>(mname, m_shortcutsController);
      93            0 : }
      94              : 
      95            0 : void ShortcutsContext::onInit(const IApplication::RunMode&)
      96              : {
      97            0 :     m_shortcutsController->init();
      98            0 : }
        

Generated by: LCOV version 2.0-1