Search in sources :

Example 1 with LabelParameterImpl

use of com.biglybt.pifimpl.local.ui.config.LabelParameterImpl 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);
}
Also used : LabelParameterImpl(com.biglybt.pifimpl.local.ui.config.LabelParameterImpl) IntParameterImpl(com.biglybt.pifimpl.local.ui.config.IntParameterImpl) IntListParameterImpl(com.biglybt.pifimpl.local.ui.config.IntListParameterImpl) BooleanParameterImpl(com.biglybt.pifimpl.local.ui.config.BooleanParameterImpl)

Example 2 with LabelParameterImpl

use of com.biglybt.pifimpl.local.ui.config.LabelParameterImpl in project BiglyBT by BiglySoftware.

the class ConfigSectionInterfaceStartSWT method build.

@Override
public void build() {
    setDefaultUITypesForAdd(UIInstance.UIT_SWT);
    // "Start" Sub-Section
    // -------------------
    add(new BooleanParameterImpl("ui.startfirst", "ConfigView.label.StartUIBeforeCore"), Parameter.MODE_ADVANCED);
    add(new BooleanParameterImpl("Show Splash", "ConfigView.label.showsplash"));
    // XXX is this really SWT only?
    add(new BooleanParameterImpl("update.start", "ConfigView.label.checkonstart"));
    // XXX is this really SWT only?
    add(new BooleanParameterImpl("update.periodic", "ConfigView.label.periodiccheck"));
    BooleanParameterImpl autoDownload = new BooleanParameterImpl("update.autodownload", "ConfigView.section.update.autodownload");
    add(autoDownload);
    BooleanParameterImpl openDialog = new BooleanParameterImpl("update.opendialog", "ConfigView.label.opendialog");
    add(openDialog);
    autoDownload.addDisabledOnSelection(openDialog);
    // XXX is this really SWT only?
    // no but can't think where else to put it
    add(new BooleanParameterImpl("update.anonymous", "ConfigView.label.update.anonymous")).setMinimumRequiredUserMode(Parameter.MODE_ADVANCED);
    add("ifs.gap1", new LabelParameterImpl(""));
    add(new BooleanParameterImpl("Open Transfer Bar On Start", "ConfigView.label.open_transfer_bar_on_start"));
    add(new BooleanParameterImpl("Start Minimized", "ConfigView.label.startminimized"));
    if (Constants.isUnix) {
        add(new BooleanParameterImpl("ui.useGTK2", "ConfigView.label.useGTK2"));
    }
    // UI switcher window.
    ActionParameterImpl ui_switcher_button = new ActionParameterImpl("ConfigView.label.ui_switcher", "ConfigView.label.ui_switcher_button");
    add(ui_switcher_button);
    ui_switcher_button.addListener(param -> Utils.execSWTThread(() -> UISwitcherUtil.openSwitcherWindow()));
}
Also used : LabelParameterImpl(com.biglybt.pifimpl.local.ui.config.LabelParameterImpl) ActionParameterImpl(com.biglybt.pifimpl.local.ui.config.ActionParameterImpl) BooleanParameterImpl(com.biglybt.pifimpl.local.ui.config.BooleanParameterImpl)

Example 3 with LabelParameterImpl

use of com.biglybt.pifimpl.local.ui.config.LabelParameterImpl in project BiglyBT by BiglySoftware.

the class ConfigSectionConnectionDNS method build.

@Override
public void build() {
    add(new LabelParameterImpl("ConfigView.section.dns.info"));
    add(new HyperlinkParameterImpl("ConfigView.label.please.visit.here", Wiki.DNS));
    add(new StringParameterImpl(Connection.SCFG_DNS_ALT_SERVERS, "ConfigView.section.dns.alts"));
    add(new BooleanParameterImpl(Connection.BCFG_DNS_ALT_SERVERS_SOCKS_ENABLE, "ConfigView.section.dns.allow_socks"));
}
Also used : LabelParameterImpl(com.biglybt.pifimpl.local.ui.config.LabelParameterImpl) HyperlinkParameterImpl(com.biglybt.pifimpl.local.ui.config.HyperlinkParameterImpl) StringParameterImpl(com.biglybt.pifimpl.local.ui.config.StringParameterImpl) BooleanParameterImpl(com.biglybt.pifimpl.local.ui.config.BooleanParameterImpl)

