aboutsummaryrefslogtreecommitdiff
path: root/src/schemes/NullSchemeHandler.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/schemes/NullSchemeHandler.hpp')
-rw-r--r--src/schemes/NullSchemeHandler.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/schemes/NullSchemeHandler.hpp b/src/schemes/NullSchemeHandler.hpp
new file mode 100644
index 0000000..bc05076
--- /dev/null
+++ b/src/schemes/NullSchemeHandler.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <QWebEngineUrlRequestJob>
+#include <QWebEngineUrlSchemeHandler>
+#include <QtCore>
+#include <qcontainerfwd.h>
+#include <qdebug.h>
+#include <qurlquery.h>
+
+// TODO: Install doc dir and pass this path during build
+#define NULL_DOCS_DIR "./doc"
+
+class NullSchemeHandler : public QWebEngineUrlSchemeHandler {
+ Q_OBJECT
+
+public:
+ static NullSchemeHandler &instance() {
+ static NullSchemeHandler handler;
+ return handler;
+ }
+
+ void requestStarted(QWebEngineUrlRequestJob *job) override;
+
+private:
+ NullSchemeHandler() = default;
+
+ QByteArray read_static_docs_file(const QString &path);
+ QByteArray read_index_html();
+ QByteArray get_content_type(const QString &path);
+};