[Differential] [Accepted] D2369: Convert powerdevil backends to proper plugins

broulik (Kai Uwe Broulik) noreply at phabricator.kde.org
Mon Aug 8 08:53:16 UTC 2016


broulik accepted this revision.
broulik added a comment.
This revision is now accepted and ready to land.


  Looks good to me.
  
  > wayland
  
  Wayland would still use upower but instead of having XRandRBrightness only use sysfs, this needs some more thought on how we could split that in the future, I guess.

INLINE COMMENTS

> kdedpowerdevil.cpp:83
> +    const QStringList paths = QCoreApplication::libraryPaths();
> +    QFileInfoList finfos;
> +    for (const QString& path : paths) {

fileInfos

also call reserve() as you later iterate something and add an already known number of items

> kdedpowerdevil.cpp:84
> +    QFileInfoList finfos;
> +    for (const QString& path : paths) {
> +        QDir dir(path + QLatin1String("/kf5/powerdevil/"),

const QString &paths

> kdedpowerdevil.cpp:94
> +    Q_FOREACH (const QFileInfo &f, finfos) {
> +        if (f.baseName().toLower() == QStringLiteral("powerdevilupowerbackend")) {
> +            backendFileInfo = f;

compare with QLatin1String

> kdedpowerdevil.cpp:100
>  
> -    if (!interface) {
> -        // Ouch
> +    QPluginLoader* loader = new QPluginLoader(backendFileInfo.filePath(), m_core);
> +    QObject *instance = loader->instance();

QPluginLoader *

> kdedpowerdevil.cpp:107
>      } else {
> -        // Let's go!
> +        auto interface = qobject_cast<PowerDevil::BackendInterface*>(instance);
>          qCDebug(POWERDEVIL) << "Backend loaded, loading core";

Check for interface being null (cast failed) maybe?

REPOSITORY
  rPOWERDEVIL Powerdevil

BRANCH
  bshah/proper-backends

REVISION DETAIL
  https://phabricator.kde.org/D2369

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: bshah, broulik, #plasma
Cc: plasma-devel, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20160808/fb8abd53/attachment.html>


More information about the Plasma-devel mailing list