Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Plover's JSON-style config #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Handle Plover's JSON-style config
  • Loading branch information
sachac committed May 12, 2021
commit 5809ec327cb171b1bca9a5ccc34d4bada48c00a5
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -13,4 +13,7 @@ StenoTray.jar: *.class

# No special options should be necessary.
.java.class: $<
javac -source 1.6 -target 1.6 $<
javac -cp .:javax.json-1.0.jar $<

clean:
rm *.jar *.class
Binary file modified StenoTray.jar
Binary file not shown.
18 changes: 16 additions & 2 deletions StenoTray.java
Original file line number Diff line number Diff line change
@@ -17,6 +17,12 @@
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.json.JsonArray;
import javax.json.JsonReader;
import javax.json.Json;
import javax.json.JsonObject;
import java.util.ListIterator;
import java.io.StringReader;

public class StenoTray extends JFrame {
static String mkPath(String path1, String... paths)
@@ -414,8 +420,16 @@ else if (fields[0].trim().equals("DEBUG"))
while (((line = pConfig.readLine()) != null)) {
fields = line.split("=");
if (fields.length >= 2) {
if (fields[0].trim().length() > 15)
if (fields[0].trim().substring(0,15).equals("dictionary_file"))
if (fields[0].trim().equals("dictionaries")) {
JsonReader reader = Json.createReader(new StringReader(fields[1].trim()));
JsonArray list = reader.readArray();
ListIterator l = list.listIterator();
while ( l.hasNext() ) {
JsonObject j = (JsonObject) l.next();
dictionaryFiles.add(mkPath(PLOVER_DIR, j.getString("path")));
}
}
if (fields[0].trim().equals("dictionary_file"))
dictionaryFiles.add(fields[1].trim());
if (fields[0].trim().equals("log_file"))
logFile = fields[1].trim();
Binary file added javax.json-1.0.jar
Binary file not shown.