Skip to content

Commit

Permalink
Implemented stubs for extensions module
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism authored and igorkorsukov committed Jan 21, 2021
1 parent 436cdf8 commit d981e7c
Show file tree
Hide file tree
Showing 42 changed files with 536 additions and 104 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ set(TELEMETRY_TRACK_ID "" CACHE STRING "Telemetry track id")
set(CRASH_REPORT_URL "" CACHE STRING "URL where to send crash reports")

option(BUILD_NETWORK_MODULE "Build network module" ON)
option(BUILD_EXTENSIONS_MODULE "Build extensions module" ON)
option(BUILD_LANGUAGES_MODULE "Build languages module" ON)

option(SOUNDFONT3 "Ogg Vorbis compressed fonts" ON) # Enable Ogg Vorbis compressed fonts, requires Ogg & Vorbis
Expand Down
1 change: 1 addition & 0 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#define TELEMETRY_TRACK_ID "${TELEMETRY_TRACK_ID}"

#cmakedefine BUILD_NETWORK_MODULE
#cmakedefine BUILD_EXTENSIONS_MODULE
#cmakedefine BUILD_LANGUAGES_MODULE

#cmakedefine WIN_SPARKLE_ENABLED
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ if (NOT OS_IS_WASM)
add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/rtf2html rtf2html) # for capella

add_subdirectory(cloud)
add_subdirectory(extensions)

if (BUILD_EXTENSIONS_MODULE)
add_subdirectory(extensions)
endif (BUILD_EXTENSIONS_MODULE)


if (BUILD_LANGUAGES_MODULE)
add_subdirectory(languages)
Expand Down
1 change: 0 additions & 1 deletion src/appshell/qml/HomePage/HomePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import MuseScore.Ui 1.0
import MuseScore.Dock 1.0
import MuseScore.UiComponents 1.0
import MuseScore.UserScores 1.0
import MuseScore.Extensions 1.0
import MuseScore.Cloud 1.0

DockPage {
Expand Down
6 changes: 3 additions & 3 deletions src/extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml )
set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/extensionsmodule.cpp
${CMAKE_CURRENT_LIST_DIR}/extensionsmodule.h
${CMAKE_CURRENT_LIST_DIR}/iextensionscontroller.h
${CMAKE_CURRENT_LIST_DIR}/iextensionsservice.h
${CMAKE_CURRENT_LIST_DIR}/iextensionsconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/iextensionunpacker.h
${CMAKE_CURRENT_LIST_DIR}/extensionstypes.h
${CMAKE_CURRENT_LIST_DIR}/extensionserrors.h
${CMAKE_CURRENT_LIST_DIR}/internal/extensionscontroller.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/extensionscontroller.h
${CMAKE_CURRENT_LIST_DIR}/internal/extensionsservice.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/extensionsservice.h
${CMAKE_CURRENT_LIST_DIR}/internal/extensionsconfiguration.cpp
${CMAKE_CURRENT_LIST_DIR}/internal/extensionsconfiguration.h
${CMAKE_CURRENT_LIST_DIR}/internal/extensionunpacker.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/extensions.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<qresource prefix="/">
<file>qml/MuseScore/Extensions/ExtensionsPage.qml</file>
<file>qml/MuseScore/Extensions/qmldir</file>
<file>qml/MuseScore/Extensions/ExtensionsListView.qml</file>
<file>qml/MuseScore/Extensions/ExtensionItem.qml</file>
<file>qml/MuseScore/Extensions/internal/ExtensionItem.qml</file>
<file>qml/MuseScore/Extensions/internal/ExtensionsListView.qml</file>
</qresource>
</RCC>
4 changes: 1 addition & 3 deletions src/extensions/extensionserrors.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 extensions {
namespace mu::extensions {
enum class Err {
Undefined = int(Ret::Code::Undefined),
NoError = int(Ret::Code::Ok),
Expand Down Expand Up @@ -72,6 +71,5 @@ inline Ret make_ret(Err e)
return Ret(static_cast<int>(e));
}
}
}

#endif // MU_EXTENSIONS_EXTENSIONSERRORS_H
8 changes: 4 additions & 4 deletions src/extensions/extensionsmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <QQmlEngine>

#include "internal/extensionsconfiguration.h"
#include "internal/extensionscontroller.h"
#include "internal/extensionsservice.h"
#include "internal/extensionunpacker.h"
#include "view/extensionlistmodel.h"

Expand All @@ -31,7 +31,7 @@
using namespace mu::extensions;

static ExtensionsConfiguration* m_extensionsConfiguration = new ExtensionsConfiguration();
static ExtensionsController* m_extensionsController = new ExtensionsController();
static ExtensionsService* m_extensionsService = new ExtensionsService();

