LCOV - code coverage report
Current view: top level - muse/framework/workspace - workspacemodule.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 51 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 "workspacemodule.h"
      23              : 
      24              : #include "modularity/ioc.h"
      25              : 
      26              : #include "interactive/iinteractiveuriregister.h"
      27              : #include "rcommand/icommandsregister.h"
      28              : #include "rcommand/icommandsstate.h"
      29              : 
      30              : #include "internal/workspaceconfiguration.h"
      31              : #include "internal/workspacemanager.h"
      32              : #include "internal/workspaceactioncontroller.h"
      33              : #include "internal/workspacecommandsregister.h"
      34              : #include "internal/workspacecommandsstate.h"
      35              : #include "internal/workspacesdataprovider.h"
      36              : 
      37              : #include "muse_framework_config.h"
      38              : 
      39              : #ifdef MUSE_MODULE_ACTIONS_SUPPORT
      40              : #include "ui/iuiactionsregister.h"
      41              : #include "internal/workspaceuiactions.h"
      42              : #endif
      43              : 
      44              : #ifdef MUSE_MODULE_DIAGNOSTICS
      45              : #include "diagnostics/idiagnosticspathsregister.h"
      46              : #endif
      47              : 
      48              : using namespace muse::workspace;
      49              : using namespace muse::modularity;
      50              : 
      51              : static const std::string mname("workspace");
      52              : 
      53            0 : std::string WorkspaceModule::moduleName() const
      54              : {
      55            0 :     return mname;
      56              : }
      57              : 
      58            0 : void WorkspaceModule::registerExports()
      59              : {
      60            0 :     m_configuration = std::make_shared<WorkspaceConfiguration>(globalCtx());
      61            0 :     globalIoc()->registerExport<IWorkspaceConfiguration>(mname, m_configuration);
      62            0 : }
      63              : 
      64            0 : void WorkspaceModule::resolveImports()
      65              : {
      66            0 :     auto ir = globalIoc()->resolve<muse::interactive::IInteractiveUriRegister>(mname);
      67            0 :     if (ir) {
      68            0 :         ir->registerQmlUri(Uri("muse://workspace/select"), "Muse.Workspace", "WorkspacesDialog");
      69            0 :         ir->registerQmlUri(Uri("muse://workspace/create"), "Muse.Workspace", "NewWorkspaceDialog");
      70              :     }
      71              : 
      72            0 :     auto cr = globalIoc()->resolve<muse::rcommand::ICommandsRegister>(mname);
      73            0 :     if (cr) {
      74            0 :         cr->reg(std::make_shared<WorkspaceCommandsRegister>());
      75              :     }
      76            0 : }
      77              : 
      78            0 : void WorkspaceModule::onInit(const IApplication::RunMode&)
      79              : {
      80            0 :     m_configuration->init();
      81              : 
      82              : #ifdef MUSE_MODULE_DIAGNOSTICS
      83            0 :     auto pr = globalIoc()->resolve<muse::diagnostics::IDiagnosticsPathsRegister>(mname);
      84            0 :     if (pr) {
      85            0 :         io::paths_t paths = m_configuration->workspacePaths();
      86            0 :         for (const io::path_t& p : paths) {
      87            0 :             pr->reg("workspace", p);
      88              :         }
      89            0 :     }
      90              : #endif
      91            0 : }
      92              : 
      93            0 : void WorkspaceModule::onDeinit()
      94              : {
      95            0 : }
      96              : 
      97            0 : IContextSetup* WorkspaceModule::newContext(const kors::modularity::ContextPtr& ctx) const
      98              : {
      99            0 :     return new WorkspaceContext(ctx);
     100              : }
     101              : 
     102            0 : void WorkspaceContext::registerExports()
     103              : {
     104            0 :     m_actionController = std::make_shared<WorkspaceActionController>(iocContext());
     105            0 :     m_manager = std::make_shared<WorkspaceManager>(iocContext());
     106            0 :     m_provider = std::make_shared<WorkspacesDataProvider>(iocContext());
     107            0 :     ioc()->registerExport<IWorkspaceManager>(mname, m_manager);
     108            0 :     ioc()->registerExport<IWorkspacesDataProvider>(mname, m_provider);
     109            0 : }
     110              : 
     111            0 : void WorkspaceContext::onInit(const IApplication::RunMode&)
     112              : {
     113            0 :     m_manager->init();
     114            0 :     m_provider->init();
     115            0 :     m_actionController->init();
     116            0 : }
     117              : 
     118            0 : void WorkspaceContext::resolveImports()
     119              : {
     120              : #ifdef MUSE_MODULE_ACTIONS_SUPPORT
     121            0 :     auto ar = ioc()->resolve<ui::IUiActionsRegister>(mname);
     122            0 :     if (ar) {
     123            0 :         ar->reg(std::make_shared<WorkspaceUiActions>(m_actionController, iocContext()));
     124              :     }
     125              : #endif
     126              : 
     127            0 :     auto cs = ioc()->resolve<muse::rcommand::ICommandsState>(mname);
     128            0 :     if (cs) {
     129            0 :         cs->reg(std::make_shared<WorkspaceCommandsState>(iocContext()));
     130              :     }
     131            0 : }
     132              : 
     133            0 : void WorkspaceContext::onDeinit()
     134              : {
     135            0 :     m_manager->deinit();
     136            0 : }
        

Generated by: LCOV version 2.0-1