Implemented stubs for plugins module

This commit is contained in:
Eism 2021-01-25 12:22:26 +02:00 committed by Igor Korsukov
parent ef9d80951d
commit 89d0fd31c6
39 changed files with 383 additions and 43 deletions

View file

@ -59,6 +59,7 @@ option(BUILD_USERSCORES_MODULE "Build userscores module" ON)
option(BUILD_CLOUD_MODULE "Build cloud module" ON)
option(BUILD_EXTENSIONS_MODULE "Build extensions module" ON)
option(BUILD_LANGUAGES_MODULE "Build languages module" ON)
option(BUILD_PLUGINS_MODULE "Build plugins module" ON)
option(BUILD_PLAYBACK_MODULE "Build playback module" ON)
option(BUILD_PALETTE_MODULE "Build palette module" ON)
option(BUILD_INSTRUMENTS_MODULE "Build instruments module" ON)

View file

@ -48,6 +48,7 @@
#cmakedefine BUILD_CLOUD_MODULE
#cmakedefine BUILD_EXTENSIONS_MODULE
#cmakedefine BUILD_LANGUAGES_MODULE
#cmakedefine BUILD_PLUGINS_MODULE
#cmakedefine BUILD_PLAYBACK_MODULE
#cmakedefine BUILD_PALETTE_MODULE
#cmakedefine BUILD_INSTRUMENTS_MODULE

View file

@ -40,7 +40,9 @@ if (NOT OS_IS_WASM)
add_subdirectory(languages)
endif (BUILD_LANGUAGES_MODULE)
add_subdirectory(plugins)
if (BUILD_PLUGINS_MODULE)
add_subdirectory(plugins)
endif (BUILD_PLUGINS_MODULE)
endif()
# Scenes common

View file

@ -21,7 +21,6 @@
<file>qml/DevTools/Audio/SoundFontsPanel.qml</file>
<file>qml/DevTools/Audio/MidiPorts.qml</file>
<file>qml/DevTools/VST/VSTTests.qml</file>
<file>qml/DevTools/Plugins/PluginsTests.qml</file>
<file>qml/DevTools/Gallery/GeneralComponentsGallery.qml</file>
<file>qml/DevTools/Telemetry/TelemetryInfo.qml</file>
<file>qml/main.wasm.qml</file>

View file

