1
0

HttpServerPage.h 735 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef HTTP_SERVER_PAGE_H
  2. #define HTTP_SERVER_PAGE_H
  3. #include <QWidget>
  4. #include <QLabel>
  5. #include <QLineEdit>
  6. #include <QPushButton>
  7. #include "hv/HttpServer.h"
  8. #include "hv/WebSocketServer.h"
  9. class HttpServerPage : public QWidget
  10. {
  11. Q_OBJECT
  12. public:
  13. explicit HttpServerPage(QWidget *parent = nullptr);
  14. ~HttpServerPage();
  15. bool start(int port, const char* host = "0.0.0.0");
  16. void stop();
  17. protected:
  18. void initUI();
  19. void initConnect();
  20. private:
  21. QLineEdit *hostEdt;
  22. QLineEdit *portEdt;
  23. QPushButton *startBtn;
  24. QPushButton *stopBtn;
  25. // hv::HttpServer *server;
  26. hv::WebSocketServer *server;
  27. hv::HttpService *service;
  28. hv::WebSocketService *ws;
  29. };
  30. #endif // HTTP_SERVER_PAGE_H