HelperLauncher.h 1004 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // Created by Tobias Hieta on 28/08/15.
  3. //
  4. #ifndef KONVERGO_HELPERLAUNCHER_H
  5. #define KONVERGO_HELPERLAUNCHER_H
  6. #include <QLocalSocket>
  7. #include <QObject>
  8. #include <QProcess>
  9. #include <QJsonObject>
  10. #include "LocalJsonClient.h"
  11. #include "tools/helper/HelperSocket.h"
  12. #include "Version.h"
  13. #include "utils/Utils.h"
  14. #ifdef Q_OS_MAC
  15. #include "HelperLaunchd.h"
  16. #endif
  17. class HelperLauncher : public QObject
  18. {
  19. Q_OBJECT
  20. DEFINE_SINGLETON(HelperLauncher)
  21. public:
  22. bool connectToHelper();
  23. static QString HelperPath();
  24. void stop();
  25. void start();
  26. private Q_SLOTS:
  27. void gotMessage(const QVariantMap& message);
  28. void socketError(QLocalSocket::LocalSocketError error);
  29. void didConnect();
  30. void launch();
  31. void socketDisconnect();
  32. bool killHelper();
  33. private:
  34. explicit HelperLauncher(QObject* parent = nullptr);
  35. QProcess* m_helperProcess;
  36. LocalJsonClient* m_jsonClient;
  37. void updateClientId();
  38. #ifdef Q_OS_MAC
  39. HelperLaunchd* m_launchd;
  40. #endif
  41. };
  42. #endif //KONVERGO_HELPERLAUNCHER_H