Example 4 with LabelParameterImpl

use of com.biglybt.pifimpl.local.ui.config.LabelParameterImpl in project BiglyBT by BiglySoftware.

the class ConfigSectionPlugins method build.

@Override
public void build() {
    if (!CoreFactory.isCoreRunning()) {
        add(new LabelParameterImpl("core.not.available"));
    }
    String sep = File.separator;
    File fUserPluginDir = FileUtil.getUserFile("plugins");
    String sUserPluginDir;
    try {
        sUserPluginDir = fUserPluginDir.getCanonicalPath();
    } catch (Throwable e) {
        sUserPluginDir = fUserPluginDir.toString();
    }
    if (!sUserPluginDir.endsWith(sep)) {
        sUserPluginDir += sep;
    }
    File fAppPluginDir = FileUtil.getApplicationFile("plugins");
    String sAppPluginDir;
    try {
        sAppPluginDir = fAppPluginDir.getCanonicalPath();
    } catch (Throwable e) {
        sAppPluginDir = fAppPluginDir.toString();
    }
    if (!sAppPluginDir.endsWith(sep)) {
        sAppPluginDir += sep;
    }
    add(new LabelParameterImpl("ConfigView.pluginlist.whereToPut"));
    File dirUserPlugin = FileUtil.newFile(sUserPluginDir);
    if (!(dirUserPlugin.exists() && dirUserPlugin.isDirectory())) {
        dirUserPlugin = dirUserPlugin.getParentFile();
    }
    HyperlinkParameterImpl paramUserPluginDir = new HyperlinkParameterImpl("!" + sUserPluginDir.replaceAll("&", "&&") + "!", dirUserPlugin.getAbsolutePath());
    add(paramUserPluginDir);
    paramUserPluginDir.setIndent(1, false);
    add(new LabelParameterImpl("ConfigView.pluginlist.whereToPutOr"));
    File dirAppPlugin = FileUtil.newFile(sAppPluginDir);
    if (!(dirAppPlugin.exists() && dirAppPlugin.isDirectory())) {
        dirAppPlugin = dirAppPlugin.getParentFile();
    }
    HyperlinkParameterImpl paramAppPluginDir = new HyperlinkParameterImpl("!" + sAppPluginDir.replaceAll("&", "&&") + "!", dirAppPlugin.getAbsolutePath());
    add(paramAppPluginDir);
    paramAppPluginDir.setIndent(1, false);
    if (paramContextPluginList != null) {
        add(new LabelParameterImpl("ConfigView.pluginlist.info"));
        add("PluginList", new UIParameterImpl(paramContextPluginList, null));
    } else {
    // could setup params for each plugin
    }
}
Also used : UIParameterImpl(com.biglybt.pifimpl.local.ui.config.UIParameterImpl) LabelParameterImpl(com.biglybt.pifimpl.local.ui.config.LabelParameterImpl) HyperlinkParameterImpl(com.biglybt.pifimpl.local.ui.config.HyperlinkParameterImpl) File(java.io.File)

Aggregations

LabelParameterImpl (com.biglybt.pifimpl.local.ui.config.LabelParameterImpl)4 BooleanParameterImpl (com.biglybt.pifimpl.local.ui.config.BooleanParameterImpl)3 HyperlinkParameterImpl (com.biglybt.pifimpl.local.ui.config.HyperlinkParameterImpl)2 ActionParameterImpl (com.biglybt.pifimpl.local.ui.config.ActionParameterImpl)1 IntListParameterImpl (com.biglybt.pifimpl.local.ui.config.IntListParameterImpl)1 IntParameterImpl (com.biglybt.pifimpl.local.ui.config.IntParameterImpl)1 StringParameterImpl (com.biglybt.pifimpl.local.ui.config.StringParameterImpl)1 UIParameterImpl (com.biglybt.pifimpl.local.ui.config.UIParameterImpl)1 File (java.io.File)1