Changeset 856 for java/installer2/src/net
- Timestamp:
- May 3, 2013, 4:13:54 PM (12 years ago)
- Location:
- java/installer2/src/net/oni2/aeinstaller
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
java/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.java
r852 r856 11 11 import javax.swing.JDialog; 12 12 import javax.swing.JOptionPane; 13 import javax.swing.JTextField; 13 14 import javax.swing.KeyStroke; 14 15 import javax.swing.UIManager; … … 42 43 private JCheckBox chkCopyOutro; 43 44 45 private JCheckBox chkUseProxy; 46 private JTextField txtProxyHost; 47 private JTextField txtProxyPort; 48 44 49 /** 45 50 * Open the settings … … 70 75 private void initValues() { 71 76 SettingsManager set = SettingsManager.getInstance(); 77 ProxySettings prox = ProxySettings.getInstance(); 72 78 73 79 laFModel = new LaFComboModel(); … … 79 85 chkCopyIntro.setSelected(set.get("copyintro", false)); 80 86 chkCopyOutro.setSelected(set.get("copyoutro", true)); 87 88 chkUseProxy.setSelected(prox.isUseProxy()); 89 txtProxyHost.setText(prox.getHostOrIp()); 90 txtProxyPort.setText(String.valueOf(prox.getPort())); 81 91 } 82 92 83 93 @SuppressWarnings("unused") 84 94 private boolean save() { 95 96 boolean proxyUse = chkUseProxy.isSelected(); 97 int proxyPort = -1; 98 try { 99 proxyPort = Integer.valueOf(txtProxyPort.getText()); 100 } catch (NumberFormatException e) { 101 } 102 if ((proxyPort < 1) || (proxyPort > 65535)) { 103 JOptionPane.showMessageDialog(this, 104 bundle.getString("proxyIllegalPort.text"), 105 bundle.getString("proxyIllegalPort.title"), 106 JOptionPane.ERROR_MESSAGE); 107 return false; 108 } 109 String proxyHost = txtProxyHost.getText(); 110 111 ProxySettings prox = ProxySettings.getInstance(); 112 if (!prox.getHostOrIp().equalsIgnoreCase(proxyHost) 113 || (prox.getPort() != proxyPort) 114 || (prox.isUseProxy() != proxyUse)) { 115 boolean proxyOldUse = prox.isUseProxy(); 116 int proxyOldPort = prox.getPort(); 117 String proxyOldHost = prox.getHostOrIp(); 118 119 prox.setUseProxy(proxyUse); 120 prox.setHostOrIp(proxyHost); 121 prox.setPort(proxyPort); 122 if (!prox.validate()) { 123 JOptionPane.showMessageDialog(this, 124 bundle.getString("proxyVerifyFailed.text"), 125 bundle.getString("proxyVerifyFailed.title"), 126 JOptionPane.ERROR_MESSAGE); 127 prox.setUseProxy(proxyOldUse); 128 prox.setHostOrIp(proxyOldHost); 129 prox.setPort(proxyOldPort); 130 return false; 131 } 132 133 prox.serializeToFile(Paths.getProxySettingsFilename()); 134 } 135 85 136 SettingsManager set = SettingsManager.getInstance(); 86 137 … … 102 153 JOptionPane.INFORMATION_MESSAGE); 103 154 } 104 105 ProxySettings prox = ProxySettings.getInstance();106 prox.serializeToFile(Paths.getProxySettingsFilename());107 155 108 156 return true; 109 157 } 110 111 158 } -
java/installer2/src/net/oni2/aeinstaller/gui/settings/SettingsDialog.yml
r850 r856 21 21 >chkCopyIntro [pref] 22 22 >chkCopyOutro [pref] 23 - JPanel(name=panProxy, groupTitle=panProxy): 24 - JLabel(name=empty) 25 - JCheckBox(name=chkUseProxy, horizontalTextPosition=LEADING, text=chkUseProxy) 26 - JLabel(name=lblProxyHost, text=lblProxyHost) 27 - JTextField(name=txtProxyHost) 28 - JLabel(name=lblProxyPort, text=lblProxyPort) 29 - JTextField(name=txtProxyPort) 30 - MigLayout: | 31 [min] [18] [grow] 32 >chkUseProxy+2 empty [pref] 33 >lblProxyHost txtProxyHost+* [pref] 34 >lblProxyPort txtProxyPort+* [pref] 23 35 - JPanel(name=panUI, groupTitle=panUI): 24 36 - JLabel(name=lblLaF, text=lblLaF) … … 30 42 [grow] 31 43 panCommon [pref] 44 panProxy [pref] 32 45 panUI [pref] 33 46 >btnOk+*=1,btnCancel=1 [min] -
java/installer2/src/net/oni2/aeinstaller/localization/SettingsDialog.properties
r656 r856 6 6 lblLaF=GUI theme: 7 7 8 panCommon=Common settings8 panCommon=Common 9 9 lblNotifyOnStart=Notify about updates on startup: 10 10 lblNotifyDepsAfterInstall=Only notify about dependencies after installation: … … 19 19 lblCopyOutro=Enable ending video on installation: 20 20 21 panProxy=Proxy 22 chkUseProxy=Use proxy: 23 lblProxyHost=Hostname or IP: 24 lblProxyPort=Port number: 25 26 proxyIllegalPort.text=The value entered for the proxy port number has to be an integer number between 1 and 65535. 27 proxyIllegalPort.title=Invalid port number 28 proxyVerifyFailed.text=No connection could be established to the given host+port combination.\nEither disable proxy usage or correct the data entered. 29 proxyVerifyFailed.title=Verifying proxy settings failed 30 21 31 newLaF.text=A new GUI theme was selected.\nPlease restart the application in order to apply the changes. 22 32 newLaF.title=Restart to apply theme
Note:
See TracChangeset
for help on using the changeset viewer.