D10512: try to preload certain applets in a smart way

Anthony Fieroni noreply at phabricator.kde.org
Mon Feb 19 18:15:47 UTC 2018


anthonyfieroni added inline comments.

INLINE COMMENTS

> appletquickitem.cpp:57-68
> +    if (s_preloadPolicy == Uninitialized) {
> +        if (qEnvironmentVariableIsSet("PLASMA_PRELOAD_POLICY")) {
> +            const QString policy = QString::fromUtf8(qgetenv("PLASMA_PRELOAD_POLICY")).toLower();
> +            if (policy == QStringLiteral("aggressive")) {
> +                s_preloadPolicy = Aggressive;
> +            } else if (policy == QStringLiteral("none")) {
> +                s_preloadPolicy = None;

So Adaptive can a default even environment variable is not setted?
Furthermore you can make a static function to access value

  AppletQuickItemPrivate::PreloadPolicy AppletQuickItemPrivate::appletPolicy()
  {
      static const PreloadPolicy preloadPolicy = []() -> PreloadPolicy {
          if (qEnvironmentVariableIsSet("PLASMA_PRELOAD_POLICY")) {
              const QString policy = QString::fromUtf8(qgetenv("PLASMA_PRELOAD_POLICY")).toLower();
              if (policy == QStringLiteral("aggressive")) {
                  return Aggressive;
              } else if (policy == QStringLiteral("none")) {
                  return None;
              }
          }
          return Adaptive;
      }();
      return preloadPolicy;
  }

REPOSITORY
  R242 Plasma Framework (Library)

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

To: mart, #plasma
Cc: anthonyfieroni, davidedmundson, broulik, apol, ngraham, plasma-devel, #frameworks, michaelh, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180219/877060cc/attachment.html>


More information about the Plasma-devel mailing list