D7640: QtCurve: reduce progressbar timer overhead

René J.V. Bertin noreply at phabricator.kde.org
Fri Sep 1 21:21:53 UTC 2017


rjvbb updated this revision to Diff 19073.
rjvbb added a comment.


  Following Breeze's example, we can defer the creation of a timer for the busy/indeterminate state to when we encounter one, i.e. when `Style::drawControl()` is called with `CE_ProgressBarContents`.
  
  Determining if the timer can be killed is a bit trickier of course (without changing considerably more), so I could do this:
  
  1- start the timer if still necessary
  
    A- when an animated PB is shown for the 1st time (= as usual), but not when a non animated PB is shown.
    B- when an indeterminate PB is *drawn* for the 1st time
  
  2- return to the idle frequency when there are no more visible animated PBs (= current proposed change)
  3- kill the timer when all PBs are closed, destroyed or hidden
  
  Slight complication: Style::drawControl() is const, so one also has to move `m_timer`, `m_progressBarAnimateTimer` and `m_progressBarAnimateFps` to a private class, which in addition would have to have a `q` pointer and a startParentTimer() "proxy" so we can call Style::startTimer() from a const member function.
  
  For now I've only implemented this for Qt5, let me know if this is too much (complicated, or of a hack).

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D7640?vs=19044&id=19073

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

AFFECTED FILES
  qt4/style/qtcurve.cpp
  qt4/style/qtcurve.h
  qt5/style/qtcurve.cpp
  qt5/style/qtcurve.h
  qt5/style/qtcurve_api.cpp
  qt5/style/qtcurve_p.h

To: rjvbb, yuyichao, #plasma
Cc: davidedmundson, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170901/078d0e70/attachment.html>


More information about the Plasma-devel mailing list