KWin
Loading...
Searching...
No Matches
clockskewnotifier.cpp
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "clockskewnotifier.h"
9
10namespace KWin
11{
12
14{
15public:
16 void loadNotifierEngine();
18
21 bool isActive = false;
22};
23
32
34{
35 if (!engine) {
36 return;
37 }
38
39 QObject::disconnect(engine, &ClockSkewNotifierEngine::clockSkewed, notifier, &ClockSkewNotifier::clockSkewed);
40 engine->deleteLater();
41
42 engine = nullptr;
43}
44
46 : QObject(parent)
47 , d(new Private)
48{
49 d->notifier = this;
50}
51
55
57{
58 return d->isActive;
59}
60
62{
63 if (d->isActive == set) {
64 return;
65 }
66
67 d->isActive = set;
68
69 if (d->isActive) {
70 d->loadNotifierEngine();
71 } else {
72 d->unloadNotifierEngine();
73 }
74
75 Q_EMIT activeChanged();
76}
77
78} // namespace KWin
79
80#include "moc_clockskewnotifier.cpp"
ClockSkewNotifierEngine * engine
static ClockSkewNotifierEngine * create(QObject *parent)
ClockSkewNotifier(QObject *parent=nullptr)