[570] | 1 | package org.expeditee.settings;
|
---|
[4] | 2 |
|
---|
[655] | 3 | import java.awt.Color;
|
---|
[4] | 4 | import java.io.File;
|
---|
[572] | 5 | import java.io.FileNotFoundException;
|
---|
| 6 | import java.io.IOException;
|
---|
| 7 | import java.util.ArrayList;
|
---|
[729] | 8 | import java.util.Arrays;
|
---|
[4] | 9 | import java.util.LinkedList;
|
---|
| 10 | import java.util.List;
|
---|
| 11 |
|
---|
[572] | 12 | import org.expeditee.agents.SearchGreenstone;
|
---|
| 13 | import org.expeditee.agents.mail.MailSession;
|
---|
| 14 | import org.expeditee.agents.wordprocessing.JSpellChecker;
|
---|
| 15 | import org.expeditee.gui.AttributeValuePair;
|
---|
| 16 | import org.expeditee.gui.DisplayIO;
|
---|
[571] | 17 | import org.expeditee.gui.Frame;
|
---|
[570] | 18 | import org.expeditee.gui.FrameIO;
|
---|
[571] | 19 | import org.expeditee.gui.FrameUtils;
|
---|
[572] | 20 | import org.expeditee.gui.FreeItems;
|
---|
| 21 | import org.expeditee.gui.MessageBay;
|
---|
[571] | 22 | import org.expeditee.items.Item;
|
---|
[572] | 23 | import org.expeditee.items.ItemUtils;
|
---|
[4] | 24 | import org.expeditee.items.Text;
|
---|
[729] | 25 | import org.expeditee.setting.ArraySetting;
|
---|
[666] | 26 | import org.expeditee.setting.BooleanSetting;
|
---|
| 27 | import org.expeditee.setting.FloatSetting;
|
---|
[655] | 28 | import org.expeditee.setting.FrameSetting;
|
---|
| 29 | import org.expeditee.setting.FunctionSetting;
|
---|
[666] | 30 | import org.expeditee.setting.IntegerSetting;
|
---|
[655] | 31 | import org.expeditee.setting.ListSetting;
|
---|
| 32 | import org.expeditee.setting.Setting;
|
---|
[666] | 33 | import org.expeditee.setting.StringSetting;
|
---|
| 34 | import org.expeditee.setting.TextSetting;
|
---|
[4] | 35 |
|
---|
| 36 | /**
|
---|
| 37 | * Central class to contain all values that can be set by the user on their
|
---|
| 38 | * profile frame. These values should be updated only by
|
---|
| 39 | * FrameUtils.ParseProfile.
|
---|
| 40 | */
|
---|
| 41 | public abstract class UserSettings {
|
---|
[348] | 42 |
|
---|
| 43 | public final static String DEFAULT_PROFILE_NAME = "default";
|
---|
[289] | 44 |
|
---|
[717] | 45 | public static final IntegerSetting Gravity = new IntegerSetting("Distance the cursor has to be from a text item to select the text item", 3);
|
---|
| 46 |
|
---|
[732] | 47 | public static final StringSetting StartFrame = new StringSetting("The frame to go to when Expeditee is started (defaults to the profile frame)", null);
|
---|
| 48 |
|
---|
[572] | 49 | /*
|
---|
[717] | 50 | * Stuff that goes first
|
---|
| 51 | */
|
---|
| 52 | public static final StringSetting HomeFrame = new StringSetting("The home frame", null) {
|
---|
| 53 | @Override
|
---|
| 54 | public boolean setSetting(Text text) {
|
---|
| 55 | if(text.getText().indexOf(':') == -1 || !text.hasLink()) {
|
---|
| 56 | text.setLink(FrameIO.LoadProfile(UserSettings.ProfileName.get()).getName());
|
---|
| 57 | }
|
---|
| 58 | String first = FrameUtils.getLink(text, UserSettings.HomeFrame.get());
|
---|
| 59 | // do not use non-existant frames as the first frame
|
---|
| 60 | if (FrameIO.isValidFrameName(first)) {
|
---|
| 61 | _value = first;
|
---|
| 62 | }
|
---|
| 63 | // warn the user
|
---|
| 64 | else {
|
---|
| 65 | // MessageBay.warningMessage("Home frame: " + first
|
---|
| 66 | // + " is not a valid frame.");
|
---|
| 67 | _value = FrameIO.LoadProfile(UserSettings.ProfileName.get()).getName();
|
---|
| 68 | }
|
---|
| 69 | return true;
|
---|
| 70 | }
|
---|
| 71 | };
|
---|
| 72 | public static final StringSetting DefaultFrame = new StringSetting("The default frame", null) {
|
---|
| 73 | @Override
|
---|
| 74 | public boolean setSetting(Text text) {
|
---|
| 75 | _value = FrameUtils.getLink(text, _value);
|
---|
| 76 | return true;
|
---|
| 77 | }
|
---|
| 78 | };
|
---|
| 79 | public static final IntegerSetting InitialWidth = new IntegerSetting("Initial width of Expeditee window", 1024);
|
---|
| 80 |
|
---|
| 81 | public static final IntegerSetting InitialHeight = new IntegerSetting("Initial height of Expeditee window", 768);
|
---|
| 82 |
|
---|
| 83 | public static final TextSetting ItemTemplate = new TextSetting("Template for normal text items") {
|
---|
| 84 | @Override
|
---|
| 85 | public boolean setSetting(Text text) {
|
---|
| 86 | _value = text.getTemplateForm();
|
---|
| 87 | return true;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | @Override
|
---|
| 91 | public Text generateText() {
|
---|
| 92 | return new Text("ItemTemplate");
|
---|
| 93 | }
|
---|
| 94 | };
|
---|
| 95 | public static final TextSetting AnnotationTemplate = new TextSetting("Template for annotation text items") {
|
---|
| 96 | @Override
|
---|
| 97 | public boolean setSetting(Text text) {
|
---|
| 98 | _value = text.getTemplateForm();
|
---|
| 99 | return true;
|
---|
| 100 | }
|
---|
| 101 | @Override
|
---|
| 102 | public Text generateText() {
|
---|
| 103 | Text t = new Text("AnnotationTemplate");
|
---|
| 104 | t.setColor(Color.gray);
|
---|
| 105 | return t;
|
---|
| 106 | }
|
---|
| 107 | };
|
---|
| 108 |
|
---|
| 109 | public static final TextSetting CommentTemplate = new TextSetting("Template for code comment text items") {
|
---|
| 110 | @Override
|
---|
| 111 | public boolean setSetting(Text text) {
|
---|
| 112 | _value = text.getTemplateForm();
|
---|
| 113 | return true;
|
---|
| 114 | }
|
---|
| 115 | @Override
|
---|
| 116 | public Text generateText() {
|
---|
| 117 | Text t = new Text("CommentTemplate");
|
---|
| 118 | t.setColor(Color.green.darker());
|
---|
| 119 | return t;
|
---|
| 120 | }
|
---|
| 121 | };
|
---|
| 122 |
|
---|
| 123 | public static final TextSetting StatTemplate = new TextSetting("Template for statistics (e.g. extracted attributes) text items") {
|
---|
| 124 | @Override
|
---|
| 125 | public boolean setSetting(Text text) {
|
---|
| 126 | _value = text.getTemplateForm();
|
---|
| 127 | return true;
|
---|
| 128 | }
|
---|
| 129 | @Override
|
---|
| 130 | public Text generateText() {
|
---|
| 131 | Text t = new Text("StatsTemplate");
|
---|
| 132 | t.setColor(Color.BLACK);
|
---|
| 133 | t.setBackgroundColor(new Color(0.9F, 0.9F, 0.9F));
|
---|
| 134 | t.setFamily(Text.MONOSPACED_FONT);
|
---|
| 135 | t.setSize(14);
|
---|
| 136 | return t;
|
---|
| 137 | }
|
---|
| 138 | };
|
---|
| 139 |
|
---|
| 140 | /*
|
---|
[572] | 141 | * General settings (no setter functions)
|
---|
| 142 | */
|
---|
[289] | 143 |
|
---|
[666] | 144 | public static final FloatSetting ScaleFactor = new FloatSetting("Scale Factor for drawing (TODO: does this even do anything?)", 1F);
|
---|
[655] | 145 |
|
---|
[666] | 146 | public static final FloatSetting FormatSpacingMin = new FloatSetting("Minimum spacing ratio", null);
|
---|
[655] | 147 |
|
---|
[666] | 148 | public static final FloatSetting FormatSpacingMax = new FloatSetting("Maximum spacing ratio", null);
|
---|
[4] | 149 |
|
---|
[666] | 150 | public static final IntegerSetting LineStraightenThreshold = new IntegerSetting("Threshold for straightening a line (TODO: does this even do anything?)", 15);
|
---|
[4] | 151 |
|
---|
[666] | 152 | public static final IntegerSetting NoOpThreshold = new IntegerSetting("Distance the cursor may be dragged while clicking before the operation is cancelled", 60);
|
---|
[74] | 153 |
|
---|
[666] | 154 | public static final IntegerSetting TitlePosition = new IntegerSetting("Position of title item in frame (TODO: find whether this is x-offset or y-offset)", 150);
|
---|
[4] | 155 |
|
---|
[666] | 156 | public static final StringSetting ProfileName = new StringSetting("Profile name", FrameIO.ConvertToValidFramesetName(System.getProperty("user.name")));
|
---|
[348] | 157 |
|
---|
[666] | 158 | public static final StringSetting UserName = new StringSetting("User name", ProfileName.get());
|
---|
[655] | 159 |
|
---|
[666] | 160 | public static final BooleanSetting AntiAlias = new BooleanSetting("Whether anti-aliasing should be enabled", false);
|
---|
[572] | 161 |
|
---|
[666] | 162 | public static final BooleanSetting LineHighlight = new BooleanSetting("Whether lines should be highlighted", false);
|
---|
[572] | 163 |
|
---|
[666] | 164 | public static final BooleanSetting Logging = new BooleanSetting("Whether logging should be enabled", false);
|
---|
[572] | 165 |
|
---|
[666] | 166 | public static final BooleanSetting LogStats = new BooleanSetting("Whether stats should be logged", true);
|
---|
[572] | 167 |
|
---|
[666] | 168 | public static final BooleanSetting Threading = new BooleanSetting("Whether threading should be enabled", true);
|
---|
[572] | 169 |
|
---|
| 170 |
|
---|
| 171 | /*
|
---|
| 172 | * Frames
|
---|
| 173 | */
|
---|
[427] | 174 |
|
---|
[666] | 175 | public static final StringSetting StatisticsFrameset = new StringSetting("The statistics frameset", null);
|
---|
[4] | 176 |
|
---|
[666] | 177 | public static final StringSetting MenuFrame = new StringSetting("The menu frame", null);
|
---|
[4] | 178 |
|
---|
[572] | 179 | /*
|
---|
| 180 | * Directories
|
---|
| 181 | */
|
---|
[655] | 182 | public static final ListSetting<String> FrameDirs = new ListSetting<String>("Directories to look in for frames") {
|
---|
| 183 | @Override
|
---|
| 184 | public boolean setSetting(Text text) {
|
---|
| 185 | _value.addAll(FrameUtils.getDirs(text));
|
---|
| 186 | return true;
|
---|
[641] | 187 | }
|
---|
[655] | 188 | };
|
---|
| 189 | public static final Setting FramesetDir = new Setting("Adds a directory to look in for frames") {
|
---|
| 190 | @Override
|
---|
| 191 | public boolean setSetting(Text text) {
|
---|
| 192 | if(text.getText().indexOf(':') == -1) {
|
---|
| 193 | return false;
|
---|
| 194 | }
|
---|
| 195 | AttributeValuePair avp = new AttributeValuePair(text.getText());
|
---|
| 196 | if(avp.getValue().trim().length() != 0) {
|
---|
| 197 | String dir = FrameUtils.getDir(avp.getValue());
|
---|
| 198 | if (dir != null) {
|
---|
| 199 | UserSettings.FrameDirs.get().add(dir);
|
---|
| 200 | return true;
|
---|
| 201 | }
|
---|
| 202 | }
|
---|
| 203 | return false;
|
---|
[639] | 204 | }
|
---|
[655] | 205 | };
|
---|
[4] | 206 |
|
---|
[655] | 207 | public static ListSetting<String> ImageDirs = new ListSetting<String>("Directories to look in for images") {
|
---|
| 208 | @Override
|
---|
| 209 | public boolean setSetting(Text text) {
|
---|
| 210 | _value.addAll(FrameUtils.getDirs(text));
|
---|
| 211 | return true;
|
---|
[641] | 212 | }
|
---|
[655] | 213 | };
|
---|
| 214 | public static final Setting ImageDir = new Setting("Adds a directory to look in for images") {
|
---|
| 215 | @Override
|
---|
| 216 | public boolean setSetting(Text text) {
|
---|
| 217 | if(text.getText().indexOf(':') == -1) {
|
---|
| 218 | return false;
|
---|
| 219 | }
|
---|
| 220 | AttributeValuePair avp = new AttributeValuePair(text.getText());
|
---|
| 221 | if(avp.getValue().trim().length() != 0) {
|
---|
| 222 | String dir = FrameUtils.getDir(avp.getValue());
|
---|
| 223 | if(dir != null) {
|
---|
| 224 | UserSettings.ImageDirs.get().add(0, dir);
|
---|
| 225 | return true;
|
---|
| 226 | }
|
---|
| 227 | }
|
---|
| 228 | return false;
|
---|
[639] | 229 | }
|
---|
[655] | 230 | };
|
---|
[572] | 231 |
|
---|
[655] | 232 | public static final Setting LogDir = new Setting("Set the directory to save logs") {
|
---|
| 233 | @Override
|
---|
| 234 | public boolean setSetting(Text text) {
|
---|
| 235 | if(text.getText().indexOf(':') == -1) {
|
---|
| 236 | return false;
|
---|
| 237 | }
|
---|
| 238 | AttributeValuePair avp = new AttributeValuePair(text.getText());
|
---|
| 239 | if(avp.getValue().trim().length() != 0) {
|
---|
| 240 | FrameIO.LOGS_DIR = FrameUtils.getDir(avp.getValue());
|
---|
| 241 | }
|
---|
| 242 | return true;
|
---|
[641] | 243 | }
|
---|
[655] | 244 | };
|
---|
[4] | 245 |
|
---|
[572] | 246 | /*
|
---|
| 247 | * Templates
|
---|
| 248 | */
|
---|
[666] | 249 | public static final TextSetting TitleTemplate = new TextSetting("Template for Title text item") {
|
---|
| 250 | @Override
|
---|
| 251 | public Text generateText() {
|
---|
[706] | 252 | Text t = new Text("TitleTemplate");
|
---|
| 253 | t.setSize(30);
|
---|
| 254 | t.setFontStyle("Bold");
|
---|
| 255 | t.setFamily("SansSerif");
|
---|
| 256 | t.setColor(Color.BLUE);
|
---|
| 257 | t.setPosition(25, 50);
|
---|
| 258 | return t;
|
---|
[666] | 259 | }
|
---|
| 260 | };
|
---|
[572] | 261 |
|
---|
[666] | 262 | public static final TextSetting DotTemplate = new TextSetting("Template for dot items") {
|
---|
[655] | 263 | @Override
|
---|
| 264 | public boolean setSetting(Text text) {
|
---|
| 265 | _value = text.getTemplateForm();
|
---|
| 266 | return true;
|
---|
| 267 | }
|
---|
[666] | 268 |
|
---|
| 269 | @Override
|
---|
| 270 | public Text generateText() {
|
---|
[677] | 271 | return new Text("DotTemplate");
|
---|
[666] | 272 | }
|
---|
[655] | 273 | };
|
---|
[544] | 274 |
|
---|
[666] | 275 | public static final TextSetting TooltipTemplate = new TextSetting("Template for tooltips") {
|
---|
[664] | 276 | @Override
|
---|
| 277 | public boolean setSetting(Text text) {
|
---|
| 278 | _value = text.getTemplateForm();
|
---|
| 279 | return true;
|
---|
| 280 | }
|
---|
[666] | 281 | @Override
|
---|
| 282 | public Text generateText() {
|
---|
[677] | 283 | Text t = new Text("TooltipTemplate");
|
---|
[666] | 284 | t.setColor(Color.BLACK);
|
---|
| 285 | t.setBackgroundColor(new Color(0.7F, 0.7F, 0.9F));
|
---|
| 286 | // t.setFamily(Text.MONOSPACED_FONT);
|
---|
| 287 | t.setSize(14);
|
---|
| 288 | return t;
|
---|
| 289 | }
|
---|
[664] | 290 | };
|
---|
| 291 |
|
---|
[572] | 292 | /*
|
---|
| 293 | * Colorwheels
|
---|
| 294 | */
|
---|
[729] | 295 | public static final ArraySetting<Color> ColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
| 296 | new Color[] { Color.BLACK, Color.RED, Color.BLUE, Item.GREEN, Color.MAGENTA, Color.YELLOW.darker(), Color.WHITE }) {
|
---|
[655] | 297 | @Override
|
---|
[729] | 298 | public boolean setSetting(Text text) {
|
---|
| 299 | Frame child = text.getChild();
|
---|
| 300 | if (child == null) {
|
---|
| 301 | return false;
|
---|
| 302 | }
|
---|
| 303 | _value = FrameUtils.getColorWheel(child);
|
---|
| 304 | return true;
|
---|
[655] | 305 | }
|
---|
| 306 | };
|
---|
[571] | 307 |
|
---|
[729] | 308 | public static final ArraySetting<Color> FillColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
| 309 | new Color[] { new Color(255, 150, 150), new Color(150, 150, 255), new Color(150, 255, 150),
|
---|
| 310 | new Color(255, 150, 255), new Color(255, 255, 100), Color.WHITE, Color.BLACK }) {
|
---|
[655] | 311 | @Override
|
---|
[729] | 312 | public boolean setSetting(Text text) {
|
---|
| 313 | Frame child = text.getChild();
|
---|
| 314 | if (child == null) {
|
---|
| 315 | return false;
|
---|
| 316 | }
|
---|
| 317 | _value = FrameUtils.getColorWheel(child);
|
---|
| 318 | return true;
|
---|
[655] | 319 | }
|
---|
| 320 | };
|
---|
[571] | 321 |
|
---|
[729] | 322 | public static final ArraySetting<Color> BackgroundColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
| 323 | new Color[] { new Color(235, 235, 235), new Color(225, 225, 255), new Color(195, 255, 255),
|
---|
| 324 | new Color(225, 255, 225), new Color(255, 255, 195), new Color(255, 225, 225),
|
---|
| 325 | new Color(255, 195, 255), Color.WHITE, Color.GRAY, Color.DARK_GRAY, Color.BLACK, null }) {
|
---|
[655] | 326 | @Override
|
---|
[729] | 327 | public boolean setSetting(Text text) {
|
---|
| 328 | Frame child = text.getChild();
|
---|
| 329 | if (child == null) {
|
---|
| 330 | return false;
|
---|
| 331 | }
|
---|
| 332 | _value = FrameUtils.getColorWheel(child);
|
---|
| 333 | return true;
|
---|
[655] | 334 | }
|
---|
| 335 | };
|
---|
[571] | 336 |
|
---|
[572] | 337 | /*
|
---|
| 338 | * Other
|
---|
| 339 | */
|
---|
[655] | 340 | public static final ListSetting<Text> Style = new ListSetting<Text>("Set the style (TODO: what does this do?)") {
|
---|
| 341 | @Override
|
---|
| 342 | public boolean setSetting(Text text) {
|
---|
| 343 | Frame child = text.getChild();
|
---|
| 344 | if (child == null) {
|
---|
| 345 | _value = new LinkedList<Text>();
|
---|
| 346 | return true;
|
---|
| 347 | }
|
---|
| 348 |
|
---|
| 349 |
|
---|
| 350 | List<Text> style = new ArrayList<Text>(8);
|
---|
| 351 | for (int i = 0; i < 10; i++) {
|
---|
| 352 | style.add(null);
|
---|
| 353 | }
|
---|
| 354 |
|
---|
| 355 | for (Text t : child.getBodyTextItems(false)) {
|
---|
| 356 | String type = t.getText();
|
---|
| 357 | char lastChar = type.charAt(type.length() - 1);
|
---|
| 358 | if (Character.isDigit(lastChar)) {
|
---|
| 359 | style.set(lastChar - '0', t);
|
---|
| 360 | } else {
|
---|
| 361 | style.set(0, t);
|
---|
| 362 | }
|
---|
| 363 | }
|
---|
| 364 | _value = style;
|
---|
| 365 | return true;
|
---|
[639] | 366 | }
|
---|
[655] | 367 | };
|
---|
[572] | 368 |
|
---|
[655] | 369 | public static final FunctionSetting SpellChecker = new FunctionSetting("Enables the dictionary with the default dictionary") {
|
---|
| 370 | @Override
|
---|
| 371 | public void run() {
|
---|
| 372 | try {
|
---|
[641] | 373 | JSpellChecker.create();
|
---|
| 374 | } catch (FileNotFoundException e) {
|
---|
[655] | 375 | MessageBay.errorMessage("Could not find dictionary: " + e.getMessage());
|
---|
[641] | 376 | } catch (IOException e) {
|
---|
| 377 | e.printStackTrace();
|
---|
| 378 | }
|
---|
[572] | 379 | }
|
---|
[655] | 380 | };
|
---|
| 381 | public static final FrameSetting Spelling = new FrameSetting("Enables the dictionary and adds the items in the child frame to the dictionary") {
|
---|
| 382 | @Override
|
---|
| 383 | public void run(Frame frame) {
|
---|
| 384 | try {
|
---|
| 385 | JSpellChecker.create(frame);
|
---|
| 386 | } catch (Exception e) {
|
---|
| 387 | e.printStackTrace();
|
---|
| 388 | }
|
---|
[641] | 389 | }
|
---|
[655] | 390 | };
|
---|
[572] | 391 |
|
---|
[655] | 392 | public static final FrameSetting GreenstoneSettings = new FrameSetting("Greenstone settings (TODO: What are these for?)") {
|
---|
| 393 | @Override
|
---|
| 394 | public void run(Frame frame) {
|
---|
| 395 | SearchGreenstone.init(frame);
|
---|
| 396 | }
|
---|
| 397 | };
|
---|
[572] | 398 |
|
---|
[655] | 399 | public static final FrameSetting Reminders = new FrameSetting("Reminders (TODO: What are these for?)") {
|
---|
| 400 | @Override
|
---|
| 401 | public void run(Frame frame) {
|
---|
| 402 | org.expeditee.gui.Reminders.init(frame);
|
---|
[642] | 403 | }
|
---|
[655] | 404 | };
|
---|
[572] | 405 |
|
---|
[655] | 406 | public static final FrameSetting MailSettings = new FrameSetting("Mail Settings (TODO: How does this work?)") {
|
---|
| 407 | @Override
|
---|
| 408 | public void run(Frame frame) {
|
---|
| 409 | MailSession.init(frame);
|
---|
[642] | 410 | }
|
---|
[655] | 411 | };
|
---|
[572] | 412 |
|
---|
[655] | 413 | public static final FrameSetting CursorFrame = new FrameSetting("Items on this frame will be used as the cursor (clearing the frame or removing the link will default back to a normal cursor)") {
|
---|
| 414 | @Override
|
---|
| 415 | public void run(Frame frame) {
|
---|
| 416 | FreeItems.getCursor().addAll(ItemUtils.CopyItems(frame.getAllItems()));
|
---|
[572] | 417 | for (Item i : FreeItems.getCursor()) {
|
---|
| 418 | i.setParent(null);
|
---|
| 419 | }
|
---|
| 420 | DisplayIO.setCursor(Item.HIDDEN_CURSOR);
|
---|
| 421 | DisplayIO.setCursor(Item.DEFAULT_CURSOR);
|
---|
| 422 | }
|
---|
[655] | 423 | };
|
---|
[572] | 424 |
|
---|
| 425 |
|
---|
[4] | 426 | // add default values
|
---|
[355] | 427 | static {
|
---|
[490] | 428 | String expeditee_home = System.getProperty("expeditee.home");
|
---|
| 429 | if (expeditee_home != null) {
|
---|
[504] | 430 | FrameIO.changeParentFolder(expeditee_home + File.separator);
|
---|
| 431 | } else {
|
---|
| 432 | FrameIO.changeParentFolder(getSaveLocation());
|
---|
| 433 | }
|
---|
| 434 |
|
---|
[655] | 435 | UserSettings.FrameDirs.get().add(FrameIO.FRAME_PATH);
|
---|
| 436 | UserSettings.FrameDirs.get().add(FrameIO.PUBLIC_PATH);
|
---|
| 437 | UserSettings.FrameDirs.get().add(FrameIO.PROFILE_PATH);
|
---|
| 438 | UserSettings.FrameDirs.get().add(FrameIO.HELP_PATH);
|
---|
[666] | 439 | UserSettings.FrameDirs.get().add(FrameIO.MESSAGES_PATH);
|
---|
| 440 | UserSettings.FrameDirs.setDefault(UserSettings.FrameDirs.get());
|
---|
[655] | 441 | UserSettings.ImageDirs.get().add(FrameIO.IMAGES_PATH);
|
---|
[666] | 442 | UserSettings.ImageDirs.setDefault(UserSettings.ImageDirs.get());
|
---|
[4] | 443 | }
|
---|
| 444 |
|
---|
| 445 | /**
|
---|
[504] | 446 | * Find the appropriate directory to store application settings in for
|
---|
| 447 | * the current OS.
|
---|
| 448 | * This has only been tested on Linux so far, so if it doesn't work it
|
---|
| 449 | * may need to be modified or reverted. Should return:
|
---|
| 450 | * Linux: ~/.expeditee
|
---|
| 451 | * Windows: %appdata%\.expeditee
|
---|
| 452 | * Mac: ~/Library/Application\ Support/.expeditee
|
---|
| 453 | * @return the path to store expeditee's settings
|
---|
[4] | 454 | */
|
---|
[504] | 455 | public static String getSaveLocation() {
|
---|
| 456 | String OS=System.getProperty("os.name").toLowerCase();
|
---|
| 457 | if(OS.indexOf("win")>0) { //windoze
|
---|
| 458 | return System.getenv("APPDATA")+File.separator+".expeditee"+File.separator;
|
---|
| 459 | } else if(OS.indexOf("mac")>0) { //mac
|
---|
| 460 | return System.getProperty("user.home")+File.separator+"Library"+File.separator+"Application Support"+File.separator+".expeditee"+File.separator;
|
---|
| 461 | } else { //linux or other
|
---|
| 462 | return System.getProperty("user.home")+File.separator+".expeditee"+File.separator;
|
---|
[4] | 463 | }
|
---|
| 464 | }
|
---|
| 465 | }
|
---|