<table><tr><td style="">antonanikin added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D2792" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Ok, lets I describe the original problem "step by step".</p>

<p>We have some <tt style="background: #ebebeb; font-size: 13px;">KJob</tt> and associated <tt style="background: #ebebeb; font-size: 13px;">JobStatus</tt>. Job do some work and can send signals, handled by <tt style="background: #ebebeb; font-size: 13px;">JobStatus</tt>. We have two main scenarios:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">Job do it's work and <strong>send</strong> <tt style="background: #ebebeb; font-size: 13px;">percent</tt> signals. After recieving first <tt style="background: #ebebeb; font-size: 13px;">percent</tt> signal from our job <tt style="background: #ebebeb; font-size: 13px;">StatusbarProgressWidget</tt> starts internal timer (1000 ms.) - during this delay widget blocks progress showing. If after this timeout our job is still in "live" state, widget popups progress bar and update it's status with new <tt style="background: #ebebeb; font-size: 13px;">percent</tt> signals. When our job finished <tt style="background: #ebebeb; font-size: 13px;">JobStatus</tt> obect send <tt style="background: #ebebeb; font-size: 13px;">hideProgress</tt> signal, which causes starting second internal timer in <tt style="background: #ebebeb; font-size: 13px;">StatusbarProgressWidget</tt> (for 5000 ms.), after which progress bar is hided. The key point here - time interval between first <tt style="background: #ebebeb; font-size: 13px;">percent</tt> signal and <tt style="background: #ebebeb; font-size: 13px;">hideProgress</tt> signal - if it less than 1000 ms. we don't see any progress status (blocked by <tt style="background: #ebebeb; font-size: 13px;">StatusbarProgressWidget</tt>).</li>
</ol>

<ol class="remarkup-list" start="2">
<li class="remarkup-list-item">Job do it's work <strong>and don't send</strong> <tt style="background: #ebebeb; font-size: 13px;">percent</tt> signals. After it's finishing the <tt style="background: #ebebeb; font-size: 13px;">JobStatus</tt> object emit <tt style="background: #ebebeb; font-size: 13px;">hideProgress</tt> signal and therefore we don't see any progress.</li>
</ol>

<p>This patch tries to fix described problem. If job send <tt style="background: #ebebeb; font-size: 13px;">percent</tt> signal <tt style="background: #ebebeb; font-size: 13px;">JobStatus</tt> starts internal timer and blocks emitting of <tt style="background: #ebebeb; font-size: 13px;">hideProgress</tt> before timer finished. If job don't send <tt style="background: #ebebeb; font-size: 13px;">percent</tt> signal <tt style="background: #ebebeb; font-size: 13px;">JobStatus</tt> emit such signal at <tt style="background: #ebebeb; font-size: 13px;">slotFinished</tt> and after starts timer.</p>

<p>This approach allows to show resulting status in any case. The key idea - provide delay between first <tt style="background: #ebebeb; font-size: 13px;">percent</tt> signal and “final” <tt style="background: #ebebeb; font-size: 13px;">hideProgress</tt> signal. The ugly place is using <em>magic constant</em> for delay, but <tt style="background: #ebebeb; font-size: 13px;">StatusbarProgressWidget</tt> don't provide any mechanisms to avoid this.</p></div></div><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D2792#inline-11043" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">mwolff</span> wrote in <span style="color: #4b4d51; font-weight: bold;">jobstatus.cpp:58</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">why change this? undo please</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">fixed</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D2792#inline-11042" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">mwolff</span> wrote in <span style="color: #4b4d51; font-weight: bold;">jobstatus.h:65</span></div>
<div style="margin: 8px 0; padding: 0 12px; color: #74777D;"><p style="padding: 0; margin: 8px;">unrelated change which introduces a memory leak - undo</p></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">JobStatusPrivate</tt> now is QObject and created as child of <tt style="background: #ebebeb; font-size: 13px;">JobStatus</tt> object - there should be no memory leaks.</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>rKDEVPLATFORM KDevPlatform</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D2792" rel="noreferrer">https://phabricator.kde.org/D2792</a></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>mwolff, kfunk, antonanikin<br /><strong>Cc: </strong>mwolff, kdevelop-devel, KDevelop<br /></div>