D9770: Optimization of byteSize(double size)

Kai Uwe Broulik noreply at phabricator.kde.org
Tue Jan 9 18:38:41 UTC 2018


broulik added a comment.


  Nice catch.

INLINE COMMENTS

> kjobtrackerformatters.cpp:29
>  
> +const char* units[] {"%1 B", "%1 KiB", "%1 MiB", "%1 GiB", "%1 TiB", "%1 PiB", "%1 EiB", "%1 ZiB", "%1 YiB"};
> +const int unitsSize = sizeof(units)/sizeof(const char *);

These aren't translated anymore. The `translate` call is also a hint that these strings should be extracted

> kjobtrackerformatters.cpp:31
>  {
> -    QList<QString> units;
> -    units << QCoreApplication::translate("KJobTrackerFormatters", "%1 B")

how about making that list `static` and turning it into an initializer list?

  static const auto s_units {
      QCoreApplication::translate(...),
      ...
  }

REPOSITORY
  R288 KJobWidgets

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

To: jtamate, #frameworks
Cc: broulik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180109/eda98d23/attachment.html>


More information about the Kde-frameworks-devel mailing list