2020-04-25 18:50:24 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
//
|
|
|
|
// Copyright (C) 2020 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 2.
|
|
|
|
//
|
|
|
|
// 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, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#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-02-02 17:22:45 +01:00
|
|
|
#include "actions/iactionsregister.h"
|
2020-07-31 10:50:25 +02:00
|
|
|
#include "ui/iinteractiveuriregister.h"
|
2020-07-28 16:12:28 +02:00
|
|
|
|
2021-02-02 17:22:45 +01:00
|
|
|
#include "internal/applicationactions.h"
|
|
|
|
#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"
|
2020-12-19 13:21:12 +01:00
|
|
|
#include "view/dockwindow/docksetup.h"
|
|
|
|
#include "view/settings/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"
|
2020-12-19 13:21:12 +01: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;
|
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>();
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
ioc()->registerExport<IAppShellConfiguration>(moduleName(), s_appShellConfiguration);
|
2021-02-11 10:17:59 +01:00
|
|
|
ioc()->registerExport<IApplicationActionController>(moduleName(), s_applicationActionController);
|
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-02-09 16:49:48 +01:00
|
|
|
auto ar = ioc()->resolve<actions::IActionsRegister>(moduleName());
|
2021-02-02 17:22:45 +01:00
|
|
|
if (ar) {
|
|
|
|
ar->reg(std::make_shared<ApplicationActions>());
|
|
|
|
}
|
|
|
|
|
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));
|
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()
|
|
|
|
{
|
|
|
|
dock::DockSetup::registerQmlTypes();
|
2020-06-11 15:31:02 +02:00
|
|
|
|
|
|
|
qmlRegisterType<SettingListModel>("MuseScore.Settings", 1, 0, "SettingListModel");
|
2021-02-09 16:49:48 +01:00
|
|
|
qmlRegisterType<AppMenuModel>("MuseScore.AppMenu", 1, 0, "AppMenuModel");
|
2021-02-24 15:48:08 +01:00
|
|
|
qmlRegisterType<NotationPageModel>("MuseScore.PageState", 1, 0, "NotationPageModel");
|
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-02-02 17:22:45 +01:00
|
|
|
}
|