xuqiang 4 місяців тому
батько
коміт
7ea3361fd1
5 змінених файлів з 23 додано та 23 видалено
  1. 3 3
      include/appcontext.h
  2. 6 6
      include/httpserver.h
  3. 2 2
      src/appcontext.cpp
  4. 10 10
      src/httpserver.cpp
  5. 2 2
      src/mainwindow.cpp

+ 3 - 3
include/appcontext.h

@@ -6,7 +6,7 @@
 #include "projectmanager.h"
 #include "network.h"
 #include "serialport.h"
-#include "fileserver.h"
+#include "httpserver.h"
 
 class AppContext : public QObject
 {
@@ -21,14 +21,14 @@ public:
     ProjectManager &projectManager();
     Network &network();
     SerialPort &serialPort();
-    FileServer &fileserver();
+    HttpServer &httpServer();
 
 private:
     PluginManager m_pluginMgr;
     ProjectManager m_projectMgr;
     Network m_network;
     SerialPort m_serialPort;
-    FileServer m_fileServer;
+    HttpServer m_httpServer;
 
 };
 

+ 6 - 6
include/fileserver.h → include/httpserver.h

@@ -1,18 +1,18 @@
-#ifndef __FILESERVER_H__
-#define __FILESERVER_H__
+#ifndef __HTTPSERVER_H__
+#define __HTTPSERVER_H__
 
 #include <QObject>
 #include <httplib.h>
 #include <stdint.h>
 #include <QThread>
 
-class FileServer : public QObject
+class HttpServer : public QObject
 {
     Q_OBJECT
 
 public:
-    explicit FileServer(QObject *parent = nullptr);
-    ~FileServer();
+    explicit HttpServer(QObject *parent = nullptr);
+    ~HttpServer();
 
     std::string addr() const;
     uint16_t port() const;
@@ -34,4 +34,4 @@ private slots:
 
 };
 
-#endif // FILESERVER_H
+#endif // HTTPSERVER_H

+ 2 - 2
src/appcontext.cpp

@@ -39,7 +39,7 @@ SerialPort &AppContext::serialPort()
     return m_serialPort;
 }
 
-FileServer &AppContext::fileserver()
+HttpServer &AppContext::httpServer()
 {
-    return m_fileServer;
+    return m_httpServer;
 }

+ 10 - 10
src/fileserver.cpp → src/httpserver.cpp

@@ -1,39 +1,39 @@
-#include "fileserver.h"
+#include "httpserver.h"
 #include "logger.h"
 #include <fstream>
 #include <QJsonObject>
 #include <QJsonDocument>
 #include <QDir>
 
-FileServer::FileServer(QObject *parent)
+HttpServer::HttpServer(QObject *parent)
     : QObject{parent}
 {
     moveToThread(&m_thread);
-    connect(&m_thread, &QThread::started, this, &FileServer::run_hhttp_sever);
+    connect(&m_thread, &QThread::started, this, &HttpServer::run_hhttp_sever);
     run("0.0.0.0", 18000);
 }
 
-FileServer::~FileServer()
+HttpServer::~HttpServer()
 {
     stop();
 }
 
-std::string FileServer::addr() const
+std::string HttpServer::addr() const
 {
     return m_addr;
 }
 
-uint16_t FileServer::port() const
+uint16_t HttpServer::port() const
 {
     return m_port;
 }
 
-bool FileServer::isRunning() const
+bool HttpServer::isRunning() const
 {
     return m_thread.isRunning();
 }
 
-void FileServer::run(const char *addr, unsigned short port)
+void HttpServer::run(const char *addr, unsigned short port)
 {
     m_addr = std::string(addr);
     m_port = port;
@@ -41,14 +41,14 @@ void FileServer::run(const char *addr, unsigned short port)
     m_thread.start();
 }
 
-void FileServer::stop()
+void HttpServer::stop()
 {
     m_server.stop();
     m_thread.quit();
     m_thread.wait();
 }
 
-void FileServer::run_hhttp_sever()
+void HttpServer::run_hhttp_sever()
 {
 
     // 心跳

+ 2 - 2
src/mainwindow.cpp

@@ -22,8 +22,8 @@ MainWindow::MainWindow(QWidget *parent)
     SerialPort &serialPort = AppContext::instance().serialPort();
     connect(&serialPort, &SerialPort::pageSwitch, this, &MainWindow::onPageSwitdh);
 
-    FileServer &fileServer = AppContext::instance().fileserver();
-    connect(&fileServer, &FileServer::monitorConfigureUpdate, this, &MainWindow::onConfigureUpdate);
+    HttpServer &httpServer = AppContext::instance().httpServer();
+    connect(&httpServer, &HttpServer::monitorConfigureUpdate, this, &MainWindow::onConfigureUpdate);
 }
 
 MainWindow::~MainWindow()