1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Plugins: Port plugin spec to standard desktop file

Makes it translatable
This commit is contained in:
David Rosca 2018-02-11 14:16:31 +01:00
parent 683854f502
commit 7c013f5342
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
58 changed files with 291 additions and 189 deletions

View File

@ -27,15 +27,16 @@
#include "navigationbar.h"
#include "mainapplication.h"
#include "statusbar.h"
#include "desktopfile.h"
AdBlockPlugin::AdBlockPlugin()
: QObject()
{
}
PluginSpec AdBlockPlugin::pluginSpec()
DesktopFile AdBlockPlugin::metaData() const
{
return PluginSpec();
return DesktopFile();
}
void AdBlockPlugin::init(InitState state, const QString &settingsPath)

View File

@ -30,7 +30,7 @@ class AdBlockPlugin : public QObject, public PluginInterface
public:
explicit AdBlockPlugin();
PluginSpec pluginSpec() override;
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath) override;
void unload() override;
bool testPlugin() override;

View File

@ -25,28 +25,6 @@
#include "qzcommon.h"
#include "webhittestresult.h"
struct PluginSpec {
QString name;
QString info;
QString description;
QString author;
QString version;
QPixmap icon;
bool hasSettings;
PluginSpec() {
hasSettings = false;
}
bool operator==(const PluginSpec &other) const {
return (this->name == other.name &&
this->info == other.info &&
this->description == other.description &&
this->author == other.author &&
this->version == other.version);
}
};
class QTranslator;
class QMenu;
class QMouseEvent;
@ -55,13 +33,14 @@ class QWheelEvent;
class WebView;
class WebPage;
class DesktopFile;
class PluginInterface
{
public:
enum InitState { StartupInitState, LateInitState };
virtual PluginSpec pluginSpec() = 0;
virtual DesktopFile metaData() const = 0;
virtual void init(InitState state, const QString &settingsPath) = 0;
virtual void unload() = 0;
virtual bool testPlugin() = 0;
@ -86,6 +65,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.0")
Q_DECLARE_INTERFACE(PluginInterface, "Falkon.Browser.PluginInterface/2.1")
#endif // PLUGININTERFACE_H

View File

@ -23,6 +23,7 @@
#include "datapaths.h"
#include "adblock/adblockplugin.h"
#include "../config.h"
#include "desktopfile.h"
#include <iostream>
#include <QPluginLoader>
@ -126,8 +127,10 @@ void Plugins::loadPlugins()
plugin.instance = initPlugin(PluginInterface::StartupInitState, iPlugin, loader);
if (plugin.isLoaded()) {
plugin.pluginSpec = iPlugin->pluginSpec();
m_availablePlugins.append(plugin);
plugin.pluginSpec = createSpec(iPlugin->metaData());
if (!plugin.pluginSpec.name.isEmpty()) {
m_availablePlugins.append(plugin);
}
}
}
@ -172,13 +175,13 @@ void Plugins::loadAvailablePlugins()
Plugin plugin;
plugin.fileName = fileName;
plugin.fullPath = absolutePath;
plugin.pluginSpec = iPlugin->pluginSpec();
plugin.pluginSpec = createSpec(iPlugin->metaData());
plugin.pluginLoader = loader;
plugin.instance = 0;
loader->unload();
if (!alreadySpecInAvailable(plugin.pluginSpec)) {
if (!plugin.pluginSpec.name.isEmpty() && !alreadySpecInAvailable(plugin.pluginSpec)) {
m_availablePlugins.append(plugin);
}
}
@ -230,3 +233,24 @@ bool Plugins::alreadySpecInAvailable(const PluginSpec &spec)
return false;
}
PluginSpec Plugins::createSpec(const DesktopFile &metaData) const
{
PluginSpec spec;
spec.name = metaData.name(mApp->currentLanguage());
spec.description = metaData.comment(mApp->currentLanguage());
spec.version = metaData.value(QSL("X-Falkon-Version")).toString();
spec.author = QSL("%1 <%2>").arg(metaData.value(QSL("X-Falkon-Author")).toString(), metaData.value(QSL("X-Falkon-Email")).toString());
spec.hasSettings = metaData.value(QSL("X-Falkon-Settings")).toBool();
const QString iconName = metaData.icon();
if (!iconName.isEmpty()) {
if (QFileInfo::exists(iconName)) {
spec.icon = QIcon(iconName).pixmap(32);
} else {
spec.icon = QIcon::fromTheme(iconName).pixmap(32);
}
}
return spec;
}

