/* * SPDX-License-Identifier: GPL-3.0-only * MuseScore-CLA-applies * * MuseScore * Music Composition & Notation * * Copyright (C) 2021 MuseScore BVBA and others * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "appshellmodule.h" #include #include "modularity/ioc.h" #include "ui/iuiactionsregister.h" #include "ui/iinteractiveuriregister.h" #include "internal/applicationuiactions.h" #include "internal/applicationactioncontroller.h" #include "internal/appshellconfiguration.h" #include "internal/startupscenario.h" #include "internal/applicationactioncontroller.h" #include "view/devtools/settingslistmodel.h" #include "view/appmenumodel.h" #include "view/mainwindowtitleprovider.h" #include "view/notationpagemodel.h" #include "view/notationstatusbarmodel.h" #include "view/aboutmodel.h" #include "view/firstlaunchsetup/firstlaunchsetupmodel.h" #include "view/firstlaunchsetup/themespagemodel.h" #include "view/preferences/preferencesmodel.h" #include "view/preferences/generalpreferencesmodel.h" #include "view/preferences/updatepreferencesmodel.h" #include "view/preferences/appearancepreferencesmodel.h" #include "view/preferences/programmestartpreferencesmodel.h" #include "view/preferences/folderspreferencesmodel.h" #include "view/preferences/noteinputpreferencesmodel.h" #include "view/preferences/advancedpreferencesmodel.h" #include "view/preferences/canvaspreferencesmodel.h" #include "view/preferences/scorepreferencesmodel.h" #include "view/preferences/importpreferencesmodel.h" #include "view/preferences/iopreferencesmodel.h" #include "view/preferences/commonaudioapiconfigurationmodel.h" #include "view/framelesswindow/framelesswindowmodel.h" #include "view/publish/publishtoolbarmodel.h" #include "view/windowdroparea.h" #include "view/dockwindow/docksetup.h" using namespace mu::appshell; using namespace mu::framework; using namespace mu::modularity; using namespace mu::ui; using namespace mu::dock; static std::shared_ptr s_applicationActionController = std::make_shared(); static std::shared_ptr s_applicationUiActions = std::make_shared(s_applicationActionController); static std::shared_ptr s_appShellConfiguration = std::make_shared(); static void appshell_init_qrc() { Q_INIT_RESOURCE(appshell); } AppShellModule::AppShellModule() { } std::string AppShellModule::moduleName() const { return "appshell"; } void AppShellModule::registerExports() { DockSetup::registerExports(); ioc()->registerExport(moduleName(), s_appShellConfiguration); ioc()->registerExport(moduleName(), s_applicationActionController); ioc()->registerExport(moduleName(), new StartupScenario()); } void AppShellModule::resolveImports() { auto ar = ioc()->resolve(moduleName()); if (ar) { ar->reg(s_applicationUiActions); } auto ir = ioc()->resolve(moduleName()); if (ir) { ir->registerUri(Uri("musescore://home"), ContainerMeta(ContainerType::PrimaryPage)); ir->registerUri(Uri("musescore://notation"), ContainerMeta(ContainerType::PrimaryPage)); ir->registerUri(Uri("musescore://sequencer"), ContainerMeta(ContainerType::PrimaryPage)); ir->registerUri(Uri("musescore://publish"), ContainerMeta(ContainerType::PrimaryPage)); ir->registerUri(Uri("musescore://devtools"), ContainerMeta(ContainerType::PrimaryPage)); ir->registerUri(Uri("musescore://about/musescore"), ContainerMeta(ContainerType::QmlDialog, "AboutDialog.qml")); ir->registerUri(Uri("musescore://about/musicxml"), ContainerMeta(ContainerType::QmlDialog, "AboutMusicXMLDialog.qml")); ir->registerUri(Uri("musescore://firstLaunchSetup"), ContainerMeta(ContainerType::QmlDialog, "FirstLaunchSetup/FirstLaunchSetupDialog.qml")); ir->registerUri(Uri("musescore://preferences"), ContainerMeta(ContainerType::QmlDialog, "Preferences/PreferencesDialog.qml")); } } void AppShellModule::registerResources() { appshell_init_qrc(); } void AppShellModule::registerUiTypes() { DockSetup::registerQmlTypes(); qmlRegisterType("MuseScore.Preferences", 1, 0, "SettingListModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "PreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "GeneralPreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "UpdatePreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "AppearancePreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "ProgrammeStartPreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "FoldersPreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "NoteInputPreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "AdvancedPreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "CanvasPreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "ScorePreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "ImportPreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "IOPreferencesModel"); qmlRegisterType("MuseScore.Preferences", 1, 0, "CommonAudioApiConfigurationModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "AppMenuModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "MainWindowTitleProvider"); qmlRegisterType("MuseScore.AppShell", 1, 0, "NotationPageModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "NotationStatusBarModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "AboutModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "FirstLaunchSetupModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "ThemesPageModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "FramelessWindowModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "PublishToolBarModel"); qmlRegisterType("MuseScore.Ui", 1, 0, "WindowDropArea"); } void AppShellModule::onInit(const IApplication::RunMode&) { DockSetup::onInit(); s_appShellConfiguration->init(); s_applicationActionController->init(); s_applicationUiActions->init(); }