diff --git a/src/com/limelight/gui/MainFrame.java b/src/com/limelight/gui/MainFrame.java index 160142c..d37a8e1 100644 --- a/src/com/limelight/gui/MainFrame.java +++ b/src/com/limelight/gui/MainFrame.java @@ -31,6 +31,8 @@ import com.limelight.binding.PlatformBinding; import com.limelight.input.ControllerListener; import com.limelight.nvstream.NvConnection; import com.limelight.nvstream.http.NvHTTP; +import com.limelight.settings.PreferencesManager; +import com.limelight.settings.PreferencesManager.Preferences; public class MainFrame { private JTextField hostField; @@ -59,10 +61,12 @@ public class MainFrame { JPanel centerPane = new JPanel(); centerPane.setLayout(new BoxLayout(centerPane, BoxLayout.Y_AXIS)); + Preferences prefs = PreferencesManager.getPreferences(); + hostField = new JTextField(); hostField.setMaximumSize(new Dimension(Integer.MAX_VALUE, 24)); hostField.setToolTipText("Enter host name or IP address"); - hostField.setText("GeForce PC host"); + hostField.setText(prefs.getHost()); hostField.setSelectionStart(0); hostField.setSelectionEnd(hostField.getText().length()); @@ -144,7 +148,13 @@ public class MainFrame { return new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - Limelight.createInstance(hostField.getText()); + String host = hostField.getText(); + Preferences prefs = PreferencesManager.getPreferences(); + if (!host.equals(prefs.getHost())) { + prefs.setHost(host); + PreferencesManager.writePreferences(prefs); + } + Limelight.createInstance(host); } }; } diff --git a/src/com/limelight/settings/PreferencesManager.java b/src/com/limelight/settings/PreferencesManager.java index 5f31ed3..77215c6 100644 --- a/src/com/limelight/settings/PreferencesManager.java +++ b/src/com/limelight/settings/PreferencesManager.java @@ -48,18 +48,27 @@ public abstract class PreferencesManager { private Resolution res; private boolean fullscreen; + private String host; /** * construcs default preferences: 720p 30Hz fullscreen */ public Preferences() { - this.res = Resolution.RES_720_30; - this.fullscreen = true; + this(Resolution.RES_720_30, true); } public Preferences(Resolution res, boolean fullscreen) { this.res = res; this.fullscreen = fullscreen; + this.host = "GeForce PC host"; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; } public Resolution getResolution() {