1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #include "listener.h" |
6 | #include "framework/listener/private/listener_p.h" |
7 | #include "framework/service/qtclassmanager.h" |
8 | |
9 | DPF_BEGIN_NAMESPACE |
10 | |
11 | // 饿汉避免释放冲突 |
12 | static dpf::Listener listener; |
13 | |
14 | Listener::Listener(QObject *parent) |
15 | : QObject(parent) |
16 | , d(new ListenerPrivate(this)) |
17 | { |
18 | |
19 | } |
20 | |
21 | Listener &Listener::instance() |
22 | { |
23 | return listener; |
24 | } |
25 | |
26 | ListenerPrivate::ListenerPrivate(Listener *parent) |
27 | : QObject(parent) |
28 | , q(parent) |
29 | { |
30 | QObject::connect(this, &ListenerPrivate::pluginsInitialized, |
31 | q, &Listener::pluginsInitialized, |
32 | Qt::UniqueConnection); |
33 | |
34 | QObject::connect(this, &ListenerPrivate::pluginsStarted, |
35 | q, &Listener::pluginsStarted, |
36 | Qt::UniqueConnection); |
37 | |
38 | QObject::connect(this, &ListenerPrivate::pluginsStoped, |
39 | q, &Listener::pluginsStoped, |
40 | Qt::UniqueConnection); |
41 | } |
42 | |
43 | DPF_END_NAMESPACE |
44 | |