Skip to content
Merged
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
8 changes: 4 additions & 4 deletions src/appshell/view/aboutmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class AboutModel : public QObject, public muse::Injectable
{
Q_OBJECT

Inject<IAppShellConfiguration> configuration = { this };
Inject<muse::update::IUpdateConfiguration> updateConfiguration = { this };
Inject<muse::IGlobalConfiguration> globalConfiguration = { this };
Inject<muse::IApplication> application = { this };
muse::Inject<IAppShellConfiguration> configuration = { this };
muse::Inject<muse::update::IUpdateConfiguration> updateConfiguration = { this };
muse::Inject<muse::IGlobalConfiguration> globalConfiguration = { this };
muse::Inject<muse::IApplication> application = { this };

public:
explicit AboutModel(QObject* parent = nullptr);
Expand Down
7 changes: 2 additions & 5 deletions src/appshell/view/firstlaunchsetup/tutorialspagemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_APPSHELL_TUTORIALSPAGEMODEL_H
#define MU_APPSHELL_TUTORIALSPAGEMODEL_H
#pragma once

#include <QObject>

Expand All @@ -34,13 +33,11 @@ class TutorialsPageModel : public QObject, public muse::Injectable
{
Q_OBJECT

Inject<muse::update::IUpdateConfiguration> updateConfiguration = { this };
muse::Inject<muse::update::IUpdateConfiguration> updateConfiguration = { this };

public:
explicit TutorialsPageModel(QObject* parent = nullptr);

Q_INVOKABLE QUrl museScorePrivacyPolicyUrl() const;
};
}

#endif // MU_APPSHELL_TUTORIALSPAGEMODEL_H
11 changes: 4 additions & 7 deletions src/appshell/view/internal/splashscreen/loadingscreenview.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef MU_APPSHELL_LOADINGSCREENVIEW_H
#define MU_APPSHELL_LOADINGSCREENVIEW_H
#pragma once

#include <QWidget>

Expand All @@ -37,9 +36,9 @@ class LoadingScreenView : public QWidget, public muse::Injectable
{
Q_OBJECT

Inject<muse::ui::IUiConfiguration> uiConfiguration = { this };
Inject<muse::languages::ILanguagesService> languagesService = { this };
Inject<muse::IApplication> application = { this };
muse::Inject<muse::ui::IUiConfiguration> uiConfiguration = { this };
muse::Inject<muse::languages::ILanguagesService> languagesService = { this };
muse::Inject<muse::IApplication> application = { this };

public:
explicit LoadingScreenView(QWidget* parent = nullptr);
Expand All @@ -52,5 +51,3 @@ class LoadingScreenView : public QWidget, public muse::Injectable
QSvgRenderer* m_backgroundRenderer = nullptr;
};
}

#endif // MU_APPSHELL_LOADINGSCREENVIEW_H
14 changes: 7 additions & 7 deletions src/appshell/view/notationpagemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class NotationPageModel : public QObject, public muse::Injectable, public muse::
Q_PROPERTY(bool isNavigatorVisible READ isNavigatorVisible NOTIFY isNavigatorVisibleChanged)
Q_PROPERTY(bool isBraillePanelVisible READ isBraillePanelVisible NOTIFY isBraillePanelVisibleChanged)

Inject<muse::actions::IActionsDispatcher> dispatcher = { this };
Inject<muse::dock::IDockWindowProvider> dockWindowProvider = { this };
Inject<muse::extensions::IExtensionsProvider> extensionsProvider = { this };
Inject<context::IGlobalContext> globalContext = { this };
Inject<notation::INotationConfiguration> notationConfiguration = { this };
Inject<braille::IBrailleConfiguration> brailleConfiguration = { this };
Inject<IAppShellConfiguration> configuration = { this };
muse::Inject<muse::actions::IActionsDispatcher> dispatcher = { this };
muse::Inject<muse::dock::IDockWindowProvider> dockWindowProvider = { this };
muse::Inject<muse::extensions::IExtensionsProvider> extensionsProvider = { this };
muse::Inject<context::IGlobalContext> globalContext = { this };
muse::Inject<notation::INotationConfiguration> notationConfiguration = { this };
muse::Inject<braille::IBrailleConfiguration> brailleConfiguration = { this };
muse::Inject<IAppShellConfiguration> configuration = { this };

public:
explicit NotationPageModel(QObject* parent = nullptr);
Expand Down
17 changes: 7 additions & 10 deletions src/appshell/view/preferences/folderspreferencesmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_APPSHELL_FOLDERSPREFERENCESMODEL_H
#define MU_APPSHELL_FOLDERSPREFERENCESMODEL_H
#pragma once

#include <QAbstractListModel>

Expand All @@ -38,12 +37,12 @@ class FoldersPreferencesModel : public QAbstractListModel, public muse::Injectab
{
Q_OBJECT

Inject<project::IProjectConfiguration> projectConfiguration = { this };
Inject<notation::INotationConfiguration> notationConfiguration = { this };
Inject<muse::extensions::IExtensionsConfiguration> extensionsConfiguration = { this };
Inject<muse::audio::IAudioConfiguration> audioConfiguration = { this };
Inject<muse::vst::IVstConfiguration> vstConfiguration = { this };
Inject<IAppShellConfiguration> configuration = { this };
muse::Inject<project::IProjectConfiguration> projectConfiguration = { this };
muse::Inject<notation::INotationConfiguration> notationConfiguration = { this };
muse::Inject<muse::extensions::IExtensionsConfiguration> extensionsConfiguration = { this };
muse::Inject<muse::audio::IAudioConfiguration> audioConfiguration = { this };
muse::Inject<muse::vst::IVstConfiguration> vstConfiguration = { this };
muse::Inject<IAppShellConfiguration> configuration = { this };

public:
explicit FoldersPreferencesModel(QObject* parent = nullptr);
Expand Down Expand Up @@ -100,5 +99,3 @@ class FoldersPreferencesModel : public QAbstractListModel, public muse::Injectab
QList<FolderInfo> m_folders;
};
}

