diff --git a/src/commons.h b/src/commons.h index 00e1771..a8cc66f 100644 --- a/src/commons.h +++ b/src/commons.h @@ -85,7 +85,7 @@ private: class CommonsModule { public: - static void defineCommonsMod(const char *uri, int versionMajor, int versionMinor) { + static void defineModule(const char *uri, int versionMajor, int versionMinor) { qRegisterMetaType("SortType::Type"); qRegisterMetaType("DataType::Type"); qRegisterMetaType("DataEntity"); diff --git a/src/settings/settings.cpp b/src/settings/settings.cpp index 04d60d7..1abf0e6 100644 --- a/src/settings/settings.cpp +++ b/src/settings/settings.cpp @@ -20,6 +20,7 @@ #include #include +#include #define UKUI_MENU_SCHEMA "org.ukui.menu.settings" #define CONTROL_CENTER_SETTING "org.ukui.control-center.personalise" @@ -31,6 +32,12 @@ namespace UkuiMenu { +void SettingModule::defineModule(const char *uri, int versionMajor, int versionMinor) +{ + qRegisterMetaType("GlobalSetting::Key"); + qmlRegisterUncreatableType(uri, versionMajor, versionMinor, "GlobalSetting", "Use enums only."); +} + GlobalSetting *GlobalSetting::instance() { static GlobalSetting setting(nullptr); diff --git a/src/settings/settings.h b/src/settings/settings.h index 7549c49..c4093d5 100644 --- a/src/settings/settings.h +++ b/src/settings/settings.h @@ -34,6 +34,12 @@ namespace UkuiMenu { +class SettingModule +{ +public: + static void defineModule(const char *uri, int versionMajor, int versionMinor); +}; + class GlobalSetting : public QObject { Q_OBJECT diff --git a/src/ukui-menu-application.cpp b/src/ukui-menu-application.cpp index 7226f86..31a904c 100644 --- a/src/ukui-menu-application.cpp +++ b/src/ukui-menu-application.cpp @@ -45,7 +45,9 @@ void UkuiMenuApplication::registerQmlTypes() { const char *uri = "org.ukui.menu.core"; int versionMajor = 1, versionMinor = 0; - CommonsModule::defineCommonsMod(uri, versionMajor, versionMinor); + CommonsModule::defineModule(uri, versionMajor, versionMinor); + SettingModule::defineModule(uri, versionMajor, versionMinor); + ModelManager::registerMetaTypes(); }