View File

@ -29,6 +29,22 @@ class QPluginLoader;
class SpeedDial;
struct PluginSpec {
QString name;
QString description;
QString author;
QString version;
QPixmap icon;
bool hasSettings = false;
bool operator==(const PluginSpec &other) const {
return (this->name == other.name &&
this->description == other.description &&
this->author == other.author &&
this->version == other.version);
}
};
class FALKON_EXPORT Plugins : public QObject
{
Q_OBJECT
@ -82,6 +98,7 @@ signals:
private:
bool alreadySpecInAvailable(const PluginSpec &spec);
PluginSpec createSpec(const DesktopFile &metaData) const;
PluginInterface* initPlugin(PluginInterface::InitState state , PluginInterface* pluginInterface, QPluginLoader* loader);
void refreshLoadedPlugins();

View File

@ -102,17 +102,20 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
painter->setFont(versionFont);
style->drawItemText(painter, versionRect, Qt::AlignLeft, textPalette, true, version, colorRole);
// Draw info
// Draw author
const int infoYPos = nameRect.bottom() + opt.fontMetrics.leading();
QRect infoRect(nameRect.x(), infoYPos, nameRect.width(), opt.fontMetrics.height());
const QString info = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 1).toString(), Qt::ElideRight, infoRect.width());
painter->setFont(opt.font);
QFont font = opt.font;
font.setPointSize(font.pointSize() - 1);
painter->setFont(font);
style->drawItemText(painter, infoRect, Qt::TextSingleLine | Qt::AlignLeft, textPalette, true, info, colorRole);
// Draw description
const int descriptionYPos = infoRect.bottom() + opt.fontMetrics.leading();
QRect descriptionRect(infoRect.x(), descriptionYPos, infoRect.width(), opt.fontMetrics.height());
const QString description = opt.fontMetrics.elidedText(index.data(Qt::UserRole + 2).toString(), Qt::ElideRight, descriptionRect.width());
painter->setFont(opt.font);
style->drawItemText(painter, descriptionRect, Qt::TextSingleLine | Qt::AlignLeft, textPalette, true, description, colorRole);
}

View File

@ -111,12 +111,12 @@ void PluginsManager::refresh()
}
item->setIcon(icon);
QString pluginInfo = QString("<b>%1</b> %2<br/><i>%3</i><br/>%4").arg(spec.name, spec.version, spec.author.toHtmlEscaped(), spec.info);
QString pluginInfo = QString("<b>%1</b> %2<br/><i>%3</i><br/>").arg(spec.name, spec.version, spec.author.toHtmlEscaped());
item->setToolTip(pluginInfo);
item->setText(spec.name);
item->setData(Qt::UserRole, spec.version);
item->setData(Qt::UserRole + 1, spec.info);
item->setData(Qt::UserRole + 1, spec.author);
item->setData(Qt::UserRole + 2, spec.description);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);

View File

