From 2d33897c2aa60fa4640de040b19951043bba1edc Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 <0xFEEDC0DE64@gmail.com> Date: Sat, 22 Sep 2018 07:23:06 +0200 Subject: [PATCH] Applied WebApplication interface changes --- fileserverapplication.cpp | 8 ++++---- fileserverapplication.h | 7 ++++++- fileserverplugin.cpp | 4 ++-- fileserverplugin.h | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/fileserverapplication.cpp b/fileserverapplication.cpp index 7681e74..6819a6a 100644 --- a/fileserverapplication.cpp +++ b/fileserverapplication.cpp @@ -1,18 +1,18 @@ #include "fileserverapplication.h" +#include "webserver.h" #include "httprequest.h" #include "httpresponse.h" #include "httpclientconnection.h" -FileserverApplication::FileserverApplication(const QJsonObject &config, QObject *parent) : - WebApplication(parent) +FileserverApplication::FileserverApplication(const QJsonObject &config, WebServer &webServer) : + WebApplication(&webServer), m_webServer(webServer) { - + Q_UNUSED(config) } void FileserverApplication::start() { - } void FileserverApplication::handleRequest(HttpClientConnection *connection, const HttpRequest &request) diff --git a/fileserverapplication.h b/fileserverapplication.h index d282d9b..46feb19 100644 --- a/fileserverapplication.h +++ b/fileserverapplication.h @@ -4,14 +4,19 @@ class QJsonObject; +class WebServer; + class FileserverApplication : public WebApplication { Q_OBJECT public: - FileserverApplication(const QJsonObject &config, QObject *parent = Q_NULLPTR); + FileserverApplication(const QJsonObject &config, WebServer &webServer); void start() Q_DECL_OVERRIDE; void handleRequest(HttpClientConnection *connection, const HttpRequest &request) Q_DECL_OVERRIDE; + +private: + WebServer &m_webServer; }; diff --git a/fileserverplugin.cpp b/fileserverplugin.cpp index 33d70a8..dc02492 100644 --- a/fileserverplugin.cpp +++ b/fileserverplugin.cpp @@ -13,7 +13,7 @@ QString FileserverPlugin::pluginName() const return QStringLiteral("fileserver"); } -WebApplication *FileserverPlugin::createApplication(const QJsonObject &config) const +WebApplication *FileserverPlugin::createApplication(const QJsonObject &config, WebServer &webServer) const { - return new FileserverApplication(config); + return new FileserverApplication(config, webServer); } diff --git a/fileserverplugin.h b/fileserverplugin.h index 21aecf9..7f78f33 100644 --- a/fileserverplugin.h +++ b/fileserverplugin.h @@ -12,5 +12,5 @@ public: FileserverPlugin(QObject *parent = Q_NULLPTR); QString pluginName() const Q_DECL_OVERRIDE; - WebApplication *createApplication(const QJsonObject &config) const Q_DECL_OVERRIDE; + WebApplication *createApplication(const QJsonObject &config, WebServer &webServer) const Q_DECL_OVERRIDE; };