nick_name_text.setText(_core.getConfigurationManager().getNickName());
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
prompt_on_exit_check = new Button(content,SWT.CHECK);
prompt_on_exit_check.setText(_._("settingswindow.tab.general.checkbox.prompt_on_exit"));
prompt_on_exit_check.setSelection(swt_preferences.promptOnExit());
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
prompt_on_exit_check.setLayoutData(layout_data);
server_list_update = new Button(content,SWT.CHECK);
server_list_update.setText(_._("settingswindow.tab.general.checkbox.update_server_list"));
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
server_list_update.setLayoutData(layout_data);
boolean update = false;
try {
update = config_manager.updateServerListAtConnect();
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
server_list_update.setSelection(update);
startup_update_check = new Button(content,SWT.CHECK);
startup_update_check.setText(_._("settingswindow.tab.general.checkbox.startup_update_check"));
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
startup_update_check.setLayoutData(layout_data);
startup_update_check.setSelection(swt_preferences.updateCheckAtStartup());
connect_at_startup = new Button(content,SWT.CHECK);
connect_at_startup.setText(_._("settingswindow.tab.general.checkbox.connect_at_startup"));
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
connect_at_startup.setLayoutData(layout_data);
connect_at_startup.setSelection(swt_preferences.isConnectAtStartup());
kad_enabled = new Button(content,SWT.CHECK);
kad_enabled.setText(_._("settingswindow.tab.general.checkbox.enable_kad"));
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
kad_enabled.setLayoutData(layout_data);
try {
kad_enabled.setSelection(config_manager.isJKadAutoconnectEnabled());
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
if (JMConstants.IS_NIGHTLY_BUILD) {
show_nightly_build_warning = new Button(content,SWT.CHECK);
show_nightly_build_warning.setText(_._("settingswindow.tab.general.checkbox.show_nightly_build_warning"));
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
show_nightly_build_warning.setLayoutData(layout_data);
show_nightly_build_warning.setSelection(swt_preferences.isNightlyBuildWarning());
}
Group ports = new Group(content,SWT.NONE);
ports.setText(_._("settingswindow.tab.general.group.ports"));
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
ports.setLayoutData(layout_data);
ports.setLayout(new GridLayout(2,false));
label = new Label(ports,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setForeground(skin.getDefaultColor());
label.setText(_._("settingswindow.tab.connection.label.tcp_port") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
tcp_port = new Spinner (ports, SWT.BORDER);
tcp_port.setMinimum(1);
tcp_port.setMaximum(65535);
try {
tcp_port.setSelection(config_manager.getTCP());
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
tcp_port.setIncrement(1);
tcp_port.setPageIncrement(100);
label = new Label(ports,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setForeground(skin.getDefaultColor());
label.setText(_._("settingswindow.tab.connection.label.udp_port") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
Composite container1 = new Composite(ports,SWT.NONE);
container1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
layout = new GridLayout(2,false);
layout.marginWidth=0;
layout.marginHeight=0;
container1.setLayout(layout);
udp_port = new Spinner (container1, SWT.BORDER);
udp_port.setMinimum(1);
udp_port.setMaximum(65535);
try {
udp_port.setSelection(config_manager.getUDP());
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
udp_port.setIncrement(1);
udp_port.setPageIncrement(100);
enable_udp = new Button(container1,SWT.CHECK);
enable_udp.setText(_._("settingswindow.tab.connection.button.enabled"));
enable_udp.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
updateUDPControls();
}
});
try {
enable_udp.setSelection(config_manager.isUDPEnabled());
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
updateUDPControls();
Group limits = new Group(content,SWT.NONE);
limits.setText(_._("settingswindow.tab.general.group.limits"));
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
limits.setLayoutData(layout_data);
limits.setLayout(new GridLayout(2,false));
label = new Label(limits,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setForeground(skin.getDefaultColor());
label.setText(_._("settingswindow.tab.connection.label.download_limit") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
Composite container2 = new Composite(limits,SWT.NONE);
layout_data = new GridData(GridData.FILL_HORIZONTAL);
container2.setLayoutData(layout_data);
layout = new GridLayout(3,false);
layout.marginWidth = 0;
layout.marginHeight = 0;
container2.setLayout(layout);
download_limit = new Text(container2,SWT.BORDER );
download_limit.addListener(SWT.Verify, number_filter);
layout_data = new GridData();
layout_data.widthHint = EDIT_FIELD_WIDTH;
download_limit.setLayoutData(layout_data);
try {
download_limit.setText((config_manager.getDownloadLimit()/1024)+"");
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
new Label(container2,SWT.NONE).setText(_._("settingswindow.tab.connection.label.kb_s"));
enable_download_limit = new Button(container2,SWT.CHECK);
enable_download_limit.setText(_._("settingswindow.tab.connection.button.enabled"));
enable_download_limit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
updateDownloadLimitControls();
}
});
label = new Label(limits,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setForeground(skin.getDefaultColor());
label.setText(_._("settingswindow.tab.connection.label.upload_limit") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
Composite container3 = new Composite(limits,SWT.NONE);
layout_data = new GridData(GridData.FILL_HORIZONTAL);
container3.setLayoutData(layout_data);
layout = new GridLayout(3,false);
layout.marginWidth = 0;
layout.marginHeight = 0;
container3.setLayout(layout);
upload_limit = new Text(container3,SWT.BORDER );
upload_limit.addListener(SWT.Verify, number_filter);
layout_data = new GridData();
layout_data.widthHint = EDIT_FIELD_WIDTH;
upload_limit.setLayoutData(layout_data);
try {
upload_limit.setText((config_manager.getUploadLimit()/1024)+"");
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
new Label(container3,SWT.NONE).setText(_._("settingswindow.tab.connection.label.kb_s"));
enable_upload_limit = new Button(container3,SWT.CHECK);
enable_upload_limit.setText(_._("settingswindow.tab.connection.button.enabled"));
enable_upload_limit.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
updateUploadLimitControls();
}
});
boolean enable = false;
try {
enable = config_manager.getDownloadLimit()==0 ? false : true;
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
enable_download_limit.setSelection(enable);
try {
enable = config_manager.getUploadLimit() == 0 ? false : true;
} catch (ConfigurationManagerException e1) {
e1.printStackTrace();
}
enable_upload_limit.setSelection(enable);
updateDownloadLimitControls();
updateUploadLimitControls();
Group capacities = new Group(content,SWT.NONE);
capacities.setText(_._("settingswindow.tab.general.group.capacities"));
layout_data = new GridData(GridData.FILL_HORIZONTAL);
layout_data.horizontalSpan = 2;
capacities.setLayoutData(layout_data);
capacities.setLayout(new GridLayout(2,false));
label = new Label(capacities,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setForeground(skin.getDefaultColor());
label.setText(_._("settingswindow.tab.connection.label.download_capacity") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
download_capacity = new Text(capacities,SWT.BORDER );
download_capacity.addListener(SWT.Verify, number_filter);
layout_data = new GridData();
layout_data.widthHint = EDIT_FIELD_WIDTH;
download_capacity.setLayoutData(layout_data);
label = new Label(capacities,SWT.NONE);
label.setFont(skin.getDefaultFont());
label.setForeground(skin.getDefaultColor());
label.setText(_._("settingswindow.tab.connection.label.upload_capacity") + " : ");
label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
upload_capacity = new Text(capacities,SWT.BORDER );
upload_capacity.addListener(SWT.Verify, number_filter);
layout_data = new GridData();
layout_data.widthHint = EDIT_FIELD_WIDTH;
upload_capacity.setLayoutData(layout_data);
new Label(capacities,SWT.NONE);
container = new Composite(capacities,SWT.NONE);
layout_data = new GridData();
container.setLayoutData(layout_data);
layout = new GridLayout(2,false);
layout.marginWidth = 0;
layout.marginHeight = 0;
container.setLayout(layout);
kbit_button = new Button(container,SWT.RADIO);
kbit_button.setText(_._("settingswindow.tab.connection.button.k_bit"));
kbit_button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (kbit_button.getSelection()) {
if (!kbyte_selected) return ;
kbyte_selected = false;
long download = Long.parseLong(download_capacity.getText());
long upload = Long.parseLong(upload_capacity.getText());
download*=8;
upload*=8;
download_capacity.setText(download+"");
upload_capacity.setText(upload+"");
}
}
});
kbyte_button = new Button(container,SWT.RADIO);
kbyte_button.setText(_._("settingswindow.tab.connection.button.k_byte"));
kbyte_button.setSelection(true);
kbyte_button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {