httpserver.h 687 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef __HTTPSERVER_H__
  2. #define __HTTPSERVER_H__
  3. #include <QObject>
  4. #include <httplib.h>
  5. #include <stdint.h>
  6. #include <QThread>
  7. class HttpServer : public QObject
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit HttpServer(QObject *parent = nullptr);
  12. ~HttpServer();
  13. std::string addr() const;
  14. uint16_t port() const;
  15. bool isRunning() const;
  16. void run(const char *addr, unsigned short port);
  17. void stop();
  18. private:
  19. std::string m_addr;
  20. uint16_t m_port;
  21. httplib::Server m_server;
  22. QThread m_thread;
  23. signals:
  24. void monitorConfigureUpdate(const QString &filename);
  25. void reloadCanvas();
  26. private slots:
  27. void run_hhttp_sever();
  28. };
  29. #endif // HTTPSERVER_H