parent
accfa782b2
commit
d886c7d113
|
@ -74,7 +74,7 @@ public class JoystickBottomPanel extends JPanel
|
|||
{
|
||||
if (aComboBox == null)
|
||||
{
|
||||
aComboBox = new KeySelectionComboBox();
|
||||
aComboBox = new KeySelectionComboBox(this.model);
|
||||
aComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -90,7 +90,7 @@ public class JoystickBottomPanel extends JPanel
|
|||
{
|
||||
if (bComboBox == null)
|
||||
{
|
||||
bComboBox = new KeySelectionComboBox();
|
||||
bComboBox = new KeySelectionComboBox(this.model);
|
||||
bComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -106,7 +106,7 @@ public class JoystickBottomPanel extends JPanel
|
|||
{
|
||||
if (cComboBox == null)
|
||||
{
|
||||
cComboBox = new KeySelectionComboBox();
|
||||
cComboBox = new KeySelectionComboBox(this.model);
|
||||
cComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
|
|
@ -36,6 +36,7 @@ public class JoystickPanel extends JPanel
|
|||
private JTextField configTextField;
|
||||
|
||||
private JoystickModel model;
|
||||
private JPanel configPanel;
|
||||
|
||||
public JoystickPanel(int portnumber, JoystickModel model)
|
||||
{
|
||||
|
@ -102,18 +103,13 @@ public class JoystickPanel extends JPanel
|
|||
gbc_joystickBottomPanel.gridx = 0;
|
||||
gbc_joystickBottomPanel.gridy = 5;
|
||||
add(getJoystickBottomPanel(), gbc_joystickBottomPanel);
|
||||
GridBagConstraints gbc_configLabel = new GridBagConstraints();
|
||||
gbc_configLabel.anchor = GridBagConstraints.EAST;
|
||||
gbc_configLabel.insets = new Insets(0, 0, 0, 5);
|
||||
gbc_configLabel.gridx = 0;
|
||||
gbc_configLabel.gridy = 6;
|
||||
add(getConfigLabel(), gbc_configLabel);
|
||||
GridBagConstraints gbc_configTextField = new GridBagConstraints();
|
||||
gbc_configTextField.insets = new Insets(0, 0, 0, 5);
|
||||
gbc_configTextField.fill = GridBagConstraints.HORIZONTAL;
|
||||
gbc_configTextField.gridx = 1;
|
||||
gbc_configTextField.gridy = 6;
|
||||
add(getConfigTextField(), gbc_configTextField);
|
||||
GridBagConstraints gbc_configPanel = new GridBagConstraints();
|
||||
gbc_configPanel.fill = GridBagConstraints.HORIZONTAL;
|
||||
gbc_configPanel.insets = new Insets(0, 0, 0, 5);
|
||||
gbc_configPanel.gridx = 0;
|
||||
gbc_configPanel.gridwidth = 3;
|
||||
gbc_configPanel.gridy = 6;
|
||||
add(getConfigPanel(), gbc_configPanel);
|
||||
if (!Beans.isDesignTime())
|
||||
{
|
||||
model.addPropertyChangeListener((e) -> modelChanged());
|
||||
|
@ -161,7 +157,7 @@ public class JoystickPanel extends JPanel
|
|||
{
|
||||
if (leftFireComboBox == null)
|
||||
{
|
||||
leftFireComboBox = new KeySelectionComboBox();
|
||||
leftFireComboBox = new KeySelectionComboBox(this.model);
|
||||
leftFireComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -189,7 +185,7 @@ public class JoystickPanel extends JPanel
|
|||
{
|
||||
if (rightFireComboBox == null)
|
||||
{
|
||||
rightFireComboBox = new KeySelectionComboBox();
|
||||
rightFireComboBox = new KeySelectionComboBox(this.model);
|
||||
rightFireComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -205,7 +201,7 @@ public class JoystickPanel extends JPanel
|
|||
{
|
||||
if (tlComboBox == null)
|
||||
{
|
||||
tlComboBox = new KeySelectionComboBox();
|
||||
tlComboBox = new KeySelectionComboBox(this.model);
|
||||
tlComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -221,7 +217,7 @@ public class JoystickPanel extends JPanel
|
|||
{
|
||||
if (trComboBox == null)
|
||||
{
|
||||
trComboBox = new KeySelectionComboBox();
|
||||
trComboBox = new KeySelectionComboBox(this.model);
|
||||
trComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -283,4 +279,26 @@ public class JoystickPanel extends JPanel
|
|||
}
|
||||
return configTextField;
|
||||
}
|
||||
private JPanel getConfigPanel() {
|
||||
if (configPanel == null) {
|
||||
configPanel = new JPanel();
|
||||
GridBagLayout gbl_configPanel = new GridBagLayout();
|
||||
configPanel.setLayout(gbl_configPanel);
|
||||
GridBagConstraints gbc_configLabel = new GridBagConstraints();
|
||||
gbc_configLabel.anchor = GridBagConstraints.WEST;
|
||||
gbc_configLabel.insets = new Insets(0, 10, 0, 5);
|
||||
gbc_configLabel.gridx = 0;
|
||||
gbc_configLabel.gridy = 0;
|
||||
configPanel.add(getConfigLabel(), gbc_configLabel);
|
||||
GridBagConstraints gbc_configTextField = new GridBagConstraints();
|
||||
gbc_configTextField.insets = new Insets(0, 0, 0, 20);
|
||||
gbc_configTextField.fill = GridBagConstraints.HORIZONTAL;
|
||||
gbc_configTextField.weightx = 1.0;
|
||||
gbc_configTextField.anchor = GridBagConstraints.NORTHWEST;
|
||||
gbc_configTextField.gridx = 1;
|
||||
gbc_configTextField.gridy = 0;
|
||||
configPanel.add(getConfigTextField(), gbc_configTextField);
|
||||
}
|
||||
return configPanel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public class JoystickStickPanel extends JPanel
|
|||
{
|
||||
if (upComboBox == null)
|
||||
{
|
||||
upComboBox = new KeySelectionComboBox();
|
||||
upComboBox = new KeySelectionComboBox(this.model);
|
||||
upComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -85,7 +85,7 @@ public class JoystickStickPanel extends JPanel
|
|||
{
|
||||
if (leftComboBox == null)
|
||||
{
|
||||
leftComboBox = new KeySelectionComboBox();
|
||||
leftComboBox = new KeySelectionComboBox(this.model);
|
||||
leftComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -101,7 +101,7 @@ public class JoystickStickPanel extends JPanel
|
|||
{
|
||||
if (rightComboBox == null)
|
||||
{
|
||||
rightComboBox = new KeySelectionComboBox();
|
||||
rightComboBox = new KeySelectionComboBox(this.model);
|
||||
rightComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
@ -117,7 +117,7 @@ public class JoystickStickPanel extends JPanel
|
|||
{
|
||||
if (downComboBox == null)
|
||||
{
|
||||
downComboBox = new KeySelectionComboBox();
|
||||
downComboBox = new KeySelectionComboBox(this.model);
|
||||
downComboBox.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent arg0)
|
||||
|
|
|
@ -7,6 +7,8 @@ import java.util.Objects;
|
|||
|
||||
import javax.swing.JComboBox;
|
||||
|
||||
import se.lantz.model.JoystickModel;
|
||||
|
||||
public class KeySelectionComboBox extends JComboBox<String>
|
||||
{
|
||||
|
||||
|
@ -17,9 +19,12 @@ public class KeySelectionComboBox extends JComboBox<String>
|
|||
|
||||
Map<String, String> codeMap = new HashMap<>();
|
||||
|
||||
public KeySelectionComboBox()
|
||||
private JoystickModel model;
|
||||
|
||||
public KeySelectionComboBox(JoystickModel model)
|
||||
{
|
||||
super();
|
||||
this.model = model;
|
||||
setupItemsAndCodes();
|
||||
}
|
||||
|
||||
|
@ -31,50 +36,10 @@ public class KeySelectionComboBox extends JComboBox<String>
|
|||
this.addItem("Left");
|
||||
this.addItem("Right");
|
||||
this.addItem("Fire");
|
||||
this.addItem("F1");
|
||||
this.addItem("F2");
|
||||
this.addItem("F3");
|
||||
this.addItem("F4");
|
||||
this.addItem("F5");
|
||||
this.addItem("F6");
|
||||
this.addItem("F7");
|
||||
this.addItem("F8");
|
||||
this.addItem("A");
|
||||
this.addItem("B");
|
||||
this.addItem("C");
|
||||
this.addItem("D");
|
||||
this.addItem("E");
|
||||
this.addItem("F");
|
||||
this.addItem("G");
|
||||
this.addItem("H");
|
||||
this.addItem("I");
|
||||
this.addItem("J");
|
||||
this.addItem("K");
|
||||
this.addItem("L");
|
||||
this.addItem("M");
|
||||
this.addItem("N");
|
||||
this.addItem("O");
|
||||
this.addItem("P");
|
||||
this.addItem("Q");
|
||||
this.addItem("R");
|
||||
this.addItem("S");
|
||||
this.addItem("T");
|
||||
this.addItem("U");
|
||||
this.addItem("V");
|
||||
this.addItem("W");
|
||||
this.addItem("X");
|
||||
this.addItem("Y");
|
||||
this.addItem("Z");
|
||||
this.addItem("1");
|
||||
this.addItem("2");
|
||||
this.addItem("3");
|
||||
this.addItem("4");
|
||||
this.addItem("5");
|
||||
this.addItem("6");
|
||||
this.addItem("7");
|
||||
this.addItem("8");
|
||||
this.addItem("9");
|
||||
this.addItem("0");
|
||||
for (String code : model.getKeyCodeList())
|
||||
{
|
||||
this.addItem(code);
|
||||
}
|
||||
this.addItem("ARROW LEFT");
|
||||
this.addItem("ARROW UP");
|
||||
this.addItem("THEC64");
|
||||
|
@ -94,32 +59,99 @@ public class KeySelectionComboBox extends JComboBox<String>
|
|||
this.addItem("SHIFT LOCK");
|
||||
this.addItem("SPACE");
|
||||
this.addItem("£ (Pound)");
|
||||
// Codes not matching the text
|
||||
codeMap.put("", "----");
|
||||
codeMap.put("JU", "Up");
|
||||
codeMap.put("JD", "Down");
|
||||
codeMap.put("JL", "Left");
|
||||
codeMap.put("JR", "Right");
|
||||
codeMap.put("JF", "Fire");
|
||||
codeMap.put("AL", "ARROW LEFT");
|
||||
codeMap.put("AU", "ARROW UP");
|
||||
codeMap.put("CM", "THEC64");
|
||||
codeMap.put("CO", ", (Comma)");
|
||||
codeMap.put("CT", "CTRL");
|
||||
codeMap.put("CU", "Cursor Up");
|
||||
codeMap.put("CD", "Cursor Down");
|
||||
codeMap.put("CL", "Cursor Left");
|
||||
codeMap.put("CR", "Cursor Right");
|
||||
codeMap.put("DL", "INST/DEL");
|
||||
codeMap.put("EN", "RETURN");
|
||||
codeMap.put("HM", "CLR/HOME");
|
||||
codeMap.put("RS", "RUN/STOP");
|
||||
codeMap.put("RE", "RESTORE");
|
||||
codeMap.put("SL", "Left SHIFT");
|
||||
codeMap.put("SR", "Right SHIFT");
|
||||
codeMap.put("SS", "SHIFT LOCK");
|
||||
codeMap.put("SP", "SPACE");
|
||||
codeMap.put("PO", "£ (Pound)");
|
||||
|
||||
codeMap = model.getKeyCodeMap();
|
||||
|
||||
//
|
||||
// this.addItem("F1");
|
||||
// this.addItem("F2");
|
||||
// this.addItem("F3");
|
||||
// this.addItem("F4");
|
||||
// this.addItem("F5");
|
||||
// this.addItem("F6");
|
||||
// this.addItem("F7");
|
||||
// this.addItem("F8");
|
||||
// this.addItem("A");
|
||||
// this.addItem("B");
|
||||
// this.addItem("C");
|
||||
// this.addItem("D");
|
||||
// this.addItem("E");
|
||||
// this.addItem("F");
|
||||
// this.addItem("G");
|
||||
// this.addItem("H");
|
||||
// this.addItem("I");
|
||||
// this.addItem("J");
|
||||
// this.addItem("K");
|
||||
// this.addItem("L");
|
||||
// this.addItem("M");
|
||||
// this.addItem("N");
|
||||
// this.addItem("O");
|
||||
// this.addItem("P");
|
||||
// this.addItem("Q");
|
||||
// this.addItem("R");
|
||||
// this.addItem("S");
|
||||
// this.addItem("T");
|
||||
// this.addItem("U");
|
||||
// this.addItem("V");
|
||||
// this.addItem("W");
|
||||
// this.addItem("X");
|
||||
// this.addItem("Y");
|
||||
// this.addItem("Z");
|
||||
// this.addItem("1");
|
||||
// this.addItem("2");
|
||||
// this.addItem("3");
|
||||
// this.addItem("4");
|
||||
// this.addItem("5");
|
||||
// this.addItem("6");
|
||||
// this.addItem("7");
|
||||
// this.addItem("8");
|
||||
// this.addItem("9");
|
||||
// this.addItem("0");
|
||||
// this.addItem("ARROW LEFT");
|
||||
// this.addItem("ARROW UP");
|
||||
// this.addItem("THEC64");
|
||||
// this.addItem(", (Comma)");
|
||||
// this.addItem("CTRL");
|
||||
// this.addItem("Cursor Up");
|
||||
// this.addItem("Cursor Down");
|
||||
// this.addItem("Cursor Left");
|
||||
// this.addItem("Cursor Right");
|
||||
// this.addItem("INST/DEL");
|
||||
// this.addItem("RETURN");
|
||||
// this.addItem("CLR/HOME");
|
||||
// this.addItem("RUN/STOP");
|
||||
// this.addItem("RESTORE");
|
||||
// this.addItem("Left SHIFT");
|
||||
// this.addItem("Right SHIFT");
|
||||
// this.addItem("SHIFT LOCK");
|
||||
// this.addItem("SPACE");
|
||||
// this.addItem("£ (Pound)");
|
||||
// // Codes not matching the text
|
||||
// codeMap.put("", "----");
|
||||
// codeMap.put("JU", "Up");
|
||||
// codeMap.put("JD", "Down");
|
||||
// codeMap.put("JL", "Left");
|
||||
// codeMap.put("JR", "Right");
|
||||
// codeMap.put("JF", "Fire");
|
||||
// codeMap.put("AL", "ARROW LEFT");
|
||||
// codeMap.put("AU", "ARROW UP");
|
||||
// codeMap.put("CM", "THEC64");
|
||||
// codeMap.put("CO", ", (Comma)");
|
||||
// codeMap.put("CT", "CTRL");
|
||||
// codeMap.put("CU", "Cursor Up");
|
||||
// codeMap.put("CD", "Cursor Down");
|
||||
// codeMap.put("CL", "Cursor Left");
|
||||
// codeMap.put("CR", "Cursor Right");
|
||||
// codeMap.put("DL", "INST/DEL");
|
||||
// codeMap.put("EN", "RETURN");
|
||||
// codeMap.put("HM", "CLR/HOME");
|
||||
// codeMap.put("RS", "RUN/STOP");
|
||||
// codeMap.put("RE", "RESTORE");
|
||||
// codeMap.put("SL", "Left SHIFT");
|
||||
// codeMap.put("SR", "Right SHIFT");
|
||||
// codeMap.put("SS", "SHIFT LOCK");
|
||||
// codeMap.put("SP", "SPACE");
|
||||
// codeMap.put("PO", "£ (Pound)");
|
||||
}
|
||||
|
||||
public void setSelectedCode(String code)
|
||||
|
|
|
@ -20,6 +20,7 @@ import javax.swing.JPopupMenu;
|
|||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JSplitPane;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import se.lantz.gui.gameview.GameViewManager;
|
||||
import se.lantz.model.MainViewModel;
|
||||
|
@ -157,10 +158,10 @@ public class MainPanel extends JPanel
|
|||
};
|
||||
list.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
|
||||
|
||||
list.addListSelectionListener((e) -> {
|
||||
if (e.getValueIsAdjusting() == false)
|
||||
list.addListSelectionListener(e -> {
|
||||
if (!e.getValueIsAdjusting())
|
||||
{
|
||||
getGameDetailsBackgroundPanel().updateSelectedGame(list.getSelectedValue());
|
||||
SwingUtilities.invokeLater(() -> getGameDetailsBackgroundPanel().updateSelectedGame(list.getSelectedValue()));
|
||||
}
|
||||
});
|
||||
list.setModel(uiModel.getGameListModel());
|
||||
|
|
|
@ -4,7 +4,9 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class JoystickModel extends AbstractModel
|
||||
|
@ -16,10 +18,98 @@ public class JoystickModel extends AbstractModel
|
|||
private List<String> configList = new ArrayList<>();
|
||||
private ActionListener primaryListener;
|
||||
|
||||
private Map<String, String> keyCodeMap = new HashMap<>();
|
||||
private List<String> keyCodeList = new ArrayList<>();
|
||||
|
||||
public JoystickModel(boolean port1)
|
||||
{
|
||||
this.port1 = port1;
|
||||
setupKeyKodes();
|
||||
}
|
||||
|
||||
private void setupKeyKodes()
|
||||
{
|
||||
keyCodeList.add("F1");
|
||||
keyCodeList.add("F2");
|
||||
keyCodeList.add("F3");
|
||||
keyCodeList.add("F4");
|
||||
keyCodeList.add("F5");
|
||||
keyCodeList.add("F6");
|
||||
keyCodeList.add("F7");
|
||||
keyCodeList.add("F8");
|
||||
keyCodeList.add("A");
|
||||
keyCodeList.add("B");
|
||||
keyCodeList.add("C");
|
||||
keyCodeList.add("D");
|
||||
keyCodeList.add("E");
|
||||
keyCodeList.add("F");
|
||||
keyCodeList.add("G");
|
||||
keyCodeList.add("H");
|
||||
keyCodeList.add("I");
|
||||
keyCodeList.add("J");
|
||||
keyCodeList.add("K");
|
||||
keyCodeList.add("L");
|
||||
keyCodeList.add("M");
|
||||
keyCodeList.add("N");
|
||||
keyCodeList.add("O");
|
||||
keyCodeList.add("P");
|
||||
keyCodeList.add("Q");
|
||||
keyCodeList.add("R");
|
||||
keyCodeList.add("S");
|
||||
keyCodeList.add("T");
|
||||
keyCodeList.add("U");
|
||||
keyCodeList.add("V");
|
||||
keyCodeList.add("W");
|
||||
keyCodeList.add("X");
|
||||
keyCodeList.add("Y");
|
||||
keyCodeList.add("Z");
|
||||
keyCodeList.add("1");
|
||||
keyCodeList.add("2");
|
||||
keyCodeList.add("3");
|
||||
keyCodeList.add("4");
|
||||
keyCodeList.add("5");
|
||||
keyCodeList.add("6");
|
||||
keyCodeList.add("7");
|
||||
keyCodeList.add("8");
|
||||
keyCodeList.add("9");
|
||||
keyCodeList.add("0");
|
||||
|
||||
// Codes not matching the text
|
||||
keyCodeMap.put("", "----");
|
||||
keyCodeMap.put("JU", "Up");
|
||||
keyCodeMap.put("JD", "Down");
|
||||
keyCodeMap.put("JL", "Left");
|
||||
keyCodeMap.put("JR", "Right");
|
||||
keyCodeMap.put("JF", "Fire");
|
||||
keyCodeMap.put("AL", "ARROW LEFT");
|
||||
keyCodeMap.put("AU", "ARROW UP");
|
||||
keyCodeMap.put("CM", "THEC64");
|
||||
keyCodeMap.put("CO", ", (Comma)");
|
||||
keyCodeMap.put("CT", "CTRL");
|
||||
keyCodeMap.put("CU", "Cursor Up");
|
||||
keyCodeMap.put("CD", "Cursor Down");
|
||||
keyCodeMap.put("CL", "Cursor Left");
|
||||
keyCodeMap.put("CR", "Cursor Right");
|
||||
keyCodeMap.put("DL", "INST/DEL");
|
||||
keyCodeMap.put("EN", "RETURN");
|
||||
keyCodeMap.put("HM", "CLR/HOME");
|
||||
keyCodeMap.put("RS", "RUN/STOP");
|
||||
keyCodeMap.put("RE", "RESTORE");
|
||||
keyCodeMap.put("SL", "Left SHIFT");
|
||||
keyCodeMap.put("SR", "Right SHIFT");
|
||||
keyCodeMap.put("SS", "SHIFT LOCK");
|
||||
keyCodeMap.put("SP", "SPACE");
|
||||
keyCodeMap.put("PO", "£ (Pound)");
|
||||
}
|
||||
|
||||
public List<String> getKeyCodeList()
|
||||
{
|
||||
return keyCodeList;
|
||||
}
|
||||
|
||||
public Map<String, String> getKeyCodeMap()
|
||||
{
|
||||
return keyCodeMap;
|
||||
}
|
||||
|
||||
public String getConfigString()
|
||||
|
@ -75,37 +165,46 @@ public class JoystickModel extends AbstractModel
|
|||
|
||||
public void setConfigString(String configString)
|
||||
{
|
||||
disableChangeNotification(true);
|
||||
String definitions = configString;
|
||||
// Set all other fields based on configString
|
||||
String[] colonSplit = configString.split(":");
|
||||
if (colonSplit.length != 3)
|
||||
if (colonSplit.length == 3)
|
||||
{
|
||||
throw new IllegalStateException("Invalid config string");
|
||||
definitions = colonSplit[2];
|
||||
setPrimary(colonSplit[1].contains("*"));
|
||||
}
|
||||
configList.clear();
|
||||
|
||||
configList = new ArrayList<>(Arrays.asList(colonSplit[2].split(",")));
|
||||
while (configList.size() < 15)
|
||||
ArrayList<String> newConfigList = new ArrayList<>(Arrays.asList(definitions.split(",")));
|
||||
while (newConfigList.size() < 15)
|
||||
{
|
||||
configList.add("");
|
||||
newConfigList.add("");
|
||||
}
|
||||
disableChangeNotification(true);
|
||||
setUp(configList.get(0));
|
||||
setDown(configList.get(1));
|
||||
setLeft(configList.get(2));
|
||||
setRight(configList.get(3));
|
||||
setLeftFire(configList.get(4));
|
||||
setRightFire(configList.get(5));
|
||||
setTl(configList.get(6));
|
||||
setTr(configList.get(7));
|
||||
setUnused1(configList.get(8));
|
||||
setA(configList.get(9));
|
||||
setB(configList.get(10));
|
||||
setC(configList.get(11));
|
||||
setUnused2(configList.get(12));
|
||||
setUnused3(configList.get(13));
|
||||
setUnused4(configList.get(14));
|
||||
//Validate all entries
|
||||
for (int i = 0; i < newConfigList.size(); i++)
|
||||
{
|
||||
String value = newConfigList.get(i);
|
||||
if (!keyCodeList.contains(value) && !keyCodeMap.keySet().contains(value))
|
||||
{
|
||||
newConfigList.set(i, "");
|
||||
}
|
||||
}
|
||||
setUp(newConfigList.get(0));
|
||||
setDown(newConfigList.get(1));
|
||||
setLeft(newConfigList.get(2));
|
||||
setRight(newConfigList.get(3));
|
||||
setLeftFire(newConfigList.get(4));
|
||||
setRightFire(newConfigList.get(5));
|
||||
setTl(newConfigList.get(6));
|
||||
setTr(newConfigList.get(7));
|
||||
setUnused1(newConfigList.get(8));
|
||||
setA(newConfigList.get(9));
|
||||
setB(newConfigList.get(10));
|
||||
setC(newConfigList.get(11));
|
||||
setUnused2(newConfigList.get(12));
|
||||
setUnused3(newConfigList.get(13));
|
||||
setUnused4(newConfigList.get(14));
|
||||
|
||||
setPrimary(colonSplit[1].contains("*"));
|
||||
disableChangeNotification(false);
|
||||
notifyChange();
|
||||
}
|
||||
|
|
|
@ -1,30 +1,34 @@
|
|||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>pcusb.log</file>
|
||||
<append>true</append>
|
||||
<!-- set immediateFlush to false for much higher logging throughput -->
|
||||
<immediateFlush>true</immediateFlush>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>pcusb-%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<maxHistory>30</maxHistory>
|
||||
<totalSizeCap>1Mb</totalSizeCap>
|
||||
</rollingPolicy>
|
||||
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<maxFileSize>1MB</maxFileSize>
|
||||
</triggeringPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="debug">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
<appender name="STDOUT"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>pcusb.log</file>
|
||||
<rollingPolicy
|
||||
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>pcusb-%d{yyyy-MM-dd}_%i.log</fileNamePattern>
|
||||
<maxHistory>5</maxHistory>
|
||||
<totalSizeCap>30MB</totalSizeCap>
|
||||
<timeBasedFileNamingAndTriggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<!-- or whenever the file size reaches 5MB -->
|
||||
<maxFileSize>5MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="debug">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</configuration>
|
Loading…
Reference in New Issue