diff --git a/CMakeLists.txt b/CMakeLists.txt index 17bc9cb4870cd..99a3f46ea4139 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ option(MUE_BUILD_VIDEOEXPORT_MODULE "Build videoexport module" OFF) option(MUE_BUILD_IMAGESEXPORT_MODULE "Build imagesexport module" ON) option(MUE_BUILD_INSPECTOR_MODULE "Build inspector module" ON) option(MUE_BUILD_INSTRUMENTSSCENE_MODULE "Build instruments scene module" ON) +option(MUE_BUILD_MUSESOUNDS_MODULE "Build muse sounds module" ON) option(MUE_BUILD_NOTATION_MODULE "Build notation module" ON) option(MUE_BUILD_NOTATION_TESTS "Build notation tests" ON) option(MUE_BUILD_PALETTE_MODULE "Build palette module" ON) diff --git a/SetupConfigure.cmake b/SetupConfigure.cmake index e3972c958b182..e70c7f504734f 100644 --- a/SetupConfigure.cmake +++ b/SetupConfigure.cmake @@ -143,6 +143,7 @@ if(BUILD_CONFIGURE MATCHES "VTEST") set(MUSE_MODULE_LANGUAGES OFF) set(MUSE_MODULE_LEARN OFF) set(MUSE_MODULE_MULTIINSTANCES OFF) + set(MUE_BUILD_MUSESOUNDS_MODULE OFF) set(MUE_BUILD_PALETTE_MODULE OFF) set(MUE_BUILD_PLAYBACK_MODULE OFF) set(MUSE_MODULE_EXTENSIONS OFF) @@ -265,6 +266,7 @@ def_opt(MUE_BUILD_BRAILLE_MODULE ${MUE_BUILD_BRAILLE_MODULE}) def_opt(MUE_BUILD_CONVERTER_MODULE ${MUE_BUILD_CONVERTER_MODULE}) def_opt(MUE_BUILD_INSPECTOR_MODULE ${MUE_BUILD_INSPECTOR_MODULE}) def_opt(MUE_BUILD_INSTRUMENTSSCENE_MODULE ${MUE_BUILD_INSTRUMENTSSCENE_MODULE}) +def_opt(MUE_BUILD_MUSESOUNDS_MODULE ${MUE_BUILD_MUSESOUNDS_MODULE}) def_opt(MUE_BUILD_NOTATION_MODULE ${MUE_BUILD_NOTATION_MODULE}) def_opt(MUE_BUILD_PALETTE_MODULE ${MUE_BUILD_PALETTE_MODULE}) def_opt(MUE_BUILD_PLAYBACK_MODULE ${MUE_BUILD_PLAYBACK_MODULE}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 45bf8ab70b802..1538ce56adcc7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,6 +52,10 @@ if (MUE_BUILD_INSTRUMENTSSCENE_MODULE) add_subdirectory(instrumentsscene) endif() +if (MUE_BUILD_MUSESOUNDS_MODULE) + add_subdirectory(musesounds) +endif() + if (MUE_BUILD_NOTATION_MODULE) add_subdirectory(notation) endif() diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 07aee6087a6f1..2341a879d7397 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -171,6 +171,10 @@ if (MUE_BUILD_APPSHELL_MODULE) list(APPEND LINK_LIB appshell) endif() +if (MUE_BUILD_MUSESOUNDS_MODULE) + list(APPEND LINK_LIB musesounds) +endif() + if (NOT CC_IS_EMSCRIPTEN) list(APPEND LINK_LIB muse::cloud) list(APPEND LINK_LIB muse::languages) diff --git a/src/app/appfactory.cpp b/src/app/appfactory.cpp index b79b671d7c8c4..b6731c4cf2383 100644 --- a/src/app/appfactory.cpp +++ b/src/app/appfactory.cpp @@ -153,6 +153,10 @@ #include "stubs/instrumentsscene/instrumentsscenestubmodule.h" #endif +#ifdef MUE_BUILD_MUSESOUNDS_MODULE +#include "musesounds/musesoundsmodule.h" +#endif + #ifdef MUE_BUILD_NOTATION_MODULE #include "notation/notationmodule.h" #else @@ -299,6 +303,9 @@ std::shared_ptr AppFactory::newGuiApp(const CmdOptions& opti app->addModule(new muse::languages::LanguagesModule()); app->addModule(new muse::learn::LearnModule()); app->addModule(new muse::mi::MultiInstancesModule()); +#ifdef MUE_BUILD_MUSESOUNDS_MODULE + app->addModule(new mu::musesounds::MuseSoundsModule()); +#endif app->addModule(new mu::notation::NotationModule()); app->addModule(new mu::palette::PaletteModule()); app->addModule(new mu::playback::PlaybackModule()); diff --git a/src/appshell/CMakeLists.txt b/src/appshell/CMakeLists.txt index 72a0f31b20c37..36ed619c6a91c 100644 --- a/src/appshell/CMakeLists.txt +++ b/src/appshell/CMakeLists.txt @@ -103,8 +103,6 @@ set(MODULE_SRC ${CMAKE_CURRENT_LIST_DIR}/view/internal/splashscreen/loadingscreenview.h ${CMAKE_CURRENT_LIST_DIR}/view/internal/splashscreen/newinstanceloadingscreenview.cpp ${CMAKE_CURRENT_LIST_DIR}/view/internal/splashscreen/newinstanceloadingscreenview.h - ${CMAKE_CURRENT_LIST_DIR}/view/internal/musesounds/musesoundslistmodel.cpp - ${CMAKE_CURRENT_LIST_DIR}/view/internal/musesounds/musesoundslistmodel.h ) diff --git a/src/appshell/appshell.qrc b/src/appshell/appshell.qrc index 7e243a31bdfe2..ee73ff2aee5f9 100644 --- a/src/appshell/appshell.qrc +++ b/src/appshell/appshell.qrc @@ -102,8 +102,5 @@ qml/Preferences/internal/MixerSection.qml qml/DevTools/Extensions/ExtensionsListView.qml qml/platform/PlatformMenuBar.qml - qml/HomePage/musesounds/MuseSoundItem.qml - qml/HomePage/musesounds/MuseSoundsListView.qml - qml/HomePage/musesounds/MuseSoundsPage.qml diff --git a/src/appshell/appshellmodule.cpp b/src/appshell/appshellmodule.cpp index 3ce959f1b5b47..054d6d94c395f 100644 --- a/src/appshell/appshellmodule.cpp +++ b/src/appshell/appshellmodule.cpp @@ -61,7 +61,6 @@ #include "view/framelesswindow/framelesswindowmodel.h" #include "view/publish/publishtoolbarmodel.h" #include "view/internal/maintoolbarmodel.h" -#include "view/internal/musesounds/musesoundslistmodel.h" #ifdef Q_OS_MAC #include "view/appmenumodel.h" @@ -173,7 +172,6 @@ void AppShellModule::registerUiTypes() qmlRegisterType("MuseScore.AppShell", 1, 0, "FramelessWindowModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "PublishToolBarModel"); qmlRegisterType("MuseScore.AppShell", 1, 0, "MainToolBarModel"); - qmlRegisterType("MuseScore.AppShell", 1, 0, "MuseSoundsListModel"); } void AppShellModule::onPreInit(const IApplication::RunMode& mode) diff --git a/src/appshell/qml/HomePage/HomePage.qml b/src/appshell/qml/HomePage/HomePage.qml index 2d03a1b17ae71..f2fd7da3e1689 100644 --- a/src/appshell/qml/HomePage/HomePage.qml +++ b/src/appshell/qml/HomePage/HomePage.qml @@ -25,11 +25,10 @@ import Muse.Ui 1.0 import Muse.UiComponents 1.0 import Muse.Dock 1.0 -import MuseScore.Project 1.0 import Muse.Cloud 1.0 import Muse.Learn 1.0 - -import "musesounds" +import MuseScore.Project 1.0 +import MuseScore.MuseSounds 1.0 DockPage { id: root diff --git a/src/musesounds/CMakeLists.txt b/src/musesounds/CMakeLists.txt new file mode 100644 index 0000000000000..f8a54f02efbb2 --- /dev/null +++ b/src/musesounds/CMakeLists.txt @@ -0,0 +1,34 @@ +# 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 . + +declare_module(musesounds) + +set(MODULE_QRC musesounds.qrc) +set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml) + +set(MODULE_SRC + ${CMAKE_CURRENT_LIST_DIR}/musesoundsmodule.cpp + ${CMAKE_CURRENT_LIST_DIR}/musesoundsmodule.h + + ${CMAKE_CURRENT_LIST_DIR}/view/musesoundslistmodel.cpp + ${CMAKE_CURRENT_LIST_DIR}/view/musesoundslistmodel.h + ) + +setup_module() diff --git a/src/musesounds/musesounds.qrc b/src/musesounds/musesounds.qrc new file mode 100644 index 0000000000000..67ccec635f74b --- /dev/null +++ b/src/musesounds/musesounds.qrc @@ -0,0 +1,8 @@ + + + qml/MuseScore/MuseSounds/qmldir + qml/MuseScore/MuseSounds/MuseSoundsPage.qml + qml/MuseScore/MuseSounds/internal/MuseSoundsListView.qml + qml/MuseScore/MuseSounds/internal/MuseSoundItem.qml + + diff --git a/src/musesounds/musesoundsmodule.cpp b/src/musesounds/musesoundsmodule.cpp new file mode 100644 index 0000000000000..5ceb3ecc5fc0e --- /dev/null +++ b/src/musesounds/musesoundsmodule.cpp @@ -0,0 +1,61 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-Studio-CLA-applies + * + * MuseScore Studio + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore Limited + * + * 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 "musesoundsmodule.h" + +#include + +#include "view/musesoundslistmodel.h" + +using namespace mu::musesounds; +using namespace muse; + +static void musesounds_init_qrc() +{ + Q_INIT_RESOURCE(musesounds); +} + +std::string MuseSoundsModule::moduleName() const +{ + return "musesounds"; +} + +void MuseSoundsModule::registerExports() +{ +} + +void MuseSoundsModule::resolveImports() +{ +} + +void MuseSoundsModule::registerResources() +{ + musesounds_init_qrc(); +} + +void MuseSoundsModule::registerUiTypes() +{ + qmlRegisterType("MuseScore.AppShell", 1, 0, "MuseSoundsListModel"); +} + +void MuseSoundsModule::onInit(const IApplication::RunMode&) +{ +} diff --git a/src/musesounds/musesoundsmodule.h b/src/musesounds/musesoundsmodule.h new file mode 100644 index 0000000000000..1a452b1941e30 --- /dev/null +++ b/src/musesounds/musesoundsmodule.h @@ -0,0 +1,41 @@ +/* + * SPDX-License-Identifier: GPL-3.0-only + * MuseScore-Studio-CLA-applies + * + * MuseScore Studio + * Music Composition & Notation + * + * Copyright (C) 2021 MuseScore Limited + * + * 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 . + */ + +#pragma once + +#include + +#include "modularity/imodulesetup.h" + +namespace mu::musesounds { +class MuseSoundsModule : public muse::modularity::IModuleSetup +{ +public: + std::string moduleName() const override; + + void registerExports() override; + void resolveImports() override; + void registerResources() override; + void registerUiTypes() override; + void onInit(const muse::IApplication::RunMode& mode) override; +}; +} diff --git a/src/appshell/qml/HomePage/musesounds/MuseSoundsPage.qml b/src/musesounds/qml/MuseScore/MuseSounds/MuseSoundsPage.qml similarity index 100% rename from src/appshell/qml/HomePage/musesounds/MuseSoundsPage.qml rename to src/musesounds/qml/MuseScore/MuseSounds/MuseSoundsPage.qml diff --git a/src/appshell/qml/HomePage/musesounds/MuseSoundItem.qml b/src/musesounds/qml/MuseScore/MuseSounds/internal/MuseSoundItem.qml similarity index 100% rename from src/appshell/qml/HomePage/musesounds/MuseSoundItem.qml rename to src/musesounds/qml/MuseScore/MuseSounds/internal/MuseSoundItem.qml diff --git a/src/appshell/qml/HomePage/musesounds/MuseSoundsListView.qml b/src/musesounds/qml/MuseScore/MuseSounds/internal/MuseSoundsListView.qml similarity index 100% rename from src/appshell/qml/HomePage/musesounds/MuseSoundsListView.qml rename to src/musesounds/qml/MuseScore/MuseSounds/internal/MuseSoundsListView.qml diff --git a/src/musesounds/qml/MuseScore/MuseSounds/qmldir b/src/musesounds/qml/MuseScore/MuseSounds/qmldir new file mode 100644 index 0000000000000..46a27d8158802 --- /dev/null +++ b/src/musesounds/qml/MuseScore/MuseSounds/qmldir @@ -0,0 +1,2 @@ +module MuseScore.MuseSounds +MuseSoundsPage 1.0 MuseSoundsPage.qml diff --git a/src/appshell/view/internal/musesounds/musesoundslistmodel.cpp b/src/musesounds/view/musesoundslistmodel.cpp similarity index 99% rename from src/appshell/view/internal/musesounds/musesoundslistmodel.cpp rename to src/musesounds/view/musesoundslistmodel.cpp index 5973f193b30c1..99242a205a2ff 100644 --- a/src/appshell/view/internal/musesounds/musesoundslistmodel.cpp +++ b/src/musesounds/view/musesoundslistmodel.cpp @@ -24,7 +24,7 @@ #include "log.h" -using namespace mu::appshell; +using namespace mu::musesounds; MuseSoundsListModel::MuseSoundsListModel(QObject* parent) : QAbstractListModel(parent), Injectable(muse::iocCtxForQmlObject(this)) diff --git a/src/appshell/view/internal/musesounds/musesoundslistmodel.h b/src/musesounds/view/musesoundslistmodel.h similarity index 98% rename from src/appshell/view/internal/musesounds/musesoundslistmodel.h rename to src/musesounds/view/musesoundslistmodel.h index 0afe3ff5abdd5..df19ddcb29421 100644 --- a/src/appshell/view/internal/musesounds/musesoundslistmodel.h +++ b/src/musesounds/view/musesoundslistmodel.h @@ -28,7 +28,7 @@ #include "context/iglobalcontext.h" #include "iglobalconfiguration.h" -namespace mu::appshell { +namespace mu::musesounds { struct MuseSoundCategoryInfo { muse::String id; muse::String title; diff --git a/src/update/internal/updatescenario.h b/src/update/internal/updatescenario.h deleted file mode 100644 index 72e708dee0c5b..0000000000000 --- a/src/update/internal/updatescenario.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-3.0-only - * MuseScore-Studio-CLA-applies - * - * MuseScore Studio - * Music Composition & Notation - * - * Copyright (C) 2021 MuseScore Limited - * - * 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 . - */ -#ifndef MU_UPDATE_UPDATESCENARIO_H -#define MU_UPDATE_UPDATESCENARIO_H - -#include "async/asyncable.h" -#include "progress.h" - -#include "modularity/ioc.h" -#include "iinteractive.h" -#include "actions/iactionsdispatcher.h" -#include "multiinstances/imultiinstancesprovider.h" -#include "../iupdateconfiguration.h" -#include "../iupdateservice.h" - -#include "../iupdatescenario.h" - -namespace mu::update { -class UpdateScenario : public IUpdateScenario, public muse::async::Asyncable -{ - INJECT(muse::IInteractive, interactive) - INJECT(muse::actions::IActionsDispatcher, dispatcher) - INJECT(muse::mi::IMultiInstancesProvider, multiInstancesProvider) - INJECT(IUpdateConfiguration, configuration) - INJECT(IUpdateService, updateService) - -public: - void delayedInit(); - - void checkForUpdate() override; - -private: - bool isCheckStarted() const; - - void doCheckForUpdate(bool manual); - void th_heckForUpdate(); - - void processUpdateResult(int errorCode); - - void showNoUpdateMsg(); - void showReleaseInfo(const ReleaseInfo& info); - - void showServerErrorMsg(); - - void downloadRelease(); - void closeAppAndStartInstallation(const muse::io::path_t& installerPath); - - bool m_progress = false; - muse::ProgressPtr m_progressChannel = nullptr; -}; -} - -#endif // MU_UPDATE_UPDATESCENARIO_H