1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

PluginInterface: Remove getTranslator

This commit is contained in:
David Rosca 2018-02-27 09:20:17 +01:00
parent 3ba386de42
commit 0d51e0ce32
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
25 changed files with 7 additions and 125 deletions

View File

@ -18,14 +18,12 @@
#ifndef PLUGININTERFACE_H #ifndef PLUGININTERFACE_H
#define PLUGININTERFACE_H #define PLUGININTERFACE_H
#include <QPixmap>
#include <QtPlugin> #include <QtPlugin>
#include <QWebEnginePage> #include <QWebEnginePage>
#include "qzcommon.h" #include "qzcommon.h"
#include "webhittestresult.h" #include "webhittestresult.h"
class QTranslator;
class QMenu; class QMenu;
class QMouseEvent; class QMouseEvent;
class QKeyEvent; class QKeyEvent;
@ -38,15 +36,18 @@ class DesktopFile;
class PluginInterface class PluginInterface
{ {
public: public:
enum InitState { StartupInitState, LateInitState }; enum InitState {
StartupInitState,
LateInitState
};
virtual ~PluginInterface() { }
virtual DesktopFile metaData() const = 0; virtual DesktopFile metaData() const = 0;
virtual void init(InitState state, const QString &settingsPath) = 0; virtual void init(InitState state, const QString &settingsPath) = 0;
virtual void unload() = 0; virtual void unload() = 0;
virtual bool testPlugin() = 0; virtual bool testPlugin() = 0;
virtual ~PluginInterface() { }
virtual QTranslator* getTranslator(const QString &locale) { Q_UNUSED(locale) return 0; }
virtual void showSettings(QWidget* parent = 0) { Q_UNUSED(parent) } virtual void showSettings(QWidget* parent = 0) { Q_UNUSED(parent) }
virtual void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &r) { Q_UNUSED(menu) Q_UNUSED(view) Q_UNUSED(r) } virtual void populateWebViewMenu(QMenu* menu, WebView* view, const WebHitTestResult &r) { Q_UNUSED(menu) Q_UNUSED(view) Q_UNUSED(r) }
@ -65,6 +66,6 @@ public:
virtual bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) { Q_UNUSED(page); Q_UNUSED(url); Q_UNUSED(type); Q_UNUSED(isMainFrame); return true; } virtual bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) { Q_UNUSED(page); Q_UNUSED(url); Q_UNUSED(type); Q_UNUSED(isMainFrame); return true; }
}; };
Q_DECLARE_INTERFACE(PluginInterface, "Falkon.Browser.PluginInterface/2.2") Q_DECLARE_INTERFACE(PluginInterface, "Falkon.Browser.PluginInterface/2.3")
#endif // PLUGININTERFACE_H #endif // PLUGININTERFACE_H

View File

