Skip to content

Commit

Permalink
Implemented stubs for plugins module
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism authored and igorkorsukov committed Jan 25, 2021
1 parent ef9d809 commit 89d0fd3
Show file tree
Hide file tree
Showing 39 changed files with 383 additions and 43 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/appshell/appshell.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/appshell/qml/DevTools/DevToolsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ 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"
import "./NotationDialogs"
import "./Telemetry"
import "./Audio"
import "./VST"
import "./Plugins"

DockPage {
id: homePage
Expand Down
9 changes: 8 additions & 1 deletion src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/internal/pluginsservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -62,6 +61,5 @@ class PluginsService : public IPluginsService, public async::Asyncable
async::Channel<PluginInfo> m_pluginChanged;
};
}
}

#endif // MU_PLUGINS_PLUGINSSERVICE_H
4 changes: 1 addition & 3 deletions src/plugins/ipluginsservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@

#include "modularity/imoduleexport.h"

namespace mu {
namespace plugins {
namespace mu::plugins {
class IPluginsService : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IPluginsService)
Expand All @@ -49,6 +48,5 @@ class IPluginsService : MODULE_EXPORT_INTERFACE
virtual async::Channel<PluginInfo> pluginChanged() const = 0;
};
}
}

#endif // MU_PLUGINS_IPLUGINSSERVICE_H
19 changes: 10 additions & 9 deletions src/plugins/plugins.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
4 changes: 1 addition & 3 deletions src/plugins/pluginserrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -46,6 +45,5 @@ inline Ret make_ret(Err e)
return Ret(static_cast<int>(e));
}
}
}

#endif // MU_EXTENSIONS_EXTENSIONSERRORS_H
4 changes: 1 addition & 3 deletions src/plugins/pluginstypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

#include "io/path.h"

namespace mu {
namespace plugins {
namespace mu::plugins {
using CodeKey = QString;
using CodeKeyList = QList<CodeKey>;

Expand All @@ -49,6 +48,5 @@ struct PluginInfo

using PluginInfoList = QList<PluginInfo>;
}
}

#endif // MU_PLUGINS_IPLUGINSCONFIGURATION_H
2 changes: 2 additions & 0 deletions src/plugins/qml/MuseScore/Plugins/PluginsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import QtQuick.Controls 2.2
import MuseScore.UiComponents 1.0
import MuseScore.Plugins 1.0

import "internal"

Item {
id: root

Expand Down
3 changes: 1 addition & 2 deletions src/plugins/qml/MuseScore/Plugins/qmldir
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions src/plugins/view/dev/pluginstestmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@

#include <QObject>

namespace mu {
namespace plugins {
namespace mu::plugins {
class PluginsTestModel : public QObject
{
Q_OBJECT
Expand All @@ -47,6 +46,5 @@ class PluginsTestModel : public QObject
PluginInfoList m_installedPlugins;
};
}
}

#endif // MU_PLUGINS_PLUGINSTESTMODEL_H
14 changes: 7 additions & 7 deletions src/plugins/view/pluginsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/view/pluginsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
#include <QAbstractListModel>
#include <QList>

namespace mu {
namespace plugins {
namespace mu::plugins {
class PluginsModel : public QAbstractListModel, public async::Asyncable
{
Q_OBJECT
Expand Down Expand Up @@ -74,6 +73,5 @@ class PluginsModel : public QAbstractListModel, public async::Asyncable
QList<PluginInfo> m_plugins;
};
}
}

#endif // MU_PLUGINS_PLUGINSMODEL_H
4 changes: 1 addition & 3 deletions src/plugins/view/pluginview.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class QmlPlugin;
class QQuickView;
class QQmlComponent;

namespace mu {
namespace plugins {
namespace mu::plugins {
class PluginView : public QObject
{
Q_OBJECT
Expand Down Expand Up @@ -67,6 +66,5 @@ class PluginView : public QObject
QQuickView* m_view = nullptr;
};
}
}

#endif // MU_PLUGINS_PLUGINVIEW_H
4 changes: 4 additions & 0 deletions src/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
35 changes: 35 additions & 0 deletions src/stubs/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 7 additions & 0 deletions src/stubs/plugins/plugins.qrc
Original file line number Diff line number Diff line change
@@ -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>
35 changes: 35 additions & 0 deletions src/stubs/plugins/pluginsconfigurationstub.cpp
Original file line number Diff line number Diff line change
@@ -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&)
{
}
35 changes: 35 additions & 0 deletions src/stubs/plugins/pluginsconfigurationstub.h
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 89d0fd3

Please sign in to comment.