plugins/nightcolor: Rename d-bus interface

This commit is contained in:
Vlad Zahorodnii 2024-02-07 22:03:14 +02:00
parent a5726e19fd
commit 5ad63f21e0
5 changed files with 43 additions and 43 deletions

View file

@ -6,5 +6,5 @@ set(KWIN_EFFECTS_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.kwin.
set(KWIN_VIRTUALKEYBOARD_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.kwin.VirtualKeyboard.xml")
set(KWIN_TABLETMODE_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.KWin.TabletModeManager.xml")
set(KWIN_INPUTDEVICE_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.kwin.InputDevice.xml")
set(KWIN_COLORCORRECT_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.kwin.ColorCorrect.xml")
set(KWIN_NIGHTLIGHT_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.KWin.NightLight.xml")
set(KWIN_WAYLAND_BIN_PATH "@CMAKE_INSTALL_FULL_BINDIR@/kwin_wayland")

View file

@ -18,7 +18,7 @@ ecm_qt_declare_logging_category(nightcolor
kconfig_add_kcfg_files(nightcolor nightcolorsettings.kcfgc)
set(nightcolor_xml_SOURCES)
qt_add_dbus_adaptor(nightcolor_xml_SOURCES org.kde.kwin.ColorCorrect.xml nightcolordbusinterface.h KWin::NightColorDBusInterface)
qt_add_dbus_adaptor(nightcolor_xml_SOURCES org.kde.KWin.NightLight.xml nightcolordbusinterface.h KWin::NightColorDBusInterface)
target_sources(nightcolor PRIVATE ${nightcolor_xml_SOURCES})
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
@ -28,4 +28,4 @@ endif()
target_link_libraries(nightcolor kwin KF6::ConfigGui KF6::GlobalAccel KF6::I18n)
install(FILES nightcolorsettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
install(FILES org.kde.kwin.ColorCorrect.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})
install(FILES org.kde.KWin.NightLight.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})

View file

@ -8,8 +8,8 @@
*/
#include "nightcolordbusinterface.h"
#include "colorcorrectadaptor.h"
#include "nightcolormanager.h"
#include "nightlightadaptor.h"
#include <QDBusMessage>
@ -31,12 +31,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("inhibited"), m_manager->isInhibited());
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -49,12 +49,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("enabled"), m_manager->isEnabled());
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -67,12 +67,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("running"), m_manager->isRunning());
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -85,12 +85,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("currentTemperature"), m_manager->currentTemperature());
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -103,12 +103,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("targetTemperature"), m_manager->targetTemperature());
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -121,12 +121,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("mode"), uint(m_manager->mode()));
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -139,12 +139,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("daylight"), uint(m_manager->daylight()));
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -158,12 +158,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("previousTransitionDuration"), previousTransitionDuration());
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -177,12 +177,12 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
changedProperties.insert(QStringLiteral("scheduledTransitionDuration"), scheduledTransitionDuration());
QDBusMessage message = QDBusMessage::createSignal(
QStringLiteral("/ColorCorrect"),
QStringLiteral("/org/kde/KWin/NightLight"),
QStringLiteral("org.freedesktop.DBus.Properties"),
QStringLiteral("PropertiesChanged"));
message.setArguments({
QStringLiteral("org.kde.kwin.ColorCorrect"),
QStringLiteral("org.kde.KWin.NightLight"),
changedProperties,
QStringList(), // invalidated_properties
});
@ -190,14 +190,14 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
QDBusConnection::sessionBus().send(message);
});
new ColorCorrectAdaptor(this);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/ColorCorrect"), this);
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.NightColor"));
new NightLightAdaptor(this);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/kde/KWin/NightLight"), this);
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin.NightLight"));
}
NightColorDBusInterface::~NightColorDBusInterface()
{
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.NightColor"));
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.KWin.NightLight"));
}
bool NightColorDBusInterface::isInhibited() const
@ -268,7 +268,7 @@ quint32 NightColorDBusInterface::scheduledTransitionDuration() const
return quint32(m_manager->scheduledTransitionDuration());
}
void NightColorDBusInterface::nightColorAutoLocationUpdate(double latitude, double longitude)
void NightColorDBusInterface::setLocation(double latitude, double longitude)
{
m_manager->autoLocationUpdate(latitude, longitude);
}

View file

@ -21,7 +21,7 @@ class NightColorManager;
class NightColorDBusInterface : public QObject, public QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.ColorCorrect")
Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.NightLight")
Q_PROPERTY(bool inhibited READ isInhibited)
Q_PROPERTY(bool enabled READ isEnabled)
Q_PROPERTY(bool running READ isRunning)
@ -58,7 +58,7 @@ public Q_SLOTS:
* @return void
* @since 5.12
*/
void nightColorAutoLocationUpdate(double latitude, double longitude);
void setLocation(double latitude, double longitude);
/**
* @brief Temporarily blocks Night Color.

View file

@ -1,15 +1,15 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.kwin.ColorCorrect">
<method name="nightColorAutoLocationUpdate">
<interface name="org.kde.KWin.NightLight">
<method name="setLocation">
<arg type="d" direction="in"/>
<arg type="d" direction="in"/>
</method>
<!--
Creates an inhibition lock for Night Color.
Creates an inhibition lock for Night Light.
You can use this method to temporarily disable Night Color feature.
You can use this method to temporarily disable Night Light feature.
After calling this method, the screen color temperature will be set
back to the neutral temperature (6500K).
@ -54,22 +54,22 @@
</method>
<!--
This property holds a value to indicate whether Night Color is inhibited.
This property holds a value to indicate whether Night Light is inhibited.
-->
<property name="inhibited" type="b" access="read"/>
<!--
This property holds a value to indicate whether Night Color is enabled.
This property holds a value to indicate whether Night Light is enabled.
-->
<property name="enabled" type="b" access="read"/>
<!--
This property holds a value to indicate whether Night Color is running.
This property holds a value to indicate whether Night Light is running.
-->
<property name="running" type="b" access="read"/>
<!--
This property holds a value to indicate whether Night Color is available.
This property holds a value to indicate whether Night Light is available.
-->
<property name="available" type="b" access="read"/>
@ -91,7 +91,7 @@
<property name="mode" type="u" access="read"/>
<!--
This property holds a value to indicate whether nightcolor is currently on day or night time.
This property holds a value to indicate whether Night Light is currently on day or night time.
True = day time, false = night time
-->
@ -99,28 +99,28 @@
<!--
This property holds a Unix timestamp that specifies when the previous color
temperature transition had started. Note that when Night Color operates in
temperature transition had started. Note that when Night Light operates in
the constant mode, this property holds a value of 0.
-->
<property name="previousTransitionDateTime" type="t" access="read"/>
<!--
This property holds a value that specifies the duration of the previous color
temperature transition, in milliseconds. Note that when Night Color operates
temperature transition, in milliseconds. Note that when Night Light operates
in the constant mode, this property holds a value of 0.
-->
<property name="previousTransitionDuration" type="u" access="read"/>
<!--
This property holds a Unix timestamp that specifies when the next scheduled
color temperature transition will start. Note that when Night Color operates
color temperature transition will start. Note that when Night Light operates
in the constant mode, this property holds a value of 0.
-->
<property name="scheduledTransitionDateTime" type="t" access="read"/>
<!--
This property holds a value that specifies the duration of next scheduled
color transition, in milliseconds. Note that when Night Color operates in
color transition, in milliseconds. Note that when Night Light operates in
the constant mode, this property holds a value of 0.
-->
<property name="scheduledTransitionDuration" type="u" access="read"/>