Changeset 25788 in osm for applications/editors/josm/plugins/livegps/src
- Timestamp:
- 2011-04-04T19:47:00+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsSuppressor.java
r23191 r25788 19 19 20 20 /** 21 * Default sleep time is 5 seconds.21 * Default sleep time is 0.5 seconds. 22 22 */ 23 private static final int DEFAULT_SLEEP_TIME = 5; 24 25 /** 26 * The currently used sleepTime. 27 */ 28 private int sleepTime = DEFAULT_SLEEP_TIME; 23 private static final int DEFAULT_SLEEP_TIME = 500; 24 private static final String oldConfigKey = "livegps.refreshinterval"; /* in seconds */ 25 private static final String ConfigKey = "livegps.refresh_interval_msec"; /* in msec */ 26 private int sleepTime; 29 27 30 28 /** … … 62 60 63 61 /** 64 * Retrieve the sleepTime from the configuration. 65 * If no such configuration key exists, it will be initialized here. 62 * Retrieve the sleepTime from the configuration. Be compatible with old 63 * version that stored value in seconds. If no such configuration key exists, 64 * it will be initialized here. 66 65 */ 67 66 private void initSleepTime() { 68 // fetch it from the user setting, or use the default value. 69 int sleepSeconds = 0; 70 sleepSeconds = Main.pref.getInteger("livegps.refreshinterval", 71 DEFAULT_SLEEP_TIME); 67 if ((this.sleepTime = Main.pref.getInteger(ConfigKey, 0)) == 0) { 68 if ((this.sleepTime = Main.pref.getInteger(oldConfigKey, 0)) != 0) { 69 this.sleepTime *= 1000; 70 Main.pref.put(oldConfigKey, null); 71 } else 72 this.sleepTime = DEFAULT_SLEEP_TIME; 73 } 74 72 75 // creates the setting, if none present. 73 Main.pref.putInteger("livegps.refreshinterval", sleepSeconds); 74 75 // convert seconds into milliseconds internally. 76 this.sleepTime = sleepSeconds * 1000; 76 Main.pref.putInteger(ConfigKey, this.sleepTime); 77 77 } 78 78
Note:
See TracChangeset
for help on using the changeset viewer.