Make use of KPluginMetaData where we can
Summary: Instead of relying on the older KPluginInfo which is slower (parses de metadata twice) and comes from a much higher tier. Test Plan: Running plasmashell with it Reviewers: #plasma, mart Reviewed By: #plasma, mart Subscribers: kossebau, broulik, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D23682
This commit is contained in:
parent
e5b1475e14
commit
591aceb3f9
|
@ -93,7 +93,7 @@ ecm_generate_export_header(KF5Plasma
|
|||
GROUP_BASE_NAME KF
|
||||
VERSION ${KF5_VERSION}
|
||||
DEPRECATED_BASE_VERSION 0
|
||||
DEPRECATION_VERSIONS 5.6 5.19 5.28 5.30 5.36 5.46
|
||||
DEPRECATION_VERSIONS 5.6 5.19 5.28 5.30 5.36 5.46 5.67
|
||||
)
|
||||
# TODO: add support for EXCLUDE_DEPRECATED_BEFORE_AND_AT to all Plasma libs
|
||||
# needs fixing of undeprecated API being still implemented using own deprecated API
|
||||
|
|
|
@ -522,7 +522,7 @@ void Containment::setContainmentActions(const QString &trigger, const QString &p
|
|||
ContainmentActions *plugin = nullptr;
|
||||
|
||||
plugin = containmentActions().value(trigger);
|
||||
if (plugin && plugin->pluginInfo().pluginName() != pluginName) {
|
||||
if (plugin && plugin->metadata().pluginId() != pluginName) {
|
||||
containmentActions().remove(trigger);
|
||||
delete plugin;
|
||||
plugin = nullptr;
|
||||
|
|
|
@ -66,6 +66,11 @@ KPluginInfo ContainmentActions::pluginInfo() const
|
|||
return KPluginInfo(d->containmentActionsDescription);
|
||||
}
|
||||
|
||||
KPluginMetaData ContainmentActions::metadata() const
|
||||
{
|
||||
return d->containmentActionsDescription;
|
||||
}
|
||||
|
||||
Containment *ContainmentActions::containment()
|
||||
{
|
||||
if (d->containment) {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <plasma/version.h>
|
||||
|
||||
class QAction;
|
||||
class KPluginMetaData;
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
@ -63,12 +64,24 @@ public:
|
|||
|
||||
~ContainmentActions();
|
||||
|
||||
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 64)
|
||||
/**
|
||||
* @return the plugin info for this ContainmentActions instance,
|
||||
* including name, pluginName and icon
|
||||
* @since 5.0
|
||||
*
|
||||
* @deprecated since 5.67, use metadata
|
||||
*/
|
||||
PLASMA_DEPRECATED_VERSION(5, 67, "use metadata()")
|
||||
KPluginInfo pluginInfo() const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @return metadata for this ContainmentActions instance
|
||||
* including name, pluginName and icon
|
||||
* @since 5.62
|
||||
*/
|
||||
KPluginMetaData metadata() const;
|
||||
|
||||
/**
|
||||
* This method should be called once the plugin is loaded or settings are changed.
|
||||
|
|
|
@ -49,6 +49,10 @@ namespace Plasma
|
|||
{
|
||||
|
||||
DataEngine::DataEngine(const KPluginInfo &plugin, QObject *parent)
|
||||
: DataEngine(plugin.toMetaData(), parent)
|
||||
{}
|
||||
|
||||
DataEngine::DataEngine(const KPluginMetaData &plugin, QObject *parent)
|
||||
: QObject(parent),
|
||||
d(new DataEnginePrivate(this, plugin))
|
||||
{
|
||||
|
@ -63,7 +67,7 @@ DataEngine::DataEngine(const KPluginInfo &plugin, QObject *parent)
|
|||
|
||||
DataEngine::DataEngine(QObject *parent, const QVariantList &args)
|
||||
: QObject(parent),
|
||||
d(new DataEnginePrivate(this, KPluginInfo(args), args))
|
||||
d(new DataEnginePrivate(this, KPluginInfo(args).toMetaData(), args))
|
||||
{
|
||||
if (d->script) {
|
||||
d->setupScriptSupport();
|
||||
|
@ -99,6 +103,11 @@ Service *DataEngine::serviceForSource(const QString &source)
|
|||
}
|
||||
|
||||
KPluginInfo DataEngine::pluginInfo() const
|
||||
{
|
||||
return KPluginInfo(d->dataEngineDescription);
|
||||
}
|
||||
|
||||
KPluginMetaData DataEngine::metadata() const
|
||||
{
|
||||
return d->dataEngineDescription;
|
||||
}
|
||||
|
@ -408,9 +417,9 @@ void DataEngine::setStorageEnabled(const QString &source, bool store)
|
|||
}
|
||||
|
||||
// Private class implementations
|
||||
DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info, const QVariantList &args)
|
||||
DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginMetaData &md, const QVariantList &args)
|
||||
: q(e),
|
||||
dataEngineDescription(info),
|
||||
dataEngineDescription(md),
|
||||
refCount(-1), // first ref
|
||||
checkSourcesTimerId(0),
|
||||
updateTimerId(0),
|
||||
|
@ -427,12 +436,12 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info, con
|
|||
}
|
||||
|
||||
if (dataEngineDescription.isValid()) {
|
||||
QString api = dataEngineDescription.property(QStringLiteral("X-Plasma-API")).toString();
|
||||
QString api = dataEngineDescription.value(QStringLiteral("X-Plasma-API"));
|
||||
|
||||
if (!api.isEmpty()) {
|
||||
const QString path =
|
||||
QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||
QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/") + dataEngineDescription.pluginName(),
|
||||
QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/") + dataEngineDescription.pluginId(),
|
||||
QStandardPaths::LocateDirectory);
|
||||
package = new Package(PluginLoader::self()->loadPackage(QStringLiteral("Plasma/DataEngine"), api));
|
||||
package->setPath(path);
|
||||
|
|
|
@ -67,13 +67,28 @@ public:
|
|||
typedef QMapIterator<QString, QVariant> DataIterator;
|
||||
typedef QHash<QString, DataContainer *> SourceDict;
|
||||
|
||||
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 64)
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent The parent object.
|
||||
* @param plugin plugin info that describes the engine
|
||||
*
|
||||
* @deprecated since 5.67
|
||||
**/
|
||||
PLASMA_DEPRECATED_VERSION(5, 67, "Use KPluginMetaData")
|
||||
explicit DataEngine(const KPluginInfo &plugin, QObject *parent = nullptr);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent The parent object.
|
||||
* @param plugin metadata that describes the engine
|
||||
*
|
||||
* @since 5.62
|
||||
*/
|
||||
explicit DataEngine(const KPluginMetaData &plugin, QObject *parent = nullptr);
|
||||
|
||||
explicit DataEngine(QObject *parent = nullptr, const QVariantList &args = QVariantList());
|
||||
|
||||
|
@ -95,10 +110,22 @@ public:
|
|||
*/
|
||||
Q_INVOKABLE virtual Service *serviceForSource(const QString &source);
|
||||
|
||||
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 64)
|
||||
/**
|
||||
* @return description of the plugin that implements this DataEngine
|
||||
*
|
||||
* @deprecated since 5.67, use metadata
|
||||
*/
|
||||
PLASMA_DEPRECATED_VERSION(5, 67, "Use metadata()")
|
||||
KPluginInfo pluginInfo() const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @return description of the plugin that implements this DataEngine
|
||||
*
|
||||
* @since 5.62
|
||||
*/
|
||||
KPluginMetaData metadata() const;
|
||||
|
||||
/**
|
||||
* Connects a source to an object for data updates. The object must
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <QElapsedTimer>
|
||||
|
||||
#include <kplugininfo.h>
|
||||
#include <KPluginMetaData>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ class Service;
|
|||
class DataEnginePrivate
|
||||
{
|
||||
public:
|
||||
DataEnginePrivate(DataEngine *e, const KPluginInfo &info, const QVariantList &args = QVariantList());
|
||||
DataEnginePrivate(DataEngine *e, const KPluginMetaData &info, const QVariantList &args = QVariantList());
|
||||
~DataEnginePrivate();
|
||||
DataContainer *source(const QString &sourceName, bool createWhenMissing = true);
|
||||
void connectSource(DataContainer *s, QObject *visualization, uint pollingInterval,
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
void scheduleSourcesUpdated();
|
||||
|
||||
DataEngine *q;
|
||||
KPluginInfo dataEngineDescription;
|
||||
KPluginMetaData dataEngineDescription;
|
||||
int refCount;
|
||||
int checkSourcesTimerId;
|
||||
int updateTimerId;
|
||||
|
|
|
@ -131,7 +131,7 @@ Storage::Storage(QObject *parent)
|
|||
|
||||
Plasma::DataEngine *engine = qobject_cast<Plasma::DataEngine *>(parentObject);
|
||||
if (engine) {
|
||||
m_clientName = engine->pluginInfo().pluginName();
|
||||
m_clientName = engine->metadata().pluginId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -809,7 +809,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
|
|||
if (realTheme) {
|
||||
const QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1String("/metadata.desktop")));
|
||||
KConfig metadata(metadataPath, KConfig::SimpleConfig);
|
||||
pluginInfo = KPluginInfo(metadataPath);
|
||||
pluginMetaData = KPluginMetaData(metadataPath);
|
||||
|
||||
processContrastSettings(&metadata);
|
||||
processBlurBehindSettings(&metadata);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <kimagecache.h>
|
||||
#include <kshareddatacache.h>
|
||||
#include <kwindowsystem.h>
|
||||
#include <KPluginMetaData>
|
||||
#include <QTimer>
|
||||
|
||||
#include <config-plasma.h>
|
||||
|
@ -110,7 +111,7 @@ public:
|
|||
static QHash<QString, ThemePrivate *> themes;
|
||||
|
||||
QString themeName;
|
||||
KPluginInfo pluginInfo;
|
||||
KPluginMetaData pluginMetaData;
|
||||
QList<QString> fallbackThemes;
|
||||
KSharedConfigPtr colors;
|
||||
KColorScheme colorScheme;
|
||||
|
|
|
@ -89,9 +89,14 @@ Package DataEngineScript::package() const
|
|||
}
|
||||
|
||||
KPluginInfo DataEngineScript::description() const
|
||||
{
|
||||
return KPluginInfo(metadata());
|
||||
}
|
||||
|
||||
KPluginMetaData DataEngineScript::metadata() const
|
||||
{
|
||||
Q_ASSERT(d->dataEngine);
|
||||
return d->dataEngine->d->dataEngineDescription;
|
||||
return d->dataEngine->metadata();
|
||||
}
|
||||
|
||||
void DataEngineScript::setData(const QString &source, const QString &key,
|
||||
|
|
|
@ -110,10 +110,22 @@ protected:
|
|||
*/
|
||||
Package package() const override;
|
||||
|
||||
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 67)
|
||||
/**
|
||||
* @return the KPluginInfo associated with this plasmoid
|
||||
* @return the KPluginInfo associated with this dataengine
|
||||
*
|
||||
* @deprecated since 5.67 use metadata()
|
||||
*/
|
||||
PLASMA_DEPRECATED_VERSION(5, 67, "Use KPluginMetaData metadata()")
|
||||
KPluginInfo description() const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @return the KPluginMetaData associated with this dataengine
|
||||
*
|
||||
* @since 5.62
|
||||
*/
|
||||
KPluginMetaData metadata() const;
|
||||
|
||||
void setData(const QString &source, const QString &key,
|
||||
const QVariant &value);
|
||||
|
|
|
@ -443,7 +443,7 @@ void Theme::setCacheLimit(int kbytes)
|
|||
|
||||
KPluginInfo Theme::pluginInfo() const
|
||||
{
|
||||
return d->pluginInfo;
|
||||
return KPluginInfo(d->pluginMetaData);
|
||||
}
|
||||
|
||||
QFont Theme::defaultFont() const
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
#include <plasma/plasma_export.h>
|
||||
|
||||
class KPluginMetaData;
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
|
@ -314,12 +316,24 @@ public:
|
|||
*/
|
||||
void releaseRectsCache(const QString &image);
|
||||
|
||||
#if PLASMA_ENABLE_DEPRECATED_SINCE(5, 64)
|
||||
/**
|
||||
* @return plugin info for this theme, with information such as
|
||||
* name, description, author, website etc
|
||||
* @since 5.0
|
||||
*
|
||||
* @deprecated since 5.67, use KPluginMetaData
|
||||
*/
|
||||
PLASMA_DEPRECATED_VERSION(5, 67, "Use KPluginMetaData metadata()")
|
||||
KPluginInfo pluginInfo() const;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @return metadata for this theme, with information such as
|
||||
* name, description, author, website etc
|
||||
* @since 5.64
|
||||
*/
|
||||
KPluginMetaData metadata() const;
|
||||
|
||||
/**
|
||||
* @return The default application font
|
||||
|
|
Loading…
Reference in New Issue
Block a user