Format the remaining time in code so we can do the right thing with the

seconds.
This commit is contained in:
Michael Bayne
2004-07-26 18:05:55 +00:00
parent 119541f527
commit cbf272221c
2 changed files with 12 additions and 7 deletions
@@ -1,5 +1,5 @@
// //
// $Id: StatusPanel.java,v 1.6 2004/07/26 17:52:32 mdb Exp $ // $Id: StatusPanel.java,v 1.7 2004/07/26 18:05:55 mdb Exp $
package com.threerings.getdown.launcher; package com.threerings.getdown.launcher;
@@ -49,15 +49,20 @@ public class StatusPanel extends JComponent
{ {
_progress = percent; _progress = percent;
String msg = "m.complete"; String msg = "m.complete";
int minutes = 0, seconds = 0; String remstr = "";
if (remaining > 1) { if (remaining > 1) {
msg = "m.complete_remain"; msg = "m.complete_remain";
minutes = (int)(remaining / 60); int minutes = (int)(remaining / 60);
seconds = (int)(remaining % 60); int seconds = (int)(remaining % 60);
remstr = minutes + ":";
if (seconds < 10) {
remstr += "0";
}
remstr += seconds;
} }
msg = get(msg); msg = get(msg);
String label = MessageFormat.format(msg, new Object[] { String label = MessageFormat.format(msg, new Object[] {
new Integer(percent), new Integer(minutes), new Integer(seconds) }); new Integer(percent), remstr });
_newplab = new Label(label, _ifc.progressText, _pfont); _newplab = new Label(label, _ifc.progressText, _pfont);
repaint(); repaint();
} }
@@ -1,5 +1,5 @@
# #
# $Id: messages.properties,v 1.5 2004/07/26 17:52:31 mdb Exp $ # $Id: messages.properties,v 1.6 2004/07/26 18:05:55 mdb Exp $
# #
# Getdown translation messages # Getdown translation messages
@@ -13,7 +13,7 @@ m.patching = Patching...
m.launching = Launching... m.launching = Launching...
m.complete = {0}% complete m.complete = {0}% complete
m.complete_remain = {0}% complete {1}:{2} remaining m.complete_remain = {0}% complete {1} remaining
m.updating_metadata = Downloading control files... m.updating_metadata = Downloading control files...