Debian Codegraph @

src/helper/helper.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #pragma once
5
6 #include "helperids.h"
7 #include <QDBusAbstractAdaptor>
8 #include <QDBusMessage>
9 #include <QDBusVariant>
10 #include <QObject>
11 #include <QTimer>
12 #include <memory>
13 #include <thread>
14
15 class ICryptoLayer;
16 class IAppRegistry;
17 class IProcessMonitor;
18 class MsgReceiver;
19 class QByteArray;
20
21 class Helper final : public QDBusAbstractAdaptor
22 {
23 Q_OBJECT
24 Q_CLASSINFO("D-Bus Interface", DBUS_HELPER_INTERFACE)
25
26 public:
27 Helper(QObject *parent) noexcept;
28 ~Helper();
29
30 public slots: // D-Bus interface slots
31 QDBusVariant start(QByteArray const &appPublicKey, int autoExitTimeout,
32 QDBusMessage const &message);
33 bool started() const;
34 Q_NOREPLY void exit(QByteArray const &signature);
35 Q_NOREPLY void delayAutoExit();
36
37 private slots:
38 void exitHelper();
39 void autoExitTimeout();
40
41 private:
42 bool isAuthorized(QDBusMessage const &message) const;
43 bool initCrypto(QByteArray const &appPublicKey);
44 bool initProcessMonitor();
45 void endProcessMonitor();
46 bool initMsgReceiver();
47
48 QTimer autoExitTimer_;
49
50 std::shared_ptr<ICryptoLayer> cryptoLayer_;
51 std::shared_ptr<IAppRegistry> appRegistry_;
52 std::unique_ptr<IProcessMonitor> processMonitor_;
53 std::unique_ptr<std::thread> pMonThread_;
54 std::unique_ptr<MsgReceiver> msgReceiver_;
55 };