@ -3,6 +3,7 @@ import QtQuick 2.15
import MuseScore.Dock 1.0
import MuseScore.Ui 1.0
import MuseScore.UiComponents 1.0
import MuseScore.Plugins 1.0
import "./Gallery"
import "./Interactive"
@ -10,7 +11,6 @@ import "./NotationDialogs"
import "./Telemetry"
import "./Audio"
import "./VST"
import "./Plugins"
DockPage {
id: homePage

View file

@ -49,7 +49,6 @@
#else
#include "stubs/userscores/userscoresstubmodule.h"
#endif
#include "plugins/pluginsmodule.h"
#include "notation/notationmodule.h"
#include "importexport/importexportmodule.h"
#include "importexport/musicxml/musicxmlmodule.h"
@ -83,7 +82,11 @@
#ifndef Q_OS_WASM
#include "workspace/workspacemodule.h"
#ifdef BUILD_PLUGINS_MODULE
#include "plugins/pluginsmodule.h"
#else
#include "stubs/plugins/pluginsstubmodule.h"
#endif
#include "importexport/importexportmodule.h"
#ifdef BUILD_CLOUD_MODULE
#include "cloud/cloudmodule.h"
@ -185,7 +188,11 @@ int main(int argc, char** argv)
app.addModule(new mu::iex::bb::BBModule());
app.addModule(new mu::iex::musicxml::MusicXmlModule());
app.addModule(new mu::workspace::WorkspaceModule());
#ifdef BUILD_PLUGINS_MODULE
app.addModule(new mu::plugins::PluginsModule());
#else
app.addModule(new mu::plugins::PluginsStubModule());
#endif
#ifdef BUILD_CLOUD_MODULE
app.addModule(new mu::cloud::CloudModule());
#else

View file

@ -28,8 +28,7 @@
#include "io/path.h"
#include "async/asyncable.h"
namespace mu {
namespace plugins {
namespace mu::plugins {
class PluginsService : public IPluginsService, public async::Asyncable
{
INJECT(plugins, IPluginsConfiguration, configuration)
@ -62,6 +61,5 @@ private:
async::Channel<PluginInfo> m_pluginChanged;
};
}
}
#endif // MU_PLUGINS_PLUGINSSERVICE_H

View file

@ -26,8 +26,7 @@
#include "modularity/imoduleexport.h"
namespace mu {
namespace plugins {
namespace mu::plugins {
class IPluginsService : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IPluginsService)
@ -49,6 +48,5 @@ public:
virtual async::Channel<PluginInfo> pluginChanged() const = 0;
};
}
}
#endif // MU_PLUGINS_IPLUGINSSERVICE_H

View file

@ -2,14 +2,15 @@
<qresource prefix="/">
<file>qml/MuseScore/Plugins/qmldir</file>
<file>qml/MuseScore/Plugins/PluginsPage.qml</file>
<file>qml/MuseScore/Plugins/PluginsListView.qml</file>
<file>qml/MuseScore/Plugins/PluginItem.qml</file>
<file>qml/MuseScore/Plugins/placeholders/placeholder1.jpeg</file>
<file>qml/MuseScore/Plugins/placeholders/placeholder2.jpeg</file>
<file>qml/MuseScore/Plugins/placeholders/placeholder3.jpeg</file>
<file>qml/MuseScore/Plugins/placeholders/placeholder4.jpeg</file>
<file>qml/MuseScore/Plugins/placeholders/placeholder5.jpeg</file>
<file>qml/MuseScore/Plugins/placeholders/placeholder6.jpeg</file>
<file>qml/MuseScore/Plugins/placeholders/placeholder7.jpeg</file>
<file>qml/MuseScore/Plugins/internal/PluginItem.qml</file>
<file>qml/MuseScore/Plugins/internal/PluginsListView.qml</file>
<file>qml/MuseScore/Plugins/internal/placeholders/placeholder1.jpeg</file>
<file>qml/MuseScore/Plugins/internal/placeholders/placeholder2.jpeg</file>
<file>qml/MuseScore/Plugins/internal/placeholders/placeholder3.jpeg</file>
<file>qml/MuseScore/Plugins/internal/placeholders/placeholder4.jpeg</file>
<file>qml/MuseScore/Plugins/internal/placeholders/placeholder5.jpeg</file>
<file>qml/MuseScore/Plugins/internal/placeholders/placeholder6.jpeg</file>
<file>qml/MuseScore/Plugins/internal/placeholders/placeholder7.jpeg</file>
<file>qml/MuseScore/Plugins/DevTools/PluginsTests.qml</file>
</qresource>
</RCC>

View file

@ -22,8 +22,7 @@
#include "ret.h"
#include "translation.h"
namespace mu {
namespace plugins {
namespace mu::plugins {
enum class Err {
Undefined = int(Ret::Code::Undefined),
NoError = int(Ret::Code::Ok),
@ -46,6 +45,5 @@ inline Ret make_ret(Err e)
return Ret(static_cast<int>(e));
}
}
}
#endif // MU_EXTENSIONS_EXTENSIONSERRORS_H

View file

@ -25,8 +25,7 @@
#include "io/path.h"
namespace mu {
namespace plugins {
namespace mu::plugins {
using CodeKey = QString;
using CodeKeyList = QList<CodeKey>;
@ -49,6 +48,5 @@ struct PluginInfo
using PluginInfoList = QList<PluginInfo>;
}
}
#endif // MU_PLUGINS_IPLUGINSCONFIGURATION_H

View file

@ -4,6 +4,8 @@ import QtQuick.Controls 2.2
import MuseScore.UiComponents 1.0
import MuseScore.Plugins 1.0
import "internal"
Item {
id: root

View file

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View file

Before

Width:  |  Height:  |  Size: 219 KiB

After

Width:  |  Height:  |  Size: 219 KiB

View file

Before

Width:  |  Height:  |  Size: 253 KiB

After

Width:  |  Height:  |  Size: 253 KiB

View file

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View file

Before

Width:  |  Height:  |  Size: 188 KiB

After

Width:  |  Height:  |  Size: 188 KiB

View file

Before

Width:  |  Height:  |  Size: 437 KiB

After

Width:  |  Height:  |  Size: 437 KiB

View file

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View file

@ -1,4 +1,3 @@
module MuseScore.Plugins
PluginsPage 1.0 PluginsPage.qml
PluginsListView 1.0 PluginsListView.qml
PluginItem 1.0 PluginItem.qml
PluginsTests 1.0 DevTools/PluginsTests.qml

View file

@ -24,8 +24,7 @@
#include <QObject>
namespace mu {
namespace plugins {
namespace mu::plugins {
class PluginsTestModel : public QObject
{
Q_OBJECT
@ -47,6 +46,5 @@ private:
PluginInfoList m_installedPlugins;
};
}
}
#endif // MU_PLUGINS_PLUGINSTESTMODEL_H

View file

@ -46,13 +46,13 @@ void PluginsModel::load()
// TODO: this is temporary solution and will be changed in future
QList<QString> thumbnailUrlExamples {
"placeholders/placeholder1.jpeg",
"placeholders/placeholder2.jpeg",
"placeholders/placeholder3.jpeg",
"placeholders/placeholder4.jpeg",
"placeholders/placeholder5.jpeg",
"placeholders/placeholder6.jpeg",
"placeholders/placeholder7.jpeg"
"qrc:/qml/MuseScore/Plugins/internal/placeholders/placeholder1.jpeg",
"qrc:/qml/MuseScore/Plugins/internal/placeholders/placeholder2.jpeg",
"qrc:/qml/MuseScore/Plugins/internal/placeholders/placeholder3.jpeg",
"qrc:/qml/MuseScore/Plugins/internal/placeholders/placeholder4.jpeg",
"qrc:/qml/MuseScore/Plugins/internal/placeholders/placeholder5.jpeg",
"qrc:/qml/MuseScore/Plugins/internal/placeholders/placeholder6.jpeg",
"qrc:/qml/MuseScore/Plugins/internal/placeholders/placeholder7.jpeg"
};
QList<QString> categoriesExamples {

View file

@ -28,8 +28,7 @@
#include <QAbstractListModel>
#include <QList>
namespace mu {
namespace plugins {
namespace mu::plugins {
class PluginsModel : public QAbstractListModel, public async::Asyncable
{
Q_OBJECT
@ -74,6 +73,5 @@ private:
QList<PluginInfo> m_plugins;
};
}
}
#endif // MU_PLUGINS_PLUGINSMODEL_H

View file

@ -35,8 +35,7 @@ class QmlPlugin;
class QQuickView;
class QQmlComponent;
namespace mu {
namespace plugins {
namespace mu::plugins {
class PluginView : public QObject
{
Q_OBJECT
@ -67,6 +66,5 @@ private:
QQuickView* m_view = nullptr;
};
}
}
#endif // MU_PLUGINS_PLUGINVIEW_H

View file

@ -17,6 +17,10 @@ if (NOT BUILD_LANGUAGES_MODULE)
add_subdirectory(languages)
endif (NOT BUILD_LANGUAGES_MODULE)
if (NOT BUILD_PLUGINS_MODULE)
add_subdirectory(plugins)
endif (NOT BUILD_PLUGINS_MODULE)
if (NOT BUILD_PLAYBACK_MODULE)
add_subdirectory(playback)
endif (NOT BUILD_PLAYBACK_MODULE)

View file

@ -0,0 +1,35 @@
#=============================================================================
# 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.
#=============================================================================
set(MODULE plugins)
set(MODULE_QRC plugins.qrc)
set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml)
set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/pluginsstubmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/pluginsstubmodule.h
${CMAKE_CURRENT_LIST_DIR}/pluginsservicestub.cpp
${CMAKE_CURRENT_LIST_DIR}/pluginsservicestub.h
${CMAKE_CURRENT_LIST_DIR}/pluginsconfigurationstub.cpp
${CMAKE_CURRENT_LIST_DIR}/pluginsconfigurationstub.h
)
include(${PROJECT_SOURCE_DIR}/build/module.cmake)

View file

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/">
<file>qml/MuseScore/Plugins/qmldir</file>
<file>qml/MuseScore/Plugins/PluginsPage.qml</file>
<file>qml/MuseScore/Plugins/DevTools/PluginsTests.qml</file>
</qresource>
</RCC>

View file

@ -0,0 +1,35 @@
//=============================================================================
// 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 "pluginsconfigurationstub.h"
using namespace mu::plugins;
mu::io::paths PluginsConfigurationStub::pluginsDirPaths() const
{
return {};
}
mu::ValCh<CodeKeyList> PluginsConfigurationStub::installedPlugins() const
{
return mu::ValCh<CodeKeyList>();
}
void PluginsConfigurationStub::setInstalledPlugins(const CodeKeyList&)
{
}

View file

@ -0,0 +1,35 @@
//=============================================================================
// 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.
//=============================================================================
#ifndef MU_PLUGINS_PLUGINSCONFIGURATIONSTUB_H
#define MU_PLUGINS_PLUGINSCONFIGURATIONSTUB_H
#include "plugins/ipluginsconfiguration.h"
namespace mu::plugins {
class PluginsConfigurationStub : public IPluginsConfiguration
{
public:
io::paths pluginsDirPaths() const override;
ValCh<CodeKeyList> installedPlugins() const override;
void setInstalledPlugins(const CodeKeyList& codeKeyList) override;
};
}
#endif // MU_PLUGINS_PLUGINSCONFIGURATIONSTUB_H

View file

@ -0,0 +1,58 @@
//=============================================================================
// 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 "pluginsservicestub.h"
using namespace mu::plugins;
using namespace mu;
RetVal<PluginInfoList> PluginsServiceStub::plugins(IPluginsService::PluginsStatus) const
{
RetVal<PluginInfoList> result;
result.ret = make_ret(Ret::Code::NotSupported);
return result;
}
RetValCh<framework::Progress> PluginsServiceStub::install(const CodeKey&)
{
RetValCh<framework::Progress> result;
result.ret = make_ret(Ret::Code::NotSupported);
return result;
}
RetValCh<framework::Progress> PluginsServiceStub::update(const CodeKey&)
{
RetValCh<framework::Progress> result;
result.ret = make_ret(Ret::Code::NotSupported);
return result;
}
Ret PluginsServiceStub::uninstall(const CodeKey&)
{
return make_ret(Ret::Code::NotSupported);
}
Ret PluginsServiceStub::run(const CodeKey&)
{
return make_ret(Ret::Code::NotSupported);
}
async::Channel<PluginInfo> PluginsServiceStub::pluginChanged() const
{
return async::Channel<PluginInfo>();
}

View file

@ -0,0 +1,40 @@
//=============================================================================
// 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.
//=============================================================================
#ifndef MU_PLUGINS_PLUGINSSERVICESTUB_H
#define MU_PLUGINS_PLUGINSSERVICESTUB_H
#include "plugins/ipluginsservice.h"
namespace mu::plugins {
class PluginsServiceStub : public IPluginsService
{
public:
RetVal<PluginInfoList> plugins(PluginsStatus status = All) const override;
RetValCh<framework::Progress> install(const CodeKey& codeKey) override;
RetValCh<framework::Progress> update(const CodeKey& codeKey) override;
Ret uninstall(const CodeKey& codeKey) override;
Ret run(const CodeKey& codeKey) override;
async::Channel<PluginInfo> pluginChanged() const override;
};
}
#endif // MU_PLUGINS_IPLUGINSSERVICE_H

View file

@ -0,0 +1,57 @@
//=============================================================================
// 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 "pluginsstubmodule.h"
#include "modularity/ioc.h"
#include "ui/iuiengine.h"
#include "pluginsservicestub.h"
#include "pluginsconfigurationstub.h"
#include "ui/iinteractiveuriregister.h"
using namespace mu::plugins;
using namespace mu::framework;
using namespace mu::ui;
static void plugins_init_qrc()
{
Q_INIT_RESOURCE(plugins);
}
std::string PluginsStubModule::moduleName() const
{
return "plugins_stub";
}
void PluginsStubModule::registerExports()
{
ioc()->registerExport<IPluginsService>(moduleName(), new PluginsServiceStub());
ioc()->registerExport<IPluginsConfiguration>(moduleName(), new PluginsConfigurationStub());
}
void PluginsStubModule::registerResources()
{
plugins_init_qrc();
}
void PluginsStubModule::registerUiTypes()
{
ioc()->resolve<IUiEngine>(moduleName())->addSourceImportPath(plugins_QML_IMPORT);
}

View file

@ -0,0 +1,36 @@
//=============================================================================
// 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.
//=============================================================================
#ifndef MU_PLUGINS_PLUGINSSTUBSMODULE_H
#define MU_PLUGINS_PLUGINSSTUBSMODULE_H
#include "modularity/imodulesetup.h"
namespace mu::plugins {
class PluginsStubModule : public framework::IModuleSetup
{
public:
std::string moduleName() const override;
void registerExports() override;
void registerResources() override;
void registerUiTypes() override;
};
}
#endif // MU_PLUGINS_PLUGINSSTUBSMODULE_H

View file

@ -0,0 +1,12 @@
import QtQuick 2.15
import MuseScore.UiComponents 1.0
Rectangle {
color: ui.theme.backgroundPrimaryColor
StyledTextLabel {
anchors.centerIn: parent
text: "Plugins Tests Page Stub"
}
}

View file

@ -0,0 +1,20 @@
import QtQuick 2.15
import MuseScore.UiComponents 1.0
Rectangle {
property string search: ""
property string selectedCategory: ""
property string backgroundColor: ui.theme.backgroundPrimaryColor
function categories() {
return {}
}
color: backgroundColor
StyledTextLabel {
anchors.centerIn: parent
text: "Plugins Page Stub"
}
}

View file

@ -0,0 +1,3 @@
module MuseScore.Plugins
PluginsPage 1.0 PluginsPage.qml
PluginsTests 1.0 DevTools/PluginsTests.qml