Formatting code, removed TODO and imports.

This commit is contained in:
Maschell 2017-03-27 20:40:44 +02:00
parent e7fc629bec
commit 72fd042a3a
3 changed files with 13 additions and 20 deletions

View File

@ -52,7 +52,7 @@ public class GuiInputControls extends JPanel implements ActionListener {
private JTextField ipTextBox; private JTextField ipTextBox;
private JPanel ipTextBoxWrap; private JPanel ipTextBoxWrap;
private JLabel statusLabel; private JLabel statusLabel;
private JPanel autoActivateWrap; private JPanel autoActivateWrap;
private JCheckBox cbautoActivateController; private JCheckBox cbautoActivateController;
@ -79,12 +79,11 @@ public class GuiInputControls extends JPanel implements ActionListener {
statusLabel = new JLabel("Ready."); statusLabel = new JLabel("Ready.");
statusLabel.setAlignmentX(Component.CENTER_ALIGNMENT); statusLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
cbautoActivateController = new JCheckBox();
cbautoActivateController = new JCheckBox();
cbautoActivateController.setSelected(Settings.AUTO_ACTIVATE_CONTROLLER); cbautoActivateController.setSelected(Settings.AUTO_ACTIVATE_CONTROLLER);
cbautoActivateController.addActionListener(new ActionListener() { cbautoActivateController.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
boolean selected = ((JCheckBox) e.getSource()).isSelected(); boolean selected = ((JCheckBox) e.getSource()).isSelected();
@ -92,12 +91,12 @@ public class GuiInputControls extends JPanel implements ActionListener {
cbautoActivateController.setSelected(selected); cbautoActivateController.setSelected(selected);
} }
}); });
autoActivateWrap = new JPanel(new FlowLayout()); autoActivateWrap = new JPanel(new FlowLayout());
autoActivateWrap.add(new JLabel("Auto Activate Controller: ")); autoActivateWrap.add(new JLabel("Auto Activate Controller: "));
autoActivateWrap.add(cbautoActivateController); autoActivateWrap.add(cbautoActivateController);
autoActivateWrap.setMaximumSize(new Dimension(1000, 20)); autoActivateWrap.setMaximumSize(new Dimension(1000, 20));
add(Box.createVerticalGlue()); add(Box.createVerticalGlue());
add(ipTextBoxWrap); add(ipTextBoxWrap);

View File

@ -98,7 +98,7 @@ public class ControllerManager {
} catch (ControllerInitializationFailedException e) { } catch (ControllerInitializationFailedException e) {
// e.printStackTrace(); // e.printStackTrace();
} }
break; break;
case XINPUT14: case XINPUT14:
try { try {
c = new XInput14Controller(deviceIdentifier); c = new XInput14Controller(deviceIdentifier);
@ -108,7 +108,7 @@ public class ControllerManager {
break; break;
case XINPUT13: case XINPUT13:
try { try {
c = new XInput13Controller(deviceIdentifier); c = new XInput13Controller(deviceIdentifier);
} catch (ControllerInitializationFailedException e) { } catch (ControllerInitializationFailedException e) {
// e.printStackTrace(); // e.printStackTrace();
} }
@ -117,7 +117,7 @@ public class ControllerManager {
break; break;
} }
if (c != null) { // I don't like that starting the Thread happens here =/ if (c != null) { // I don't like that starting the Thread happens here =/
if(Settings.AUTO_ACTIVATE_CONTROLLER){ if (Settings.AUTO_ACTIVATE_CONTROLLER) {
c.setActive(true); c.setActive(true);
} }
new Thread(c).start(); new Thread(c).start();

View File

@ -26,17 +26,11 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.extern.java.Log; import lombok.extern.java.Log;
import net.ash.HIDToVPADNetworkClient.controller.Controller.ControllerType;
import net.ash.HIDToVPADNetworkClient.util.Settings.Platform;
//TODO autosave IP addr
@Log @Log
public class Settings { public class Settings {
@ -91,11 +85,11 @@ public class Settings {
Settings.ipAddr = prop.getProperty("ipAddr"); Settings.ipAddr = prop.getProperty("ipAddr");
String autoActivatingControllerString = prop.getProperty("autoActivatingController"); String autoActivatingControllerString = prop.getProperty("autoActivatingController");
if(autoActivatingControllerString != null){ //We don't combine the if statements to keep the default value. if (autoActivatingControllerString != null) { // We don't combine the if statements to keep the default value.
if(autoActivatingControllerString.equals("true")){ if (autoActivatingControllerString.equals("true")) {
Settings.AUTO_ACTIVATE_CONTROLLER = true; Settings.AUTO_ACTIVATE_CONTROLLER = true;
}else{ } else {
Settings.AUTO_ACTIVATE_CONTROLLER = false; Settings.AUTO_ACTIVATE_CONTROLLER = false;
} }
} }