From 3b611f42bf5c233ca66e406474896022b6ed78cc Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sat, 25 Aug 2018 20:07:54 +0200 Subject: Add BrowserInterface to simplify plugins a bit --- plugins/ProfileEditor/profileeditorplugin.cpp | 15 ++------------- plugins/ProfileEditor/profileeditorplugin.h | 12 +++--------- 2 files changed, 5 insertions(+), 22 deletions(-) (limited to 'plugins/ProfileEditor') diff --git a/plugins/ProfileEditor/profileeditorplugin.cpp b/plugins/ProfileEditor/profileeditorplugin.cpp index d13e819..5d5c18a 100644 --- a/plugins/ProfileEditor/profileeditorplugin.cpp +++ b/plugins/ProfileEditor/profileeditorplugin.cpp @@ -20,24 +20,13 @@ QHash> ProfileEditorPlugin::commands() auto *dialog = createWidget(nullptr); return dialog->exec(); }); - - hash.insert("list-profiles", [this]() -> int { - for(const WebProfile *profile : qAsConst(profiles)) { - qDebug(" - %s", qUtf8Printable(profile->name())); - } - return 0; - }); return hash; } QDialog *ProfileEditorPlugin::createWidget(QWidget *parent) { - auto *widget = new ProfileManagerDialog(profiles, parent); + Q_CHECK_PTR(browser); + auto *widget = new ProfileManagerDialog(browser->profiles(), parent); widget->setAttribute(Qt::WA_DeleteOnClose, true); return widget; } - -void ProfileEditorPlugin::registerProfile(WebProfile *profile) -{ - profiles.append(profile); -} diff --git a/plugins/ProfileEditor/profileeditorplugin.h b/plugins/ProfileEditor/profileeditorplugin.h index bc95708..c3e08af 100644 --- a/plugins/ProfileEditor/profileeditorplugin.h +++ b/plugins/ProfileEditor/profileeditorplugin.h @@ -14,11 +14,11 @@ class QWebEngineProfile; class QDialog; -class ProfileEditorPlugin : public QObject, public PluginInterface, public ProfileInterface +class ProfileEditorPlugin : public QObject, public PluginInterface { Q_OBJECT - Q_PLUGIN_METADATA(IID ProfileInterfaceIid FILE "ProfileEditor.json") - Q_INTERFACES(PluginInterface ProfileInterface) + Q_PLUGIN_METADATA(IID PluginInterfaceIid FILE "ProfileEditor.json") + Q_INTERFACES(PluginInterface) public: // PluginInterface @@ -26,12 +26,6 @@ public: // ProfileInterface QDialog *createWidget(QWidget *parent) override; - -public slots: - void registerProfile(WebProfile *profile) override; - -private: - QVector profiles; }; #endif //PROFILEEDITOR_PLUGIN_H -- cgit v1.2.1