use of com.biglybt.pifimpl.local.ui.config.IntParameterImpl in project BiglyBT by BiglySoftware.
the class ConfigSectionFilePerformance method build.
@Override
public void build() {
add(new LabelParameterImpl("ConfigView.section.file.perf.explain"));
// diskmanager.hashchecking.strategy
String[] strategyLabels = new String[3];
for (int i = 0; i < strategyLabels.length; i++) {
strategyLabels[i] = MessageText.getString("ConfigView.section.file.hashchecking.strategy." + i);
}
add(new IntListParameterImpl(ICFG_DISKMANAGER_HASHCHECKING_STRATEGY, "ConfigView.section.file.hashchecking.strategy", new int[] { 0, 1, 2 }, strategyLabels));
/* replaced by strategy
add(new BooleanParameterImpl(BCFG_DISKMANAGER_FRIENDLY_HASHCHECKING,
"ConfigView.section.file.friendly.hashchecking"));
*/
// diskmanager.hashchecking.smallestfirst
add(new BooleanParameterImpl(BCFG_DISKMANAGER_HASHCHECKING_SMALLESTFIRST, "ConfigView.section.file.hashchecking.smallestfirst"));
// diskmanager.hashchecking.maxactive
IntParameterImpl recheck_max_active = new IntParameterImpl(BCFG_DISKMANAGER_HASHCHECKING_MAX_ACTIVE, "ConfigView.section.file.hashchecking.maxactive");
add(recheck_max_active, Parameter.MODE_INTERMEDIATE);
recheck_max_active.setMinValue(0);
add(new BooleanParameterImpl(BCFG_DISKMANAGER_ONE_OP_PER_FS, "ConfigView.section.file.one.op.per.fs"));
// diskmanager.perf.cache.enable
BooleanParameterImpl disk_cache = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_ENABLE, "ConfigView.section.file.perf.cache.enable");
add(disk_cache);
// diskmanager.perf.cache.size
long kinb = DisplayFormatters.getKinB();
long max_mem_bytes = Runtime.getRuntime().maxMemory();
long mb_1 = 1 * kinb * kinb;
long mb_32 = 32 * mb_1;
IntParameterImpl cache_size = new IntParameterImpl(ICFG_DISKMANAGER_PERF_CACHE_SIZE, "", 1, COConfigurationManager.CONFIG_CACHE_SIZE_MAX_MB);
add(cache_size);
// XXX Changed "DisplayFormatters.getUnit(DisplayFormatters.UNIT_MB)"
// to getUnitBase10 for the release, since the # is in MB.
cache_size.setLabelText(MessageText.getString("ConfigView.section.file.perf.cache.size", new String[] { DisplayFormatters.getUnitBase10(DisplayFormatters.UNIT_MB) }));
cache_size.setSuffixLabelText(MessageText.getString("ConfigView.section.file.perf.cache.size.explain", new String[] { DisplayFormatters.formatByteCountToKiBEtc(mb_32), DisplayFormatters.formatByteCountToKiBEtc(max_mem_bytes), Constants.URL_WIKI }));
// don't cache smaller than
IntParameterImpl cache_not_smaller_than = new IntParameterImpl(ICFG_DISKMANAGER_PERF_CACHE_NOTSMALLERTHAN, "");
add(cache_not_smaller_than, Parameter.MODE_INTERMEDIATE);
cache_not_smaller_than.setMinValue(0);
// XXX Changed "DisplayFormatters.getUnit(DisplayFormatters.UNIT_KB)" to
// getUnitBase10 for the release, since the # is stored in KB.
cache_not_smaller_than.setLabelText(MessageText.getString("ConfigView.section.file.perf.cache.notsmallerthan", new String[] { DisplayFormatters.getUnitBase10(DisplayFormatters.UNIT_KB) }));
// diskmanager.perf.cache.enable.read
BooleanParameterImpl disk_cache_read = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_ENABLE_READ, "ConfigView.section.file.perf.cache.enable.read");
add(disk_cache_read, Parameter.MODE_INTERMEDIATE);
// diskmanager.perf.cache.enable.write
BooleanParameterImpl disk_cache_write = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_ENABLE_WRITE, "ConfigView.section.file.perf.cache.enable.write");
add(disk_cache_write, Parameter.MODE_INTERMEDIATE);
// diskmanager.perf.cache.flushpieces
BooleanParameterImpl disk_cache_flush = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_FLUSHPIECES, "ConfigView.section.file.perf.cache.flushpieces");
add(disk_cache_flush, Parameter.MODE_INTERMEDIATE);
// diskmanager.perf.cache.trace
BooleanParameterImpl disk_cache_trace = new BooleanParameterImpl(BCFG_DISKMANAGER_PERF_CACHE_TRACE, "ConfigView.section.file.perf.cache.trace");
add(disk_cache_trace, Parameter.MODE_INTERMEDIATE);
disk_cache.addEnabledOnSelection(cache_not_smaller_than, disk_cache_trace, disk_cache_read, disk_cache_write, disk_cache_flush, disk_cache_trace);
// Max Open Files
IntParameterImpl paramMaxOpenFiles = new IntParameterImpl(ICFG_FILE_MAX_OPEN, "ConfigView.section.file.max_open_files");
add(paramMaxOpenFiles, Parameter.MODE_ADVANCED);
paramMaxOpenFiles.setSuffixLabelKey("ConfigView.section.file.max_open_files.explain");
// write mb limit
IntParameterImpl write_block_limit = new IntParameterImpl(ICFG_DISKMANAGER_PERF_WRITE_MAXMB, "");
add(write_block_limit, Parameter.MODE_ADVANCED);
write_block_limit.setLabelText(MessageText.getString("ConfigView.section.file.writemblimit", new String[] { DisplayFormatters.getUnitBase10(DisplayFormatters.UNIT_MB) }));
write_block_limit.setSuffixLabelKey("ConfigView.section.file.writemblimit.explain");
// read mb limit
IntParameterImpl check_piece_limit = new IntParameterImpl(ICFG_DISKMANAGER_PERF_READ_MAXMB, "");
add(check_piece_limit, Parameter.MODE_ADVANCED);
check_piece_limit.setLabelText(MessageText.getString("ConfigView.section.file.readmblimit", new String[] { DisplayFormatters.getUnitBase10(DisplayFormatters.UNIT_MB) }));
check_piece_limit.setSuffixLabelKey("ConfigView.section.file.readmblimit.explain");
disk_cache.addEnabledOnSelection(cache_size);
}
use of com.biglybt.pifimpl.local.ui.config.IntParameterImpl in project BiglyBT by BiglySoftware.
the class ConfigSectionTransferLAN method build.
@Override
public void build() {
setDefaultUserModeForAdd(Parameter.MODE_ADVANCED);
BooleanParameterImpl enable_lan = new BooleanParameterImpl(BCFG_LAN_SPEED_ENABLED, "ConfigView.section.transfer.lan.enable");
add(enable_lan);
IntParameterImpl lan_max_upload = new IntParameterImpl(ICFG_MAX_LAN_UPLOAD_SPEED_K_BS, "ConfigView.section.transfer.lan.uploadrate");
add(lan_max_upload);
IntParameterImpl lan_max_download = new IntParameterImpl(ICFG_MAX_LAN_DOWNLOAD_SPEED_K_BS, "ConfigView.section.transfer.lan.downloadrate");
add(lan_max_download);
enable_lan.addEnabledOnSelection(lan_max_upload, lan_max_download);
}
use of com.biglybt.pifimpl.local.ui.config.IntParameterImpl in project BiglyBT by BiglySoftware.
the class ConfigSectionConnectionProxySWT method configSectionCreate.
@Override
public void configSectionCreate(Composite parent, Map<ParameterImpl, BaseSwtParameter> mapParamToSwtParam) {
BooleanParameterImpl enableProxy = (BooleanParameterImpl) getPluginParam(BCFG_ENABLE_PROXY);
BooleanParameterImpl enableSocks = (BooleanParameterImpl) getPluginParam(BCFG_ENABLE_SOCKS);
StringParameterImpl pHost = (StringParameterImpl) getPluginParam(SCFG_PROXY_HOST);
IntParameterImpl pPort = (IntParameterImpl) getPluginParam(SCFG_PROXY_PORT);
StringParameterImpl pUser = (StringParameterImpl) getPluginParam(SCFG_PROXY_USERNAME);
StringParameterImpl pPass = (StringParameterImpl) getPluginParam(SCFG_PROXY_PASSWORD);
BooleanParameterImpl trackerDNSKill = (BooleanParameterImpl) getPluginParam(BCFG_PROXY_SOCKS_TRACKER_DNS_DISABLE);
ParameterImpl paramButtonTest = getPluginParam(ConfigSectionConnectionProxy.ID_BTN_TEST);
ParameterImpl[] socks_params = { enableProxy, enableSocks, pHost, pPort, pUser, pPass, trackerDNSKill };
ParameterListener socks_adapter = param -> {
boolean enabled = enableProxy.getValue() && enableSocks.getValue() && pHost.getValue().trim().length() > 0 && pPort.getValue() > 0;
boolean socks_enabled = enableProxy.getValue() && enableSocks.getValue();
trackerDNSKill.setEnabled(socks_enabled);
if (enabled) {
try {
NetworkAdminSocksProxy nasp = NetworkAdmin.getSingleton().createSocksProxy(pHost.getValue(), pPort.getValue(), pUser.getValue(), pPass.getValue());
synchronized (test_proxy) {
test_proxy[0] = nasp;
}
} catch (Throwable e) {
enabled = false;
}
}
if (!enabled) {
synchronized (test_proxy) {
test_proxy[0] = null;
}
}
final boolean f_enabled = enabled;
Utils.execSWTThread(() -> paramButtonTest.setEnabled(f_enabled));
};
for (ParameterImpl socks_param : socks_params) {
socks_param.addListener(socks_adapter);
}
// init settings
socks_adapter.parameterChanged(null);
}
Aggregations