@ -17,10 +17,16 @@
* ============================================================ */
#include "desktopfile.h"
DesktopFile::DesktopFile(const QString &filePath)
: m_settings(filePath, QSettings::IniFormat)
#include <QSettings>
DesktopFile::DesktopFile()
{
m_settings.beginGroup(QSL("Desktop Entry"));
}
DesktopFile::DesktopFile(const QString &filePath)
{
m_settings.reset(new QSettings(filePath, QSettings::IniFormat));
m_settings->beginGroup(QSL("Desktop Entry"));
}
QString DesktopFile::name(const QString &locale) const
@ -45,11 +51,14 @@ QString DesktopFile::icon() const
QVariant DesktopFile::value(const QString &key, const QString &locale) const
{
if (!m_settings) {
return QVariant();
}
if (!locale.isEmpty()) {
const QString localeKey = QSL("%1[%2]").arg(key, locale);
if (m_settings.contains(localeKey)) {
return m_settings.value(localeKey);
if (m_settings->contains(localeKey)) {
return m_settings->value(localeKey);
}
}
return m_settings.value(key);
return m_settings->value(key);
}

View File

@ -17,13 +17,16 @@
* ============================================================ */
#pragma once
#include <QSettings>
#include <QSharedPointer>
#include "qzcommon.h"
class QSettings;
class FALKON_EXPORT DesktopFile
{
public:
explicit DesktopFile();
explicit DesktopFile(const QString &filePath);
QString name(const QString &locale = QString()) const;
@ -33,5 +36,5 @@ public:
QVariant value(const QString &key, const QString &locale = QString()) const;
private:
QSettings m_settings;
QSharedPointer<QSettings> m_settings;
};

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/autoscroll">
<file>metadata.desktop</file>
<file>data/scroll_all.png</file>
<file>data/scroll_all@2x.png</file>
<file>data/scroll_horizontal.png</file>

View File

@ -22,6 +22,7 @@
#include "pluginproxy.h"
#include "mainapplication.h"
#include "../config.h"
#include "desktopfile.h"
#include <QTranslator>
@ -31,18 +32,9 @@ AutoScrollPlugin::AutoScrollPlugin()
{
}
PluginSpec AutoScrollPlugin::pluginSpec()
DesktopFile AutoScrollPlugin::metaData() const
{
PluginSpec spec;
spec.name = "AutoScroll";
spec.info = "AutoScroll plugin";
spec.description = "Provides support for autoscroll with middle mouse button";
spec.version = "1.0.1";
spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QIcon(QSL(":/autoscroll/data/scroll_all.png")).pixmap(32);
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":autoscroll/metadata.desktop"));
}
void AutoScrollPlugin::init(InitState state, const QString &settingsPath)

View File

@ -31,7 +31,8 @@ class AutoScrollPlugin : public QObject, public PluginInterface
public:
explicit AutoScrollPlugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=AutoScroll
Comment=Provides support for autoscroll with middle mouse button
Icon=:autoscroll/data/scroll_all.png
Type=Service
X-Falkon-Author=David Rosca
X-Falkon-Email=nowrep@gmail.com
X-Falkon-Version=1.0.1
X-Falkon-Settings=true

View File

@ -28,6 +28,7 @@
#include "../config.h"
#include "statusbar.h"
#include "navigationbar.h"
#include "desktopfile.h"
#include <QTimer>
#include <QSettings>
@ -65,18 +66,9 @@ FCM_Plugin::FCM_Plugin()
{
}
PluginSpec FCM_Plugin::pluginSpec()
DesktopFile FCM_Plugin::metaData() const
{
PluginSpec spec;
spec.name = "Flash Cookie Manager";
spec.info = "A plugin to manage flash cookies.";
spec.description = "You can easily view/delete flash cookies stored on your computer. This is a solution for having more privacy.";
spec.version = "0.3.0";
spec.author = "Razi Alavizadeh <s.r.alavizadeh@gmail.com>";
spec.icon = QPixmap(":/flashcookiemanager/data/flash-cookie-manager.png");
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":flashcookiemanager/metadata.desktop"));
}
void FCM_Plugin::init(InitState state, const QString &settingsPath)

View File

