Dekko
Loading...
Searching...
No Matches
PluginLoader.h
1/* Copyright (C) 2017 Dan Chapman <dpniel@ubuntu.com>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef PLUGINLOADER_H
19#define PLUGINLOADER_H
20
21#include <QLoggingCategory>
22#include <QObject>
23#include <QtPlugin>
24#include "PluginInfo.h"
25#include <QTranslator>
26
27Q_DECLARE_LOGGING_CATEGORY(PLUGIN_LOADER)
28
30{
31public:
32 virtual QString name() const = 0;
33 virtual QString description() const = 0;
34 virtual PluginInfo *create(QObject *parent) const = 0;
35};
36
37Q_DECLARE_INTERFACE(PluginInterface, "PluginInterface")
38
40{
41public:
42 explicit PluginLoader();
44
45 void loadPlugins(QMultiMap<QString, PluginInfo *> &registry, const QString &pluginType = QString());
46 void setPluginPaths(const QStringList &paths);
47
48protected:
49 PluginInfo *parsePluginSpec(const QString &path);
50 void initSettings(const QVariantMap &map);
51 void loadTranslations(const QString &i18nDir);
52
53private:
54 QStringList m_pluginPaths;
55 QList<QPointer<QTranslator> > m_translators;
56};
57
58#endif // PLUGINLOADER_H