2021-04-19 16:06:08 +02:00
|
|
|
/*
|
|
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2020-04-25 18:50:24 +02:00
|
|
|
|
|
|
|
#include "appshellmodule.h"
|
|
|
|
|
2020-06-19 16:50:30 +02:00
|
|
|
#include <QQmlEngine>
|
2020-04-25 18:50:24 +02:00
|
|
|
|
2020-07-28 16:12:28 +02:00
|
|
|
#include "modularity/ioc.h"
|
2020-12-19 13:21:12 +01:00
|
|
|
|
2021-03-30 19:30:16 +02:00
|
|
|
#include "ui/iuiactionsregister.h"
|
2020-07-31 10:50:25 +02:00
|
|
|
#include "ui/iinteractiveuriregister.h"
|
2020-07-28 16:12:28 +02:00
|
|
|
|
2021-03-30 19:30:16 +02:00
|
|
|
#include "internal/applicationuiactions.h"
|
2021-02-02 17:22:45 +01:00
|
|
|
#include "internal/applicationactioncontroller.h"
|
2021-02-09 16:49:48 +01:00
|
|
|
#include "internal/appshellconfiguration.h"
|
2021-02-24 15:48:08 +01:00
|
|
|
#include "internal/notationpagestate.h"
|
2021-03-01 10:35:54 +01:00
|
|
|
|
|
|
|
#include "view/devtools/settingslistmodel.h"
|
2021-02-09 16:49:48 +01:00
|
|
|
#include "view/appmenumodel.h"
|
2021-02-24 15:48:08 +01:00
|
|
|
#include "view/notationpagemodel.h"
|
2021-06-01 13:02:03 +02:00
|
|
|
#include "view/notationstatusbarmodel.h"
|
2021-02-28 17:38:18 +01:00
|
|
|
#include "view/aboutmodel.h"
|
2021-03-19 18:29:47 +01:00
|
|
|
#include "view/startupmodel.h"
|
2021-04-01 20:19:40 +02:00
|
|
|
#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"
|
2021-05-21 11:59:18 +02:00
|
|
|
#include "view/framelesswindow/framelesswindowmodel.h"
|
2021-06-10 12:17:45 +02:00
|
|
|
#include "view/publish/publishtoolbarmodel.h"
|
2021-03-10 14:25:46 +01:00
|
|
|
|
2021-05-21 16:15:18 +02:00
|
|
|
#include "view/dockwindow/docksetup.h"
|
2021-04-29 09:55:52 +02:00
|
|
|
|
2020-04-25 18:50:24 +02:00
|
|
|
using namespace mu::appshell;
|
2020-07-28 16:12:28 +02:00
|
|
|
using namespace mu::framework;
|
2021-01-18 08:15:02 +01:00
|
|
|
using namespace mu::ui;
|
2021-04-29 12:12:33 +02:00
|
|
|
using namespace mu::dock;
|
2020-04-25 18:50:24 +02:00
|
|
|
|
2021-02-09 16:49:48 +01:00
|
|
|
static std::shared_ptr<ApplicationActionController> s_applicationActionController = std::make_shared<ApplicationActionController>();
|
2021-03-30 19:30:16 +02:00
|
|
|
static std::shared_ptr<ApplicationUiActions> s_applicationUiActions = std::make_shared<ApplicationUiActions>(s_applicationActionController);
|
2021-02-09 16:49:48 +01:00
|
|
|
static std::shared_ptr<AppShellConfiguration> s_appShellConfiguration = std::make_shared<AppShellConfiguration>();
|
2021-02-24 15:48:08 +01:00
|
|
|
static std::shared_ptr<NotationPageState> s_notationPageState = std::make_shared<NotationPageState>();
|
2021-02-02 17:22:45 +01:00
|
|
|
|
2020-04-25 18:50:24 +02:00
|
|
|
static void appshell_init_qrc()
|
|
|
|
{
|
|
|
|
Q_INIT_RESOURCE(appshell);
|
|
|
|
}
|
|
|
|
|
|
|
|
AppShellModule::AppShellModule()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string AppShellModule::moduleName() const
|
|
|
|
{
|
|
|
|
return "appshell";
|
|
|
|
}
|
|
|
|
|
2021-02-09 16:49:48 +01:00
|
|
|
void AppShellModule::registerExports()
|
|
|
|
{
|
2021-04-29 12:12:33 +02:00
|
|
|
DockSetup::registerExports();
|
|
|
|
|
2021-02-09 16:49:48 +01:00
|
|
|
ioc()->registerExport<IAppShellConfiguration>(moduleName(), s_appShellConfiguration);
|
2021-02-24 15:48:08 +01:00
|
|
|
ioc()->registerExport<INotationPageState>(moduleName(), s_notationPageState);
|
2021-02-09 16:49:48 +01:00
|
|
|
}
|
|
|
|
|
2020-07-28 16:12:28 +02:00
|
|
|
void AppShellModule::resolveImports()
|
|
|
|
{
|
2021-03-30 19:30:16 +02:00
|
|
|
auto ar = ioc()->resolve<ui::IUiActionsRegister>(moduleName());
|
2021-02-02 17:22:45 +01:00
|
|
|
if (ar) {
|
2021-03-30 19:30:16 +02:00
|
|
|
ar->reg(s_applicationUiActions);
|
2021-02-02 17:22:45 +01:00
|
|
|
}
|
|
|
|
|
2020-07-31 10:50:25 +02:00
|
|
|
auto ir = ioc()->resolve<IInteractiveUriRegister>(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));
|
2021-02-28 17:38:18 +01:00
|
|
|
ir->registerUri(Uri("musescore://about/musescore"), ContainerMeta(ContainerType::QmlDialog, "AboutDialog.qml"));
|
|
|
|
ir->registerUri(Uri("musescore://about/musicxml"), ContainerMeta(ContainerType::QmlDialog, "AboutMusicXMLDialog.qml"));
|
2021-03-01 10:35:54 +01:00
|
|
|
ir->registerUri(Uri("musescore://preferences"), ContainerMeta(ContainerType::QmlDialog, "Preferences/PreferencesDialog.qml"));
|
2020-07-28 16:12:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-25 18:50:24 +02:00
|
|
|
void AppShellModule::registerResources()
|
|
|
|
{
|
|
|
|
appshell_init_qrc();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AppShellModule::registerUiTypes()
|
|
|
|
{
|
2021-04-29 12:12:33 +02:00
|
|
|
DockSetup::registerQmlTypes();
|
2020-06-11 15:31:02 +02:00
|
|
|
|
2021-03-01 10:35:54 +01:00
|
|
|
qmlRegisterType<SettingListModel>("MuseScore.Preferences", 1, 0, "SettingListModel");
|
|
|
|
qmlRegisterType<PreferencesModel>("MuseScore.Preferences", 1, 0, "PreferencesModel");
|
2021-03-18 13:20:08 +01:00
|
|
|
qmlRegisterType<GeneralPreferencesModel>("MuseScore.Preferences", 1, 0, "GeneralPreferencesModel");
|
2021-03-19 10:50:42 +01:00
|
|
|
qmlRegisterType<UpdatePreferencesModel>("MuseScore.Preferences", 1, 0, "UpdatePreferencesModel");
|
2021-03-16 17:07:35 +01:00
|
|
|
qmlRegisterType<AppearancePreferencesModel>("MuseScore.Preferences", 1, 0, "AppearancePreferencesModel");
|
2021-03-19 12:44:39 +01:00
|
|
|
qmlRegisterType<ProgrammeStartPreferencesModel>("MuseScore.Preferences", 1, 0, "ProgrammeStartPreferencesModel");
|
2021-03-19 21:06:21 +01:00
|
|
|
qmlRegisterType<FoldersPreferencesModel>("MuseScore.Preferences", 1, 0, "FoldersPreferencesModel");
|
2021-03-22 18:45:42 +01:00
|
|
|
qmlRegisterType<NoteInputPreferencesModel>("MuseScore.Preferences", 1, 0, "NoteInputPreferencesModel");
|
2021-03-26 15:04:18 +01:00
|
|
|
qmlRegisterType<AdvancedPreferencesModel>("MuseScore.Preferences", 1, 0, "AdvancedPreferencesModel");
|
2021-03-24 12:56:53 +01:00
|
|
|
qmlRegisterType<CanvasPreferencesModel>("MuseScore.Preferences", 1, 0, "CanvasPreferencesModel");
|
2021-03-28 17:49:50 +02:00
|
|
|
qmlRegisterType<ScorePreferencesModel>("MuseScore.Preferences", 1, 0, "ScorePreferencesModel");
|
2021-03-30 11:24:18 +02:00
|
|
|
qmlRegisterType<ImportPreferencesModel>("MuseScore.Preferences", 1, 0, "ImportPreferencesModel");
|
2021-04-01 10:57:20 +02:00
|
|
|
qmlRegisterType<IOPreferencesModel>("MuseScore.Preferences", 1, 0, "IOPreferencesModel");
|
2021-04-01 16:39:28 +02:00
|
|
|
qmlRegisterType<CommonAudioApiConfigurationModel>("MuseScore.Preferences", 1, 0, "CommonAudioApiConfigurationModel");
|
2021-03-19 18:29:47 +01:00
|
|
|
qmlRegisterType<AppMenuModel>("MuseScore.AppShell", 1, 0, "AppMenuModel");
|
2021-02-28 17:38:18 +01:00
|
|
|
qmlRegisterType<NotationPageModel>("MuseScore.AppShell", 1, 0, "NotationPageModel");
|
2021-06-01 13:02:03 +02:00
|
|
|
qmlRegisterType<NotationStatusBarModel>("MuseScore.AppShell", 1, 0, "NotationStatusBarModel");
|
2021-02-28 17:38:18 +01:00
|
|
|
qmlRegisterType<AboutModel>("MuseScore.AppShell", 1, 0, "AboutModel");
|
2021-03-19 18:29:47 +01:00
|
|
|
qmlRegisterType<StartupModel>("MuseScore.AppShell", 1, 0, "StartupModel");
|
2021-05-21 11:59:18 +02:00
|
|
|
qmlRegisterType<FramelessWindowModel>("MuseScore.AppShell", 1, 0, "FramelessWindowModel");
|
2021-06-10 12:17:45 +02:00
|
|
|
qmlRegisterType<PublishToolBarModel>("MuseScore.AppShell", 1, 0, "PublishToolBarModel");
|
2020-04-25 18:50:24 +02:00
|
|
|
}
|
2021-02-02 17:22:45 +01:00
|
|
|
|
|
|
|
void AppShellModule::onInit(const IApplication::RunMode&)
|
|
|
|
{
|
2021-02-24 15:48:08 +01:00
|
|
|
s_appShellConfiguration->init();
|
2021-02-09 16:49:48 +01:00
|
|
|
s_applicationActionController->init();
|
2021-02-24 15:48:08 +01:00
|
|
|
s_notationPageState->init();
|
2021-03-30 19:30:16 +02:00
|
|
|
s_applicationUiActions->init();
|
2021-02-02 17:22:45 +01:00
|
|
|
}
|