static void extensions_init_qrc()
{
Expand All @@ -46,7 +46,7 @@ std::string ExtensionsModule::moduleName() const
void ExtensionsModule::registerExports()
{
framework::ioc()->registerExport<IExtensionsConfiguration>(moduleName(), m_extensionsConfiguration);
framework::ioc()->registerExport<IExtensionsController>(moduleName(), m_extensionsController);
framework::ioc()->registerExport<IExtensionsService>(moduleName(), m_extensionsService);
framework::ioc()->registerExport<IExtensionUnpacker>(moduleName(), new ExtensionUnpacker());
}

Expand All @@ -69,6 +69,6 @@ void ExtensionsModule::onInit(const framework::IApplication::RunMode& runMode)
return;
}

m_extensionsController->init();
m_extensionsService->init();
m_extensionsConfiguration->init();
}
4 changes: 1 addition & 3 deletions src/extensions/extensionsmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

#include "modularity/imodulesetup.h"

namespace mu {
namespace extensions {
namespace mu::extensions {
class ExtensionsModule : public framework::IModuleSetup
{
public:
Expand All @@ -35,6 +34,5 @@ class ExtensionsModule : public framework::IModuleSetup
void onInit(const framework::IApplication::RunMode& mode) override;
};
}
}

#endif // MU_EXTENSIONS_EXTENSIONSSMODULE_H
4 changes: 1 addition & 3 deletions src/extensions/extensionstypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#include <QJsonObject>
#include <QObject>

namespace mu {
namespace extensions {
namespace mu::extensions {
class ExtensionStatus
{
Q_GADGET
Expand Down Expand Up @@ -92,6 +91,5 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Extension::ExtensionTypes)

using ExtensionsHash = QHash<QString /*code*/, Extension>;
}
}

#endif // MU_EXTENSIONS_EXTENSIONSTYPES_H
4 changes: 1 addition & 3 deletions src/extensions/iextensionsconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#include "io/path.h"
#include "extensionstypes.h"

namespace mu {
namespace extensions {
namespace mu::extensions {
class IExtensionsConfiguration : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IExtensionsConfiguration)
Expand Down Expand Up @@ -54,6 +53,5 @@ class IExtensionsConfiguration : MODULE_EXPORT_INTERFACE
virtual io::paths templatesPaths() const = 0;
};
}
}

#endif // MU_EXTENSIONS_IEXTENSIONSCONFIGURATION_H
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#ifndef MU_EXTENSIONS_IEXTENSIONSCONTROLLER_H
#define MU_EXTENSIONS_IEXTENSIONSCONTROLLER_H
#ifndef MU_EXTENSIONS_IEXTENSIONSSERVICE_H
#define MU_EXTENSIONS_IEXTENSIONSSERVICE_H

#include "modularity/imoduleexport.h"
#include "retval.h"

#include "extensionstypes.h"

namespace mu {
namespace extensions {
class IExtensionsController : MODULE_EXPORT_INTERFACE
namespace mu::extensions {
class IExtensionsService : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IExtensionsController)
INTERFACE_ID(IExtensionsService)

public:
virtual ~IExtensionsController() = default;
virtual ~IExtensionsService() = default;

virtual ValCh<ExtensionsHash> extensions() const = 0;
virtual RetCh<ExtensionProgress> install(const QString& extensionCode) = 0;
Expand All @@ -41,6 +40,5 @@ class IExtensionsController : MODULE_EXPORT_INTERFACE
virtual RetCh<Extension> extensionChanged() const = 0;
};
}
}

#endif // MU_EXTENSIONS_IEXTENSIONSCONTROLLER_H
#endif // MU_EXTENSIONS_IEXTENSIONSSERVICE_H
4 changes: 1 addition & 3 deletions src/extensions/iextensionunpacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#include "modularity/imoduleexport.h"
#include "ret.h"

namespace mu {
namespace extensions {
namespace mu::extensions {
class IExtensionUnpacker : MODULE_EXPORT_INTERFACE
{
INTERFACE_ID(IExtensionUnpacker)
Expand All @@ -36,6 +35,5 @@ class IExtensionUnpacker : MODULE_EXPORT_INTERFACE
virtual Ret unpack(const QString& source, const QString& destination) const = 0;
};
}
}

#endif // MU_EXTENSIONS_IEXTENSIONUNPACKER_H
4 changes: 1 addition & 3 deletions src/extensions/internal/extensionsconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#include "iglobalconfiguration.h"
#include "framework/system/ifilesystem.h"

namespace mu {
namespace extensions {
namespace mu::extensions {
class ExtensionsConfiguration : public IExtensionsConfiguration
{
INJECT(extensions, framework::IGlobalConfiguration, globalConfiguration)
Expand Down Expand Up @@ -67,6 +66,5 @@ class ExtensionsConfiguration : public IExtensionsConfiguration
async::Channel<ExtensionsHash> m_extensionHashChanged;
};
}
}

#endif // MU_EXTENSIONS_EXTENSIONSCONFIGURATION_H
Loading

0 comments on commit d981e7c

Please sign in to comment.