@ -51,8 +51,7 @@ class FCM_Plugin : public QObject, public PluginInterface
public:
explicit FCM_Plugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/flashcookiemanager">
<file>metadata.desktop</file>
<file>data/flash-cookie-manager.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Flash Cookie Manager
Comment=You can easily view/delete flash cookies stored on your computer. This is a solution for having more privacy.
Icon=:flashcookiemanager/data/flash-cookie-manager.png
Type=Service
X-Falkon-Author=Razi Alavizadeh
X-Falkon-Email=s.r.alavizadeh@gmail.com
X-Falkon-Version=0.3.0
X-Falkon-Settings=true

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/gkp">
<file>metadata.desktop</file>
<file>data/icon.png</file>
</qresource>
</RCC>

View File

@ -23,6 +23,7 @@
#include "mainapplication.h"
#include "autofill.h"
#include "passwordmanager.h"
#include "desktopfile.h"
#include <QTranslator>
@ -32,18 +33,9 @@ GnomeKeyringPlugin::GnomeKeyringPlugin()
{
}
PluginSpec GnomeKeyringPlugin::pluginSpec()
DesktopFile GnomeKeyringPlugin::metaData() const
{
PluginSpec spec;
spec.name = "Gnome Keyring Passwords";
spec.info = "Gnome Keyring password backend";
spec.description = "Provides support for storing passwords in gnome-keyring";
spec.version = "0.1.0";
spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QPixmap(":gkp/data/icon.png");
spec.hasSettings = false;
return spec;
return DesktopFile(QSL(":gkp/metadata.desktop"));
}
void GnomeKeyringPlugin::init(InitState state, const QString &settingsPath)

View File

@ -30,7 +30,8 @@ class GnomeKeyringPlugin : public QObject, public PluginInterface
public:
explicit GnomeKeyringPlugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Gnome Keyring Passwords
Comment=Provides support for storing passwords in gnome-keyring
Icon=:gkp/data/icon.png
Type=Service
X-Falkon-Author=David Rosca
X-Falkon-Email=nowrep@gmail.com
X-Falkon-Version=0.1.0
X-Falkon-Settings=false

View File

@ -25,6 +25,7 @@
#include "tabwidget.h"
#include "webtab.h"
#include "../config.h"
#include "desktopfile.h"
#include <QTranslator>
@ -34,18 +35,9 @@ GM_Plugin::GM_Plugin()
{
}
PluginSpec GM_Plugin::pluginSpec()
DesktopFile GM_Plugin::metaData() const
{
PluginSpec spec;
spec.name = "GreaseMonkey";
spec.info = "Userscripts for Falkon";
spec.description = "Provides support for userscripts";
spec.version = "0.9.4";
spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QIcon(":gm/data/icon.svg").pixmap(32);
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":gm/metadata.desktop"));
}
void GM_Plugin::init(InitState state, const QString &settingsPath)

View File

@ -31,7 +31,7 @@ class GM_Plugin : public QObject, public PluginInterface
public:
explicit GM_Plugin();
PluginSpec pluginSpec() override;
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath) override;
void unload() override;
bool testPlugin() override;

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/gm">
<file>metadata.desktop</file>
<file>data/bootstrap.min.js</file>
<file>data/values.min.js</file>
<file>data/icon.svg</file>

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=GreaseMonkey
Comment=Provides support for userscripts
Icon=:gm/data/icon.svg
Type=Service
X-Falkon-Author=David Rosca
X-Falkon-Email=nowrep@gmail.com
X-Falkon-Version=0.9.4
X-Falkon-Settings=true

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/imgfinder">
<file>metadata.desktop</file>
<file>data/icon.png</file>
<file>data/google.png</file>
<file>data/yandex.png</file>

View File

@ -24,6 +24,7 @@
#include "mainapplication.h"
#include "enhancedmenu.h"
#include "../config.h"
#include "desktopfile.h"
#include <QMenu>
#include <QTranslator>
@ -34,18 +35,9 @@ ImageFinderPlugin::ImageFinderPlugin()
{
}
PluginSpec ImageFinderPlugin::pluginSpec()
DesktopFile ImageFinderPlugin::metaData() const
{
PluginSpec spec;
spec.name = "ImageFinder";
spec.info = "Image Finder Plugin";
spec.description = "Provides context menu with reverse image search engine support";
spec.version = "0.2.0";
spec.author = "Vladislav Tronko <innermous@gmail.com>";
spec.icon = QPixmap(":/imgfinder/data/icon.png");
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":imgfinder/metadata.desktop"));
}
void ImageFinderPlugin::init(InitState state, const QString &settingsPath)

