diff --git a/libnymea-core/integrations/thingmanagerimplementation.cpp b/libnymea-core/integrations/thingmanagerimplementation.cpp index 4f0d4380..6bfeeec4 100644 --- a/libnymea-core/integrations/thingmanagerimplementation.cpp +++ b/libnymea-core/integrations/thingmanagerimplementation.cpp @@ -919,6 +919,27 @@ ParamType ThingManagerImplementation::translateParamType(const PluginId &pluginI return translatedParamType; } +StateType ThingManagerImplementation::translateStateType(const PluginId &pluginId, const StateType &stateType, const QLocale &locale) +{ + StateType translatedStateType = stateType; + translatedStateType.setDisplayName(translate(pluginId, stateType.displayName(), locale)); + return translatedStateType; +} + +EventType ThingManagerImplementation::translateEventType(const PluginId &pluginId, const EventType &eventType, const QLocale &locale) +{ + EventType translatedEventType = eventType; + translatedEventType.setDisplayName(translate(pluginId, eventType.displayName(), locale)); + return translatedEventType; +} + +ActionType ThingManagerImplementation::translateActionType(const PluginId &pluginId, const ActionType &actionType, const QLocale &locale) +{ + ActionType translatedActionType = actionType; + translatedActionType.setDisplayName(translate(pluginId, actionType.displayName(), locale)); + return translatedActionType; +} + ThingClass ThingManagerImplementation::translateThingClass(const ThingClass &thingClass, const QLocale &locale) { ThingClass translatedThingClass = thingClass; @@ -929,6 +950,31 @@ ThingClass ThingManagerImplementation::translateThingClass(const ThingClass &thi translatedSettingsTypes.append(translateParamType(thingClass.pluginId(), paramType, locale)); } translatedThingClass.setSettingsTypes(translatedSettingsTypes); + + ParamTypes translatedParamTypes; + foreach (const ParamType ¶mType, thingClass.paramTypes()) { + translatedParamTypes.append(translateParamType(thingClass.pluginId(), paramType, locale)); + } + translatedThingClass.setParamTypes(translatedParamTypes); + + StateTypes translatedStateTypes; + foreach (const StateType &stateType, thingClass.stateTypes()) { + translatedStateTypes.append(translateStateType(thingClass.pluginId(), stateType, locale)); + } + translatedThingClass.setStateTypes(translatedStateTypes); + + EventTypes translatedEventTypes; + foreach (const EventType &eventType, thingClass.eventTypes()) { + translatedEventTypes.append(translateEventType(thingClass.pluginId(), eventType, locale)); + } + translatedThingClass.setEventTypes(translatedEventTypes); + + ActionTypes translatedActionTypes; + foreach (const ActionType &actionType, thingClass.actionTypes()) { + translatedActionTypes.append(translateActionType(thingClass.pluginId(), actionType, locale)); + } + translatedThingClass.setActionTypes(translatedActionTypes); + return translatedThingClass; } diff --git a/libnymea-core/integrations/thingmanagerimplementation.h b/libnymea-core/integrations/thingmanagerimplementation.h index f9b0f093..b67e4dc9 100644 --- a/libnymea-core/integrations/thingmanagerimplementation.h +++ b/libnymea-core/integrations/thingmanagerimplementation.h @@ -115,6 +115,9 @@ public: QString translate(const PluginId &pluginId, const QString &string, const QLocale &locale) override; ParamType translateParamType(const PluginId &pluginId, const ParamType ¶mType, const QLocale &locale) override; + StateType translateStateType(const PluginId &pluginId, const StateType &stateType, const QLocale &locale) override; + EventType translateEventType(const PluginId &pluginId, const EventType &eventType, const QLocale &locale) override; + ActionType translateActionType(const PluginId &pluginId, const ActionType &actionType, const QLocale &locale) override; ThingClass translateThingClass(const ThingClass &thingClass, const QLocale &locale) override; Vendor translateVendor(const Vendor &vendor, const QLocale &locale) override; diff --git a/libnymea/integrations/thingmanager.h b/libnymea/integrations/thingmanager.h index ed67a5ef..f33a59c5 100644 --- a/libnymea/integrations/thingmanager.h +++ b/libnymea/integrations/thingmanager.h @@ -91,6 +91,9 @@ public: virtual QString translate(const PluginId &pluginId, const QString &string, const QLocale &locale) = 0; virtual ParamType translateParamType(const PluginId &pluginId, const ParamType ¶mType, const QLocale &locale) = 0; + virtual StateType translateStateType(const PluginId &pluginId, const StateType &stateType, const QLocale &locale) = 0; + virtual EventType translateEventType(const PluginId &pluginId, const EventType &eventType, const QLocale &locale) = 0; + virtual ActionType translateActionType(const PluginId &pluginId, const ActionType &actionType, const QLocale &locale) = 0; virtual ThingClass translateThingClass(const ThingClass &thingClass, const QLocale &locale) = 0; virtual Vendor translateVendor(const Vendor &vendor, const QLocale &locale) = 0; signals: