Changeset View
Changeset View
Standalone View
Standalone View
src/baloo/baloodetector.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2016-2019 Matthieu Gallien <matthieu_gallien@yahoo.fr> | ||||
3 | * | ||||
4 | * This program is free software: you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 3 of the License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | * Lesser General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Lesser General Public License | ||||
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||||
16 | */ | ||||
17 | | ||||
18 | #ifndef BALOODETECTOR_H | ||||
19 | #define BALOODETECTOR_H | ||||
20 | | ||||
21 | #include <QObject> | ||||
22 | #include <QDBusServiceWatcher> | ||||
23 | | ||||
24 | class BalooDetector : public QObject | ||||
25 | { | ||||
26 | | ||||
27 | Q_OBJECT | ||||
28 | | ||||
29 | Q_PROPERTY(bool balooAvailability | ||||
30 | READ balooAvailability | ||||
31 | NOTIFY balooAvailabilityChanged) | ||||
32 | | ||||
33 | public: | ||||
34 | | ||||
35 | explicit BalooDetector(QObject *parent = nullptr); | ||||
36 | | ||||
37 | bool balooAvailability() const; | ||||
38 | | ||||
39 | Q_SIGNALS: | ||||
40 | | ||||
41 | void balooAvailabilityChanged(); | ||||
42 | | ||||
43 | public Q_SLOTS: | ||||
44 | | ||||
45 | void checkBalooAvailability(); | ||||
46 | | ||||
47 | private Q_SLOTS: | ||||
48 | | ||||
49 | void serviceRegistered(const QString &service); | ||||
50 | | ||||
51 | void serviceUnregistered(const QString &service); | ||||
52 | | ||||
53 | private: | ||||
54 | | ||||
55 | bool checkBalooConfiguration(); | ||||
56 | | ||||
57 | bool checkBalooServiceIsRunning(); | ||||
58 | | ||||
59 | void signalBalooAvailability(bool isAvailable); | ||||
60 | | ||||
61 | QDBusServiceWatcher mBalooWatcher; | ||||
62 | | ||||
63 | bool mBalooAvailability = false; | ||||
64 | | ||||
65 | }; | ||||
66 | | ||||
67 | #endif // BALOODETECTOR_H |