Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion framework/cloud/audiocom/iaudiocomservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@

#include "cloud/cloudtypes.h"

#include "cloud/iauthorizationservice.h"

class QIODevice;
class QString;

using DevicePtr = std::shared_ptr<QIODevice>;

namespace muse::cloud {
class IAudioComService : MODULE_GLOBAL_INTERFACE
class IAudioComService : MODULE_CONTEXT_INTERFACE
{
INTERFACE_ID(IAudioComService)

Expand Down
27 changes: 21 additions & 6 deletions framework/cloud/cloudmodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ using namespace muse;
using namespace muse::cloud;
using namespace muse::modularity;

static const std::string mname("cloud");

std::string CloudModule::moduleName() const
{
return "cloud";
Expand All @@ -44,12 +46,6 @@ void CloudModule::registerExports()
{
m_cloudConfiguration = std::make_shared<CloudConfiguration>(globalCtx());
globalIoc()->registerExport<ICloudConfiguration>(moduleName(), m_cloudConfiguration);
#ifdef MUSE_MODULE_CLOUD_MUSESCORECOM
m_museScoreComService = std::make_shared<MuseScoreComService>(globalCtx());
globalIoc()->registerExport<IMuseScoreComService>(moduleName(), m_museScoreComService);
#endif
m_audioComService = std::make_shared<AudioComService>(globalCtx());
globalIoc()->registerExport<IAudioComService>(moduleName(), m_audioComService);
}

void CloudModule::resolveImports()
Expand All @@ -63,6 +59,25 @@ void CloudModule::resolveImports()
void CloudModule::onInit(const IApplication::RunMode&)
{
m_cloudConfiguration->init();
}

modularity::IContextSetup* CloudModule::newContext(const muse::modularity::ContextPtr& ctx) const
{
return new CloudModuleContext(ctx);
}

void CloudModuleContext::registerExports()
{
#ifdef MUSE_MODULE_CLOUD_MUSESCORECOM
m_museScoreComService = std::make_shared<MuseScoreComService>(iocContext());
ioc()->registerExport<IMuseScoreComService>(mname, m_museScoreComService);
#endif
m_audioComService = std::make_shared<AudioComService>(iocContext());
ioc()->registerExport<IAudioComService>(mname, m_audioComService);
}

void CloudModuleContext::onInit(const IApplication::RunMode&)
{
#ifdef MUSE_MODULE_CLOUD_MUSESCORECOM
m_museScoreComService->init();
#endif
Expand Down
18 changes: 16 additions & 2 deletions framework/cloud/cloudmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

namespace muse::cloud {
class CloudConfiguration;
class MuseScoreComService;
class AudioComService;
class CloudModule : public modularity::IModuleSetup
{
public:
Expand All @@ -38,8 +36,24 @@ class CloudModule : public modularity::IModuleSetup
void resolveImports() override;
void onInit(const IApplication::RunMode& mode) override;

modularity::IContextSetup* newContext(const muse::modularity::ContextPtr& ctx) const override;

private:
std::shared_ptr<CloudConfiguration> m_cloudConfiguration;
};

class MuseScoreComService;
class AudioComService;
class CloudModuleContext : public modularity::IContextSetup
{
public:
CloudModuleContext(const muse::modularity::ContextPtr& ctx)
: modularity::IContextSetup(ctx) {}

void registerExports() override;
void onInit(const IApplication::RunMode& mode) override;

private:
#ifdef MUSE_MODULE_CLOUD_MUSESCORECOM
std::shared_ptr<MuseScoreComService> m_museScoreComService;
#endif
Expand Down
2 changes: 1 addition & 1 deletion framework/cloud/musescorecom/imusescorecomservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class QString;
using DevicePtr = std::shared_ptr<QIODevice>;

namespace muse::cloud {
class IMuseScoreComService : MODULE_GLOBAL_INTERFACE
class IMuseScoreComService : MODULE_CONTEXT_INTERFACE
{
INTERFACE_ID(IMuseScoreComService)

Expand Down
4 changes: 2 additions & 2 deletions framework/cloud/qml/Muse/Cloud/cloudsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class CloudsModel : public QAbstractListModel, public Contextable, public async:
QML_ELEMENT

#ifdef MUSE_MODULE_CLOUD_MUSESCORECOM
GlobalInject<IMuseScoreComService> museScoreComService;
ContextInject<IMuseScoreComService> museScoreComService = { this };
#endif
GlobalInject<IAudioComService> audioComService;
ContextInject<IAudioComService> audioComService = { this };

public:
explicit CloudsModel(QObject* parent = nullptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MuseScoreComAuthorizationModel : public QObject, public Contextable, publi

QML_ELEMENT

GlobalInject<IMuseScoreComService> museScoreComService;
ContextInject<IMuseScoreComService> museScoreComService = { this };

public:
explicit MuseScoreComAuthorizationModel(QObject* parent = nullptr);
Expand Down