Added option to hide progress text with ui.hide_progress_text

This commit is contained in:
neher
2015-10-06 21:18:41 +02:00
parent 947e45ef05
commit e8e4a151df
2 changed files with 19 additions and 9 deletions
@@ -142,6 +142,9 @@ public class Application
/** Whether window decorations are hidden for the UI. */
public boolean hideDecorations;
/** Whether progress text should be hidden or not. */
public boolean hideProgressText;
/** The global percentages for each step. A step may have more than one, and
* the lowest reasonable one is used if a step is revisited. */
public Map<Step, List<Integer>> stepPercentages =
@@ -156,7 +159,8 @@ public class Application
", pb=" + progressBar + ", srect=" + status + ", st=" + statusText +
", shadow=" + textShadow + ", err=" + installError + ", nrect=" + patchNotes +
", notes=" + patchNotesUrl + ", stepPercentages=" + stepPercentages +
", parect=" + playAgain + ", paimage=" + playAgainImage + "]";
", parect=" + playAgain + ", paimage=" + playAgainImage +
", hideProgressText" + hideProgressText + "]";
}
/** Initializer */
@@ -662,6 +666,7 @@ public class Application
_name = ui.name = (String)cdata.get("ui.name");
ui.progress = parseRect(cdata, "ui.progress", ui.progress);
ui.progressText = parseColor(cdata, "ui.progress_text", ui.progressText);
ui.hideProgressText = Boolean.parseBoolean((String)cdata.get("ui.hide_progress_text"));
ui.progressBar = parseColor(cdata, "ui.progress_bar", ui.progressBar);
ui.status = parseRect(cdata, "ui.status", ui.status);
ui.statusText = parseColor(cdata, "ui.status_text", ui.statusText);
@@ -105,8 +105,11 @@ public class StatusPanel extends JComponent
// maybe update the progress label
if (_progress != percent) {
_progress = percent;
if (!_ifc.hideProgressText) {
String msg = MessageFormat.format(get("m.complete"), percent);
_newplab = createLabel(msg, _ifc.progressText);
_newplab = createLabel( msg, _ifc.progressText );
}
needsRepaint = true;
}
@@ -127,13 +130,15 @@ public class StatusPanel extends JComponent
}
remaining /= values;
if (!_ifc.hideProgressText) {
// now compute our display value
int minutes = (int)(remaining / 60);
int seconds = (int)(remaining % 60);
String remstr = minutes + ":" + ((seconds < 10) ? "0" : "") + seconds;
String msg = MessageFormat.format(get("m.remain"), remstr);
_newrlab = createLabel(msg, _ifc.statusText);
_newrlab = createLabel( msg, _ifc.statusText );
}
needsRepaint = true;
} else if (_rlabel != null || _newrlab != null) {