View File

@ -32,7 +32,8 @@ class ImageFinderPlugin : public QObject, public PluginInterface
public:
explicit ImageFinderPlugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=ImageFinder
Comment=Provides context menu with reverse image search engine support
Icon=:imgfinder/data/icon.png
Type=Service
X-Falkon-Author=Vladislav Tronko
X-Falkon-Email=innermous@gmail.com
X-Falkon-Version=0.2.0
X-Falkon-Settings=true

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/kwp">
<file>metadata.desktop</file>
<file>data/icon.png</file>
</qresource>
</RCC>

View File

@ -23,6 +23,7 @@
#include "mainapplication.h"
#include "autofill.h"
#include "passwordmanager.h"
#include "desktopfile.h"
#include <QTranslator>
@ -32,18 +33,9 @@ KWalletPlugin::KWalletPlugin()
{
}
PluginSpec KWalletPlugin::pluginSpec()
DesktopFile KWalletPlugin::metaData() const
{
PluginSpec spec;
spec.name = "KWallet Passwords";
spec.info = "KWallet password backend";
spec.description = "Provides support for storing passwords in KWallet";
spec.version = "0.1.2";
spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QPixmap(":kwp/data/icon.png");
spec.hasSettings = false;
return spec;
return DesktopFile(QSL(":kwp/metadata.desktop"));
}
void KWalletPlugin::init(InitState state, const QString &settingsPath)

View File

@ -30,7 +30,8 @@ class KWalletPlugin : public QObject, public PluginInterface
public:
explicit KWalletPlugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=KWallet Passwords
Comment=Provides support for storing passwords in KWallet
Icon=:kwp/data/icon.png
Type=Service
X-Falkon-Author=David Rosca
X-Falkon-Email=nowrep@gmail.com
X-Falkon-Version=0.1.2
X-Falkon-Settings=false

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Mouse Gestures
Comment=Provides support for navigating in webpages by mouse gestures
Icon=:mousegestures/data/icon.png
Type=Service
X-Falkon-Author=David Rosca
X-Falkon-Email=nowrep@gmail.com
X-Falkon-Version=0.5.0
X-Falkon-Settings=true

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/mousegestures">
<file>metadata.desktop</file>
<file>data/icon.png</file>
<file>data/down.gif</file>
<file>data/down-left.gif</file>

View File

@ -21,6 +21,7 @@
#include "mainapplication.h"
#include "browserwindow.h"
#include "../config.h"
#include "desktopfile.h"
#include <QTranslator>
@ -30,18 +31,9 @@ MouseGesturesPlugin::MouseGesturesPlugin()
{
}
PluginSpec MouseGesturesPlugin::pluginSpec()
DesktopFile MouseGesturesPlugin::metaData() const
{
PluginSpec spec;
spec.name = "Mouse Gestures";
spec.info = "Mouse gestures for Falkon";
spec.description = "Provides support for navigating in webpages by mouse gestures";
spec.version = "0.5.0";
spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QPixmap(":/mousegestures/data/icon.png");
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":mousegestures/metadata.desktop"));
}
void MouseGesturesPlugin::init(InitState state, const QString &settingsPath)

View File

