diff options
Diffstat (limited to 'include/smolbote')
-rw-r--r-- | include/smolbote/filterinterface.hpp | 38 | ||||
-rw-r--r-- | include/smolbote/plugininterface.h | 29 | ||||
-rw-r--r-- | include/smolbote/session.hpp | 41 |
3 files changed, 108 insertions, 0 deletions
diff --git a/include/smolbote/filterinterface.hpp b/include/smolbote/filterinterface.hpp new file mode 100644 index 0000000..9c78c97 --- /dev/null +++ b/include/smolbote/filterinterface.hpp @@ -0,0 +1,38 @@ +/* + * This file is part of smolbote. It's copyrighted by the contributors recorded + * in the version control history of the file, available from its original + * location: https://library.iserlohn-fortress.net/aqua/smolbote.git + * + * SPDX-License-Identifier: MIT + */ + +#ifndef SMOLBOTE_FILTER_HPP +#define SMOLBOTE_FILTER_HPP + +#include <QWebEngineUrlRequestInfo> +#include <QtPlugin> + +class Filter +{ +public: + virtual ~Filter() = default; + + virtual void filter(QWebEngineUrlRequestInfo &info) const = 0; + virtual bool isUpToDate() const = 0; +}; + +// A class to provide filter interfaces +class QIODevice; +class FilterPlugin +{ +public: + virtual ~FilterPlugin() = default; + + virtual Filter* load(QIODevice* from) const = 0; +}; + +#define FilterPluginIid "net.iserlohn-fortress.smolbote.FilterPlugin" +Q_DECLARE_INTERFACE(FilterPlugin, FilterPluginIid) + +#endif // SMOLBOTE_FILTER_HPP + diff --git a/include/smolbote/plugininterface.h b/include/smolbote/plugininterface.h new file mode 100644 index 0000000..4c36d8a --- /dev/null +++ b/include/smolbote/plugininterface.h @@ -0,0 +1,29 @@ +/* + * This file is part of smolbote. It's copyrighted by the contributors recorded + * in the version control history of the file, available from its original + * location: https://library.iserlohn-fortress.net/aqua/smolbote.git + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include <QtPlugin> +#include <QHash> +#include <memory> +#include <functional> +#include <QApplication> + +typedef QHash<QString, std::function<int()>> CommandHash_t; + +class QDialog; +class PluginInterface +{ +public: + virtual ~PluginInterface() = default; + virtual CommandHash_t commands() = 0; + virtual QDialog *createWidget(QWidget *parent = nullptr) const = 0; +}; + +#define PluginInterfaceIid "net.iserlohn-fortress.smolbote.PluginInterface" +Q_DECLARE_INTERFACE(PluginInterface, PluginInterfaceIid) diff --git a/include/smolbote/session.hpp b/include/smolbote/session.hpp new file mode 100644 index 0000000..0146802 --- /dev/null +++ b/include/smolbote/session.hpp @@ -0,0 +1,41 @@ +/* + * This file is part of smolbote. It's copyrighted by the contributors recorded + * in the version control history of the file, available from its original + * location: https://library.iserlohn-fortress.net/aqua/smolbote.git + * + * SPDX-License-Identifier: MIT + */ + +#ifndef SMOLBOTE_SESSION_HPP +#define SMOLBOTE_SESSION_HPP + +#include <QByteArray> +#include <QString> +#include <QStringList> +#include <QVector> + +class [[nodiscard]] Session +{ +public: + struct WebView { + QString profile; + QString url; + QByteArray history; + }; + + struct SubWindow { + QString profile; + QVector<WebView> tabs; + }; + + struct MainWindow { + QVector<SubWindow> subwindows; + }; + + virtual ~Session() = default; + + [[nodiscard]] virtual QByteArray serialize() const = 0; + [[nodiscard]] virtual QVector<MainWindow> get() const = 0; +}; + +#endif // SMOLBOTE_SESSION_HPP |