Some drive-by tidying while reviewing.
This commit is contained in:
@@ -105,24 +105,21 @@ public class StatusPanel extends JComponent
|
|||||||
// maybe update the progress label
|
// maybe update the progress label
|
||||||
if (_progress != percent) {
|
if (_progress != percent) {
|
||||||
_progress = percent;
|
_progress = percent;
|
||||||
|
|
||||||
if (!_ifc.hideProgressText) {
|
if (!_ifc.hideProgressText) {
|
||||||
String msg = MessageFormat.format(get("m.complete"), percent);
|
String msg = MessageFormat.format(get("m.complete"), percent);
|
||||||
_newplab = createLabel( msg, _ifc.progressText );
|
_newplab = createLabel(msg, _ifc.progressText);
|
||||||
}
|
}
|
||||||
needsRepaint = true;
|
needsRepaint = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybe update the remaining label
|
// maybe update the remaining label
|
||||||
if (remaining > 1) {
|
if (remaining > 1) {
|
||||||
// skip this estimate if it's been less than a second since
|
// skip this estimate if it's been less than a second since our last one came in
|
||||||
// our last one came in
|
|
||||||
if (!_rthrottle.throttleOp()) {
|
if (!_rthrottle.throttleOp()) {
|
||||||
_remain[_ridx++%_remain.length] = remaining;
|
_remain[_ridx++%_remain.length] = remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
// smooth the remaining time by taking the trailing average of
|
// smooth the remaining time by taking the trailing average of the last four values
|
||||||
// the last four values
|
|
||||||
remaining = 0;
|
remaining = 0;
|
||||||
int values = Math.min(_ridx, _remain.length);
|
int values = Math.min(_ridx, _remain.length);
|
||||||
for (int ii = 0; ii < values; ii++) {
|
for (int ii = 0; ii < values; ii++) {
|
||||||
@@ -132,12 +129,10 @@ public class StatusPanel extends JComponent
|
|||||||
|
|
||||||
if (!_ifc.hideProgressText) {
|
if (!_ifc.hideProgressText) {
|
||||||
// now compute our display value
|
// now compute our display value
|
||||||
int minutes = (int)(remaining / 60);
|
int minutes = (int)(remaining / 60), seconds = (int)(remaining % 60);
|
||||||
int seconds = (int)(remaining % 60);
|
|
||||||
|
|
||||||
String remstr = minutes + ":" + ((seconds < 10) ? "0" : "") + seconds;
|
String remstr = minutes + ":" + ((seconds < 10) ? "0" : "") + seconds;
|
||||||
String msg = MessageFormat.format(get("m.remain"), remstr);
|
String msg = MessageFormat.format(get("m.remain"), remstr);
|
||||||
_newrlab = createLabel( msg, _ifc.statusText );
|
_newrlab = createLabel(msg, _ifc.statusText);
|
||||||
}
|
}
|
||||||
needsRepaint = true;
|
needsRepaint = true;
|
||||||
|
|
||||||
@@ -243,8 +238,7 @@ public class StatusPanel extends JComponent
|
|||||||
if (_plabel != null) {
|
if (_plabel != null) {
|
||||||
int xmarg = (_ifc.progress.width - _plabel.getSize().width)/2;
|
int xmarg = (_ifc.progress.width - _plabel.getSize().width)/2;
|
||||||
int ymarg = (_ifc.progress.height - _plabel.getSize().height)/2;
|
int ymarg = (_ifc.progress.height - _plabel.getSize().height)/2;
|
||||||
_plabel.render(gfx, _ifc.progress.x + xmarg,
|
_plabel.render(gfx, _ifc.progress.x + xmarg, _ifc.progress.y + ymarg);
|
||||||
_ifc.progress.y + ymarg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_label != null) {
|
if (_label != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user