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