plugins/nightlight: Fix dbus property types

currentTemperature, targetTemperature, and mode properties have "u" type.
But there is a mismatch between the property types declared in the
Q_PROPERTY macro and the org.freedesktop.DBus.Properties.PropertiesChanged
signal.

This change makes the property types consistent and match the types
declared in the xml file.
This commit is contained in:
Vlad Zahorodnii 2024-06-15 12:35:59 +03:00
parent 18e9adf5b7
commit ad31fd6b18
2 changed files with 17 additions and 16 deletions

View file

@ -46,43 +46,43 @@ NightLightDBusInterface::NightLightDBusInterface(NightLightManager *parent)
connect(m_manager, &NightLightManager::inhibitedChanged, this, [this] {
announceChangedProperties({
{QStringLiteral("inhibited"), m_manager->isInhibited()},
{QStringLiteral("inhibited"), isInhibited()},
});
});
connect(m_manager, &NightLightManager::enabledChanged, this, [this] {
announceChangedProperties({
{QStringLiteral("enabled"), m_manager->isEnabled()},
{QStringLiteral("enabled"), isEnabled()},
});
});
connect(m_manager, &NightLightManager::runningChanged, this, [this] {
announceChangedProperties({
{QStringLiteral("running"), m_manager->isRunning()},
{QStringLiteral("running"), isRunning()},
});
});
connect(m_manager, &NightLightManager::currentTemperatureChanged, this, [this] {
announceChangedProperties({
{QStringLiteral("currentTemperature"), m_manager->currentTemperature()},
{QStringLiteral("currentTemperature"), currentTemperature()},
});
});
connect(m_manager, &NightLightManager::targetTemperatureChanged, this, [this] {
announceChangedProperties({
{QStringLiteral("targetTemperature"), m_manager->targetTemperature()},
{QStringLiteral("targetTemperature"), targetTemperature()},
});
});
connect(m_manager, &NightLightManager::modeChanged, this, [this] {
announceChangedProperties({
{QStringLiteral("mode"), uint(m_manager->mode())},
{QStringLiteral("mode"), mode()},
});
});
connect(m_manager, &NightLightManager::daylightChanged, this, [this] {
announceChangedProperties({
{QStringLiteral("daylight"), uint(m_manager->daylight())},
{QStringLiteral("daylight"), daylight()},
});
});
@ -130,17 +130,17 @@ bool NightLightDBusInterface::isAvailable() const
return true; // TODO: Night color should register its own dbus service instead.
}
int NightLightDBusInterface::currentTemperature() const
quint32 NightLightDBusInterface::currentTemperature() const
{
return m_manager->currentTemperature();
}
int NightLightDBusInterface::targetTemperature() const
quint32 NightLightDBusInterface::targetTemperature() const
{
return m_manager->targetTemperature();
}
int NightLightDBusInterface::mode() const
quint32 NightLightDBusInterface::mode() const
{
return m_manager->mode();
}

View file

@ -3,6 +3,7 @@
This file is part of the KDE project.
SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com>
SPDX-FileCopyrightText: 2024 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
@ -26,9 +27,9 @@ class NightLightDBusInterface : public QObject, public QDBusContext
Q_PROPERTY(bool enabled READ isEnabled)
Q_PROPERTY(bool running READ isRunning)
Q_PROPERTY(bool available READ isAvailable)
Q_PROPERTY(int currentTemperature READ currentTemperature)
Q_PROPERTY(int targetTemperature READ targetTemperature)
Q_PROPERTY(int mode READ mode)
Q_PROPERTY(quint32 currentTemperature READ currentTemperature)
Q_PROPERTY(quint32 targetTemperature READ targetTemperature)
Q_PROPERTY(quint32 mode READ mode)
Q_PROPERTY(bool daylight READ daylight)
Q_PROPERTY(quint64 previousTransitionDateTime READ previousTransitionDateTime)
Q_PROPERTY(quint32 previousTransitionDuration READ previousTransitionDuration)
@ -43,9 +44,9 @@ public:
bool isEnabled() const;
bool isRunning() const;
bool isAvailable() const;
int currentTemperature() const;
int targetTemperature() const;
int mode() const;
quint32 currentTemperature() const;
quint32 targetTemperature() const;
quint32 mode() const;
bool daylight() const;
quint64 previousTransitionDateTime() const;
quint32 previousTransitionDuration() const;