datetime: Add Qt6 support
This commit is contained in:
parent
f9a5bfa55e
commit
b9c8be43db
@ -1,8 +1,6 @@
|
||||
include(../plugins.pri)
|
||||
|
||||
QT += network
|
||||
|
||||
TARGET = $$qtLibraryTarget(nymea_integrationplugindatetime)
|
||||
QT *= network
|
||||
|
||||
SOURCES += \
|
||||
integrationplugindatetime.cpp \
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2020, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
@ -30,10 +30,10 @@
|
||||
|
||||
#include "integrationplugindatetime.h"
|
||||
|
||||
#include "integrations/thing.h"
|
||||
#include "plugininfo.h"
|
||||
#include "hardwaremanager.h"
|
||||
#include "network/networkaccessmanager.h"
|
||||
#include <integrations/thing.h>
|
||||
#include <plugininfo.h>
|
||||
#include <hardwaremanager.h>
|
||||
#include <network/networkaccessmanager.h>
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QUrlQuery>
|
||||
@ -416,13 +416,13 @@ void IntegrationPluginDateTime::updateTimes()
|
||||
return;
|
||||
|
||||
if (m_dusk.isValid()) {
|
||||
m_todayDevice->setStateValue(todayDuskTimeStateTypeId, m_dusk.toTime_t());
|
||||
m_todayDevice->setStateValue(todayDuskTimeStateTypeId, m_dusk.toSecsSinceEpoch());
|
||||
} else {
|
||||
m_todayDevice->setStateValue(todayDuskTimeStateTypeId, 0);
|
||||
}
|
||||
if (m_sunrise.isValid() && m_sunset.isValid()) {
|
||||
m_todayDevice->setStateValue(todaySunriseTimeStateTypeId, m_sunrise.toTime_t());
|
||||
m_todayDevice->setStateValue(todaySunsetTimeStateTypeId, m_sunset.toTime_t());
|
||||
m_todayDevice->setStateValue(todaySunriseTimeStateTypeId, m_sunrise.toSecsSinceEpoch());
|
||||
m_todayDevice->setStateValue(todaySunsetTimeStateTypeId, m_sunset.toSecsSinceEpoch());
|
||||
m_todayDevice->setStateValue(todayDaylightStateTypeId, m_sunrise < m_currentDateTime && m_currentDateTime < m_sunset);
|
||||
} else {
|
||||
m_todayDevice->setStateValue(todaySunriseTimeStateTypeId, 0);
|
||||
@ -430,12 +430,12 @@ void IntegrationPluginDateTime::updateTimes()
|
||||
m_todayDevice->setStateValue(todayDaylightStateTypeId, false);
|
||||
}
|
||||
if (m_dusk.isValid()) {
|
||||
m_todayDevice->setStateValue(todayNoonTimeStateTypeId, m_noon.toTime_t());
|
||||
m_todayDevice->setStateValue(todayNoonTimeStateTypeId, m_noon.toSecsSinceEpoch());
|
||||
} else {
|
||||
m_todayDevice->setStateValue(todayNoonTimeStateTypeId, 0);
|
||||
}
|
||||
if (m_dusk.isValid()) {
|
||||
m_todayDevice->setStateValue(todayDawnTimeStateTypeId, m_dawn.toTime_t());
|
||||
m_todayDevice->setStateValue(todayDawnTimeStateTypeId, m_dawn.toSecsSinceEpoch());
|
||||
} else {
|
||||
m_todayDevice->setStateValue(todayDawnTimeStateTypeId, 0);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* Copyright 2013 - 2020, nymea GmbH
|
||||
* Copyright 2013 - 2025, nymea GmbH
|
||||
* Contact: contact@nymea.io
|
||||
*
|
||||
* This file is part of nymea.
|
||||
@ -31,9 +31,7 @@
|
||||
#ifndef INTEGRATIONPLUGINDATETIME_H
|
||||
#define INTEGRATIONPLUGINDATETIME_H
|
||||
|
||||
#include "integrations/integrationplugin.h"
|
||||
#include "alarm.h"
|
||||
#include "countdown.h"
|
||||
#include <integrations/integrationplugin.h>
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QTimeZone>
|
||||
@ -41,6 +39,9 @@
|
||||
#include <QTimer>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "alarm.h"
|
||||
#include "countdown.h"
|
||||
|
||||
class IntegrationPluginDateTime : public IntegrationPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -60,8 +61,8 @@ public:
|
||||
void startMonitoringAutoThings() override;
|
||||
|
||||
private:
|
||||
QTimer *m_timer;
|
||||
Thing *m_todayDevice;
|
||||
QTimer *m_timer = nullptr;
|
||||
Thing *m_todayDevice = nullptr;
|
||||
QTimeZone m_timeZone;
|
||||
QDateTime m_currentDateTime;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user