climanager.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef CLIMANAGER_H
  2. #define CLIMANAGER_H
  3. #include "config.h"
  4. #include "qmlhandler.h"
  5. #include <QGuiApplication>
  6. /**
  7. * Namespace which handles the CLI interaction
  8. */
  9. namespace CliManager {
  10. /**
  11. * Set the qml handler pointer
  12. * @param q The reference to the qml handler
  13. */
  14. void setQmlHandler(QMLHandler *q);
  15. /**
  16. * Boolean if the user is logged in to enable or disable the background status and list requests
  17. */
  18. extern bool loggedin;
  19. /**
  20. * Tries to start the CLI in a new thread
  21. * @param useSSL Should the CLI be started with the SSL parameter?
  22. */
  23. void init(bool useSSL);
  24. /**
  25. * Writes a command to the CLI
  26. * @param s The command
  27. */
  28. void writeToCli(QString s);
  29. /**
  30. * The background loop that reads the output of the CLI and handles it using the jsonhandler
  31. */
  32. void readPipeLoop();
  33. /**
  34. * The background loop that requests the notifications and extendedlist using the CLI every 3 seconds
  35. */
  36. void notificationsLoop();
  37. /**
  38. * The background loop that requests the status and extendedstatus using the CLI every second
  39. */
  40. void statusLoop();
  41. /**
  42. * Exit from the CLI and stop the background threads
  43. */
  44. void onExit();
  45. /**
  46. * Set the programActive variable
  47. * @param active The new value
  48. */
  49. void setProgramActive(bool active);
  50. } // namespace CliManager
  51. #endif // CLIMANAGER_H