#endif // MU_APPSHELL_FOLDERSPREFERENCESMODEL_H
4 changes: 2 additions & 2 deletions src/appshell/view/welcomedialogmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class WelcomeDialogModel : public QObject, public muse::Injectable

Q_PROPERTY(bool showOnStartup READ showOnStartup WRITE setShowOnStartup NOTIFY showOnStartupChanged)

Inject<IAppShellConfiguration> configuration = { this };
Inject<IStartupScenario> startupScenario = { this };
muse::Inject<IAppShellConfiguration> configuration = { this };
muse::Inject<IStartupScenario> startupScenario = { this };

public:
WelcomeDialogModel();
Expand Down
7 changes: 2 additions & 5 deletions src/engraving/engravingproject.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_ENGRAVING_ENGRAVINGPROJECT_H
#define MU_ENGRAVING_ENGRAVINGPROJECT_H
#pragma once

#include <memory>

Expand Down Expand Up @@ -54,7 +53,7 @@ class MStyle;
class EngravingProject : public std::enable_shared_from_this<EngravingProject>, public muse::Injectable
{
public:
Inject<IEngravingElementsProvider> engravingElementsProvider = { this };
muse::Inject<IEngravingElementsProvider> engravingElementsProvider = { this };

public:
~EngravingProject();
Expand Down Expand Up @@ -94,5 +93,3 @@ class EngravingProject : public std::enable_shared_from_this<EngravingProject>,

using EngravingProjectPtr = std::shared_ptr<EngravingProject>;
}

#endif // MU_ENGRAVING_PROJECT_H
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "global/settings.h"

using namespace muse;
using namespace mu;
using namespace muse::diagnostics;

static const Settings::Key IS_DUMP_UPLOAD_ALLOWED("diagnostics", "diagnostics/is_dump_upload_allowed");
Expand Down
29 changes: 10 additions & 19 deletions src/framework/global/modularity/ioc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_MODULARITY_IOC_H
#define MU_MODULARITY_IOC_H

#pragma once

#ifndef NO_QT_SUPPORT
#include <QObject>
Expand All @@ -30,12 +30,11 @@ class QQmlEngine;
#include "../thirdparty/kors_modularity/modularity/ioc.h" // IWYU pragma: export

namespace muse::modularity {
using ModulesIoC = kors::modularity::ModulesIoC;
using Context = kors::modularity::Context;
using ContextPtr = kors::modularity::ContextPtr;
using kors::modularity::ModulesIoC;
using kors::modularity::Context;
using kors::modularity::ContextPtr;

template<class T>
using Creator = kors::modularity::Creator<T>;
using kors::modularity::Creator;

inline ModulesIoC* _ioc(const ContextPtr& ctx = nullptr)
{
Expand Down Expand Up @@ -65,15 +64,14 @@ inline void removeIoC(const ContextPtr& ctx = nullptr)
}

namespace muse {
template<class I>
using Inject = kors::modularity::Inject<I>;
template<class I>
using GlobalInject = kors::modularity::GlobalInject<I>;
using kors::modularity::Inject;
using kors::modularity::GlobalInject;
using kors::modularity::ThreadSafeInject;

#define INJECT(Interface, getter) muse::Inject<Interface> getter;
#define INJECT_STATIC(Interface, getter) static inline muse::Inject<Interface> getter;

using Injectable = kors::modularity::Injectable;
using kors::modularity::Injectable;

#ifndef NO_QT_SUPPORT
struct QmlIoCContext : public QObject
Expand All @@ -91,10 +89,3 @@ modularity::ContextPtr iocCtxForQmlEngine(const QQmlEngine* e);
modularity::ContextPtr iocCtxForQWidget(const QWidget* o);
#endif
}

namespace mu {
template<class I>
using Inject = kors::modularity::Inject<I>;
}
Comment on lines -95 to -98
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this removal is a bit bold, but I think it's not good to reference mu namespace in framework, and typing muse:: is easy enough


#endif // MU_MODULARITY_IOC_H
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ inline ModulesIoC* ioc()

template<class I>
using Inject = kors::modularity::Inject<I>;


}

#endif // EXAMPLE_IOC_H
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef KORS_MODULARITY_INJECTABLE_H
#define KORS_MODULARITY_INJECTABLE_H
#pragma once

#include <cassert>
#include <functional>
Expand All @@ -12,7 +11,7 @@ class Injectable
public:
virtual ~Injectable() = default;

using GetContext = std::function<modularity::ContextPtr()>;
using GetContext = std::function<modularity::ContextPtr ()>;

Injectable(const modularity::ContextPtr& ctx = nullptr)
: m_ctx(ctx) {}
Expand All @@ -33,12 +32,10 @@ class Injectable
return m_ctx;
}

if (m_inj) {
m_ctx = m_inj->iocContext();
}

if (m_getCtx) {
m_ctx = m_getCtx();
} else if (m_inj) {
m_ctx = m_inj->iocContext();
}

return m_ctx;
Expand All @@ -50,5 +47,3 @@ class Injectable
GetContext m_getCtx;
};
}

#endif // KORS_MODULARITY_INJECTABLE_H
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ SOFTWARE.
#include <map>
#include <utility>

std::recursive_mutex kors::modularity::StaticMutex::mutex;

static std::map<kors::modularity::IoCID, kors::modularity::ModulesIoC*> s_map;

kors::modularity::ModulesIoC* kors::modularity::_ioc(const ContextPtr& ctx)
Expand Down
Loading
Loading