OmegaT の背景に画像を表示します。
設定ファイルのフォーマットを変更
| @@ -29,6 +29,7 @@ | ||
| 29 | 29 | import java.util.Collections; |
| 30 | 30 | import java.util.Comparator; |
| 31 | 31 | import java.util.HashMap; |
| 32 | +import java.util.LinkedHashMap; | |
| 32 | 33 | import java.util.List; |
| 33 | 34 | import java.util.Map; |
| 34 | 35 | import java.util.Set; |
| @@ -150,20 +151,20 @@ | ||
| 150 | 151 | public static ConfigObject getDefaultConfig() { |
| 151 | 152 | // search image files from PrimaryMoeConfigDir |
| 152 | 153 | File parentDir = MoeUtil.getPrimaryMoeConfigDir(); |
| 153 | - String image = getFirstImagePath(parentDir); | |
| 154 | + String imagePath = getFirstImagePath(parentDir); | |
| 154 | 155 | |
| 155 | 156 | // If image file not found, search image files from SecondaryMoeConfigDir |
| 156 | - if (image.isEmpty()) { | |
| 157 | + if (imagePath.isEmpty()) { | |
| 157 | 158 | parentDir = MoeUtil.getSecondaryMoeConfigDir(); |
| 158 | - image = getFirstImagePath(parentDir); | |
| 159 | + imagePath = getFirstImagePath(parentDir); | |
| 159 | 160 | } |
| 160 | 161 | |
| 161 | 162 | // If image file still not found, search image files from PluginJarDir |
| 162 | 163 | // for backward compatibility. |
| 163 | - if (image.isEmpty()) { | |
| 164 | + if (imagePath.isEmpty()) { | |
| 164 | 165 | try { |
| 165 | 166 | parentDir = MoeUtil.getPluginJarDir(); |
| 166 | - image = getFirstImagePath(parentDir); | |
| 167 | + imagePath = getFirstImagePath(parentDir); | |
| 167 | 168 | } catch (URISyntaxException ex) { |
| 168 | 169 | Log.log(ex.getMessage()); |
| 169 | 170 | } |
| @@ -171,6 +172,8 @@ | ||
| 171 | 172 | |
| 172 | 173 | ConfigObject effect = new ConfigObject(); |
| 173 | 174 | effect.put("type", Effect.Type.BasicEffect); |
| 175 | + Map image = new LinkedHashMap<String, Object>(); | |
| 176 | + image.put("path", imagePath); | |
| 174 | 177 | effect.put("image", image); |
| 175 | 178 | |
| 176 | 179 | List<ConfigObject> effects = new ArrayList<ConfigObject>(1); |
| @@ -38,6 +38,7 @@ | ||
| 38 | 38 | private final String KEY_TARGET = "target"; |
| 39 | 39 | private final String KEY_OPACITY = "opacity"; |
| 40 | 40 | private final String KEY_IMAGE = "image"; |
| 41 | + private final String KEY_PATH = "path"; | |
| 41 | 42 | private final String KEY_EXCLUDE = "exclude"; |
| 42 | 43 | |
| 43 | 44 | private Parts target = Parts.MainWindow; |
| @@ -50,12 +51,14 @@ | ||
| 50 | 51 | target = (Parts) config.get(KEY_TARGET); |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | - if (config.containsKey(KEY_OPACITY)) { | |
| 54 | - opacity = (Float) config.get(KEY_OPACITY); | |
| 55 | - } | |
| 56 | - | |
| 57 | 54 | if (config.containsKey(KEY_IMAGE)) { |
| 58 | - image = (String) config.get(KEY_IMAGE); | |
| 55 | + Map conf = (Map) config.get(KEY_IMAGE); | |
| 56 | + if (conf.containsKey(KEY_PATH)) { | |
| 57 | + image = (String) conf.get(KEY_PATH); | |
| 58 | + } | |
| 59 | + if (conf.containsKey(KEY_OPACITY)) { | |
| 60 | + opacity = (Float) conf.get(KEY_OPACITY); | |
| 61 | + } | |
| 59 | 62 | } |
| 60 | 63 | |
| 61 | 64 | if (config.containsKey(KEY_EXCLUDE)) { |