@ -29,7 +29,8 @@ class MouseGesturesPlugin : public QObject, public PluginInterface
public:
MouseGesturesPlugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -24,6 +24,7 @@
#include "browserwindow.h"
#include "webview.h"
#include "../config.h"
#include "desktopfile.h"
#include <QTranslator>
@ -33,18 +34,9 @@ PIM_Plugin::PIM_Plugin()
{
}
PluginSpec PIM_Plugin::pluginSpec()
DesktopFile PIM_Plugin::metaData() const
{
PluginSpec spec;
spec.name = "PIM";
spec.info = "Personal Information Manager";
spec.description = "Adds ability for Falkon to store some personal data";
spec.version = "0.2.0";
spec.author = QString::fromUtf8("Mladen Pejaković <pejakm@autistici.org>");
spec.icon = QPixmap(":/PIM/data/PIM.png");
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":PIM/metadata.desktop"));
}
void PIM_Plugin::init(InitState state, const QString &settingsPath)

View File

@ -33,7 +33,8 @@ class PIM_Plugin : public QObject, public PluginInterface
public:
PIM_Plugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/PIM">
<file>metadata.desktop</file>
<file>data/PIM.png</file>
</qresource>
</RCC>

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=PIM
Comment=Adds ability for Falkon to store some personal data
Icon=:PIM/data/PIM.png
Type=Service
X-Falkon-Author=Mladen Pejaković
X-Falkon-Email=pejakm@autistici.org
X-Falkon-Version=0.2.0
X-Falkon-Settings=true

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=StatusBar Icons
Comment=Adds additional icons and zoom widget to statusbar
Icon=:sbi/data/icon.png
Type=Service
X-Falkon-Author=David Rosca
X-Falkon-Email=nowrep@gmail.com
X-Falkon-Version=0.2.0
X-Falkon-Settings=true

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/sbi">
<file>metadata.desktop</file>
<file>data/icon.png</file>
<file>data/images.png</file>
<file>data/javascript.png</file>

View File

@ -22,6 +22,7 @@
#include "browserwindow.h"
#include "../config.h"
#include "mainapplication.h"
#include "desktopfile.h"
#include <QTranslator>
@ -31,18 +32,9 @@ StatusBarIconsPlugin::StatusBarIconsPlugin()
{
}
PluginSpec StatusBarIconsPlugin::pluginSpec()
DesktopFile StatusBarIconsPlugin::metaData() const
{
PluginSpec spec;
spec.name = "StatusBar Icons";
spec.info = "Icons in statusbar providing various actions";
spec.description = "Adds additional icons and zoom widget to statusbar";
spec.version = "0.2.0";
spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QPixmap(":sbi/data/icon.png");
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":sbi/metadata.desktop"));
}
void StatusBarIconsPlugin::init(InitState state, const QString &settingsPath)

View File

@ -30,7 +30,8 @@ class StatusBarIconsPlugin : public QObject, public PluginInterface
public:
explicit StatusBarIconsPlugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Tab Manager
Comment=Adds ability to managing tabs and windows
Icon=:tabmanager/data/tabmanager.png
Type=Service
X-Falkon-Author=Razi Alavizadeh
X-Falkon-Email=s.r.alavizadeh@gmail.com
X-Falkon-Version=0.8.0
X-Falkon-Settings=true

View File

@ -26,6 +26,7 @@
#include "tabbar.h"
#include "tabmanagersettings.h"
#include "../config.h"
#include "desktopfile.h"
#include <QInputDialog>
#include <QTranslator>
@ -46,18 +47,9 @@ TabManagerPlugin::TabManagerPlugin()
{
}
PluginSpec TabManagerPlugin::pluginSpec()
DesktopFile TabManagerPlugin::metaData() const
{
PluginSpec spec;
spec.name = "Tab Manager";
spec.info = "Simple yet powerful tab manager for Falkon";
spec.description = "Adds ability to managing tabs and windows";
spec.version = "0.8.0";
spec.author = "Razi Alavizadeh <s.r.alavizadeh@gmail.com>";
spec.icon = QPixmap(":tabmanager/data/tabmanager.png");
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":tabmanager/metadata.desktop"));
}
void TabManagerPlugin::init(InitState state, const QString &settingsPath)

View File

