From 7e6802ba352432e9b1cf87065025451ea18dff1b Mon Sep 17 00:00:00 2001 From: nowrep Date: Wed, 16 Jan 2013 14:53:17 +0100 Subject: [PATCH] [Qt5] Ported all plugins to Qt5 plugin system --- QupZilla.pro | 5 +---- src/lib/bookmarks/bookmarkstree.h | 2 +- src/plugins/AccessKeysNavigation/akn_plugin.cpp | 2 ++ src/plugins/AccessKeysNavigation/akn_plugin.h | 4 ++++ src/plugins/GreaseMonkey/gm_plugin.cpp | 2 ++ src/plugins/GreaseMonkey/gm_plugin.h | 4 ++++ src/plugins/MouseGestures/mousegesturesplugin.cpp | 2 ++ src/plugins/MouseGestures/mousegesturesplugin.h | 4 ++++ src/plugins/PIM/PIM_plugin.cpp | 2 ++ src/plugins/PIM/PIM_plugin.h | 4 ++++ src/plugins/TestPlugin/testplugin.cpp | 3 +++ src/plugins/TestPlugin/testplugin.h | 8 ++++++-- 12 files changed, 35 insertions(+), 7 deletions(-) diff --git a/QupZilla.pro b/QupZilla.pro index 2df11d4a0..7e5a3ba53 100644 --- a/QupZilla.pro +++ b/QupZilla.pro @@ -17,7 +17,4 @@ TEMPLATE = subdirs SUBDIRS = src/lib src/main CONFIG += ordered -# TODO: Fix plugins for Qt5 -!isEqual(QT_MAJOR_VERSION, 5) { - SUBDIRS += src/plugins -} +SUBDIRS += src/plugins diff --git a/src/lib/bookmarks/bookmarkstree.h b/src/lib/bookmarks/bookmarkstree.h index dda2d5172..f8b815c5b 100644 --- a/src/lib/bookmarks/bookmarkstree.h +++ b/src/lib/bookmarks/bookmarkstree.h @@ -53,6 +53,6 @@ private: BookmarkView m_viewType; signals: - void requestNewFolder(QWidget*,QString*,bool,QString,WebView*); + void requestNewFolder(QWidget*, QString*, bool, QString, WebView*); }; #endif // BOOKMARKSTREE_H diff --git a/src/plugins/AccessKeysNavigation/akn_plugin.cpp b/src/plugins/AccessKeysNavigation/akn_plugin.cpp index 8967c90bb..521441653 100644 --- a/src/plugins/AccessKeysNavigation/akn_plugin.cpp +++ b/src/plugins/AccessKeysNavigation/akn_plugin.cpp @@ -91,4 +91,6 @@ bool AKN_Plugin::keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* e return false; } +#if QT_VERSION < 0x050000 Q_EXPORT_PLUGIN2(AccessKeysNavigation, AKN_Plugin) +#endif diff --git a/src/plugins/AccessKeysNavigation/akn_plugin.h b/src/plugins/AccessKeysNavigation/akn_plugin.h index c9660ccc7..59816f137 100644 --- a/src/plugins/AccessKeysNavigation/akn_plugin.h +++ b/src/plugins/AccessKeysNavigation/akn_plugin.h @@ -30,6 +30,10 @@ class AKN_Plugin : public QObject, public PluginInterface Q_OBJECT Q_INTERFACES(PluginInterface) +#if QT_VERSION >= 0x050000 + Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.AKN") +#endif + public: AKN_Plugin(); PluginSpec pluginSpec(); diff --git a/src/plugins/GreaseMonkey/gm_plugin.cpp b/src/plugins/GreaseMonkey/gm_plugin.cpp index 3e73da2d1..a618eda15 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.cpp +++ b/src/plugins/GreaseMonkey/gm_plugin.cpp @@ -98,4 +98,6 @@ void GM_Plugin::webPageCreated(WebPage* page) connect(page->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), m_manager, SLOT(pageLoadStart())); } +#if QT_VERSION < 0x050000 Q_EXPORT_PLUGIN2(GreaseMonkey, GM_Plugin) +#endif diff --git a/src/plugins/GreaseMonkey/gm_plugin.h b/src/plugins/GreaseMonkey/gm_plugin.h index ce8ddda6d..5542154de 100644 --- a/src/plugins/GreaseMonkey/gm_plugin.h +++ b/src/plugins/GreaseMonkey/gm_plugin.h @@ -28,6 +28,10 @@ class GM_Plugin : public QObject, public PluginInterface Q_OBJECT Q_INTERFACES(PluginInterface) +#if QT_VERSION >= 0x050000 + Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.GreaseMonkey") +#endif + public: explicit GM_Plugin(); PluginSpec pluginSpec(); diff --git a/src/plugins/MouseGestures/mousegesturesplugin.cpp b/src/plugins/MouseGestures/mousegesturesplugin.cpp index 68cfdb8ea..8e7c97b31 100644 --- a/src/plugins/MouseGestures/mousegesturesplugin.cpp +++ b/src/plugins/MouseGestures/mousegesturesplugin.cpp @@ -106,4 +106,6 @@ bool MouseGesturesPlugin::mouseMove(const Qz::ObjectName &type, QObject* obj, QM return false; } +#if QT_VERSION < 0x050000 Q_EXPORT_PLUGIN2(MouseGestures, MouseGesturesPlugin) +#endif diff --git a/src/plugins/MouseGestures/mousegesturesplugin.h b/src/plugins/MouseGestures/mousegesturesplugin.h index 45093452b..abbf8a37b 100644 --- a/src/plugins/MouseGestures/mousegesturesplugin.h +++ b/src/plugins/MouseGestures/mousegesturesplugin.h @@ -26,6 +26,10 @@ class MouseGesturesPlugin : public QObject, public PluginInterface Q_OBJECT Q_INTERFACES(PluginInterface) +#if QT_VERSION >= 0x050000 + Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.MouseGestures") +#endif + public: MouseGesturesPlugin(); PluginSpec pluginSpec(); diff --git a/src/plugins/PIM/PIM_plugin.cpp b/src/plugins/PIM/PIM_plugin.cpp index 3b9e7024d..89d837688 100644 --- a/src/plugins/PIM/PIM_plugin.cpp +++ b/src/plugins/PIM/PIM_plugin.cpp @@ -95,4 +95,6 @@ bool PIM_Plugin::keyPress(const Qz::ObjectName &type, QObject* obj, QKeyEvent* e return false; } +#if QT_VERSION < 0x050000 Q_EXPORT_PLUGIN2(PIM, PIM_Plugin) +#endif diff --git a/src/plugins/PIM/PIM_plugin.h b/src/plugins/PIM/PIM_plugin.h index 0c1865f20..aa06a2f75 100644 --- a/src/plugins/PIM/PIM_plugin.h +++ b/src/plugins/PIM/PIM_plugin.h @@ -30,6 +30,10 @@ class PIM_Plugin : public QObject, public PluginInterface Q_OBJECT Q_INTERFACES(PluginInterface) +#if QT_VERSION >= 0x050000 + Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.PIM") +#endif + public: PIM_Plugin(); PluginSpec pluginSpec(); diff --git a/src/plugins/TestPlugin/testplugin.cpp b/src/plugins/TestPlugin/testplugin.cpp index 776e276fd..1b118a164 100644 --- a/src/plugins/TestPlugin/testplugin.cpp +++ b/src/plugins/TestPlugin/testplugin.cpp @@ -173,4 +173,7 @@ void TestPlugin::actionSlot() // Export plugin macro // This macro has to be only in class derived from PluginInterface // Don't call it in other files! + +#if QT_VERSION < 0x050000 Q_EXPORT_PLUGIN2(ExamplePlugin, TestPlugin) +#endif diff --git a/src/plugins/TestPlugin/testplugin.h b/src/plugins/TestPlugin/testplugin.h index f46cbeb64..abb3e7f74 100644 --- a/src/plugins/TestPlugin/testplugin.h +++ b/src/plugins/TestPlugin/testplugin.h @@ -31,13 +31,17 @@ #include #include #include -#include +#include class TestPlugin : public QObject, public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) +#if QT_VERSION >= 0x050000 + Q_PLUGIN_METADATA(IID "QupZilla.Browser.plugin.TestPlugin") +#endif + public: explicit TestPlugin(); PluginSpec pluginSpec(); @@ -57,7 +61,7 @@ private slots: void actionSlot(); private: - QWeakPointer m_settings; + QPointer m_settings; WebView* m_view; QString m_settingsPath;