openuv: Add Qt6 support
parent
c73647c20e
commit
22191713af
|
|
@ -1,6 +1,6 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
*
|
*
|
||||||
* Copyright 2013 - 2020, nymea GmbH
|
* Copyright 2013 - 2025, nymea GmbH
|
||||||
* Contact: contact@nymea.io
|
* Contact: contact@nymea.io
|
||||||
*
|
*
|
||||||
* This file is part of nymea.
|
* This file is part of nymea.
|
||||||
|
|
@ -29,9 +29,11 @@
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include "integrationpluginopenuv.h"
|
#include "integrationpluginopenuv.h"
|
||||||
#include "integrations/thing.h"
|
|
||||||
#include "plugininfo.h"
|
#include "plugininfo.h"
|
||||||
|
|
||||||
|
#include <integrations/thing.h>
|
||||||
|
#include <network/networkaccessmanager.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
|
|
@ -133,7 +135,7 @@ void IntegrationPluginOpenUv::getUvIndex(Thing *thing)
|
||||||
request.setRawHeader("x-access-token", m_apiKey);
|
request.setRawHeader("x-access-token", m_apiKey);
|
||||||
|
|
||||||
QNetworkReply *reply = hardwareManager()->networkManager()->get(request);
|
QNetworkReply *reply = hardwareManager()->networkManager()->get(request);
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, thing, this] {
|
connect(reply, &QNetworkReply::finished, this, [reply, thing] {
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
|
||||||
|
|
@ -150,7 +152,7 @@ void IntegrationPluginOpenUv::getUvIndex(Thing *thing)
|
||||||
QJsonParseError error;
|
QJsonParseError error;
|
||||||
QJsonDocument data = QJsonDocument::fromJson(reply->readAll(), &error);
|
QJsonDocument data = QJsonDocument::fromJson(reply->readAll(), &error);
|
||||||
if (error.error != QJsonParseError::NoError) {
|
if (error.error != QJsonParseError::NoError) {
|
||||||
qDebug(dcOpenUv()) << "Recieved invalide JSON object";
|
qCDebug(dcOpenUv()) << "Recieved invalide JSON object";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QVariantMap result = data.toVariant().toMap().value("result").toMap();
|
QVariantMap result = data.toVariant().toMap().value("result").toMap();
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,8 @@
|
||||||
#ifndef INTEGRATIONPLUGINOPENUV_H
|
#ifndef INTEGRATIONPLUGINOPENUV_H
|
||||||
#define INTEGRATIONPLUGINOPENUV_H
|
#define INTEGRATIONPLUGINOPENUV_H
|
||||||
|
|
||||||
#include "plugintimer.h"
|
#include <integrations/integrationplugin.h>
|
||||||
#include "integrations/integrationplugin.h"
|
#include <plugintimer.h>
|
||||||
#include "network/networkaccessmanager.h"
|
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
include(../plugins.pri)
|
include(../plugins.pri)
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_integrationpluginopenuv)
|
QT += network
|
||||||
|
|
||||||
QT+= network
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
integrationpluginopenuv.cpp \
|
integrationpluginopenuv.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
integrationpluginopenuv.h \
|
integrationpluginopenuv.h
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue