fileserver.h 662 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef __FILESERVER_H__
  2. #define __FILESERVER_H__
  3. #include <QObject>
  4. #include <httplib.h>
  5. #include <stdint.h>
  6. #include <QThread>
  7. class FileServer : public QObject
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit FileServer(QObject *parent = nullptr);
  12. ~FileServer();
  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. private slots:
  26. void run_hhttp_sever();
  27. };
  28. #endif // FILESERVER_H