Search in sources :

Example 1 with StreamManager

use of com.biglybt.core.download.StreamManager in project BiglyBT by BiglySoftware.

the class DeviceManagerUI method setupConfigUI.

public void setupConfigUI() {
    configModel = ui_manager.createBasicPluginConfigModel(ConfigSection.SECTION_ROOT, CONFIG_SECTION_ID);
    // auto search
    final BooleanParameter as = configModel.addBooleanParameter2("device.search.auto", "device.search.auto", device_manager.getAutoSearch());
    as.addListener(new ParameterListener() {

        @Override
        public void parameterChanged(Parameter param) {
            device_manager.setAutoSearch(as.getValue());
            if (device_manager.getAutoSearch()) {
                search();
            }
        }
    });
    // config - simple view
    final BooleanParameter config_simple_view = configModel.addBooleanParameter2(CONFIG_VIEW_TYPE, "devices.sidebar.simple", side_bar_view_type == SBV_SIMPLE);
    config_simple_view.addListener(new ParameterListener() {

        @Override
        public void parameterChanged(Parameter param) {
            COConfigurationManager.setParameter(CONFIG_VIEW_TYPE, config_simple_view.getValue() ? SBV_SIMPLE : SBV_FULL);
        }
    });
    configListener = new com.biglybt.core.config.ParameterListener() {

        @Override
        public void parameterChanged(String parameterName) {
            config_simple_view.setValue(COConfigurationManager.getIntParameter(CONFIG_VIEW_TYPE, SBV_SIMPLE) == SBV_SIMPLE);
        }
    };
    COConfigurationManager.addWeakParameterListener(configListener, false, CONFIG_VIEW_TYPE);
    // generic devices
    configModel.addBooleanParameter2("!" + CONFIG_VIEW_HIDE_REND_GENERIC + "!", "devices.sidebar.hide.rend.generic", side_bar_hide_rend_gen);
    configModel.addBooleanParameter2("!" + CONFIG_VIEW_SHOW_ONLY_TAGGED + "!", "devices.sidebar.show.only.tagged", side_bar_show_tagged);
    // auto-hide old devices
    final IntParameter auto_hide_old = configModel.addIntParameter2("device.config.autohide.old.devices", "device.config.autohide.old.devices", device_manager.getAutoHideOldDevicesDays(), 0, 2048);
    auto_hide_old.addListener(new ParameterListener() {

        @Override
        public void parameterChanged(Parameter param) {
            device_manager.setAutoHideOldDevicesDays(auto_hide_old.getValue());
        }
    });
    // transcoding
    if (!DISABLED_TRANSCODING) {
        createTranscodingSection();
    }
    // media servers
    // max lines
    final IntParameter max_ms_lines = configModel.addIntParameter2("device.config.ms.maxlines", "device.config.ms.maxlines", MAX_MS_DISPLAY_LINE_DEFAULT, 0, Integer.MAX_VALUE);
    configModel.createGroup("device.ms.group", new Parameter[] { max_ms_lines });
    // rss
    final BooleanParameter rss_enable = configModel.addBooleanParameter2("device.rss.enable", "device.rss.enable", device_manager.isRSSPublishEnabled());
    rss_enable.addListener(new ParameterListener() {

        @Override
        public void parameterChanged(Parameter param) {
            device_manager.setRSSPublishEnabled(rss_enable.getValue());
        }
    });
    HyperlinkParameter rss_view = configModel.addHyperlinkParameter2("device.rss.view", device_manager.getRSSLink());
    rss_enable.addEnabledOnSelection(rss_view);
    configModel.createGroup("device.rss.group", new Parameter[] { rss_enable, rss_view });
    // play now
    final StreamManager sm = StreamManager.getSingleton();
    final IntParameter pn_buffer = configModel.addIntParameter2("device.playnow.buffer", "device.playnow.buffer", sm.getBufferSecs());
    pn_buffer.addListener(new ParameterListener() {

        @Override
        public void parameterChanged(Parameter param) {
            sm.setBufferSecs(pn_buffer.getValue());
        }
    });
    final IntParameter pn_min_buffer = configModel.addIntParameter2("device.playnow.min_buffer", "device.playnow.min_buffer", sm.getMinBufferSecs());
    pn_min_buffer.addListener(new ParameterListener() {

        @Override
        public void parameterChanged(Parameter param) {
            sm.setMinBufferSecs(pn_buffer.getValue());
        }
    });
    configModel.createGroup("device.playnow.group", new Parameter[] { pn_buffer, pn_min_buffer });
    if (!DISABLED_TRANSCODING) {
        final BooleanParameter tivo_enable = configModel.addBooleanParameter2("device.tivo.enable", "device.tivo.enable", false);
        tivo_enable.setValue(device_manager.isTiVoEnabled());
        tivo_enable.addListener(new ParameterListener() {

            @Override
            public void parameterChanged(Parameter param) {
                device_manager.setTiVoEnabled(tivo_enable.getValue());
                rebuildSideBarIfExists();
            }
        });
    }
}
Also used : StreamManager(com.biglybt.core.download.StreamManager) com.biglybt.pif.ui.config(com.biglybt.pif.ui.config)

Aggregations

StreamManager (com.biglybt.core.download.StreamManager)1 com.biglybt.pif.ui.config (com.biglybt.pif.ui.config)1