use of com.biglybt.pifimpl.local.ui.config.ParameterImpl in project BiglyBT by BiglySoftware.
the class ConfigSectionImpl method deleteConfigSection.
@Override
public void deleteConfigSection() {
for (ParameterImpl parameter : mapPluginParams.values()) {
parameter.destroy();
}
mapPluginParams.clear();
isBuilt = false;
}
use of com.biglybt.pifimpl.local.ui.config.ParameterImpl 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);
}
use of com.biglybt.pifimpl.local.ui.config.ParameterImpl in project BiglyBT by BiglySoftware.
the class ConfigSectionInterfaceLanguageSWT method configSectionCreate.
@Override
public void configSectionCreate(Composite parent, Map<ParameterImpl, BaseSwtParameter> mapParamToSwtParam) {
// Hack to get Language list to fill visible area and overflow vertically
ParameterImpl paramLocale = getPluginParam(UI.SCFG_LOCALE);
BaseSwtParameter swtParamLocale = mapParamToSwtParam.get(paramLocale);
if (swtParamLocale == null) {
return;
}
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.minimumHeight = 50;
swtParamLocale.getMainControl().setLayoutData(gridData);
}
use of com.biglybt.pifimpl.local.ui.config.ParameterImpl in project BiglyBT by BiglySoftware.
the class ConsoleConfigSections method getParameter.
public ParameterWithConfigSection getParameter(String configKey) {
List<BaseConfigSection> sections = getAllConfigSections(false);
for (BaseConfigSection section : sections) {
boolean needsBuild = !section.isBuilt();
try {
if (needsBuild) {
section.build();
section.postBuild();
}
ParameterImpl pluginParam = section.getPluginParam(configKey);
if (pluginParam != null) {
return new ParameterWithConfigSection(section, pluginParam);
}
} finally {
if (needsBuild) {
section.deleteConfigSection();
}
}
}
return null;
}
Aggregations