Skip to content

Commit

Permalink
MPD: Avoid flickering of the progress bar
Browse files Browse the repository at this point in the history
The progress bar shows the number of pending background jobs.
If there is only one job pending, the progress bar is shown and
immediately hidden as soon as the process is finished.
Thus, we shouldn't show the progress bar if there is only one job
and thus no actual progress to show.

Use the default size and color scheme.
  • Loading branch information
rhaschke authored and rickstaa committed Dec 8, 2021
1 parent 4592f89 commit cb52064
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,28 +337,20 @@ void MotionPlanningDisplay::updateBackgroundJobProgressBar()

if (n == 0)
{
p->setValue(p->maximum());
p->update();
p->hide();
p->setMaximum(0);
p->setValue(0);
}
else
{
if (n == 1)
{
if (p->maximum() == 0)
p->setValue(0);
else
p->setValue(p->maximum() - 1);
}
else
if (p->maximum() < n) // increase max
{
if (p->maximum() < n)
p->setMaximum(n);
else
p->setValue(p->maximum() - n);
p->setMaximum(n);
if (n > 1) // only show bar if there will be a progress to show
p->show();
}
p->show();
else // progress
p->setValue(p->maximum() - n);
p->update();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2042,82 +2042,12 @@ This is usually achieved by random seeding, which can flip the robot configurati
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>5</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>5</height>
</size>
</property>
<property name="palette">
<palette>
<active>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Highlight">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>240</red>
<green>240</green>
<blue>240</blue>
</color>
</brush>
</colorrole>
<colorrole role="HighlightedText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Progress of background jobs&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
Expand Down

0 comments on commit cb52064

Please sign in to comment.