Commit f4b0d85f authored by Frederik Gladhorn's avatar Frederik Gladhorn

Create m_saveTimer lazily

Summary: Making the other timers lazy-initialized is more tricky, so for now just touch the saveTimer.

Reviewers: #plasma, romangg

Reviewed By: #plasma, romangg

Subscribers: romangg, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D14359
parent 5b6e9767
...@@ -51,7 +51,7 @@ KScreenDaemon::KScreenDaemon(QObject* parent, const QList< QVariant >& ) ...@@ -51,7 +51,7 @@ KScreenDaemon::KScreenDaemon(QObject* parent, const QList< QVariant >& )
, m_monitoredConfig(nullptr) , m_monitoredConfig(nullptr)
, m_monitoring(false) , m_monitoring(false)
, m_changeCompressor(new QTimer(this)) , m_changeCompressor(new QTimer(this))
, m_saveTimer(new QTimer(this)) , m_saveTimer(nullptr)
, m_lidClosedTimer(new QTimer(this)) , m_lidClosedTimer(new QTimer(this))
{ {
...@@ -97,10 +97,6 @@ void KScreenDaemon::init() ...@@ -97,10 +97,6 @@ void KScreenDaemon::init()
// Initialize OSD manager to register its dbus interface // Initialize OSD manager to register its dbus interface
m_osdManager = new KScreen::OsdManager(this); m_osdManager = new KScreen::OsdManager(this);
m_saveTimer->setInterval(300);
m_saveTimer->setSingleShot(true);
connect(m_saveTimer, &QTimer::timeout, this, &KScreenDaemon::saveCurrentConfig);
m_changeCompressor->setInterval(10); m_changeCompressor->setInterval(10);
m_changeCompressor->setSingleShot(true); m_changeCompressor->setSingleShot(true);
connect(m_changeCompressor, &QTimer::timeout, this, &KScreenDaemon::applyConfig); connect(m_changeCompressor, &QTimer::timeout, this, &KScreenDaemon::applyConfig);
...@@ -248,6 +244,12 @@ void KScreenDaemon::configChanged() ...@@ -248,6 +244,12 @@ void KScreenDaemon::configChanged()
} }
// Reset timer, delay the writeback // Reset timer, delay the writeback
if (!m_saveTimer) {
m_saveTimer = new QTimer(this);
m_saveTimer->setInterval(300);
m_saveTimer->setSingleShot(true);
connect(m_saveTimer, &QTimer::timeout, this, &KScreenDaemon::saveCurrentConfig);
}
m_saveTimer->start(); m_saveTimer->start();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment