From d387be5c11a2f9bfd41b0779b3866b907765203f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Fri, 8 Aug 2025 16:18:05 +0200 Subject: [PATCH] shelly: Add Qt6 support --- shelly/integrationpluginshelly.cpp | 3 +-- shelly/integrationpluginshelly.h | 1 - shelly/shellyjsonrpcclient.cpp | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/shelly/integrationpluginshelly.cpp b/shelly/integrationpluginshelly.cpp index 86f12d1f..4890e0b7 100644 --- a/shelly/integrationpluginshelly.cpp +++ b/shelly/integrationpluginshelly.cpp @@ -2127,8 +2127,7 @@ bool IntegrationPluginShelly::isGen2Plus(const QString &shellyId) const return shellyId.contains("Plus", Qt::CaseInsensitive) || shellyId.contains("Pro", Qt::CaseInsensitive) || shellyId.contains("G3", Qt::CaseInsensitive) // Gen3 devices have API 2 - || QRegExp("^(ShellyPlusPlugS|ShellyPlug(US|IT|UK))-[0-9A-Z]+$", Qt::CaseInsensitive).exactMatch(shellyId) // Plus plug variants need to be matched quite precisely to not also match the v1 Plug - ; + || QRegularExpression("^(ShellyPlusPlugS|ShellyPlug(US|IT|UK))-[0-9A-Z]+$", QRegularExpression::CaseInsensitiveOption).match(shellyId).hasMatch(); // Plus plug variants need to be matched quite precisely to not also match the v1 Plug } void IntegrationPluginShelly::handleInputEvent(Thing *thing, const QString &buttonName, const QString &inputEventString, int inputEventCount) diff --git a/shelly/integrationpluginshelly.h b/shelly/integrationpluginshelly.h index ec9f2da8..746440a6 100644 --- a/shelly/integrationpluginshelly.h +++ b/shelly/integrationpluginshelly.h @@ -52,7 +52,6 @@ class IntegrationPluginShelly: public IntegrationPlugin Q_PLUGIN_METADATA(IID "io.nymea.IntegrationPlugin" FILE "integrationpluginshelly.json") Q_INTERFACES(IntegrationPlugin) - public: explicit IntegrationPluginShelly(); ~IntegrationPluginShelly() override; diff --git a/shelly/shellyjsonrpcclient.cpp b/shelly/shellyjsonrpcclient.cpp index 97d22e11..de1bec4a 100644 --- a/shelly/shellyjsonrpcclient.cpp +++ b/shelly/shellyjsonrpcclient.cpp @@ -132,7 +132,7 @@ void ShellyJsonRpcClient::onTextMessageReceived(const QString &message) QVariantMap ShellyJsonRpcClient::createAuthMap() const { - int cnonce = qrand(); + int cnonce = std::rand(); QByteArray ha1 = QString("%1:%2:%3").arg(m_user).arg(m_shellyId.toLower()).arg(m_password).toUtf8(); ha1 = QCryptographicHash::hash(ha1, QCryptographicHash::Sha256).toHex(); QByteArray ha2 = QByteArrayLiteral("dummy_method:dummy_uri");