summaryrefslogtreecommitdiff
path: root/src/application.cpp
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2022-08-16 16:19:04 +0300
committeraqua <aqua@iserlohn-fortress.net>2022-08-16 16:19:04 +0300
commit616e680aa8af8f5056b5133dd44258c252ca656f (patch)
tree4c89c4fe2b9b2cc77c550c8d52d6d1058ee10846 /src/application.cpp
parentAdd rView and WebView (diff)
downloadrekonq-616e680aa8af8f5056b5133dd44258c252ca656f.tar.xz
Turn WebEngine into a plugin
Diffstat (limited to 'src/application.cpp')
-rw-r--r--src/application.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 54a7db88..9e34e5e2 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -10,8 +10,9 @@
* ============================================================ */
#include "application.h"
-#include "rview.h"
-#include "webengine/webview.h"
+#include "plugins/pluginloader.h"
+#include "plugins/rplugininterface.hpp"
+#include <QPluginLoader>
// ---------------------------------------------------------------------------------------------------------------
// Ctor and Dtor
@@ -42,9 +43,29 @@ Application::~Application()
// Destroy all web apps
for (auto *webApp : m_webApps) delete webApp;
+
+ // Unload all plugins
+ for (auto *plugin : m_plugins) {
+ plugin->unload();
+ delete plugin;
+ }
}
// ---------------------------------------------------------------------------------------------------------------
+// Plugin management
+
+bool Application::registerPlugin(const QString &path)
+{
+ auto *loader = new PluginLoader(path);
+ if (!loader->load()) {
+ delete loader;
+ return false;
+ }
+
+ m_plugins.append(loader);
+ return true;
+}
+// ---------------------------------------------------------------------------------------------------------------
/*
int Application::newInstance()
{
@@ -388,7 +409,17 @@ void Application::setWindowInfo(RekonqWindow *w)
rView *Application::newWebApp(const QUrl &url)
{
- auto *view = new WebView(url);
+ RekonqPluginInterface *interface = nullptr;
+ for (auto *plugin : m_plugins)
+ if (plugin->hasScheme(url.scheme())) {
+ interface = plugin->interface();
+ break;
+ }
+
+ if (interface == nullptr) return nullptr;
+
+ auto *view = interface->view(url);
+ Q_CHECK_PTR(view);
// tab->installEventFilter(this);
m_webApps.append(view);