Changeset 34512 in osm for applications/editors/josm/plugins/geochat/src
- Timestamp:
- 2018-08-18T17:21:22+02:00 (6 years ago)
- Location:
- applications/editors/josm/plugins/geochat/src/geochat
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/geochat/src/geochat/ChatPaneManager.java
r33796 r34512 23 23 import javax.swing.text.StyleConstants; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.gui.util.GuiHelper; 26 import org.openstreetmap.josm.spi.preferences.Config; 27 27 import org.openstreetmap.josm.tools.Logging; 28 28 … … 155 155 chatPane.setEditable(false); 156 156 Font font = chatPane.getFont(); 157 float size = Main.pref.getInt("geochat.fontsize", -1);157 float size = Config.getPref().getInt("geochat.fontsize", -1); 158 158 if (size < 6) 159 159 size += font.getSize2D(); -
applications/editors/josm/plugins/geochat/src/geochat/ChatServerConnection.java
r33796 r34512 19 19 import javax.json.JsonObject; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.data.coor.LatLon; 23 22 import org.openstreetmap.josm.data.coor.conversion.DecimalDegreesCoordinateFormat; 24 23 import org.openstreetmap.josm.data.projection.Projection; 24 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 25 25 import org.openstreetmap.josm.gui.MainApplication; 26 26 import org.openstreetmap.josm.gui.MapView; 27 import org.openstreetmap.josm.spi.preferences.Config; 27 28 import org.openstreetmap.josm.tools.Logging; 28 29 … … 88 89 */ 89 90 public void autoLogin(final String userName) { 90 final int uid = Main.pref.getInt("geochat.lastuid", 0);91 final int uid = Config.getPref().getInt("geochat.lastuid", 0); 91 92 if (uid <= 0) { 92 93 if (userName != null && userName.length() > 1) … … 173 174 this.userId = userId; 174 175 this.userName = userName; 175 Main.pref.putInt("geochat.lastuid", userId);176 Config.getPref().putInt("geochat.lastuid", userId); 176 177 for (ChatServerConnectionListener listener : listeners) { 177 178 listener.loggedIn(userName); … … 182 183 ChatServerConnection.this.userId = 0; 183 184 ChatServerConnection.this.userName = null; 184 Main.pref.put("geochat.lastuid", null);185 Config.getPref().put("geochat.lastuid", null); 185 186 for (ChatServerConnectionListener listener : listeners) { 186 187 listener.notLoggedIn(null); … … 280 281 if (getCurrentZoom() < 10) 281 282 return null; 282 Projection proj = Main.getProjection();283 Projection proj = ProjectionRegistry.getProjection(); 283 284 return proj.eastNorth2latlon(MainApplication.getMap().mapView.getCenter()); 284 285 } … … 328 329 @Override 329 330 public void run() { 330 // lastId = Main.pref.getLong("geochat.lastid", 0);331 int interval = Main.pref.getInt("geochat.interval", 2);331 // lastId = Config.getPref().getLong("geochat.lastid", 0); 332 int interval = Config.getPref().getInt("geochat.interval", 2); 332 333 while (!stopping) { 333 334 process(); … … 362 363 // reset messages 363 364 lastId = 0; 364 // Main.pref.put("geochat.lastid", null);365 // Config.getPref().put("geochat.lastid", null); 365 366 needReset = true; 366 367 } else … … 413 414 } 414 415 } 415 // if (lastId > 0 && Main.pref.getBoolean("geochat.store.lastid", true) )416 // Main.pref.putLong("geochat.lastid", lastId);416 // if (lastId > 0 && Config.getPref().getBoolean("geochat.store.lastid", true) ) 417 // Config.getPref().putLong("geochat.lastid", lastId); 417 418 } 418 419 -
applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java
r33796 r34512 34 34 import javax.swing.SwingConstants; 35 35 36 import org.openstreetmap.josm.Main;37 36 import org.openstreetmap.josm.data.Bounds; 38 37 import org.openstreetmap.josm.data.UserIdentityManager; … … 44 43 import org.openstreetmap.josm.gui.layer.MapViewPaintable; 45 44 import org.openstreetmap.josm.gui.util.GuiHelper; 45 import org.openstreetmap.josm.spi.preferences.Config; 46 46 import org.openstreetmap.josm.tools.GBC; 47 47 import org.openstreetmap.josm.tools.Logging; … … 96 96 connection = ChatServerConnection.getInstance(); 97 97 connection.addListener(this); 98 boolean autoLogin = Main.pref.get("geochat.username", null) == null ? false : Main.pref.getBoolean("geochat.autologin", true);98 boolean autoLogin = Config.getPref().get("geochat.username", null) == null ? false : Config.getPref().getBoolean("geochat.autologin", true); 99 99 connection.autoLoginWithDelay(autoLogin ? defaultUserName : null); 100 100 updateTitleAlarm(); … … 102 102 103 103 private String constructUserName() { 104 String userName = Main.pref.get("geochat.username", null); // so the default is null104 String userName = Config.getPref().get("geochat.username", null); // so the default is null 105 105 if (userName == null) 106 106 userName = UserIdentityManager.getInstance().getUserName(); … … 131 131 nameField.setPreferredSize(new Dimension(nameField.getPreferredSize().width, loginButton.getPreferredSize().height)); 132 132 133 final JCheckBox autoLoginBox = new JCheckBox(tr("Enable autologin"), Main.pref.getBoolean("geochat.autologin", true));133 final JCheckBox autoLoginBox = new JCheckBox(tr("Enable autologin"), Config.getPref().getBoolean("geochat.autologin", true)); 134 134 autoLoginBox.addActionListener(new ActionListener() { 135 135 @Override 136 136 public void actionPerformed(ActionEvent e) { 137 Main.pref.putBoolean("geochat.autologin", autoLoginBox.isSelected());137 Config.getPref().putBoolean("geochat.autologin", autoLoginBox.isSelected()); 138 138 } 139 139 }); … … 153 153 public void destroy() { 154 154 try { 155 if ( Main.pref.getBoolean("geochat.logout.on.close", true)) {155 if (Config.getPref().getBoolean("geochat.logout.on.close", true)) { 156 156 connection.removeListener(this); 157 157 connection.bruteLogout(); … … 257 257 @Override 258 258 public void loggedIn(String userName) { 259 Main.pref.put("geochat.username", userName);259 Config.getPref().put("geochat.username", userName); 260 260 if (gcPanel.getComponentCount() == 1) { 261 261 GuiHelper.runInEDTAndWait(new Runnable() { -
applications/editors/josm/plugins/geochat/src/geochat/JsonQueryUtil.java
r33982 r34512 13 13 import javax.json.JsonObject; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.gui.MainApplication; 16 import org.openstreetmap.josm.spi.preferences.Config; 17 17 import org.openstreetmap.josm.tools.Logging; 18 18 … … 32 32 public static JsonObject query(String query) throws IOException { 33 33 try { 34 String serverURL = Main.pref.get("geochat.server", "https://zverik.dev.openstreetmap.org/osmochat.php?action=");34 String serverURL = Config.getPref().get("geochat.server", "https://zverik.dev.openstreetmap.org/osmochat.php?action="); 35 35 URL url = new URL(serverURL + query); 36 36 HttpURLConnection connection = (HttpURLConnection) url.openConnection();
Note:
See TracChangeset
for help on using the changeset viewer.