LCOV - code coverage report
Current view: top level - src/palette - palettemodule.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 54 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) 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 "palettemodule.h"
      23              : 
      24              : #include <qqml.h>
      25              : 
      26              : #include "modularity/ioc.h"
      27              : #include "interactive/iinteractiveuriregister.h"
      28              : #include "accessibility/iqaccessibleinterfaceregister.h"
      29              : #include "rcommand/icommandsregister.h"
      30              : #include "rcommand/icommandsstate.h"
      31              : 
      32              : #include "internal/paletteconfiguration.h"
      33              : #include "internal/paletteactionscontroller.h"
      34              : #include "internal/paletteworkspacesetup.h"
      35              : #include "internal/paletteprovider.h"
      36              : #include "internal/palettecell.h"
      37              : #include "internal/palettecommandsregister.h"
      38              : #include "internal/palettecommandsstate.h"
      39              : 
      40              : #include "widgets/masterpalette.h"
      41              : #include "widgets/specialcharactersdialog.h"
      42              : #include "widgets/customizekitdialog.h"
      43              : #include "widgets/timesignaturepropertiesdialog.h"
      44              : #include "widgets/keyedit.h"
      45              : #include "widgets/timedialog.h"
      46              : 
      47              : using namespace mu::palette;
      48              : using namespace muse;
      49              : using namespace muse::modularity;
      50              : 
      51              : static const std::string mname("palette");
      52              : 
      53            0 : std::string PaletteModule::moduleName() const
      54              : {
      55            0 :     return mname;
      56              : }
      57              : 
      58            0 : void PaletteModule::registerExports()
      59              : {
      60            0 :     m_configuration = std::make_shared<PaletteConfiguration>(globalCtx());
      61              : 
      62            0 :     globalIoc()->registerExport<IPaletteConfiguration>(mname, m_configuration);
      63            0 : }
      64              : 
      65            0 : void PaletteModule::resolveImports()
      66              : {
      67            0 :     auto ir = globalIoc()->resolve<muse::interactive::IInteractiveUriRegister>(mname);
      68            0 :     if (ir) {
      69            0 :         ir->registerWidgetUri<MasterPalette>(Uri("musescore://palette/masterpalette"));
      70            0 :         ir->registerWidgetUri<SpecialCharactersDialog>(Uri("musescore://palette/specialcharacters"));
      71            0 :         ir->registerWidgetUri<TimeSignaturePropertiesDialog>(Uri("musescore://palette/timesignatureproperties"));
      72            0 :         ir->registerWidgetUri<CustomizeKitDialog>(Uri("musescore://palette/customizekit"));
      73            0 :         ir->registerWidgetUri<KeyEditorDialog>(Uri("musescore://notation/keysignatures"));
      74            0 :         ir->registerWidgetUri<TimeEditorDialog>(Uri("musescore://notation/timesignatures"));
      75              : 
      76            0 :         ir->registerQmlUri(Uri("musescore://palette/properties"), "MuseScore.Palette", "PalettePropertiesDialog");
      77            0 :         ir->registerQmlUri(Uri("musescore://palette/cellproperties"), "MuseScore.Palette", "PaletteCellPropertiesDialog");
      78              :     }
      79              : 
      80            0 :     auto accr = globalIoc()->resolve<muse::accessibility::IQAccessibleInterfaceRegister>(mname);
      81            0 :     if (accr) {
      82            0 :         accr->registerInterfaceGetter("mu::palette::PaletteWidget", PaletteWidget::accessibleInterface);
      83            0 :         accr->registerInterfaceGetter("mu::palette::PaletteCell", PaletteCell::accessibleInterface);
      84              :     }
      85              : 
      86            0 :     auto cr = globalIoc()->resolve<muse::rcommand::ICommandsRegister>(mname);
      87            0 :     if (cr) {
      88            0 :         cr->reg(std::make_shared<PaletteCommandsRegister>());
      89              :     }
      90            0 : }
      91              : 
      92            0 : void PaletteModule::onInit(const IApplication::RunMode&)
      93              : {
      94            0 :     m_configuration->init();
      95            0 : }
      96              : 
      97            0 : IContextSetup* PaletteModule::newContext(const muse::modularity::ContextPtr& ctx) const
      98              : {
      99            0 :     return new PaletteContext(ctx);
     100              : }
     101              : 
     102            0 : void PaletteContext::registerExports()
     103              : {
     104            0 :     m_paletteProvider = std::make_shared<PaletteProvider>(iocContext());
     105            0 :     m_actionsController = std::make_shared<PaletteActionsController>(iocContext());
     106            0 :     m_paletteWorkspaceSetup = std::make_shared<PaletteWorkspaceSetup>(iocContext());
     107              : 
     108            0 :     ioc()->registerExport<IPaletteProvider>(mname, m_paletteProvider);
     109            0 :     ioc()->registerExport<IPaletteCommandsController>(mname, m_actionsController);
     110            0 : }
     111              : 
     112            0 : void PaletteContext::resolveImports()
     113              : {
     114            0 :     auto cs = ioc()->resolve<muse::rcommand::ICommandsState>(mname);
     115            0 :     if (cs) {
     116            0 :         cs->reg(std::make_shared<PaletteCommandsState>(iocContext()));
     117              :     }
     118            0 : }
     119              : 
     120            0 : void PaletteContext::onInit(const IApplication::RunMode&)
     121              : {
     122            0 :     m_actionsController->init();
     123            0 :     m_paletteProvider->init();
     124            0 : }
     125              : 
     126            0 : void PaletteContext::onAllInited(const IApplication::RunMode&)
     127              : {
     128              :     //! NOTE We need to be sure that the workspaces are initialized.
     129              :     //! So, we loads these settings on onAllInited
     130            0 :     m_paletteWorkspaceSetup->setup();
     131            0 : }
     132              : 
     133            0 : void PaletteContext::onDeinit()
     134              : {
     135            0 :     m_paletteWorkspaceSetup.reset();
     136              : 
     137            0 :     ioc()->unregisterIfRegistered<IPaletteProvider>(mname, m_paletteProvider);
     138            0 :     m_paletteProvider.reset();
     139            0 : }
        

Generated by: LCOV version 2.0-1