source: trunk/src/org/expeditee/gui/UserSettings.java@ 544

Last change on this file since 544 was 544, checked in by jts21, 11 years ago

Updated JfxBrowser to use search engine variable, and also fixed some logic errors in it

File size: 3.3 KB
Line 
1package org.expeditee.gui;
2
3import java.io.File;
4import java.net.URL;
5import java.util.LinkedList;
6import java.util.List;
7
8import org.expeditee.items.Text;
9
10/**
11 * Central class to contain all values that can be set by the user on their
12 * profile frame. These values should be updated only by
13 * FrameUtils.ParseProfile.
14 */
15public abstract class UserSettings {
16
17 public final static String DEFAULT_PROFILE_NAME = "default";
18
19 public static List<Text> Style = new LinkedList<Text>();;
20
21 public static int Gravity = 3;
22
23 public static float ScaleFactor = 1F;
24
25 public static int LineStraightenThreshold = 15;
26
27 public static int NoOpThreshold = 60;
28
29 public static int TitlePosition = 150;
30
31 public static int InitialWidth = 1024;
32
33 public static int InitialHeight = 768;
34
35 public static String ProfileName;
36
37 public static String UserName;
38
39 public static String DefaultFrame = null;
40
41 public static String StatisticsFrameset = null;
42
43 public static String MenuFrame = null;
44
45 public static String HomeFrame = null;
46
47 public static List<String> FrameDirs = new LinkedList<String>();
48
49 public static List<String> ImageDirs = new LinkedList<String>();
50
51 public static boolean AntiAlias = false;
52
53 public static boolean LineHighlight = false;
54
55 public static boolean Logging = false;
56
57 public static boolean LogStats = true;
58
59 public static boolean Threading = true;
60
61 public static Text ItemTemplate = new Text("@ItemTemplate");
62
63 public static Text DotTemplate = new Text("@DotTemplate");
64
65 public static Text AnnotationTemplate = null;
66
67 public static Text CodeCommentTemplate = null;
68
69 public static Text TitleTemplate = null;
70
71 public static Text StatTemplate = null;
72
73 // The URL to prepend to web searches
74 public static final String defaultSearchEngine = "https://duckduckgo.com/?q=";
75 public static String searchEngine = defaultSearchEngine;
76
77 // add default values
78 static {
79 String expeditee_home = System.getProperty("expeditee.home");
80 if (expeditee_home != null) {
81 FrameIO.changeParentFolder(expeditee_home + File.separator);
82 } else {
83 FrameIO.changeParentFolder(getSaveLocation());
84 }
85
86 UserSettings.FrameDirs.add(FrameIO.FRAME_PATH);
87 UserSettings.FrameDirs.add(FrameIO.PUBLIC_PATH);
88 UserSettings.FrameDirs.add(FrameIO.PROFILE_PATH);
89 UserSettings.FrameDirs.add(FrameIO.HELP_PATH);
90 UserSettings.ImageDirs.add(FrameIO.IMAGES_PATH);
91 UserSettings.FrameDirs.add(FrameIO.MESSAGES_PATH);
92 }
93
94 /**
95 * Find the appropriate directory to store application settings in for
96 * the current OS.
97 * This has only been tested on Linux so far, so if it doesn't work it
98 * may need to be modified or reverted. Should return:
99 * Linux: ~/.expeditee
100 * Windows: %appdata%\.expeditee
101 * Mac: ~/Library/Application\ Support/.expeditee
102 * @return the path to store expeditee's settings
103 */
104 public static String getSaveLocation() {
105 String OS=System.getProperty("os.name").toLowerCase();
106 if(OS.indexOf("win")>0) { //windoze
107 return System.getenv("APPDATA")+File.separator+".expeditee"+File.separator;
108 } else if(OS.indexOf("mac")>0) { //mac
109 return System.getProperty("user.home")+File.separator+"Library"+File.separator+"Application Support"+File.separator+".expeditee"+File.separator;
110 } else { //linux or other
111 return System.getProperty("user.home")+File.separator+".expeditee"+File.separator;
112 }
113 }
114}
Note: See TracBrowser for help on using the repository browser.