1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +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
#define PLUGININTERFACE_H
#include <QPixmap>
#include <QtPlugin>
#include <QWebEnginePage>
#include "qzcommon.h"
#include "webhittestresult.h"
class QTranslator;
class QMenu;
class QMouseEvent;
class QKeyEvent;
@ -38,15 +36,18 @@ class DesktopFile;
class PluginInterface
{
public:
enum InitState { StartupInitState, LateInitState };
enum InitState {
StartupInitState,
LateInitState
};
virtual ~PluginInterface() { }
virtual DesktopFile metaData() const = 0;
virtual void init(InitState state, const QString &settingsPath) = 0;
virtual void unload() = 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 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; }
};
Q_DECLARE_INTERFACE(PluginInterface, "Falkon.Browser.PluginInterface/2.2")
Q_DECLARE_INTERFACE(PluginInterface, "Falkon.Browser.PluginInterface/2.3")
#endif // PLUGININTERFACE_H

View File

@ -24,8 +24,6 @@
#include "../config.h"
#include "desktopfile.h"
#include <QTranslator>
AutoScrollPlugin::AutoScrollPlugin()
: QObject()
, m_scroller(0)
@ -60,13 +58,6 @@ bool AutoScrollPlugin::testPlugin()
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)
{
if (!m_settings) {

View File

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

View File

@ -32,7 +32,6 @@
#include <QTimer>
#include <QSettings>
#include <QTranslator>
#include <QDir>
#include <QMenu>
@ -120,13 +119,6 @@ bool FCM_Plugin::testPlugin()
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)
{
Q_UNUSED(parent)

View File

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

View File

@ -25,8 +25,6 @@
#include "passwordmanager.h"
#include "desktopfile.h"
#include <QTranslator>
GnomeKeyringPlugin::GnomeKeyringPlugin()
: QObject()
, m_backend(0)
@ -58,10 +56,3 @@ bool GnomeKeyringPlugin::testPlugin()
// Require the version that the plugin was built with
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();
bool testPlugin();
QTranslator* getTranslator(const QString &locale);
private:
GnomeKeyringPasswordBackend* m_backend;

View File

@ -27,8 +27,6 @@
#include "../config.h"
#include "desktopfile.h"
#include <QTranslator>
GM_Plugin::GM_Plugin()
: QObject()
, m_manager(0)
@ -67,13 +65,6 @@ bool GM_Plugin::testPlugin()
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)
{
m_manager->showSettings(parent);

View File

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

View File

@ -27,7 +27,6 @@
#include "desktopfile.h"
#include <QMenu>
#include <QTranslator>
ImageFinderPlugin::ImageFinderPlugin()
: QObject()
@ -58,13 +57,6 @@ bool ImageFinderPlugin::testPlugin()
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)
{
if (!m_settings) {

View File

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

View File

@ -25,8 +25,6 @@
#include "passwordmanager.h"
#include "desktopfile.h"
#include <QTranslator>
KWalletPlugin::KWalletPlugin()
: QObject()
, m_backend(0)
@ -58,10 +56,3 @@ bool KWalletPlugin::testPlugin()
// Require the version that the plugin was built with
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 unload() override;
bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
private:
KWalletPasswordBackend* m_backend;

View File

@ -23,8 +23,6 @@
#include "../config.h"
#include "desktopfile.h"
#include <QTranslator>
MouseGesturesPlugin::MouseGesturesPlugin()
: QObject()
, m_gestures(0)
@ -59,13 +57,6 @@ bool MouseGesturesPlugin::testPlugin()
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)
{
m_gestures->showSettings(parent);

View File

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

View File

@ -26,8 +26,6 @@
#include "../config.h"
#include "desktopfile.h"
#include <QTranslator>
PIM_Plugin::PIM_Plugin()
: QObject()
, m_handler(0)
@ -62,13 +60,6 @@ bool PIM_Plugin::testPlugin()
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)
{
m_handler->showSettings(parent);

View File

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

View File

@ -24,8 +24,6 @@
#include "mainapplication.h"
#include "desktopfile.h"
#include <QTranslator>
StatusBarIconsPlugin::StatusBarIconsPlugin()
: QObject()
, m_manager(0)
@ -70,13 +68,6 @@ bool StatusBarIconsPlugin::testPlugin()
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)
{
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 unload() override;
bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override;
private:

View File

@ -29,7 +29,6 @@
#include "desktopfile.h"
#include <QInputDialog>
#include <QTranslator>
#include <QSettings>
#include <QAction>
#include <QTimer>
@ -92,13 +91,6 @@ bool TabManagerPlugin::testPlugin()
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)
{
TabManagerSettings* settings = new TabManagerSettings(this, parent);

View File

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

View File

@ -27,7 +27,6 @@
#include "desktopfile.h"
#include <QMenu>
#include <QTranslator>
#include <QPushButton>
TestPlugin::TestPlugin()
@ -96,16 +95,6 @@ bool TestPlugin::testPlugin()
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)
{
// 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 unload() override;
bool testPlugin() override;
QTranslator *getTranslator(const QString &locale) override;
void showSettings(QWidget *parent) override;
void populateWebViewMenu(QMenu *menu, WebView *view, const WebHitTestResult &r) override;

View File

@ -31,7 +31,6 @@
#include "desktopfile.h"
#include <QSettings>
#include <QTranslator>
VerticalTabsPlugin::VerticalTabsPlugin()
: QObject()
@ -92,13 +91,6 @@ bool VerticalTabsPlugin::testPlugin()
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)
{
VerticalTabsSettings *settings = new VerticalTabsSettings(this, parent);

View File

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