@ -24,8 +24,6 @@
#include "../config.h" #include "../config.h"
#include "desktopfile.h" #include "desktopfile.h"
#include <QTranslator>
AutoScrollPlugin::AutoScrollPlugin() AutoScrollPlugin::AutoScrollPlugin()
: QObject() : QObject()
, m_scroller(0) , m_scroller(0)
@ -60,13 +58,6 @@ bool AutoScrollPlugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* AutoScrollPlugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/autoscroll/locale/");
return translator;
}
void AutoScrollPlugin::showSettings(QWidget* parent) void AutoScrollPlugin::showSettings(QWidget* parent)
{ {
if (!m_settings) { if (!m_settings) {

View File

@ -36,7 +36,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override; void showSettings(QWidget *parent) override;
bool mouseMove(Qz::ObjectName type, QObject *obj, QMouseEvent *event) override; bool mouseMove(Qz::ObjectName type, QObject *obj, QMouseEvent *event) override;

View File

@ -32,7 +32,6 @@
#include <QTimer> #include <QTimer>
#include <QSettings> #include <QSettings>
#include <QTranslator>
#include <QDir> #include <QDir>
#include <QMenu> #include <QMenu>
@ -120,13 +119,6 @@ bool FCM_Plugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* FCM_Plugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/flashcookiemanager/locale/");
return translator;
}
void FCM_Plugin::showSettings(QWidget* parent) void FCM_Plugin::showSettings(QWidget* parent)
{ {
Q_UNUSED(parent) Q_UNUSED(parent)

View File

@ -55,7 +55,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override; void showSettings(QWidget *parent) override;
void populateExtensionsMenu(QMenu *menu) override; void populateExtensionsMenu(QMenu *menu) override;

View File

@ -25,8 +25,6 @@
#include "passwordmanager.h" #include "passwordmanager.h"
#include "desktopfile.h" #include "desktopfile.h"
#include <QTranslator>
GnomeKeyringPlugin::GnomeKeyringPlugin() GnomeKeyringPlugin::GnomeKeyringPlugin()
: QObject() : QObject()
, m_backend(0) , m_backend(0)
@ -58,10 +56,3 @@ bool GnomeKeyringPlugin::testPlugin()
// Require the version that the plugin was built with // Require the version that the plugin was built with
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* GnomeKeyringPlugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/gkp/locale/");
return translator;
}

View File

@ -37,8 +37,6 @@ public:
void unload(); void unload();
bool testPlugin(); bool testPlugin();
QTranslator* getTranslator(const QString &locale);
private: private:
GnomeKeyringPasswordBackend* m_backend; GnomeKeyringPasswordBackend* m_backend;

View File

@ -27,8 +27,6 @@
#include "../config.h" #include "../config.h"
#include "desktopfile.h" #include "desktopfile.h"
#include <QTranslator>
GM_Plugin::GM_Plugin() GM_Plugin::GM_Plugin()
: QObject() : QObject()
, m_manager(0) , m_manager(0)
@ -67,13 +65,6 @@ bool GM_Plugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* GM_Plugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/gm/locale/");
return translator;
}
void GM_Plugin::showSettings(QWidget* parent) void GM_Plugin::showSettings(QWidget* parent)
{ {
m_manager->showSettings(parent); m_manager->showSettings(parent);

View File

@ -35,7 +35,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator* getTranslator(const QString &locale) override;
void showSettings(QWidget* parent = 0) override; void showSettings(QWidget* parent = 0) override;
bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) override; bool acceptNavigationRequest(WebPage *page, const QUrl &url, QWebEnginePage::NavigationType type, bool isMainFrame) override;

View File

@ -27,7 +27,6 @@
#include "desktopfile.h" #include "desktopfile.h"
#include <QMenu> #include <QMenu>
#include <QTranslator>
ImageFinderPlugin::ImageFinderPlugin() ImageFinderPlugin::ImageFinderPlugin()
: QObject() : QObject()
@ -58,13 +57,6 @@ bool ImageFinderPlugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator *ImageFinderPlugin::getTranslator(const QString &locale)
{
QTranslator *translator = new QTranslator(this);
translator->load(locale, QSL(":/imgfinder/locale/"));
return translator;
}
void ImageFinderPlugin::showSettings(QWidget *parent) void ImageFinderPlugin::showSettings(QWidget *parent)
{ {
if (!m_settings) { if (!m_settings) {

View File

@ -37,7 +37,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override; void showSettings(QWidget *parent) override;
void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r) override; void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r) override;

View File

@ -25,8 +25,6 @@
#include "passwordmanager.h" #include "passwordmanager.h"
#include "desktopfile.h" #include "desktopfile.h"
#include <QTranslator>
KWalletPlugin::KWalletPlugin() KWalletPlugin::KWalletPlugin()
: QObject() : QObject()
, m_backend(0) , m_backend(0)
@ -58,10 +56,3 @@ bool KWalletPlugin::testPlugin()
// Require the version that the plugin was built with // Require the version that the plugin was built with
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* KWalletPlugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/kwp/locale/");
return translator;
}

View File

@ -35,7 +35,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
private: private:
KWalletPasswordBackend* m_backend; KWalletPasswordBackend* m_backend;

View File

@ -23,8 +23,6 @@
#include "../config.h" #include "../config.h"
#include "desktopfile.h" #include "desktopfile.h"
#include <QTranslator>
MouseGesturesPlugin::MouseGesturesPlugin() MouseGesturesPlugin::MouseGesturesPlugin()
: QObject() : QObject()
, m_gestures(0) , m_gestures(0)
@ -59,13 +57,6 @@ bool MouseGesturesPlugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* MouseGesturesPlugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/mousegestures/locale/");
return translator;
}
void MouseGesturesPlugin::showSettings(QWidget* parent) void MouseGesturesPlugin::showSettings(QWidget* parent)
{ {
m_gestures->showSettings(parent); m_gestures->showSettings(parent);

View File

@ -34,7 +34,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override; void showSettings(QWidget *parent) override;
bool mousePress(Qz::ObjectName type, QObject *obj, QMouseEvent *event) override; bool mousePress(Qz::ObjectName type, QObject *obj, QMouseEvent *event) override;

View File

@ -26,8 +26,6 @@
#include "../config.h" #include "../config.h"
#include "desktopfile.h" #include "desktopfile.h"
#include <QTranslator>
PIM_Plugin::PIM_Plugin() PIM_Plugin::PIM_Plugin()
: QObject() : QObject()
, m_handler(0) , m_handler(0)
@ -62,13 +60,6 @@ bool PIM_Plugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* PIM_Plugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/PIM/locale/");
return translator;
}
void PIM_Plugin::showSettings(QWidget* parent) void PIM_Plugin::showSettings(QWidget* parent)
{ {
m_handler->showSettings(parent); m_handler->showSettings(parent);

View File

@ -38,7 +38,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override; void showSettings(QWidget *parent) override;
void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r) override; void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r) override;

View File

@ -24,8 +24,6 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "desktopfile.h" #include "desktopfile.h"
#include <QTranslator>
StatusBarIconsPlugin::StatusBarIconsPlugin() StatusBarIconsPlugin::StatusBarIconsPlugin()
: QObject() : QObject()
, m_manager(0) , m_manager(0)
@ -70,13 +68,6 @@ bool StatusBarIconsPlugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* StatusBarIconsPlugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/sbi/locale/");
return translator;
}
void StatusBarIconsPlugin::showSettings(QWidget* parent) void StatusBarIconsPlugin::showSettings(QWidget* parent)
{ {
SBI_SettingsDialog* dialog = new SBI_SettingsDialog(m_manager, parent); SBI_SettingsDialog* dialog = new SBI_SettingsDialog(m_manager, parent);

View File

@ -35,7 +35,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override; void showSettings(QWidget *parent) override;
private: private:

View File

@ -29,7 +29,6 @@
#include "desktopfile.h" #include "desktopfile.h"
#include <QInputDialog> #include <QInputDialog>
#include <QTranslator>
#include <QSettings> #include <QSettings>
#include <QAction> #include <QAction>
#include <QTimer> #include <QTimer>
@ -92,13 +91,6 @@ bool TabManagerPlugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* TabManagerPlugin::getTranslator(const QString &locale)
{
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/tabmanager/locale/");
return translator;
}
void TabManagerPlugin::showSettings(QWidget* parent) void TabManagerPlugin::showSettings(QWidget* parent)
{ {
TabManagerSettings* settings = new TabManagerSettings(this, parent); TabManagerSettings* settings = new TabManagerSettings(this, parent);

View File

@ -43,7 +43,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override; void showSettings(QWidget *parent) override;
void populateExtensionsMenu(QMenu *menu) override; void populateExtensionsMenu(QMenu *menu) override;

View File

@ -27,7 +27,6 @@
#include "desktopfile.h" #include "desktopfile.h"
#include <QMenu> #include <QMenu>
#include <QTranslator>
#include <QPushButton> #include <QPushButton>
TestPlugin::TestPlugin() TestPlugin::TestPlugin()
@ -96,16 +95,6 @@ bool TestPlugin::testPlugin()
return (Qz::VERSION == QLatin1String(FALKON_VERSION)); return (Qz::VERSION == QLatin1String(FALKON_VERSION));
} }
QTranslator* TestPlugin::getTranslator(const QString &locale)
{
// Loads translation according to locale file
// QString locale will contains "fr_FR.qm" for French locale
QTranslator* translator = new QTranslator(this);
translator->load(locale, ":/testplugin/locale/");
return translator;
}
void TestPlugin::showSettings(QWidget* parent) void TestPlugin::showSettings(QWidget* parent)
{ {
// This function will be called from Preferences after clicking on Settings button. // This function will be called from Preferences after clicking on Settings button.

View File

@ -41,7 +41,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override; void showSettings(QWidget *parent) override;
void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r) override; void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r) override;

View File

@ -31,7 +31,6 @@
#include "desktopfile.h" #include "desktopfile.h"
#include <QSettings> #include <QSettings>
#include <QTranslator>
VerticalTabsPlugin::VerticalTabsPlugin() VerticalTabsPlugin::VerticalTabsPlugin()
: QObject() : QObject()
@ -92,13 +91,6 @@ bool VerticalTabsPlugin::testPlugin()
return (Qz::VERSION == QSL(FALKON_VERSION)); return (Qz::VERSION == QSL(FALKON_VERSION));
} }
QTranslator *VerticalTabsPlugin::getTranslator(const QString &locale)
{
QTranslator *translator = new QTranslator(this);
translator->load(locale, QSL(":/verticaltabs/locale/"));
return translator;
}
void VerticalTabsPlugin::showSettings(QWidget *parent) void VerticalTabsPlugin::showSettings(QWidget *parent)
{ {
VerticalTabsSettings *settings = new VerticalTabsSettings(this, parent); VerticalTabsSettings *settings = new VerticalTabsSettings(this, parent);

View File

@ -37,7 +37,6 @@ public:
void init(InitState state, const QString &settingsPath) override; void init(InitState state, const QString &settingsPath) override;
void unload() override; void unload() override;
bool testPlugin() override; bool testPlugin() override;
QTranslator* getTranslator(const QString &locale) override;
void showSettings(QWidget *parent = nullptr) override; void showSettings(QWidget *parent = nullptr) override;
bool keyPress(Qz::ObjectName type, QObject *obj, QKeyEvent *event) override; bool keyPress(Qz::ObjectName type, QObject *obj, QKeyEvent *event) override;