Ticket #18866: 18866.1.patch
| File 18866.1.patch, 5.1 KB (added by , 2 years ago) |
|---|
-
src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java
Subject: [PATCH] #18866 --- IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java b/src/org/openstreetmap/josm/data/preferences/sources/MapPaintPrefHelper.java
a b 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 6 import java.util.ArrayList; 7 import java.util.Arrays;8 7 import java.util.Collection; 8 import java.util.Collections; 9 9 import java.util.List; 10 10 import java.util.Map; 11 11 import java.util.Objects; … … 72 72 } 73 73 Config.getPref().putList("mappaint.style.known-defaults", new ArrayList<>(knownDefaults)); 74 74 75 // XML style is not bundled anymore76 list.removeIf(se -> "resource://styles/standard/elemstyles.xml".equals(se.url));77 78 75 return changed; 79 76 } 80 77 … … 86 83 defJosmMapcss.icon = new ImageProvider("logo").getResource(); 87 84 defJosmMapcss.title = tr("JOSM default (MapCSS)"); 88 85 defJosmMapcss.description = tr("Internal style to be used as base for runtime switchable overlay styles"); 89 ExtendedSourceEntry defPL2 = new ExtendedSourceEntry(type, "potlatch2.mapcss", "resource://styles/standard/potlatch2.mapcss"); 90 defPL2.active = false; 91 defPL2.name = "standard"; 92 defPL2.icon = new ImageProvider("dialogs/mappaint", "pl2_small").getResource(); 93 defPL2.title = tr("Potlatch 2"); 94 defPL2.description = tr("the main Potlatch 2 style"); 95 96 return Arrays.asList(defJosmMapcss, defPL2); 86 return Collections.singletonList(defJosmMapcss); 97 87 } 98 88 99 89 @Override -
src/org/openstreetmap/josm/data/Preferences.java
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 diff --git a/src/org/openstreetmap/josm/data/Preferences.java b/src/org/openstreetmap/josm/data/Preferences.java
a b 900 900 putBoolean("preferences.reset.draw.rawgps.lines", true); 901 901 putInt("draw.rawgps.lines", -1); 902 902 } 903 updateMapPaintKnownDefaults(); 903 904 if (modifiedDefault) { 904 905 try { 905 906 saveDefaults(); … … 911 912 } 912 913 } 913 914 915 /** 916 * Update the known defaults for the map paintstyles. 917 */ 918 private void updateMapPaintKnownDefaults() { 919 final String url = "url"; 920 final String active = "active"; 921 final String potlatch2 = "resource://styles/standard/potlatch2.mapcss"; 922 final String remotePotlatch2 = "https://josm.openstreetmap.de/josmfile?page=Styles/Potlatch2&zip=1"; 923 924 // Remove potlatch2 from the known defaults 925 final List<String> knownDefaults = new ArrayList<>(getList("mappaint.style.known-defaults")); 926 // See #18866: Potlatch 2 internal theme removed in favor of remote theme by Stereo 927 knownDefaults.removeIf(potlatch2::equals); 928 929 // Moved from MapPaintPrefHelper for consistency 930 // XML style is not bundled anymore 931 knownDefaults.removeIf("resource://styles/standard/elemstyles.xml"::equals); 932 putList("mappaint.style.known-defaults", knownDefaults); 933 934 // Replace potlatch2 in the current style entries, but only if it is enabled. Otherwise, remove it. 935 final List<Map<String, String>> styleEntries = new ArrayList<>(getListOfMaps("mappaint.style.entries")); 936 final boolean potlatchEnabled = styleEntries.stream().filter(map -> potlatch2.equals(map.get(url))) 937 .anyMatch(map -> Boolean.parseBoolean(map.get(active))); 938 final boolean remotePotlatch2Present = styleEntries.stream().anyMatch(map -> remotePotlatch2.equals(map.get(url))); 939 // Remove potlatch2 if it is not enabled _or_ the remote potlatch2 version is present 940 styleEntries.removeIf(map -> (!potlatchEnabled || remotePotlatch2Present) && potlatch2.equals(map.get(url))); 941 styleEntries.replaceAll(TreeMap::new); // The maps are initially immutable. 942 for (Map<String, String> map : styleEntries) { 943 if (potlatch2.equals(map.get(url))) { 944 map.put(url, remotePotlatch2); 945 } 946 } 947 putListOfMaps("mappaint.style.entries", styleEntries); 948 } 949 914 950 /** 915 951 * Enables or not the preferences file auto-save mechanism (save each time a setting is changed). 916 952 * This behaviour is enabled by default. -
deleted file resources/styles/standard/potlatch2.mapcss
diff --git a/resources/styles/standard/potlatch2.mapcss b/resources/styles/standard/potlatch2.mapcss deleted file mode 100644 index 88796b06e7d3753f0afcd789ccae63f7be1c92e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@<O00001