@ -38,7 +38,8 @@ class TabManagerPlugin : public QObject, public PluginInterface
public:
explicit TabManagerPlugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/tabmanager">
<file>metadata.desktop</file>
<file>data/tabmanager.png</file>
<file>data/tab-close.png</file>
<file>data/tab-bookmark.png</file>

View File

@ -3,7 +3,12 @@ set( TestPlugin_SRCS
testplugin_sidebar.cpp
)
set( TestPlugin_RSCS
testplugin.qrc
)
qt5_add_resources(RSCS ${TestPlugin_RSCS})
add_library(TestPlugin MODULE ${TestPlugin_SRCS} ${RSCS})
install(TARGETS TestPlugin DESTINATION ${FALKON_INSTALL_PLUGINDIR})
target_link_libraries(TestPlugin FalkonPrivate)

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Example Plugin
Comment=Very simple minimal plugin example
Icon=configure
Type=Service
X-Falkon-Author=David Rosca
X-Falkon-Email=nowrep@gmail.com
X-Falkon-Version=0.1.7
X-Falkon-Settings=true

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2018 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@
#include "sidebar.h"
#include "webhittestresult.h"
#include "../config.h"
#include "desktopfile.h"
#include <QMenu>
#include <QTranslator>
@ -37,18 +38,9 @@ TestPlugin::TestPlugin()
// It will be called even if user doesn't have the plugin allowed
}
PluginSpec TestPlugin::pluginSpec()
DesktopFile TestPlugin::metaData() const
{
PluginSpec spec;
spec.name = "Example Plugin";
spec.info = "Example minimal plugin";
spec.description = "Very simple minimal plugin example";
spec.version = "0.1.7";
spec.author = "David Rosca <nowrep@gmail.com>";
spec.icon = QPixmap(":qupzilla.png");
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":testplugin/metadata.desktop"));
}
void TestPlugin::init(InitState state, const QString &settingsPath)

View File

@ -34,7 +34,8 @@ class TestPlugin : public QObject, public PluginInterface
public:
explicit TestPlugin();
PluginSpec pluginSpec();
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath);
void unload();

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/testplugin">
<file>metadata.desktop</file>
</qresource>
</RCC>

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Vertical Tabs
Comment=Adds ability to show tabs in sidebar
Icon=:verticaltabs/data/icon.svg
Type=Service
X-Falkon-Author=David Rosca
X-Falkon-Email=nowrep@gmail.com
X-Falkon-Version=0.1.0
X-Falkon-Settings=true

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/verticaltabs">
<file>metadata.desktop</file>
<file>data/icon.svg</file>
<file>data/group.svg</file>
<file>data/index.html</file>

View File

@ -28,6 +28,7 @@
#include "sidebar.h"
#include "networkmanager.h"
#include "../config.h"
#include "desktopfile.h"
#include <QSettings>
#include <QTranslator>
@ -37,17 +38,9 @@ VerticalTabsPlugin::VerticalTabsPlugin()
{
}
PluginSpec VerticalTabsPlugin::pluginSpec()
DesktopFile VerticalTabsPlugin::metaData() const
{
PluginSpec spec;
spec.name = QSL("Vertical Tabs");
spec.info = QSL("Vertical tabs for Falkon");
spec.description = QSL("Adds ability to show tabs in sidebar");
spec.version = QSL("0.1.0");
spec.author = QSL("David Rosca <nowrep@gmail.com>");
spec.icon = QIcon(QSL(":verticaltabs/data/icon.svg")).pixmap(32);
spec.hasSettings = true;
return spec;
return DesktopFile(QSL(":verticaltabs/metadata.desktop"));
}
void VerticalTabsPlugin::init(InitState state, const QString &settingsPath)

View File

@ -33,7 +33,7 @@ class VerticalTabsPlugin : public QObject, public PluginInterface
public:
explicit VerticalTabsPlugin();
PluginSpec pluginSpec() override;
DesktopFile metaData() const override;
void init(InitState state, const QString &settingsPath) override;
void unload() override;
bool testPlugin() override;