From e412f035b054612d00fdbc39e13a958cf5492fec Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Tue, 15 May 2018 14:26:47 +0200 Subject: Profile editor plugin --- plugins/ProfileEditor/forms/profileview.ui | 2 +- plugins/ProfileEditor/profileeditorplugin.cpp | 5 ++--- plugins/ProfileEditor/profileeditorplugin.h | 10 +++++----- plugins/interfaces.h | 10 ++++++++-- 4 files changed, 16 insertions(+), 11 deletions(-) (limited to 'plugins') diff --git a/plugins/ProfileEditor/forms/profileview.ui b/plugins/ProfileEditor/forms/profileview.ui index 2e43bae..b55bda8 100644 --- a/plugins/ProfileEditor/forms/profileview.ui +++ b/plugins/ProfileEditor/forms/profileview.ui @@ -1,7 +1,7 @@ ProfileView - + 0 diff --git a/plugins/ProfileEditor/profileeditorplugin.cpp b/plugins/ProfileEditor/profileeditorplugin.cpp index d048875..7a92e51 100644 --- a/plugins/ProfileEditor/profileeditorplugin.cpp +++ b/plugins/ProfileEditor/profileeditorplugin.cpp @@ -9,10 +9,9 @@ #include "profileeditorplugin.h" #include "forms/profileview.h" -QWidget *ProfileEditorPlugin::createWidget(QWebEngineProfile *profile, QWidget *parent) +QDialog *ProfileEditorPlugin::createWidget(QWebEngineProfile *profile, QWidget *parent) { auto *widget = new ProfileView(profile, parent); - widget->setWindowFlags(Qt::ToolTip); - widget->setVisible(false); + widget->setAttribute(Qt::WA_DeleteOnClose, true); return widget; } diff --git a/plugins/ProfileEditor/profileeditorplugin.h b/plugins/ProfileEditor/profileeditorplugin.h index 3999aba..899c51a 100644 --- a/plugins/ProfileEditor/profileeditorplugin.h +++ b/plugins/ProfileEditor/profileeditorplugin.h @@ -6,13 +6,13 @@ * SPDX-License-Identifier: GPL-3.0 */ -#ifndef PROFILEEDITORPLUGIN_H -#define PROFILEEDITORPLUGIN_H +#ifndef PROFILEEDITOR_PLUGIN_H +#define PROFILEEDITOR_PLUGIN_H #include class QWebEngineProfile; -class QWidget; +class QDialog; class ProfileEditorPlugin : public QObject, public PluginInterface, public ProfileInterface { Q_OBJECT @@ -23,7 +23,7 @@ public: // PluginInterface // ProfileInterface - QWidget *createWidget(QWebEngineProfile *profile, QWidget *parent) override; + QDialog *createWidget(QWebEngineProfile *profile, QWidget *parent) override; }; -#endif //PROFILEEDITORPLUGIN_H +#endif //PROFILEEDITOR_PLUGIN_H diff --git a/plugins/interfaces.h b/plugins/interfaces.h index 3bec574..46cf24a 100644 --- a/plugins/interfaces.h +++ b/plugins/interfaces.h @@ -10,12 +10,18 @@ #define INTERFACES_H #include +#include class QString; class QAction; -class QWidget; +class QDialog; class QWebEngineProfile; +struct Plugin +{ + std::shared_ptr instance; +}; + class PluginInterface { public: @@ -27,7 +33,7 @@ class ProfileInterface public: virtual ~ProfileInterface() = default; - virtual QWidget *createWidget(QWebEngineProfile *profile, QWidget *parent) = 0; + virtual QDialog *createWidget(QWebEngineProfile *profile, QWidget *parent) = 0; }; #define PluginInterfaceIid "net.iserlohn-fortress.smolbote.PluginInterface" -- cgit v1.2.1