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

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

New copy/paste handling, add pdfImporter, add dictionary and documentation to resources, other small changes

File size: 3.1 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 // add default values
74 static {
75 String expeditee_home = System.getProperty("expeditee.home");
76 if (expeditee_home != null) {
77 FrameIO.changeParentFolder(expeditee_home + File.separator);
78 } else {
79 FrameIO.changeParentFolder(getSaveLocation());
80 }
81
82 UserSettings.FrameDirs.add(FrameIO.FRAME_PATH);
83 UserSettings.FrameDirs.add(FrameIO.PUBLIC_PATH);
84 UserSettings.FrameDirs.add(FrameIO.PROFILE_PATH);
85 UserSettings.FrameDirs.add(FrameIO.HELP_PATH);
86 UserSettings.ImageDirs.add(FrameIO.IMAGES_PATH);
87 UserSettings.FrameDirs.add(FrameIO.MESSAGES_PATH);
88 }
89
90 /**
91 * Find the appropriate directory to store application settings in for
92 * the current OS.
93 * This has only been tested on Linux so far, so if it doesn't work it
94 * may need to be modified or reverted. Should return:
95 * Linux: ~/.expeditee
96 * Windows: %appdata%\.expeditee
97 * Mac: ~/Library/Application\ Support/.expeditee
98 * @return the path to store expeditee's settings
99 */
100 public static String getSaveLocation() {
101 String OS=System.getProperty("os.name").toLowerCase();
102 if(OS.indexOf("win")>0) { //windoze
103 return System.getenv("APPDATA")+File.separator+".expeditee"+File.separator;
104 } else if(OS.indexOf("mac")>0) { //mac
105 return System.getProperty("user.home")+File.separator+"Library"+File.separator+"Application Support"+File.separator+".expeditee"+File.separator;
106 } else { //linux or other
107 return System.getProperty("user.home")+File.separator+".expeditee"+File.separator;
108 }
109 }
110}
Note: See TracBrowser for help on using the repository browser.