plugins/{nightcolor -> nightlight}
This commit is contained in:
parent
0dd2012d4f
commit
6fb8eac890
22 changed files with 189 additions and 189 deletions
|
@ -80,7 +80,7 @@ add_subdirectory(minimizeall)
|
|||
add_subdirectory(morphingpopups)
|
||||
add_subdirectory(mouseclick)
|
||||
add_subdirectory(mousemark)
|
||||
add_subdirectory(nightcolor)
|
||||
add_subdirectory(nightlight)
|
||||
add_subdirectory(outputlocator)
|
||||
add_subdirectory(overview)
|
||||
add_subdirectory(qpa)
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
kcoreaddons_add_plugin(nightcolor INSTALL_NAMESPACE "kwin/plugins")
|
||||
target_sources(nightcolor PRIVATE
|
||||
clockskewnotifier.cpp
|
||||
clockskewnotifierengine.cpp
|
||||
nightcolordbusinterface.cpp
|
||||
nightcolormanager.cpp
|
||||
main.cpp
|
||||
suncalc.cpp
|
||||
)
|
||||
|
||||
ecm_qt_declare_logging_category(nightcolor
|
||||
HEADER nightcolorlogging.h
|
||||
IDENTIFIER KWIN_NIGHTCOLOR
|
||||
CATEGORY_NAME kwin_nightcolor
|
||||
DEFAULT_SEVERITY Critical
|
||||
)
|
||||
|
||||
kconfig_add_kcfg_files(nightcolor nightcolorsettings.kcfgc)
|
||||
|
||||
set(nightcolor_xml_SOURCES)
|
||||
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")
|
||||
target_sources(nightcolor PRIVATE clockskewnotifierengine_linux.cpp)
|
||||
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.NightLight.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})
|
|
@ -1,8 +0,0 @@
|
|||
File=nightcolorsettings.kcfg
|
||||
NameSpace=KWin
|
||||
ClassName=NightColorSettings
|
||||
Singleton=true
|
||||
Mutators=true
|
||||
# nightcolormanager.h is needed for NightColorMode
|
||||
IncludeFiles=nightcolormanager.h
|
||||
UseEnumTypes=true
|
31
src/plugins/nightlight/CMakeLists.txt
Normal file
31
src/plugins/nightlight/CMakeLists.txt
Normal file
|
@ -0,0 +1,31 @@
|
|||
kcoreaddons_add_plugin(nightlight INSTALL_NAMESPACE "kwin/plugins")
|
||||
target_sources(nightlight PRIVATE
|
||||
clockskewnotifier.cpp
|
||||
clockskewnotifierengine.cpp
|
||||
nightlightdbusinterface.cpp
|
||||
nightlightmanager.cpp
|
||||
main.cpp
|
||||
suncalc.cpp
|
||||
)
|
||||
|
||||
ecm_qt_declare_logging_category(nightlight
|
||||
HEADER nightlightlogging.h
|
||||
IDENTIFIER KWIN_NIGHTLIGHT
|
||||
CATEGORY_NAME kwin_nightlight
|
||||
DEFAULT_SEVERITY Critical
|
||||
)
|
||||
|
||||
kconfig_add_kcfg_files(nightlight nightlightsettings.kcfgc)
|
||||
|
||||
set(nightlight_xml_SOURCES)
|
||||
qt_add_dbus_adaptor(nightlight_xml_SOURCES org.kde.KWin.NightLight.xml nightlightdbusinterface.h KWin::NightLightDBusInterface)
|
||||
target_sources(nightlight PRIVATE ${nightlight_xml_SOURCES})
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
target_sources(nightlight PRIVATE clockskewnotifierengine_linux.cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(nightlight kwin KF6::ConfigGui KF6::GlobalAccel KF6::I18n)
|
||||
|
||||
install(FILES nightlightsettings.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR})
|
||||
install(FILES org.kde.KWin.NightLight.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})
|
|
@ -4,27 +4,27 @@
|
|||
SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "nightcolormanager.h"
|
||||
#include "nightlightmanager.h"
|
||||
|
||||
#include <KPluginFactory>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
class KWIN_EXPORT NightColorManagerFactory : public PluginFactory
|
||||
class KWIN_EXPORT NightLightManagerFactory : public PluginFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID PluginFactory_iid FILE "metadata.json")
|
||||
Q_INTERFACES(KWin::PluginFactory)
|
||||
|
||||
public:
|
||||
explicit NightColorManagerFactory() = default;
|
||||
explicit NightLightManagerFactory() = default;
|
||||
|
||||
std::unique_ptr<Plugin> create() const override;
|
||||
};
|
||||
|
||||
std::unique_ptr<Plugin> NightColorManagerFactory::create() const
|
||||
std::unique_ptr<Plugin> NightLightManagerFactory::create() const
|
||||
{
|
||||
return std::make_unique<NightColorManager>();
|
||||
return std::make_unique<NightLightManager>();
|
||||
}
|
||||
|
||||
#include "main.moc"
|
|
@ -7,16 +7,16 @@
|
|||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "nightcolordbusinterface.h"
|
||||
#include "nightcolormanager.h"
|
||||
#include "nightlightdbusinterface.h"
|
||||
#include "nightlightadaptor.h"
|
||||
#include "nightlightmanager.h"
|
||||
|
||||
#include <QDBusMessage>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
||||
NightLightDBusInterface::NightLightDBusInterface(NightLightManager *parent)
|
||||
: QObject(parent)
|
||||
, m_manager(parent)
|
||||
, m_inhibitorWatcher(new QDBusServiceWatcher(this))
|
||||
|
@ -24,9 +24,9 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
m_inhibitorWatcher->setConnection(QDBusConnection::sessionBus());
|
||||
m_inhibitorWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
|
||||
connect(m_inhibitorWatcher, &QDBusServiceWatcher::serviceUnregistered,
|
||||
this, &NightColorDBusInterface::removeInhibitorService);
|
||||
this, &NightLightDBusInterface::removeInhibitorService);
|
||||
|
||||
connect(m_manager, &NightColorManager::inhibitedChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::inhibitedChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("inhibited"), m_manager->isInhibited());
|
||||
|
||||
|
@ -44,7 +44,7 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().send(message);
|
||||
});
|
||||
|
||||
connect(m_manager, &NightColorManager::enabledChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::enabledChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("enabled"), m_manager->isEnabled());
|
||||
|
||||
|
@ -62,7 +62,7 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().send(message);
|
||||
});
|
||||
|
||||
connect(m_manager, &NightColorManager::runningChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::runningChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("running"), m_manager->isRunning());
|
||||
|
||||
|
@ -80,7 +80,7 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().send(message);
|
||||
});
|
||||
|
||||
connect(m_manager, &NightColorManager::currentTemperatureChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::currentTemperatureChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("currentTemperature"), m_manager->currentTemperature());
|
||||
|
||||
|
@ -98,7 +98,7 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().send(message);
|
||||
});
|
||||
|
||||
connect(m_manager, &NightColorManager::targetTemperatureChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::targetTemperatureChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("targetTemperature"), m_manager->targetTemperature());
|
||||
|
||||
|
@ -116,7 +116,7 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().send(message);
|
||||
});
|
||||
|
||||
connect(m_manager, &NightColorManager::modeChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::modeChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("mode"), uint(m_manager->mode()));
|
||||
|
||||
|
@ -134,7 +134,7 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().send(message);
|
||||
});
|
||||
|
||||
connect(m_manager, &NightColorManager::daylightChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::daylightChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("daylight"), uint(m_manager->daylight()));
|
||||
|
||||
|
@ -152,7 +152,7 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().send(message);
|
||||
});
|
||||
|
||||
connect(m_manager, &NightColorManager::previousTransitionTimingsChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::previousTransitionTimingsChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("previousTransitionDateTime"), previousTransitionDateTime());
|
||||
changedProperties.insert(QStringLiteral("previousTransitionDuration"), previousTransitionDuration());
|
||||
|
@ -171,7 +171,7 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().send(message);
|
||||
});
|
||||
|
||||
connect(m_manager, &NightColorManager::scheduledTransitionTimingsChanged, this, [this] {
|
||||
connect(m_manager, &NightLightManager::scheduledTransitionTimingsChanged, this, [this] {
|
||||
QVariantMap changedProperties;
|
||||
changedProperties.insert(QStringLiteral("scheduledTransitionDateTime"), scheduledTransitionDateTime());
|
||||
changedProperties.insert(QStringLiteral("scheduledTransitionDuration"), scheduledTransitionDuration());
|
||||
|
@ -195,52 +195,52 @@ NightColorDBusInterface::NightColorDBusInterface(NightColorManager *parent)
|
|||
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin.NightLight"));
|
||||
}
|
||||
|
||||
NightColorDBusInterface::~NightColorDBusInterface()
|
||||
NightLightDBusInterface::~NightLightDBusInterface()
|
||||
{
|
||||
QDBusConnection::sessionBus().unregisterService(QStringLiteral("org.kde.KWin.NightLight"));
|
||||
}
|
||||
|
||||
bool NightColorDBusInterface::isInhibited() const
|
||||
bool NightLightDBusInterface::isInhibited() const
|
||||
{
|
||||
return m_manager->isInhibited();
|
||||
}
|
||||
|
||||
bool NightColorDBusInterface::isEnabled() const
|
||||
bool NightLightDBusInterface::isEnabled() const
|
||||
{
|
||||
return m_manager->isEnabled();
|
||||
}
|
||||
|
||||
bool NightColorDBusInterface::isRunning() const
|
||||
bool NightLightDBusInterface::isRunning() const
|
||||
{
|
||||
return m_manager->isRunning();
|
||||
}
|
||||
|
||||
bool NightColorDBusInterface::isAvailable() const
|
||||
bool NightLightDBusInterface::isAvailable() const
|
||||
{
|
||||
return true; // TODO: Night color should register its own dbus service instead.
|
||||
}
|
||||
|
||||
int NightColorDBusInterface::currentTemperature() const
|
||||
int NightLightDBusInterface::currentTemperature() const
|
||||
{
|
||||
return m_manager->currentTemperature();
|
||||
}
|
||||
|
||||
int NightColorDBusInterface::targetTemperature() const
|
||||
int NightLightDBusInterface::targetTemperature() const
|
||||
{
|
||||
return m_manager->targetTemperature();
|
||||
}
|
||||
|
||||
int NightColorDBusInterface::mode() const
|
||||
int NightLightDBusInterface::mode() const
|
||||
{
|
||||
return m_manager->mode();
|
||||
}
|
||||
|
||||
bool NightColorDBusInterface::daylight() const
|
||||
bool NightLightDBusInterface::daylight() const
|
||||
{
|
||||
return m_manager->daylight();
|
||||
}
|
||||
|
||||
quint64 NightColorDBusInterface::previousTransitionDateTime() const
|
||||
quint64 NightLightDBusInterface::previousTransitionDateTime() const
|
||||
{
|
||||
const QDateTime dateTime = m_manager->previousTransitionDateTime();
|
||||
if (dateTime.isValid()) {
|
||||
|
@ -249,12 +249,12 @@ quint64 NightColorDBusInterface::previousTransitionDateTime() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
quint32 NightColorDBusInterface::previousTransitionDuration() const
|
||||
quint32 NightLightDBusInterface::previousTransitionDuration() const
|
||||
{
|
||||
return quint32(m_manager->previousTransitionDuration());
|
||||
}
|
||||
|
||||
quint64 NightColorDBusInterface::scheduledTransitionDateTime() const
|
||||
quint64 NightLightDBusInterface::scheduledTransitionDateTime() const
|
||||
{
|
||||
const QDateTime dateTime = m_manager->scheduledTransitionDateTime();
|
||||
if (dateTime.isValid()) {
|
||||
|
@ -263,17 +263,17 @@ quint64 NightColorDBusInterface::scheduledTransitionDateTime() const
|
|||
return 0;
|
||||
}
|
||||
|
||||
quint32 NightColorDBusInterface::scheduledTransitionDuration() const
|
||||
quint32 NightLightDBusInterface::scheduledTransitionDuration() const
|
||||
{
|
||||
return quint32(m_manager->scheduledTransitionDuration());
|
||||
}
|
||||
|
||||
void NightColorDBusInterface::setLocation(double latitude, double longitude)
|
||||
void NightLightDBusInterface::setLocation(double latitude, double longitude)
|
||||
{
|
||||
m_manager->autoLocationUpdate(latitude, longitude);
|
||||
}
|
||||
|
||||
uint NightColorDBusInterface::inhibit()
|
||||
uint NightLightDBusInterface::inhibit()
|
||||
{
|
||||
const QString serviceName = QDBusContext::message().service();
|
||||
|
||||
|
@ -288,14 +288,14 @@ uint NightColorDBusInterface::inhibit()
|
|||
return m_lastInhibitionCookie;
|
||||
}
|
||||
|
||||
void NightColorDBusInterface::uninhibit(uint cookie)
|
||||
void NightLightDBusInterface::uninhibit(uint cookie)
|
||||
{
|
||||
const QString serviceName = QDBusContext::message().service();
|
||||
|
||||
uninhibit(serviceName, cookie);
|
||||
}
|
||||
|
||||
void NightColorDBusInterface::uninhibit(const QString &serviceName, uint cookie)
|
||||
void NightLightDBusInterface::uninhibit(const QString &serviceName, uint cookie)
|
||||
{
|
||||
const int removedCount = m_inhibitors.remove(serviceName, cookie);
|
||||
if (!removedCount) {
|
||||
|
@ -309,7 +309,7 @@ void NightColorDBusInterface::uninhibit(const QString &serviceName, uint cookie)
|
|||
m_manager->uninhibit();
|
||||
}
|
||||
|
||||
void NightColorDBusInterface::removeInhibitorService(const QString &serviceName)
|
||||
void NightLightDBusInterface::removeInhibitorService(const QString &serviceName)
|
||||
{
|
||||
const auto cookies = m_inhibitors.values(serviceName);
|
||||
for (const uint &cookie : cookies) {
|
||||
|
@ -317,16 +317,16 @@ void NightColorDBusInterface::removeInhibitorService(const QString &serviceName)
|
|||
}
|
||||
}
|
||||
|
||||
void NightColorDBusInterface::preview(uint previewTemp)
|
||||
void NightLightDBusInterface::preview(uint previewTemp)
|
||||
{
|
||||
m_manager->preview(previewTemp);
|
||||
}
|
||||
|
||||
void NightColorDBusInterface::stopPreview()
|
||||
void NightLightDBusInterface::stopPreview()
|
||||
{
|
||||
m_manager->stopPreview();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "moc_nightcolordbusinterface.cpp"
|
||||
#include "moc_nightlightdbusinterface.cpp"
|
|
@ -16,9 +16,9 @@
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
class NightColorManager;
|
||||
class NightLightManager;
|
||||
|
||||
class NightColorDBusInterface : public QObject, public QDBusContext
|
||||
class NightLightDBusInterface : public QObject, public QDBusContext
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.NightLight")
|
||||
|
@ -36,8 +36,8 @@ class NightColorDBusInterface : public QObject, public QDBusContext
|
|||
Q_PROPERTY(quint32 scheduledTransitionDuration READ scheduledTransitionDuration)
|
||||
|
||||
public:
|
||||
explicit NightColorDBusInterface(NightColorManager *parent);
|
||||
~NightColorDBusInterface() override;
|
||||
explicit NightLightDBusInterface(NightLightManager *parent);
|
||||
~NightLightDBusInterface() override;
|
||||
|
||||
bool isInhibited() const;
|
||||
bool isEnabled() const;
|
||||
|
@ -61,7 +61,7 @@ public Q_SLOTS:
|
|||
void setLocation(double latitude, double longitude);
|
||||
|
||||
/**
|
||||
* @brief Temporarily blocks Night Color.
|
||||
* @brief Temporarily blocks Night Light.
|
||||
* @since 5.18
|
||||
*/
|
||||
uint inhibit();
|
||||
|
@ -87,7 +87,7 @@ private Q_SLOTS:
|
|||
private:
|
||||
void uninhibit(const QString &serviceName, uint cookie);
|
||||
|
||||
NightColorManager *m_manager;
|
||||
NightLightManager *m_manager;
|
||||
QDBusServiceWatcher *m_inhibitorWatcher;
|
||||
QMultiHash<QString, uint> m_inhibitors;
|
||||
uint m_lastInhibitionCookie = 0;
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "nightcolormanager.h"
|
||||
#include "nightlightmanager.h"
|
||||
#include "clockskewnotifier.h"
|
||||
#include "colors/colordevice.h"
|
||||
#include "colors/colormanager.h"
|
||||
#include "nightcolordbusinterface.h"
|
||||
#include "nightcolorlogging.h"
|
||||
#include "nightcolorsettings.h"
|
||||
#include "nightlightdbusinterface.h"
|
||||
#include "nightlightlogging.h"
|
||||
#include "nightlightsettings.h"
|
||||
#include "suncalc.h"
|
||||
|
||||
#include <core/outputbackend.h>
|
||||
|
@ -36,28 +36,28 @@ namespace KWin
|
|||
|
||||
static const int QUICK_ADJUST_DURATION = 2000;
|
||||
static const int TEMPERATURE_STEP = 50;
|
||||
static NightColorManager *s_instance = nullptr;
|
||||
static NightLightManager *s_instance = nullptr;
|
||||
|
||||
static bool checkLocation(double lat, double lng)
|
||||
{
|
||||
return -90 <= lat && lat <= 90 && -180 <= lng && lng <= 180;
|
||||
}
|
||||
|
||||
NightColorManager *NightColorManager::self()
|
||||
NightLightManager *NightLightManager::self()
|
||||
{
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
NightColorManager::NightColorManager()
|
||||
NightLightManager::NightLightManager()
|
||||
{
|
||||
NightColorSettings::instance(kwinApp()->config());
|
||||
NightLightSettings::instance(kwinApp()->config());
|
||||
s_instance = this;
|
||||
|
||||
m_iface = new NightColorDBusInterface(this);
|
||||
m_iface = new NightLightDBusInterface(this);
|
||||
m_skewNotifier = new ClockSkewNotifier(this);
|
||||
|
||||
// Display a message when Night Color is (un)inhibited.
|
||||
connect(this, &NightColorManager::inhibitedChanged, this, [this] {
|
||||
// Display a message when Night Light is (un)inhibited.
|
||||
connect(this, &NightLightManager::inhibitedChanged, this, [this] {
|
||||
const QString iconName = isInhibited()
|
||||
? QStringLiteral("redshift-status-off")
|
||||
: m_daylight && m_targetTemperature != DEFAULT_DAY_TEMPERATURE ? QStringLiteral("redshift-status-day")
|
||||
|
@ -78,7 +78,7 @@ NightColorManager::NightColorManager()
|
|||
});
|
||||
|
||||
m_configWatcher = KConfigWatcher::create(kwinApp()->config());
|
||||
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, &NightColorManager::reconfigure);
|
||||
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, &NightLightManager::reconfigure);
|
||||
|
||||
// we may always read in the current config
|
||||
readConfig();
|
||||
|
@ -88,9 +88,9 @@ NightColorManager::NightColorManager()
|
|||
toggleAction->setObjectName(QStringLiteral("Toggle Night Color"));
|
||||
toggleAction->setText(i18n("Toggle Night Light"));
|
||||
KGlobalAccel::setGlobalShortcut(toggleAction, QList<QKeySequence>());
|
||||
connect(toggleAction, &QAction::triggered, this, &NightColorManager::toggle);
|
||||
connect(toggleAction, &QAction::triggered, this, &NightLightManager::toggle);
|
||||
|
||||
connect(kwinApp()->colorManager(), &ColorManager::deviceAdded, this, &NightColorManager::hardReset);
|
||||
connect(kwinApp()->colorManager(), &ColorManager::deviceAdded, this, &NightLightManager::hardReset);
|
||||
|
||||
connect(kwinApp()->session(), &Session::activeChanged, this, [this](bool active) {
|
||||
if (active) {
|
||||
|
@ -114,7 +114,7 @@ NightColorManager::NightColorManager()
|
|||
if (reply.isValid()) {
|
||||
comingFromSuspend = reply.value().toBool();
|
||||
} else {
|
||||
qCDebug(KWIN_NIGHTCOLOR) << "Failed to get PreparingForSleep Property of logind session:" << reply.error().message();
|
||||
qCDebug(KWIN_NIGHTLIGHT) << "Failed to get PreparingForSleep Property of logind session:" << reply.error().message();
|
||||
// Always do a hard reset in case we have no further information.
|
||||
comingFromSuspend = true;
|
||||
}
|
||||
|
@ -129,12 +129,12 @@ NightColorManager::NightColorManager()
|
|||
hardReset();
|
||||
}
|
||||
|
||||
NightColorManager::~NightColorManager()
|
||||
NightLightManager::~NightLightManager()
|
||||
{
|
||||
s_instance = nullptr;
|
||||
}
|
||||
|
||||
void NightColorManager::hardReset()
|
||||
void NightLightManager::hardReset()
|
||||
{
|
||||
cancelAllTimers();
|
||||
|
||||
|
@ -148,25 +148,25 @@ void NightColorManager::hardReset()
|
|||
resetAllTimers();
|
||||
}
|
||||
|
||||
void NightColorManager::reconfigure()
|
||||
void NightLightManager::reconfigure()
|
||||
{
|
||||
cancelAllTimers();
|
||||
readConfig();
|
||||
resetAllTimers();
|
||||
}
|
||||
|
||||
void NightColorManager::toggle()
|
||||
void NightLightManager::toggle()
|
||||
{
|
||||
m_isGloballyInhibited = !m_isGloballyInhibited;
|
||||
m_isGloballyInhibited ? inhibit() : uninhibit();
|
||||
}
|
||||
|
||||
bool NightColorManager::isInhibited() const
|
||||
bool NightLightManager::isInhibited() const
|
||||
{
|
||||
return m_inhibitReferenceCount;
|
||||
}
|
||||
|
||||
void NightColorManager::inhibit()
|
||||
void NightLightManager::inhibit()
|
||||
{
|
||||
m_inhibitReferenceCount++;
|
||||
|
||||
|
@ -176,7 +176,7 @@ void NightColorManager::inhibit()
|
|||
}
|
||||
}
|
||||
|
||||
void NightColorManager::uninhibit()
|
||||
void NightLightManager::uninhibit()
|
||||
{
|
||||
m_inhibitReferenceCount--;
|
||||
|
||||
|
@ -186,69 +186,69 @@ void NightColorManager::uninhibit()
|
|||
}
|
||||
}
|
||||
|
||||
bool NightColorManager::isEnabled() const
|
||||
bool NightLightManager::isEnabled() const
|
||||
{
|
||||
return m_active;
|
||||
}
|
||||
|
||||
bool NightColorManager::isRunning() const
|
||||
bool NightLightManager::isRunning() const
|
||||
{
|
||||
return m_running;
|
||||
}
|
||||
|
||||
int NightColorManager::currentTemperature() const
|
||||
int NightLightManager::currentTemperature() const
|
||||
{
|
||||
return m_currentTemp;
|
||||
}
|
||||
|
||||
int NightColorManager::targetTemperature() const
|
||||
int NightLightManager::targetTemperature() const
|
||||
{
|
||||
return m_targetTemperature;
|
||||
}
|
||||
|
||||
NightColorMode NightColorManager::mode() const
|
||||
NightLightMode NightLightManager::mode() const
|
||||
{
|
||||
return m_mode;
|
||||
}
|
||||
|
||||
QDateTime NightColorManager::previousTransitionDateTime() const
|
||||
QDateTime NightLightManager::previousTransitionDateTime() const
|
||||
{
|
||||
return m_prev.first;
|
||||
}
|
||||
|
||||
qint64 NightColorManager::previousTransitionDuration() const
|
||||
qint64 NightLightManager::previousTransitionDuration() const
|
||||
{
|
||||
return m_prev.first.msecsTo(m_prev.second);
|
||||
}
|
||||
|
||||
QDateTime NightColorManager::scheduledTransitionDateTime() const
|
||||
QDateTime NightLightManager::scheduledTransitionDateTime() const
|
||||
{
|
||||
return m_next.first;
|
||||
}
|
||||
|
||||
qint64 NightColorManager::scheduledTransitionDuration() const
|
||||
qint64 NightLightManager::scheduledTransitionDuration() const
|
||||
{
|
||||
return m_next.first.msecsTo(m_next.second);
|
||||
}
|
||||
|
||||
void NightColorManager::readConfig()
|
||||
void NightLightManager::readConfig()
|
||||
{
|
||||
NightColorSettings *s = NightColorSettings::self();
|
||||
NightLightSettings *s = NightLightSettings::self();
|
||||
s->load();
|
||||
|
||||
setEnabled(s->active());
|
||||
|
||||
const NightColorMode mode = s->mode();
|
||||
const NightLightMode mode = s->mode();
|
||||
switch (s->mode()) {
|
||||
case NightColorMode::Automatic:
|
||||
case NightColorMode::Location:
|
||||
case NightColorMode::Timings:
|
||||
case NightColorMode::Constant:
|
||||
case NightLightMode::Automatic:
|
||||
case NightLightMode::Location:
|
||||
case NightLightMode::Timings:
|
||||
case NightLightMode::Constant:
|
||||
setMode(mode);
|
||||
break;
|
||||
default:
|
||||
// Fallback for invalid setting values.
|
||||
setMode(NightColorMode::Automatic);
|
||||
setMode(NightLightMode::Automatic);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ void NightColorManager::readConfig()
|
|||
m_trTime = std::max(trTime / 1000 / 60, 1);
|
||||
}
|
||||
|
||||
void NightColorManager::resetAllTimers()
|
||||
void NightLightManager::resetAllTimers()
|
||||
{
|
||||
cancelAllTimers();
|
||||
setRunning(isEnabled() && !isInhibited());
|
||||
|
@ -305,14 +305,14 @@ void NightColorManager::resetAllTimers()
|
|||
resetQuickAdjustTimer(currentTargetTemp());
|
||||
}
|
||||
|
||||
void NightColorManager::cancelAllTimers()
|
||||
void NightLightManager::cancelAllTimers()
|
||||
{
|
||||
m_slowUpdateStartTimer.reset();
|
||||
m_slowUpdateTimer.reset();
|
||||
m_quickAdjustTimer.reset();
|
||||
}
|
||||
|
||||
void NightColorManager::resetQuickAdjustTimer(int targetTemp)
|
||||
void NightLightManager::resetQuickAdjustTimer(int targetTemp)
|
||||
{
|
||||
int tempDiff = std::abs(targetTemp - m_currentTemp);
|
||||
// allow tolerance of one TEMPERATURE_STEP to compensate if a slow update is coincidental
|
||||
|
@ -334,7 +334,7 @@ void NightColorManager::resetQuickAdjustTimer(int targetTemp)
|
|||
}
|
||||
}
|
||||
|
||||
void NightColorManager::quickAdjust(int targetTemp)
|
||||
void NightLightManager::quickAdjust(int targetTemp)
|
||||
{
|
||||
if (!m_quickAdjustTimer) {
|
||||
return;
|
||||
|
@ -356,7 +356,7 @@ void NightColorManager::quickAdjust(int targetTemp)
|
|||
}
|
||||
}
|
||||
|
||||
void NightColorManager::resetSlowUpdateStartTimer()
|
||||
void NightLightManager::resetSlowUpdateStartTimer()
|
||||
{
|
||||
m_slowUpdateStartTimer.reset();
|
||||
|
||||
|
@ -367,21 +367,21 @@ void NightColorManager::resetSlowUpdateStartTimer()
|
|||
|
||||
// There is no need for starting the slow update timer. Screen color temperature
|
||||
// will be constant all the time now.
|
||||
if (m_mode == NightColorMode::Constant) {
|
||||
if (m_mode == NightLightMode::Constant) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set up the next slow update
|
||||
m_slowUpdateStartTimer = std::make_unique<QTimer>();
|
||||
m_slowUpdateStartTimer->setSingleShot(true);
|
||||
connect(m_slowUpdateStartTimer.get(), &QTimer::timeout, this, &NightColorManager::resetSlowUpdateStartTimer);
|
||||
connect(m_slowUpdateStartTimer.get(), &QTimer::timeout, this, &NightLightManager::resetSlowUpdateStartTimer);
|
||||
|
||||
updateTransitionTimings(false);
|
||||
updateTargetTemperature();
|
||||
|
||||
const int diff = QDateTime::currentDateTime().msecsTo(m_next.first);
|
||||
if (diff <= 0) {
|
||||
qCCritical(KWIN_NIGHTCOLOR) << "Error in time calculation. Deactivating Night Color.";
|
||||
qCCritical(KWIN_NIGHTLIGHT) << "Error in time calculation. Deactivating Night Light.";
|
||||
return;
|
||||
}
|
||||
m_slowUpdateStartTimer->start(diff);
|
||||
|
@ -390,7 +390,7 @@ void NightColorManager::resetSlowUpdateStartTimer()
|
|||
resetSlowUpdateTimer();
|
||||
}
|
||||
|
||||
void NightColorManager::resetSlowUpdateTimer()
|
||||
void NightLightManager::resetSlowUpdateTimer()
|
||||
{
|
||||
m_slowUpdateTimer.reset();
|
||||
|
||||
|
@ -427,7 +427,7 @@ void NightColorManager::resetSlowUpdateTimer()
|
|||
}
|
||||
}
|
||||
|
||||
void NightColorManager::slowUpdate(int targetTemp)
|
||||
void NightLightManager::slowUpdate(int targetTemp)
|
||||
{
|
||||
if (!m_slowUpdateTimer) {
|
||||
return;
|
||||
|
@ -445,7 +445,7 @@ void NightColorManager::slowUpdate(int targetTemp)
|
|||
}
|
||||
}
|
||||
|
||||
void NightColorManager::preview(uint previewTemp)
|
||||
void NightLightManager::preview(uint previewTemp)
|
||||
{
|
||||
previewTemp = std::clamp<uint>(previewTemp, MIN_TEMPERATURE, DEFAULT_DAY_TEMPERATURE);
|
||||
resetQuickAdjustTimer((int)previewTemp);
|
||||
|
@ -454,7 +454,7 @@ void NightColorManager::preview(uint previewTemp)
|
|||
}
|
||||
m_previewTimer = std::make_unique<QTimer>();
|
||||
m_previewTimer->setSingleShot(true);
|
||||
connect(m_previewTimer.get(), &QTimer::timeout, this, &NightColorManager::stopPreview);
|
||||
connect(m_previewTimer.get(), &QTimer::timeout, this, &NightLightManager::stopPreview);
|
||||
m_previewTimer->start(15000);
|
||||
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(
|
||||
|
@ -468,7 +468,7 @@ void NightColorManager::preview(uint previewTemp)
|
|||
QDBusConnection::sessionBus().asyncCall(message);
|
||||
}
|
||||
|
||||
void NightColorManager::stopPreview()
|
||||
void NightLightManager::stopPreview()
|
||||
{
|
||||
if (m_previewTimer && m_previewTimer->isActive()) {
|
||||
updateTransitionTimings(false);
|
||||
|
@ -477,9 +477,9 @@ void NightColorManager::stopPreview()
|
|||
}
|
||||
}
|
||||
|
||||
void NightColorManager::updateTargetTemperature()
|
||||
void NightLightManager::updateTargetTemperature()
|
||||
{
|
||||
const int targetTemperature = mode() != NightColorMode::Constant && daylight() ? m_dayTargetTemp : m_nightTargetTemp;
|
||||
const int targetTemperature = mode() != NightLightMode::Constant && daylight() ? m_dayTargetTemp : m_nightTargetTemp;
|
||||
|
||||
if (m_targetTemperature == targetTemperature) {
|
||||
return;
|
||||
|
@ -490,16 +490,16 @@ void NightColorManager::updateTargetTemperature()
|
|||
Q_EMIT targetTemperatureChanged();
|
||||
}
|
||||
|
||||
void NightColorManager::updateTransitionTimings(bool force)
|
||||
void NightLightManager::updateTransitionTimings(bool force)
|
||||
{
|
||||
const auto oldPrev = m_prev;
|
||||
const auto oldNext = m_next;
|
||||
|
||||
if (m_mode == NightColorMode::Constant) {
|
||||
if (m_mode == NightLightMode::Constant) {
|
||||
setDaylight(false);
|
||||
m_next = DateTimes();
|
||||
m_prev = DateTimes();
|
||||
} else if (m_mode == NightColorMode::Timings) {
|
||||
} else if (m_mode == NightLightMode::Timings) {
|
||||
const QDateTime todayNow = QDateTime::currentDateTime();
|
||||
|
||||
const QDateTime nextMorB = QDateTime(todayNow.date().addDays(m_morning < todayNow.time()), m_morning);
|
||||
|
@ -520,7 +520,7 @@ void NightColorManager::updateTransitionTimings(bool force)
|
|||
const QDateTime todayNow = QDateTime::currentDateTime();
|
||||
|
||||
double lat, lng;
|
||||
if (m_mode == NightColorMode::Automatic) {
|
||||
if (m_mode == NightLightMode::Automatic) {
|
||||
lat = m_latAuto;
|
||||
lng = m_lngAuto;
|
||||
} else {
|
||||
|
@ -573,7 +573,7 @@ void NightColorManager::updateTransitionTimings(bool force)
|
|||
}
|
||||
}
|
||||
|
||||
DateTimes NightColorManager::getSunTimings(const QDateTime &dateTime, double latitude, double longitude, bool morning) const
|
||||
DateTimes NightLightManager::getSunTimings(const QDateTime &dateTime, double latitude, double longitude, bool morning) const
|
||||
{
|
||||
DateTimes dateTimes = calculateSunTimings(dateTime, latitude, longitude, morning);
|
||||
// At locations near the poles it is possible, that we can't
|
||||
|
@ -588,7 +588,7 @@ DateTimes NightColorManager::getSunTimings(const QDateTime &dateTime, double lat
|
|||
dateTimes.first = dateTimes.second.addMSecs(-FALLBACK_SLOW_UPDATE_TIME);
|
||||
} else {
|
||||
// Just use default values for morning and evening, but the user
|
||||
// will probably deactivate Night Color anyway if he is living
|
||||
// will probably deactivate Night Light anyway if he is living
|
||||
// in a region without clear sun rise and set.
|
||||
const QTime referenceTime = morning ? QTime(6, 0) : QTime(18, 0);
|
||||
dateTimes.first = QDateTime(dateTime.date(), referenceTime);
|
||||
|
@ -598,7 +598,7 @@ DateTimes NightColorManager::getSunTimings(const QDateTime &dateTime, double lat
|
|||
return dateTimes;
|
||||
}
|
||||
|
||||
bool NightColorManager::checkAutomaticSunTimings() const
|
||||
bool NightLightManager::checkAutomaticSunTimings() const
|
||||
{
|
||||
if (m_prev.first.isValid() && m_prev.second.isValid() && m_next.first.isValid() && m_next.second.isValid()) {
|
||||
const QDateTime todayNow = QDateTime::currentDateTime();
|
||||
|
@ -607,18 +607,18 @@ bool NightColorManager::checkAutomaticSunTimings() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool NightColorManager::daylight() const
|
||||
bool NightLightManager::daylight() const
|
||||
{
|
||||
return m_daylight;
|
||||
}
|
||||
|
||||
int NightColorManager::currentTargetTemp() const
|
||||
int NightLightManager::currentTargetTemp() const
|
||||
{
|
||||
if (!m_running) {
|
||||
return DEFAULT_DAY_TEMPERATURE;
|
||||
}
|
||||
|
||||
if (m_mode == NightColorMode::Constant) {
|
||||
if (m_mode == NightLightMode::Constant) {
|
||||
return m_nightTargetTemp;
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ int NightColorManager::currentTargetTemp() const
|
|||
}
|
||||
}
|
||||
|
||||
void NightColorManager::commitGammaRamps(int temperature)
|
||||
void NightLightManager::commitGammaRamps(int temperature)
|
||||
{
|
||||
const QList<ColorDevice *> devices = kwinApp()->colorManager()->devices();
|
||||
for (ColorDevice *device : devices) {
|
||||
|
@ -654,9 +654,9 @@ void NightColorManager::commitGammaRamps(int temperature)
|
|||
setCurrentTemperature(temperature);
|
||||
}
|
||||
|
||||
void NightColorManager::autoLocationUpdate(double latitude, double longitude)
|
||||
void NightLightManager::autoLocationUpdate(double latitude, double longitude)
|
||||
{
|
||||
qCDebug(KWIN_NIGHTCOLOR, "Received new location (lat: %f, lng: %f)", latitude, longitude);
|
||||
qCDebug(KWIN_NIGHTLIGHT, "Received new location (lat: %f, lng: %f)", latitude, longitude);
|
||||
|
||||
if (!checkLocation(latitude, longitude)) {
|
||||
return;
|
||||
|
@ -670,7 +670,7 @@ void NightColorManager::autoLocationUpdate(double latitude, double longitude)
|
|||
m_latAuto = latitude;
|
||||
m_lngAuto = longitude;
|
||||
|
||||
NightColorSettings *s = NightColorSettings::self();
|
||||
NightLightSettings *s = NightLightSettings::self();
|
||||
s->setLatitudeAuto(latitude);
|
||||
s->setLongitudeAuto(longitude);
|
||||
s->save();
|
||||
|
@ -678,7 +678,7 @@ void NightColorManager::autoLocationUpdate(double latitude, double longitude)
|
|||
resetAllTimers();
|
||||
}
|
||||
|
||||
void NightColorManager::setEnabled(bool enabled)
|
||||
void NightLightManager::setEnabled(bool enabled)
|
||||
{
|
||||
if (m_active == enabled) {
|
||||
return;
|
||||
|
@ -688,7 +688,7 @@ void NightColorManager::setEnabled(bool enabled)
|
|||
Q_EMIT enabledChanged();
|
||||
}
|
||||
|
||||
void NightColorManager::setRunning(bool running)
|
||||
void NightLightManager::setRunning(bool running)
|
||||
{
|
||||
if (m_running == running) {
|
||||
return;
|
||||
|
@ -697,7 +697,7 @@ void NightColorManager::setRunning(bool running)
|
|||
Q_EMIT runningChanged();
|
||||
}
|
||||
|
||||
void NightColorManager::setCurrentTemperature(int temperature)
|
||||
void NightLightManager::setCurrentTemperature(int temperature)
|
||||
{
|
||||
if (m_currentTemp == temperature) {
|
||||
return;
|
||||
|
@ -706,7 +706,7 @@ void NightColorManager::setCurrentTemperature(int temperature)
|
|||
Q_EMIT currentTemperatureChanged();
|
||||
}
|
||||
|
||||
void NightColorManager::setMode(NightColorMode mode)
|
||||
void NightLightManager::setMode(NightLightMode mode)
|
||||
{
|
||||
if (m_mode == mode) {
|
||||
return;
|
||||
|
@ -715,7 +715,7 @@ void NightColorManager::setMode(NightColorMode mode)
|
|||
Q_EMIT modeChanged();
|
||||
}
|
||||
|
||||
void NightColorManager::setDaylight(bool daylight)
|
||||
void NightLightManager::setDaylight(bool daylight)
|
||||
{
|
||||
if (m_daylight == daylight) {
|
||||
return;
|
||||
|
@ -726,4 +726,4 @@ void NightColorManager::setDaylight(bool daylight)
|
|||
|
||||
} // namespace KWin
|
||||
|
||||
#include "moc_nightcolormanager.cpp"
|
||||
#include "moc_nightlightmanager.cpp"
|
|
@ -24,15 +24,15 @@ namespace KWin
|
|||
{
|
||||
|
||||
class ClockSkewNotifier;
|
||||
class NightColorDBusInterface;
|
||||
class NightLightDBusInterface;
|
||||
|
||||
typedef QPair<QDateTime, QDateTime> DateTimes;
|
||||
typedef QPair<QTime, QTime> Times;
|
||||
|
||||
/**
|
||||
* This enum type is used to specify operation mode of the night color manager.
|
||||
* This enum type is used to specify operation mode of the night light manager.
|
||||
*/
|
||||
enum NightColorMode {
|
||||
enum NightLightMode {
|
||||
/**
|
||||
* Color temperature is computed based on the current position of the Sun.
|
||||
*
|
||||
|
@ -58,7 +58,7 @@ enum NightColorMode {
|
|||
};
|
||||
|
||||
/**
|
||||
* The night color manager is a blue light filter similar to Redshift.
|
||||
* The night light manager is a blue light filter similar to Redshift.
|
||||
*
|
||||
* There are four modes this manager can operate in: Automatic, Location, Timings,
|
||||
* and Constant. Both Automatic and Location modes derive screen color temperature
|
||||
|
@ -73,13 +73,13 @@ enum NightColorMode {
|
|||
*
|
||||
* With the Constant mode, screen color temperature is always constant.
|
||||
*/
|
||||
class KWIN_EXPORT NightColorManager : public Plugin
|
||||
class KWIN_EXPORT NightLightManager : public Plugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NightColorManager();
|
||||
~NightColorManager() override;
|
||||
explicit NightLightManager();
|
||||
~NightLightManager() override;
|
||||
|
||||
void autoLocationUpdate(double latitude, double longitude);
|
||||
|
||||
|
@ -102,12 +102,12 @@ public:
|
|||
void toggle();
|
||||
|
||||
/**
|
||||
* Returns @c true if the night color manager is blocked; otherwise @c false.
|
||||
* Returns @c true if the night light manager is blocked; otherwise @c false.
|
||||
*/
|
||||
bool isInhibited() const;
|
||||
|
||||
/**
|
||||
* Temporarily blocks the night color manager.
|
||||
* Temporarily blocks the night light manager.
|
||||
*
|
||||
* After calling this method, the screen color temperature will be reverted
|
||||
* back to 6500C. When you're done, call uninhibit() method.
|
||||
|
@ -115,17 +115,17 @@ public:
|
|||
void inhibit();
|
||||
|
||||
/**
|
||||
* Attempts to unblock the night color manager.
|
||||
* Attempts to unblock the night light manager.
|
||||
*/
|
||||
void uninhibit();
|
||||
|
||||
/**
|
||||
* Returns @c true if Night Color is enabled; otherwise @c false.
|
||||
* Returns @c true if Night Light is enabled; otherwise @c false.
|
||||
*/
|
||||
bool isEnabled() const;
|
||||
|
||||
/**
|
||||
* Returns @c true if Night Color is currently running; otherwise @c false.
|
||||
* Returns @c true if Night Light is currently running; otherwise @c false.
|
||||
*/
|
||||
bool isRunning() const;
|
||||
|
||||
|
@ -140,18 +140,18 @@ public:
|
|||
int targetTemperature() const;
|
||||
|
||||
/**
|
||||
* Returns the mode in which Night Color is operating.
|
||||
* Returns the mode in which Night Light is operating.
|
||||
*/
|
||||
NightColorMode mode() const;
|
||||
NightLightMode mode() const;
|
||||
|
||||
/**
|
||||
* Returns whether Night Color is currently on day time.
|
||||
* Returns whether Night Light is currently on day time.
|
||||
*/
|
||||
bool daylight() const;
|
||||
|
||||
/**
|
||||
* Returns the datetime that specifies when the previous screen color temperature transition
|
||||
* had started. Notice that when Night Color operates in the Constant mode, the returned date
|
||||
* had started. Notice that when Night Light operates in the Constant mode, the returned date
|
||||
* time object is not valid.
|
||||
*/
|
||||
QDateTime previousTransitionDateTime() const;
|
||||
|
@ -163,7 +163,7 @@ public:
|
|||
|
||||
/**
|
||||
* Returns the datetime that specifies when the next screen color temperature transition will
|
||||
* start. Notice that when Night Color operates in the Constant mode, the returned date time
|
||||
* start. Notice that when Night Light operates in the Constant mode, the returned date time
|
||||
* object is not valid.
|
||||
*/
|
||||
QDateTime scheduledTransitionDateTime() const;
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
|
||||
// for auto tests
|
||||
void reconfigure();
|
||||
static NightColorManager *self();
|
||||
static NightLightManager *self();
|
||||
|
||||
/**
|
||||
* Previews a given temperature for a short time (15s).
|
||||
|
@ -194,17 +194,17 @@ public Q_SLOTS:
|
|||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted whenever the night color manager is blocked or unblocked.
|
||||
* Emitted whenever the night light manager is blocked or unblocked.
|
||||
*/
|
||||
void inhibitedChanged();
|
||||
|
||||
/**
|
||||
* Emitted whenever the night color manager is enabled or disabled.
|
||||
* Emitted whenever the night light manager is enabled or disabled.
|
||||
*/
|
||||
void enabledChanged();
|
||||
|
||||
/**
|
||||
* Emitted whenever the night color manager starts or stops running.
|
||||
* Emitted whenever the night light manager starts or stops running.
|
||||
*/
|
||||
void runningChanged();
|
||||
|
||||
|
@ -224,7 +224,7 @@ Q_SIGNALS:
|
|||
void modeChanged();
|
||||
|
||||
/**
|
||||
* Emitted whenver night color has switched between day and night time.
|
||||
* Emitted whenver night light has switched between day and night time.
|
||||
*/
|
||||
void daylightChanged();
|
||||
|
||||
|
@ -264,22 +264,22 @@ private:
|
|||
void setEnabled(bool enabled);
|
||||
void setRunning(bool running);
|
||||
void setCurrentTemperature(int temperature);
|
||||
void setMode(NightColorMode mode);
|
||||
void setMode(NightLightMode mode);
|
||||
void setDaylight(bool daylight);
|
||||
|
||||
NightColorDBusInterface *m_iface;
|
||||
NightLightDBusInterface *m_iface;
|
||||
ClockSkewNotifier *m_skewNotifier;
|
||||
|
||||
// Specifies whether Night Color is enabled.
|
||||
// Specifies whether Night Light is enabled.
|
||||
bool m_active = false;
|
||||
|
||||
// Specifies whether Night Color is currently running.
|
||||
// Specifies whether Night Light is currently running.
|
||||
bool m_running = false;
|
||||
|
||||
// Specifies whether Night Color is inhibited globally.
|
||||
// Specifies whether Night Light is inhibited globally.
|
||||
bool m_isGloballyInhibited = false;
|
||||
|
||||
NightColorMode m_mode = NightColorMode::Automatic;
|
||||
NightLightMode m_mode = NightLightMode::Automatic;
|
||||
|
||||
// the previous and next sunrise/sunset intervals - in UTC time
|
||||
DateTimes m_prev = DateTimes();
|
|
@ -9,13 +9,13 @@
|
|||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="Mode" type="Enum">
|
||||
<choices name="KWin::NightColorMode">
|
||||
<choices name="KWin::NightLightMode">
|
||||
<choice name="Automatic"/>
|
||||
<choice name="Location"/>
|
||||
<choice name="Times"/>
|
||||
<choice name="Constant"/>
|
||||
</choices>
|
||||
<default>NightColorMode::Automatic</default>
|
||||
<default>NightLightMode::Automatic</default>
|
||||
</entry>
|
||||
<entry name="DayTemperature" type="Int">
|
||||
<default>6500</default>
|
8
src/plugins/nightlight/nightlightsettings.kcfgc
Normal file
8
src/plugins/nightlight/nightlightsettings.kcfgc
Normal file
|
@ -0,0 +1,8 @@
|
|||
File=nightlightsettings.kcfg
|
||||
NameSpace=KWin
|
||||
ClassName=NightLightSettings
|
||||
Singleton=true
|
||||
Mutators=true
|
||||
# nightlightmanager.h is needed for NightLightMode
|
||||
IncludeFiles=nightlightmanager.h
|
||||
UseEnumTypes=true
|
Loading…
Reference in a new issue