LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
ipluginsmanager.h
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#pragma once
10
11
#include <memory>
12
#include <QStringList>
13
#include <QObjectList>
14
15
class
ILoadProgressReporter
;
16
using
ILoadProgressReporter_ptr
= std::shared_ptr<ILoadProgressReporter>;
17
18
class
QIcon;
19
34
class
Q_DECL_EXPORT
IPluginsManager
35
{
36
public
:
37
virtual
~IPluginsManager
() {}
38
43
virtual
QObjectList
GetAllPlugins
()
const
= 0;
44
54
template
<
typename
T>
55
QObjectList
Filter
(
const
QObjectList& source)
const
56
{
57
QObjectList result;
58
for
(
const
auto
sp : source)
59
if
(qobject_cast<T> (sp))
60
result << sp;
61
return
result;
62
}
63
73
template
<
typename
T>
74
QObjectList
GetAllCastableRoots
()
const
75
{
76
return
Filter<T>
(
GetAllPlugins
());
77
}
78
90
template
<
typename
T>
91
QList<T>
GetAllCastableTo
()
const
92
{
93
QList<T>
result;
94
for
(
const
auto
root :
GetAllCastableRoots<T>
())
95
result << qobject_cast<T> (root);
96
return
result;
97
}
98
107
virtual
QObject*
GetPluginByID
(
const
QByteArray&
id
)
const
= 0;
108
125
virtual
QString
GetPluginLibraryPath
(
const
QObject*
object
)
const
= 0;
126
138
virtual
void
InjectPlugin
(QObject *
object
) = 0;
139
155
virtual
void
ReleasePlugin
(QObject *
object
) = 0;
156
164
virtual
QObject*
GetQObject
() = 0;
165
173
virtual
void
OpenSettings
(QObject *plugin) = 0;
174
191
virtual
ILoadProgressReporter_ptr
CreateLoadProgressReporter
(QObject *thisPlugin) = 0;
192
193
virtual
QIcon
GetPluginIcon
(QObject*) = 0;
194
};
195
196
Q_DECLARE_INTERFACE (
IPluginsManager
,
"org.Deviant.LeechCraft.IPluginsManager/1.0"
)
ILoadProgressReporter
Interface for reporting progress of some long-running operation during load time.
Definition
iloadprogressreporter.h:51
IPluginsManager
This interface is used to represent LeechCraft's global plugin manager.
Definition
ipluginsmanager.h:35
IPluginsManager::OpenSettings
virtual void OpenSettings(QObject *plugin)=0
Opens the settings page for the given plugin object.
IPluginsManager::ReleasePlugin
virtual void ReleasePlugin(QObject *object)=0
Releases and removes the given plugin object.
IPluginsManager::InjectPlugin
virtual void InjectPlugin(QObject *object)=0
Injects the given plugin object.
IPluginsManager::CreateLoadProgressReporter
virtual ILoadProgressReporter_ptr CreateLoadProgressReporter(QObject *thisPlugin)=0
Creates an object for reporting progress of a long-running load-time operation.
IPluginsManager::~IPluginsManager
virtual ~IPluginsManager()
Definition
ipluginsmanager.h:37
IPluginsManager::GetPluginLibraryPath
virtual QString GetPluginLibraryPath(const QObject *object) const =0
Returns the library path from which plugin instance object has been loaded.
IPluginsManager::GetPluginIcon
virtual QIcon GetPluginIcon(QObject *)=0
IPluginsManager::GetAllPlugins
virtual QObjectList GetAllPlugins() const =0
Returns list of pointers to all present plugins.
IPluginsManager::GetAllCastableRoots
QObjectList GetAllCastableRoots() const
This is the same as Filter<T> (GetAllPlugins()).
Definition
ipluginsmanager.h:74
IPluginsManager::GetQObject
virtual QObject * GetQObject()=0
Returns the pointer to plugin manager as a QObject.
IPluginsManager::Filter
QObjectList Filter(const QObjectList &source) const
Filters the given list of plugins and returns only those that can be casted to the given template typ...
Definition
ipluginsmanager.h:55
IPluginsManager::GetPluginByID
virtual QObject * GetPluginByID(const QByteArray &id) const =0
Returns plugin identified by its id.
IPluginsManager::GetAllCastableTo
QList< T > GetAllCastableTo() const
Similar to GetAlLCastableRoots() and provided for convenience.
Definition
ipluginsmanager.h:91
QList
Definition
ianrulesstorage.h:14
ILoadProgressReporter_ptr
std::shared_ptr< ILoadProgressReporter > ILoadProgressReporter_ptr
Definition
iloadprogressreporter.h:65
ILoadProgressReporter_ptr
std::shared_ptr< ILoadProgressReporter > ILoadProgressReporter_ptr
Definition
ipluginsmanager.h:16
src
interfaces
core
ipluginsmanager.h
Generated by
1.17.0