diff --git a/libnymea-app/thingclassesproxy.cpp b/libnymea-app/thingclassesproxy.cpp index 749d0493..39ad31b6 100644 --- a/libnymea-app/thingclassesproxy.cpp +++ b/libnymea-app/thingclassesproxy.cpp @@ -70,6 +70,21 @@ void ThingClassesProxy::setFilterInterface(const QString &filterInterface) } } +bool ThingClassesProxy::includeProvidedInterfaces() const +{ + return m_includeProvidedInterfaces; +} + +void ThingClassesProxy::setIncludeProvidedInterfaces(bool includeProvidedInterfaces) +{ + if (m_includeProvidedInterfaces != includeProvidedInterfaces) { + m_includeProvidedInterfaces = includeProvidedInterfaces; + emit includeProvidedInterfacesChanged(); + invalidateFilter(); + emit countChanged(); + } +} + QString ThingClassesProxy::filterDisplayName() const { return m_filterDisplayName; @@ -207,7 +222,11 @@ bool ThingClassesProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourc return false; if (!m_filterInterface.isEmpty() && !thingClass->interfaces().contains(m_filterInterface)) { - return false; + if (!m_includeProvidedInterfaces) { + return false; + } else if (!thingClass->providedInterfaces().contains(m_filterInterface)) { + return false; + } } if (!m_filterDisplayName.isEmpty() && !thingClass->displayName().toLower().contains(m_filterDisplayName.toLower())) { diff --git a/libnymea-app/thingclassesproxy.h b/libnymea-app/thingclassesproxy.h index ba77de9e..56fa27cb 100644 --- a/libnymea-app/thingclassesproxy.h +++ b/libnymea-app/thingclassesproxy.h @@ -46,6 +46,7 @@ class ThingClassesProxy : public QSortFilterProxyModel Q_PROPERTY(Engine *engine READ engine WRITE setEngine NOTIFY engineChanged) Q_PROPERTY(QString filterInterface READ filterInterface WRITE setFilterInterface NOTIFY filterInterfaceChanged) + Q_PROPERTY(bool includeProvidedInterfaces READ includeProvidedInterfaces WRITE setIncludeProvidedInterfaces NOTIFY includeProvidedInterfacesChanged) Q_PROPERTY(QString filterDisplayName READ filterDisplayName WRITE setFilterDisplayName NOTIFY filterDisplayNameChanged) Q_PROPERTY(QUuid filterVendorId READ filterVendorId WRITE setFilterVendorId NOTIFY filterVendorIdChanged) Q_PROPERTY(QString filterVendorName READ filterVendorName WRITE setFilterVendorName NOTIFY filterVendorNameChanged) @@ -67,6 +68,9 @@ public: QString filterInterface() const; void setFilterInterface(const QString &filterInterface); + bool includeProvidedInterfaces() const; + void setIncludeProvidedInterfaces(bool includeProvidedInterfaces); + QString filterDisplayName() const; void setFilterDisplayName(const QString &filter); @@ -95,6 +99,7 @@ public: signals: void engineChanged(); void filterInterfaceChanged(); + void includeProvidedInterfacesChanged(); void filterDisplayNameChanged(); void filterVendorIdChanged(); void filterVendorNameChanged(); @@ -111,6 +116,7 @@ protected: private: Engine *m_engine = nullptr; QString m_filterInterface; + bool m_includeProvidedInterfaces = false; QString m_filterDisplayName; QUuid m_filterVendorId; QString m_filterVendorName; diff --git a/libnymea-app/thingmanager.cpp b/libnymea-app/thingmanager.cpp index 8cad1847..f9fba10d 100644 --- a/libnymea-app/thingmanager.cpp +++ b/libnymea-app/thingmanager.cpp @@ -774,6 +774,7 @@ ThingClass *ThingManager::unpackThingClass(const QVariantMap &thingClassMap) thingClass->setCreateMethods(createMethods); thingClass->setSetupMethod(stringToSetupMethod(thingClassMap.value("setupMethod").toString())); thingClass->setInterfaces(thingClassMap.value("interfaces").toStringList()); + thingClass->setProvidedInterfaces(thingClassMap.value("providedInterfaces").toStringList()); // ParamTypes ParamTypes *paramTypes = new ParamTypes(thingClass); diff --git a/libnymea-app/types/thingclass.cpp b/libnymea-app/types/thingclass.cpp index c3d77030..2c40d3e4 100644 --- a/libnymea-app/types/thingclass.cpp +++ b/libnymea-app/types/thingclass.cpp @@ -117,6 +117,16 @@ void ThingClass::setInterfaces(const QStringList &interfaces) m_interfaces = interfaces; } +QStringList ThingClass::providedInterfaces() const +{ + return m_providedInterfaces; +} + +void ThingClass::setProvidedInterfaces(const QStringList &providedInterfaces) +{ + m_providedInterfaces = providedInterfaces; +} + QString ThingClass::baseInterface() const { foreach (const QString &interface, m_interfaces) { diff --git a/libnymea-app/types/thingclass.h b/libnymea-app/types/thingclass.h index fc7ecccf..4243c94f 100644 --- a/libnymea-app/types/thingclass.h +++ b/libnymea-app/types/thingclass.h @@ -52,6 +52,7 @@ class ThingClass : public QObject Q_PROPERTY(QStringList createMethods READ createMethods CONSTANT) Q_PROPERTY(SetupMethod setupMethod READ setupMethod CONSTANT) Q_PROPERTY(QStringList interfaces READ interfaces CONSTANT) + Q_PROPERTY(QStringList providedInterfaces READ providedInterfaces CONSTANT) Q_PROPERTY(QString baseInterface READ baseInterface CONSTANT) Q_PROPERTY(bool browsable READ browsable CONSTANT) Q_PROPERTY(ParamTypes *paramTypes READ paramTypes NOTIFY paramTypesChanged) @@ -100,6 +101,9 @@ public: QStringList interfaces() const; void setInterfaces(const QStringList &interfaces); + QStringList providedInterfaces() const; + void setProvidedInterfaces(const QStringList &providedInterfaces); + QString baseInterface() const; bool browsable() const; @@ -146,6 +150,7 @@ private: QStringList m_createMethods; SetupMethod m_setupMethod; QStringList m_interfaces; + QStringList m_providedInterfaces; bool m_browsable = false; ParamTypes *m_paramTypes = nullptr; diff --git a/nymea-app/ui/Nymea.qml b/nymea-app/ui/Nymea.qml index 33fdb8e5..c8b87267 100644 --- a/nymea-app/ui/Nymea.qml +++ b/nymea-app/ui/Nymea.qml @@ -226,6 +226,8 @@ ApplicationWindow { return qsTr("Smart meters"); case "heating": return qsTr("Heating"); + case "cooling": + return qsTr("Cooling"); case "thermostat": return qsTr("Thermostats"); case "evcharger": @@ -360,6 +362,8 @@ ApplicationWindow { return Qt.resolvedUrl("images/fingerprint.svg") case "accesscontrol": return Qt.resolvedUrl("images/lock-closed.svg"); + case "solarinverter": + return Qt.resolvedUrl("images/weathericons/weather-clear-day.svg") case "smartmeter": case "smartmeterconsumer": case "smartmeterproducer": diff --git a/nymea-app/ui/thingconfiguration/NewThingPage.qml b/nymea-app/ui/thingconfiguration/NewThingPage.qml index 0821ebd5..fb3b814f 100644 --- a/nymea-app/ui/thingconfiguration/NewThingPage.qml +++ b/nymea-app/ui/thingconfiguration/NewThingPage.qml @@ -149,12 +149,13 @@ Page { id: thingClassesProxy engine: _engine filterInterface: typeFilterModel.get(typeFilterComboBox.currentIndex).interfaceName + includeProvidedInterfaces: true filterVendorId: vendorFilterComboBox.currentIndex >= 0 ? vendorsFilterModel.get(vendorFilterComboBox.currentIndex).vendorId : "" filterString: displayNameFilterField.displayText groupByInterface: true } - delegate: NymeaSwipeDelegate { + delegate: NymeaItemDelegate { id: tingClassDelegate width: parent.width text: model.displayName diff --git a/nymea-app/ui/thingconfiguration/ThingClassDetailsPage.qml b/nymea-app/ui/thingconfiguration/ThingClassDetailsPage.qml index 7b9a371e..cd059b5e 100644 --- a/nymea-app/ui/thingconfiguration/ThingClassDetailsPage.qml +++ b/nymea-app/ui/thingconfiguration/ThingClassDetailsPage.qml @@ -64,16 +64,15 @@ SettingsPageBase { text: qsTr("Interfaces") } - Repeater { - model: root.thingClass.interfaces - delegate: Label { - Layout.fillWidth: true - Layout.leftMargin: Style.margins - Layout.rightMargin: Style.margins - text: modelData - } + Label { + Layout.fillWidth: true + Layout.leftMargin: Style.margins + Layout.rightMargin: Style.margins + wrapMode: Text.WordWrap + text: root.thingClass.interfaces.join(", ") + (root.thingClass.providedInterfaces.length > 0 ? " (" + root.thingClass.providedInterfaces.join(", ") + ")" : "") } + SettingsPageSectionHeader { text: qsTr("Parameters") visible: root.thingClass.paramTypes.count > 0