use of com.biglybt.ui.swt.components.LinkLabel in project BiglyBT by BiglySoftware.
the class ConfigSectionTransfer method configSectionCreate.
@Override
public Composite configSectionCreate(final Composite parent) {
GridData gridData;
GridLayout layout;
Label label;
Composite cSection = new Composite(parent, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
Utils.setLayoutData(cSection, gridData);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
cSection.setLayout(layout);
int userMode = COConfigurationManager.getIntParameter("User Mode");
// store the initial d/l speed so we can do something sensible later
final int[] manual_max_download_speed = { COConfigurationManager.getIntParameter("Max Download Speed KBs") };
// max upload speed
gridData = new GridData();
label = new Label(cSection, SWT.NULL);
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "ConfigView.label.maxuploadspeed");
gridData = new GridData();
final IntParameter paramMaxUploadSpeed = new IntParameter(cSection, "Max Upload Speed KBs", 0, Integer.MAX_VALUE);
paramMaxUploadSpeed.setLayoutData(gridData);
// max upload speed when seeding
final Composite cMaxUploadSpeedOptionsArea = new Composite(cSection, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
cMaxUploadSpeedOptionsArea.setLayout(layout);
gridData = new GridData();
gridData.horizontalIndent = 15;
gridData.horizontalSpan = 2;
Utils.setLayoutData(cMaxUploadSpeedOptionsArea, gridData);
ImageLoader imageLoader = ImageLoader.getInstance();
Image img = imageLoader.getImage("subitem");
label = new Label(cMaxUploadSpeedOptionsArea, SWT.NULL);
img.setBackground(label.getBackground());
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
Utils.setLayoutData(label, gridData);
label.setImage(img);
gridData = new GridData();
final BooleanParameter enable_seeding_rate = new BooleanParameter(cMaxUploadSpeedOptionsArea, "enable.seedingonly.upload.rate", "ConfigView.label.maxuploadspeedseeding");
enable_seeding_rate.setLayoutData(gridData);
gridData = new GridData();
final IntParameter paramMaxUploadSpeedSeeding = new IntParameter(cMaxUploadSpeedOptionsArea, "Max Upload Speed Seeding KBs", 0, Integer.MAX_VALUE);
paramMaxUploadSpeedSeeding.setLayoutData(gridData);
enable_seeding_rate.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(paramMaxUploadSpeedSeeding.getControl()));
if (userMode < 2) {
// wiki link
Composite cWiki = new Composite(cSection, SWT.COLOR_GRAY);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
gridData.horizontalSpan = 2;
Utils.setLayoutData(cWiki, gridData);
layout = new GridLayout();
layout.numColumns = 4;
layout.marginHeight = 0;
cWiki.setLayout(layout);
gridData = new GridData();
gridData.horizontalIndent = 6;
gridData.horizontalSpan = 2;
label = new Label(cWiki, SWT.NULL);
Utils.setLayoutData(label, gridData);
label.setText(MessageText.getString("Utils.link.visit") + ":");
gridData = new GridData();
gridData.horizontalIndent = 10;
gridData.horizontalSpan = 2;
new LinkLabel(cWiki, gridData, "ConfigView.section.transfer.speeds.wiki", Constants.URL_WIKI + "w/Good_settings");
}
if (userMode > 1) {
gridData = new GridData();
label = new Label(cSection, SWT.NULL);
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "ConfigView.label.maxuploadswhenbusymin");
gridData = new GridData();
new IntParameter(cSection, "max.uploads.when.busy.inc.min.secs", 0, Integer.MAX_VALUE).setLayoutData(gridData);
}
// max download speed
gridData = new GridData();
label = new Label(cSection, SWT.NULL);
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "ConfigView.label.maxdownloadspeed");
gridData = new GridData();
final IntParameter paramMaxDownSpeed = new IntParameter(cSection, "Max Download Speed KBs", 0, Integer.MAX_VALUE);
paramMaxDownSpeed.setLayoutData(gridData);
// max upload/download limit dependencies
Listener l = new Listener() {
@Override
public void handleEvent(Event event) {
boolean disableAuto = false;
boolean disableAutoSeeding = false;
if (enable_seeding_rate.isSelected()) {
disableAutoSeeding = event.widget == paramMaxUploadSpeedSeeding.getControl();
disableAuto = event.widget == paramMaxDownSpeed.getControl() || event.widget == paramMaxUploadSpeed.getControl();
} else {
disableAuto = true;
disableAutoSeeding = true;
}
if (disableAuto)
COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY, false);
if (disableAutoSeeding)
COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY, false);
}
};
paramMaxDownSpeed.getControl().addListener(SWT.Selection, l);
paramMaxUploadSpeed.getControl().addListener(SWT.Selection, l);
paramMaxUploadSpeedSeeding.getControl().addListener(SWT.Selection, l);
paramMaxUploadSpeed.addChangeListener(new ParameterChangeAdapter() {
ParameterChangeAdapter me = this;
@Override
public void parameterChanged(Parameter p, boolean internal) {
CoreWaiterSWT.waitForCoreRunning(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
if (paramMaxUploadSpeed.isDisposed()) {
paramMaxUploadSpeed.removeChangeListener(me);
return;
}
if (TransferSpeedValidator.isAutoSpeedActive(core.getGlobalManager())) {
return;
}
int up_val = paramMaxUploadSpeed.getValue();
int down_val = paramMaxDownSpeed.getValue();
if (up_val != 0 && up_val < COConfigurationManager.CONFIG_DEFAULT_MIN_MAX_UPLOAD_SPEED) {
if ((down_val == 0) || down_val > (up_val * 2)) {
paramMaxDownSpeed.setValue(up_val * 2);
}
} else {
if (down_val != manual_max_download_speed[0]) {
paramMaxDownSpeed.setValue(manual_max_download_speed[0]);
}
}
}
});
}
});
paramMaxDownSpeed.addChangeListener(new ParameterChangeAdapter() {
ParameterChangeAdapter me = this;
@Override
public void parameterChanged(Parameter p, boolean internal) {
CoreWaiterSWT.waitForCoreRunning(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
if (paramMaxDownSpeed.isDisposed()) {
paramMaxDownSpeed.removeChangeListener(me);
return;
}
if (TransferSpeedValidator.isAutoSpeedActive(core.getGlobalManager())) {
return;
}
int up_val = paramMaxUploadSpeed.getValue();
int down_val = paramMaxDownSpeed.getValue();
manual_max_download_speed[0] = down_val;
if (up_val < COConfigurationManager.CONFIG_DEFAULT_MIN_MAX_UPLOAD_SPEED) {
if (up_val != 0 && up_val < (down_val * 2)) {
paramMaxUploadSpeed.setValue((down_val + 1) / 2);
} else if (down_val == 0) {
paramMaxUploadSpeed.setValue(0);
}
}
}
});
}
});
if (userMode > 0) {
// bias upload to incomplete
BooleanParameter bias_upload = new BooleanParameter(cSection, "Bias Upload Enable", "ConfigView.label.xfer.bias_up");
gridData = new GridData();
gridData.horizontalSpan = 2;
bias_upload.setLayoutData(gridData);
final Composite bias_slack_area = new Composite(cSection, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
bias_slack_area.setLayout(layout);
gridData = new GridData();
gridData.horizontalIndent = 15;
gridData.horizontalSpan = 2;
Utils.setLayoutData(bias_slack_area, gridData);
label = new Label(bias_slack_area, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
Utils.setLayoutData(label, gridData);
label.setImage(img);
label = new Label(bias_slack_area, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.label.xfer.bias_slack");
IntParameter bias_slack = new IntParameter(bias_slack_area, "Bias Upload Slack KBs", 1, Integer.MAX_VALUE);
final Composite bias_unlimited_area = new Composite(cSection, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginWidth = 0;
layout.marginHeight = 0;
bias_unlimited_area.setLayout(layout);
gridData = new GridData();
gridData.horizontalIndent = 15;
gridData.horizontalSpan = 2;
Utils.setLayoutData(bias_unlimited_area, gridData);
label = new Label(bias_unlimited_area, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
Utils.setLayoutData(label, gridData);
label.setImage(img);
BooleanParameter bias_no_limit = new BooleanParameter(bias_unlimited_area, "Bias Upload Handle No Limit", "ConfigView.label.xfer.bias_no_limit");
bias_upload.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(new Parameter[] { bias_slack, bias_no_limit }));
}
if (userMode > 0) {
// AUTO GROUP
Group auto_group = new Group(cSection, SWT.NULL);
Messages.setLanguageText(auto_group, "group.auto");
GridLayout auto_layout = new GridLayout();
auto_layout.numColumns = 2;
auto_group.setLayout(auto_layout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
Utils.setLayoutData(auto_group, gridData);
BooleanParameter auto_adjust = new BooleanParameter(auto_group, "Auto Adjust Transfer Defaults", "ConfigView.label.autoadjust");
gridData = new GridData();
gridData.horizontalSpan = 2;
auto_adjust.setLayoutData(gridData);
// max uploads
gridData = new GridData();
label = new Label(auto_group, SWT.NULL);
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "ConfigView.label.maxuploads");
gridData = new GridData();
IntParameter paramMaxUploads = new IntParameter(auto_group, "Max Uploads", 2, Integer.MAX_VALUE);
paramMaxUploads.setLayoutData(gridData);
// max uploads when seeding
final Composite cMaxUploadsOptionsArea = new Composite(auto_group, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
cMaxUploadsOptionsArea.setLayout(layout);
gridData = new GridData();
gridData.horizontalIndent = 15;
gridData.horizontalSpan = 2;
Utils.setLayoutData(cMaxUploadsOptionsArea, gridData);
label = new Label(cMaxUploadsOptionsArea, SWT.NULL);
img.setBackground(label.getBackground());
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
Utils.setLayoutData(label, gridData);
label.setImage(img);
gridData = new GridData();
BooleanParameter enable_seeding_uploads = new BooleanParameter(cMaxUploadsOptionsArea, "enable.seedingonly.maxuploads", "ConfigView.label.maxuploadsseeding");
enable_seeding_uploads.setLayoutData(gridData);
gridData = new GridData();
final IntParameter paramMaxUploadsSeeding = new IntParameter(cMaxUploadsOptionsArea, "Max Uploads Seeding", 2, Integer.MAX_VALUE);
paramMaxUploadsSeeding.setLayoutData(gridData);
// //
gridData = new GridData();
label = new Label(auto_group, SWT.NULL);
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "ConfigView.label.max_peers_per_torrent");
gridData = new GridData();
IntParameter paramMaxClients = new IntParameter(auto_group, "Max.Peer.Connections.Per.Torrent");
paramMaxClients.setLayoutData(gridData);
// ///
// max peers when seeding
final Composite cMaxPeersOptionsArea = new Composite(auto_group, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
layout.marginHeight = 0;
cMaxPeersOptionsArea.setLayout(layout);
gridData = new GridData();
gridData.horizontalIndent = 15;
gridData.horizontalSpan = 2;
Utils.setLayoutData(cMaxPeersOptionsArea, gridData);
label = new Label(cMaxPeersOptionsArea, SWT.NULL);
img.setBackground(label.getBackground());
gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
Utils.setLayoutData(label, gridData);
label.setImage(img);
gridData = new GridData();
BooleanParameter enable_max_peers_seeding = new BooleanParameter(cMaxPeersOptionsArea, "Max.Peer.Connections.Per.Torrent.When.Seeding.Enable", "ConfigView.label.maxuploadsseeding");
enable_max_peers_seeding.setLayoutData(gridData);
gridData = new GridData();
final IntParameter paramMaxPeersSeeding = new IntParameter(cMaxPeersOptionsArea, "Max.Peer.Connections.Per.Torrent.When.Seeding", 0, Integer.MAX_VALUE);
paramMaxPeersSeeding.setLayoutData(gridData);
// ///
gridData = new GridData();
label = new Label(auto_group, SWT.NULL);
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "ConfigView.label.max_peers_total");
gridData = new GridData();
IntParameter paramMaxClientsTotal = new IntParameter(auto_group, "Max.Peer.Connections.Total");
paramMaxClientsTotal.setLayoutData(gridData);
gridData = new GridData();
label = new Label(auto_group, SWT.NULL);
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "ConfigView.label.maxseedspertorrent");
gridData = new GridData();
IntParameter max_seeds_per_torrent = new IntParameter(auto_group, "Max Seeds Per Torrent");
max_seeds_per_torrent.setLayoutData(gridData);
final Parameter[] parameters = { paramMaxUploads, enable_seeding_uploads, paramMaxUploadsSeeding, paramMaxClients, enable_max_peers_seeding, paramMaxPeersSeeding, paramMaxClientsTotal, max_seeds_per_torrent };
IAdditionalActionPerformer f_enabler = new GenericActionPerformer(new Control[0]) {
@Override
public void performAction() {
boolean auto = COConfigurationManager.getBooleanParameter("Auto Adjust Transfer Defaults");
for (Parameter p : parameters) {
Control[] c = p.getControls();
for (Control x : c) {
x.setEnabled(!auto);
}
}
if (!auto) {
paramMaxUploadsSeeding.getControl().setEnabled(COConfigurationManager.getBooleanParameter("enable.seedingonly.maxuploads"));
paramMaxPeersSeeding.getControl().setEnabled(COConfigurationManager.getBooleanParameter("Max.Peer.Connections.Per.Torrent.When.Seeding.Enable"));
}
}
};
f_enabler.performAction();
enable_seeding_uploads.setAdditionalActionPerformer(f_enabler);
enable_max_peers_seeding.setAdditionalActionPerformer(f_enabler);
auto_adjust.setAdditionalActionPerformer(f_enabler);
// NON PUBLIC PEERS GROUP
Group npp_group = new Group(cSection, SWT.NULL);
Messages.setLanguageText(npp_group, "label.non.public.peers");
GridLayout npp_layout = new GridLayout();
npp_layout.numColumns = 2;
npp_group.setLayout(npp_layout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
Utils.setLayoutData(npp_group, gridData);
label = new Label(npp_group, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.label.npp.slots");
IntParameter npp_upload_slots = new IntParameter(npp_group, "Non-Public Peer Extra Slots Per Torrent", 0, Integer.MAX_VALUE);
label = new Label(npp_group, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.label.npp.connections");
IntParameter npp_connections = new IntParameter(npp_group, "Non-Public Peer Extra Connections Per Torrent", 0, Integer.MAX_VALUE);
// END NON PUBLIC PEERS GROUP
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter useReqLimiting = new BooleanParameter(cSection, "Use Request Limiting", "ConfigView.label.userequestlimiting");
useReqLimiting.setLayoutData(gridData);
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter useReqLimitingPrios = new BooleanParameter(cSection, "Use Request Limiting Priorities", "ConfigView.label.userequestlimitingpriorities");
useReqLimitingPrios.setLayoutData(gridData);
useReqLimiting.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(useReqLimitingPrios.getControl()));
// up limits include protocol
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter upIncludesProt = new BooleanParameter(cSection, "Up Rate Limits Include Protocol", "ConfigView.label.up.includes.prot");
upIncludesProt.setLayoutData(gridData);
// down limits include protocol
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter downIncludesProt = new BooleanParameter(cSection, "Down Rate Limits Include Protocol", "ConfigView.label.down.includes.prot");
downIncludesProt.setLayoutData(gridData);
// same IP
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter allowSameIP = new BooleanParameter(cSection, "Allow Same IP Peers", "ConfigView.label.allowsameip");
allowSameIP.setLayoutData(gridData);
// lazy bit field
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter lazybf = new BooleanParameter(cSection, "Use Lazy Bitfield", "ConfigView.label.lazybitfield");
lazybf.setLayoutData(gridData);
if (userMode > 1) {
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter hap = new BooleanParameter(cSection, "peercontrol.hide.piece", "ConfigView.label.hap");
hap.setLayoutData(gridData);
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter hapds = new BooleanParameter(cSection, "peercontrol.hide.piece.ds", "ConfigView.label.hapds");
hapds.setLayoutData(gridData);
hap.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(hapds.getControl()));
}
// prioritise first/last pieces
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter firstPiece = new BooleanParameter(cSection, "Prioritize First Piece", "ConfigView.label.prioritizefirstpiece");
firstPiece.setLayoutData(gridData);
// Further prioritize High priority files according to % complete and size of file
gridData = new GridData();
gridData.horizontalSpan = 2;
BooleanParameter mostCompletedFiles = new BooleanParameter(cSection, "Prioritize Most Completed Files", "ConfigView.label.prioritizemostcompletedfiles");
mostCompletedFiles.setLayoutData(gridData);
// ignore ports
Composite cMiniArea = new Composite(cSection, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
cMiniArea.setLayout(layout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
Utils.setLayoutData(cMiniArea, gridData);
gridData = new GridData();
label = new Label(cMiniArea, SWT.NULL);
Utils.setLayoutData(label, gridData);
Messages.setLanguageText(label, "ConfigView.label.transfer.ignorepeerports");
gridData = new GridData();
gridData.widthHint = 125;
StringParameter ignore_ports = new StringParameter(cMiniArea, "Ignore.peer.ports", "0");
ignore_ports.setLayoutData(gridData);
}
return cSection;
}
use of com.biglybt.ui.swt.components.LinkLabel in project BiglyBT by BiglySoftware.
the class ConfigSectionTransferAutoSpeed method configSectionCreate.
@Override
public Composite configSectionCreate(final Composite parent) {
GridData gridData;
Composite cSection = new Composite(parent, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
cSection.setLayoutData(gridData);
GridLayout advanced_layout = new GridLayout();
advanced_layout.numColumns = 2;
cSection.setLayout(advanced_layout);
int userMode = COConfigurationManager.getIntParameter("User Mode");
Label linfo = new Label(cSection, SWT.WRAP);
Messages.setLanguageText(linfo, "ConfigView.section.transfer.autospeed.info");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
linfo.setLayoutData(gridData);
gridData = new GridData();
gridData.horizontalSpan = 2;
new LinkLabel(cSection, gridData, "ConfigView.label.please.visit.here", Constants.URL_WIKI + "w/Auto_Speed");
String[] units = { DisplayFormatters.getRateUnit(DisplayFormatters.UNIT_KB) };
// min up
Label llmux = new Label(cSection, SWT.NULL);
Messages.setLanguageText(llmux, "ConfigView.section.transfer.autospeed.minupload", units);
IntParameter min_upload = new IntParameter(cSection, "AutoSpeed Min Upload KBs");
gridData = new GridData();
min_upload.setLayoutData(gridData);
// max up
Label llmdx = new Label(cSection, SWT.NULL);
Messages.setLanguageText(llmdx, "ConfigView.section.transfer.autospeed.maxupload", units);
IntParameter max_upload = new IntParameter(cSection, "AutoSpeed Max Upload KBs");
gridData = new GridData();
max_upload.setLayoutData(gridData);
if (userMode > 0) {
BooleanParameter enable_down_adj = new BooleanParameter(cSection, "AutoSpeed Download Adj Enable", "ConfigView.section.transfer.autospeed.enabledownadj");
gridData = new GridData();
gridData.horizontalSpan = 2;
enable_down_adj.setLayoutData(gridData);
Label label = new Label(cSection, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.transfer.autospeed.downadjratio");
FloatParameter down_adj = new FloatParameter(cSection, "AutoSpeed Download Adj Ratio", 0, Float.MAX_VALUE, false, 2);
gridData = new GridData();
down_adj.setLayoutData(gridData);
enable_down_adj.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(new Control[] { down_adj.getControl() }));
}
if (userMode > 1) {
// max inc
Label label = new Label(cSection, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.transfer.autospeed.maxinc", units);
final IntParameter max_increase = new IntParameter(cSection, "AutoSpeed Max Increment KBs");
gridData = new GridData();
max_increase.setLayoutData(gridData);
// max dec
label = new Label(cSection, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.transfer.autospeed.maxdec", units);
final IntParameter max_decrease = new IntParameter(cSection, "AutoSpeed Max Decrement KBs");
gridData = new GridData();
max_decrease.setLayoutData(gridData);
// choking ping
label = new Label(cSection, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.transfer.autospeed.chokeping");
final IntParameter choke_ping = new IntParameter(cSection, "AutoSpeed Choking Ping Millis");
gridData = new GridData();
choke_ping.setLayoutData(gridData);
// forced min
label = new Label(cSection, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.transfer.autospeed.forcemin", units);
final IntParameter forced_min = new IntParameter(cSection, "AutoSpeed Forced Min KBs");
gridData = new GridData();
forced_min.setLayoutData(gridData);
// latency
label = new Label(cSection, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.transfer.autospeed.latencyfactor");
final IntParameter latency_factor = new IntParameter(cSection, "AutoSpeed Latency Factor", 1, Integer.MAX_VALUE);
gridData = new GridData();
latency_factor.setLayoutData(gridData);
Label reset_label = new Label(cSection, SWT.NULL);
Messages.setLanguageText(reset_label, "ConfigView.section.transfer.autospeed.reset");
Button reset_button = new Button(cSection, SWT.PUSH);
Messages.setLanguageText(reset_button, "ConfigView.section.transfer.autospeed.reset.button");
reset_button.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
max_increase.resetToDefault();
max_decrease.resetToDefault();
choke_ping.resetToDefault();
latency_factor.resetToDefault();
forced_min.resetToDefault();
}
});
}
return cSection;
}
use of com.biglybt.ui.swt.components.LinkLabel in project BiglyBT by BiglySoftware.
the class ConfigSectionInterface method configSectionCreate.
@Override
public Composite configSectionCreate(final Composite parent) {
GridData gridData;
GridLayout layout;
Label label;
Composite cDisplay = new Composite(parent, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
Utils.setLayoutData(cDisplay, gridData);
layout = new GridLayout();
layout.numColumns = 1;
layout.marginWidth = 0;
layout.marginHeight = 0;
cDisplay.setLayout(layout);
final PlatformManager platform = PlatformManagerFactory.getPlatformManager();
// ***** auto open group
Group gAutoOpen = new Group(cDisplay, SWT.NULL);
Messages.setLanguageText(gAutoOpen, "ConfigView.label.autoopen");
layout = new GridLayout(3, false);
gAutoOpen.setLayout(layout);
Utils.setLayoutData(gAutoOpen, new GridData(GridData.FILL_HORIZONTAL));
label = new Label(gAutoOpen, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.label.autoopen.detailstab");
new BooleanParameter(gAutoOpen, "Open Details", "ConfigView.label.autoopen.dl");
new BooleanParameter(gAutoOpen, "Open Seeding Details", "ConfigView.label.autoopen.cd");
label = new Label(gAutoOpen, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.label.autoopen.downloadbars");
new BooleanParameter(gAutoOpen, "Open Bar Incomplete", "ConfigView.label.autoopen.dl");
new BooleanParameter(gAutoOpen, "Open Bar Complete", "ConfigView.label.autoopen.cd");
if (!Constants.isOSX) {
new BooleanParameter(cDisplay, "Show Status In Window Title", "ConfigView.label.info.in.window.title");
}
new BooleanParameter(cDisplay, "Remember transfer bar location", "ConfigView.label.transferbar.remember_location");
Composite gBarTrans = new Composite(cDisplay, SWT.NULL);
layout = new GridLayout(4, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
gBarTrans.setLayout(layout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalIndent = 25;
Utils.setLayoutData(gBarTrans, gridData);
label = new Label(gBarTrans, SWT.NULL);
Messages.setLanguageText(label, "label.bar.trans");
new IntParameter(gBarTrans, "Bar Transparency", 0, 100);
label = new Label(gBarTrans, SWT.NULL);
Messages.setLanguageText(label, "label.show.icon.area");
new BooleanParameter(gBarTrans, "Transfer Bar Show Icon Area");
{
// sys tray
Group gSysTray = new Group(cDisplay, SWT.NULL);
Messages.setLanguageText(gSysTray, "ConfigView.label.systray");
layout = new GridLayout();
layout.numColumns = 2;
gSysTray.setLayout(layout);
Utils.setLayoutData(gSysTray, new GridData(GridData.FILL_HORIZONTAL));
BooleanParameter est = new BooleanParameter(gSysTray, "Enable System Tray", "ConfigView.section.interface.enabletray");
est.addChangeListener(new ParameterChangeAdapter() {
@Override
public void booleanParameterChanging(Parameter p, boolean toValue) {
if (toValue) {
SystemTraySWT.getTray();
} else {
SystemTraySWT.getTray().dispose();
}
}
});
BooleanParameter stdo = new BooleanParameter(gSysTray, "System Tray Disabled Override", "ConfigView.label.closetotrayoverride");
BooleanParameter ctt = new BooleanParameter(gSysTray, "Close To Tray", "ConfigView.label.closetotray");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
ctt.setLayoutData(gridData);
BooleanParameter mtt = new BooleanParameter(gSysTray, "Minimize To Tray", "ConfigView.label.minimizetotray");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
mtt.setLayoutData(gridData);
BooleanParameter esttt = new BooleanParameter(gSysTray, "ui.systray.tooltip.enable", "ConfigView.label.enableSystrayToolTip");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
esttt.setLayoutData(gridData);
BooleanParameter estttd = new BooleanParameter(gSysTray, "ui.systray.tooltip.next.eta.enable", "ConfigView.label.enableSystrayToolTipNextETA");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
gridData.horizontalIndent = 25;
estttd.setLayoutData(gridData);
est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(stdo.getControls(), true));
IAdditionalActionPerformer st_enabler = new GenericActionPerformer(new Control[] {}) {
@Override
public void performAction() {
boolean st_enabled = est.isSelected();
boolean override = stdo.isSelected();
boolean dl_stats = esttt.isSelected();
ctt.setEnabled(st_enabled || override);
mtt.setEnabled(st_enabled || override);
esttt.setEnabled(st_enabled);
estttd.setEnabled(st_enabled && dl_stats);
}
};
est.setAdditionalActionPerformer(st_enabler);
stdo.setAdditionalActionPerformer(st_enabler);
esttt.setAdditionalActionPerformer(st_enabler);
}
/**
* Default download / upload limits available in the UI.
*/
Group limit_group = new Group(cDisplay, SWT.NULL);
Messages.setLanguageText(limit_group, "ConfigView.label.set_ui_transfer_speeds");
layout = new GridLayout();
layout.numColumns = 2;
limit_group.setLayout(layout);
Utils.setLayoutData(limit_group, new GridData(GridData.FILL_HORIZONTAL));
Label limit_group_label = new Label(limit_group, SWT.WRAP);
Utils.setLayoutData(limit_group_label, Utils.getWrappableLabelGridData(2, GridData.GRAB_HORIZONTAL));
Messages.setLanguageText(limit_group_label, "ConfigView.label.set_ui_transfer_speeds.description");
String[] limit_types = new String[] { "download", "upload" };
final String limit_type_prefix = "config.ui.speed.partitions.manual.";
for (int i = 0; i < limit_types.length; i++) {
final BooleanParameter bp = new BooleanParameter(limit_group, limit_type_prefix + limit_types[i] + ".enabled", false, "ConfigView.label.set_ui_transfer_speeds.description." + limit_types[i]);
final StringParameter sp = new StringParameter(limit_group, limit_type_prefix + limit_types[i] + ".values", "");
IAdditionalActionPerformer iaap = new GenericActionPerformer(new Control[] {}) {
@Override
public void performAction() {
sp.getControl().setEnabled(bp.isSelected());
}
};
gridData = new GridData();
gridData.widthHint = 150;
sp.setLayoutData(gridData);
iaap.performAction();
bp.setAdditionalActionPerformer(iaap);
}
// send version
new BooleanParameter(cDisplay, "Send Version Info", "ConfigView.label.allowSendVersion");
Composite cArea = new Composite(cDisplay, SWT.NULL);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
cArea.setLayout(layout);
Utils.setLayoutData(cArea, new GridData(GridData.FILL_HORIZONTAL));
new LinkLabel(cArea, "ConfigView.label.version.info.link", Constants.URL_WIKI + "w/Version.azureusplatform.com");
if (!Constants.isOSX) {
BooleanParameter confirm = new BooleanParameter(cArea, "confirmationOnExit", "ConfigView.section.style.confirmationOnExit");
gridData = new GridData();
gridData.horizontalSpan = 2;
confirm.setLayoutData(gridData);
}
cArea = new Composite(cDisplay, SWT.NULL);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
cArea.setLayout(layout);
Utils.setLayoutData(cArea, new GridData(GridData.FILL_HORIZONTAL));
// clear remembered decisions
final Label clear_label = new Label(cArea, SWT.NULL);
Messages.setLanguageText(clear_label, "ConfigView.section.interface.cleardecisions");
final Button clear_decisions = new Button(cArea, SWT.PUSH);
Messages.setLanguageText(clear_decisions, "ConfigView.section.interface.cleardecisionsbutton");
clear_decisions.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
RememberedDecisionsManager.clearAll();
}
});
final Label clear_tracker_label = new Label(cArea, SWT.NULL);
Messages.setLanguageText(clear_tracker_label, "ConfigView.section.interface.cleartrackers");
final Button clear_tracker_button = new Button(cArea, SWT.PUSH);
Messages.setLanguageText(clear_tracker_button, "ConfigView.section.interface.cleartrackersbutton");
clear_tracker_button.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
TrackersUtil.getInstance().clearAllTrackers(true);
}
});
final Label clear_save_path_label = new Label(cArea, SWT.NULL);
Messages.setLanguageText(clear_save_path_label, "ConfigView.section.interface.clearsavepaths");
final Button clear_save_path_button = new Button(cArea, SWT.PUSH);
Messages.setLanguageText(clear_save_path_button, "ConfigView.section.interface.clearsavepathsbutton");
clear_save_path_button.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
COConfigurationManager.setParameter("saveTo_list", new ArrayList());
}
});
decisions_parameter_listener = new ParameterListener() {
@Override
public void parameterChanged(String parameterName) {
if (clear_decisions.isDisposed()) {
// tidy up from previous incarnations
COConfigurationManager.removeParameterListener("MessageBoxWindow.decisions", this);
} else {
boolean enabled = COConfigurationManager.getMapParameter("MessageBoxWindow.decisions", new HashMap()).size() > 0;
clear_label.setEnabled(enabled);
clear_decisions.setEnabled(enabled);
}
}
};
decisions_parameter_listener.parameterChanged(null);
COConfigurationManager.addParameterListener("MessageBoxWindow.decisions", decisions_parameter_listener);
if (platform.hasCapability(PlatformManagerCapabilities.RegisterFileAssociations)) {
Composite cResetAssoc = new Composite(cArea, SWT.NULL);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
cResetAssoc.setLayout(layout);
Utils.setLayoutData(cResetAssoc, new GridData());
label = new Label(cResetAssoc, SWT.NULL);
Messages.setLanguageText(label, "ConfigView.section.interface.resetassoc");
Button reset = new Button(cResetAssoc, SWT.PUSH);
Messages.setLanguageText(reset, // $NON-NLS-1$
"ConfigView.section.interface.resetassocbutton");
reset.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
try {
platform.registerApplication();
} catch (PlatformManagerException e) {
Logger.log(new LogAlert(LogAlert.UNREPEATABLE, "Failed to register application", e));
}
}
});
new BooleanParameter(cArea, "config.interface.checkassoc", "ConfigView.section.interface.checkassoc");
}
return cDisplay;
}
use of com.biglybt.ui.swt.components.LinkLabel in project BiglyBT by BiglySoftware.
the class ConfigSectionConnectionDNS method configSectionCreate.
@Override
public Composite configSectionCreate(final Composite parent) {
GridData gridData;
GridLayout layout;
Composite cSection = new Composite(parent, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
Utils.setLayoutData(cSection, gridData);
layout = new GridLayout();
layout.numColumns = 2;
cSection.setLayout(layout);
int userMode = COConfigurationManager.getIntParameter("User Mode");
if (userMode < REQUIRED_MODE) {
Label label = new Label(cSection, SWT.WRAP);
gridData = new GridData();
gridData.horizontalSpan = 2;
Utils.setLayoutData(label, gridData);
final String[] modeKeys = { "ConfigView.section.mode.beginner", "ConfigView.section.mode.intermediate", "ConfigView.section.mode.advanced" };
String param1, param2;
if (REQUIRED_MODE < modeKeys.length)
param1 = MessageText.getString(modeKeys[REQUIRED_MODE]);
else
param1 = String.valueOf(REQUIRED_MODE);
if (userMode < modeKeys.length)
param2 = MessageText.getString(modeKeys[userMode]);
else
param2 = String.valueOf(userMode);
label.setText(MessageText.getString("ConfigView.notAvailableForMode", new String[] { param1, param2 }));
return cSection;
}
// ////////////////////
Label label = new Label(cSection, SWT.WRAP);
Messages.setLanguageText(label, "ConfigView.section.dns.info");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
// needed for wrap
gridData.widthHint = 200;
Utils.setLayoutData(label, gridData);
gridData = new GridData();
gridData.horizontalSpan = 2;
new LinkLabel(cSection, gridData, "ConfigView.label.please.visit.here", MessageText.getString("ConfigView.section.dns.url"));
Label comment_label = new Label(cSection, SWT.NULL);
Messages.setLanguageText(comment_label, "ConfigView.section.dns.alts");
gridData = new GridData(GridData.FILL_HORIZONTAL);
StringParameter alt_servers = new StringParameter(cSection, "DNS Alt Servers");
alt_servers.setLayoutData(gridData);
final BooleanParameter allow_socks = new BooleanParameter(cSection, "DNS Alt Servers SOCKS Enable", "ConfigView.section.dns.allow_socks");
gridData = new GridData();
gridData.horizontalSpan = 2;
allow_socks.setLayoutData(gridData);
return cSection;
}
use of com.biglybt.ui.swt.components.LinkLabel in project BiglyBT by BiglySoftware.
the class ConfigSectionConnectionEncryption method configSectionCreate.
@Override
public Composite configSectionCreate(final Composite parent) {
GridData gridData;
Composite cSection = new Composite(parent, SWT.NULL);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL + GridData.VERTICAL_ALIGN_FILL);
cSection.setLayoutData(gridData);
GridLayout advanced_layout = new GridLayout();
cSection.setLayout(advanced_layout);
int userMode = COConfigurationManager.getIntParameter("User Mode");
if (userMode < REQUIRED_MODE) {
Label label = new Label(cSection, SWT.WRAP);
gridData = new GridData();
label.setLayoutData(gridData);
final String[] modeKeys = { "ConfigView.section.mode.beginner", "ConfigView.section.mode.intermediate", "ConfigView.section.mode.advanced" };
String param1, param2;
if (REQUIRED_MODE < modeKeys.length)
param1 = MessageText.getString(modeKeys[REQUIRED_MODE]);
else
param1 = String.valueOf(REQUIRED_MODE);
if (userMode < modeKeys.length)
param2 = MessageText.getString(modeKeys[userMode]);
else
param2 = String.valueOf(userMode);
label.setText(MessageText.getString("ConfigView.notAvailableForMode", new String[] { param1, param2 }));
return cSection;
}
Group gCrypto = new Group(cSection, SWT.NULL);
Messages.setLanguageText(gCrypto, "ConfigView.section.connection.encryption.encrypt.group");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gCrypto.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
gCrypto.setLayout(layout);
Label lcrypto = new Label(gCrypto, SWT.WRAP);
Messages.setLanguageText(lcrypto, "ConfigView.section.connection.encryption.encrypt.info");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
// needed for wrap
gridData.widthHint = 200;
Utils.setLayoutData(lcrypto, gridData);
gridData = new GridData();
gridData.horizontalSpan = 2;
new LinkLabel(gCrypto, gridData, "ConfigView.section.connection.encryption.encrypt.info.link", Constants.URL_WIKI + "w/Avoid_traffic_shaping");
final BooleanParameter require = new BooleanParameter(gCrypto, "network.transport.encrypted.require", "ConfigView.section.connection.encryption.require_encrypted_transport");
gridData = new GridData();
gridData.horizontalSpan = 2;
require.setLayoutData(gridData);
String[] encryption_types = { "Plain", "RC4" };
String[] dropLabels = new String[encryption_types.length];
String[] dropValues = new String[encryption_types.length];
for (int i = 0; i < encryption_types.length; i++) {
dropLabels[i] = encryption_types[i];
dropValues[i] = encryption_types[i];
}
Composite cEncryptLevel = new Composite(gCrypto, SWT.NULL);
gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
gridData.horizontalSpan = 2;
cEncryptLevel.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 2;
layout.marginWidth = 0;
layout.marginHeight = 0;
cEncryptLevel.setLayout(layout);
Label lmin = new Label(cEncryptLevel, SWT.NULL);
Messages.setLanguageText(lmin, "ConfigView.section.connection.encryption.min_encryption_level");
final StringListParameter min_level = new StringListParameter(cEncryptLevel, "network.transport.encrypted.min_level", encryption_types[1], dropLabels, dropValues);
Label lcryptofb = new Label(gCrypto, SWT.WRAP);
Messages.setLanguageText(lcryptofb, "ConfigView.section.connection.encryption.encrypt.fallback_info");
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
// needed for wrap
gridData.widthHint = 200;
Utils.setLayoutData(lcryptofb, gridData);
BooleanParameter fallback_outgoing = new BooleanParameter(gCrypto, "network.transport.encrypted.fallback.outgoing", "ConfigView.section.connection.encryption.encrypt.fallback_outgoing");
gridData = new GridData();
gridData.horizontalSpan = 2;
fallback_outgoing.setLayoutData(gridData);
final BooleanParameter fallback_incoming = new BooleanParameter(gCrypto, "network.transport.encrypted.fallback.incoming", "ConfigView.section.connection.encryption.encrypt.fallback_incoming");
gridData = new GridData();
gridData.horizontalSpan = 2;
fallback_incoming.setLayoutData(gridData);
final BooleanParameter use_crypto_port = new BooleanParameter(gCrypto, "network.transport.encrypted.use.crypto.port", "ConfigView.section.connection.encryption.use_crypto_port");
gridData = new GridData();
gridData.horizontalSpan = 2;
use_crypto_port.setLayoutData(gridData);
final Control[] ap_controls = { min_level.getControl(), lmin, lcryptofb, fallback_outgoing.getControl(), fallback_incoming.getControl() };
IAdditionalActionPerformer iap = new GenericActionPerformer(new Control[] {}) {
@Override
public void performAction() {
boolean required = require.isSelected();
boolean ucp_enabled = !fallback_incoming.isSelected() && required;
use_crypto_port.getControl().setEnabled(ucp_enabled);
for (int i = 0; i < ap_controls.length; i++) {
ap_controls[i].setEnabled(required);
}
}
};
fallback_incoming.setAdditionalActionPerformer(iap);
require.setAdditionalActionPerformer(iap);
return cSection;
}
Aggregations