setupTranscodeMenus(); // MDIEntry not required
}
public void setupConfigUI() {
BasicPluginConfigModel configModel = ui_manager.createBasicPluginConfigModel(
ConfigSection.SECTION_ROOT, "Devices");
// auto search
final BooleanParameter as =
configModel.addBooleanParameter2(
"device.search.auto", "device.search.auto",
device_manager.getAutoSearch());
as.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param)
{
device_manager.setAutoSearch( as.getValue());
if ( device_manager.getAutoSearch()){
search();
}
}
});
final BooleanParameter qosParam = configModel.addBooleanParameter2(
PlatformDevicesMessenger.CFG_SEND_QOS, "devices.turnon.qos", false);
// send qos
qosParam.setValue(COConfigurationManager.getBooleanParameter( PlatformDevicesMessenger.CFG_SEND_QOS, false));
qosParam.addListener(
new ParameterListener() {
public void parameterChanged(Parameter param) {
COConfigurationManager.setParameter(
PlatformDevicesMessenger.CFG_SEND_QOS, qosParam.getValue());
}
});
// 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()
{
public void
parameterChanged(
Parameter param)
{
COConfigurationManager.setParameter( CONFIG_VIEW_TYPE, config_simple_view.getValue()?SBV_SIMPLE:SBV_FULL );
}
});
COConfigurationManager.addParameterListener(
CONFIG_VIEW_TYPE,
new org.gudy.azureus2.core3.config.ParameterListener()
{
public void
parameterChanged(String
parameterName )
{
config_simple_view.setValue( COConfigurationManager.getIntParameter( CONFIG_VIEW_TYPE, SBV_SIMPLE ) == SBV_SIMPLE );
}
});
// generic devices
configModel.addBooleanParameter2(
"!" + CONFIG_VIEW_HIDE_REND_GENERIC + "!", "devices.sidebar.hide.rend.generic",
side_bar_hide_rend_gen );
// transcoding
// default dir
String def = device_manager.getDefaultWorkingDirectory().getAbsolutePath();
final DirectoryParameter def_work_dir = configModel.addDirectoryParameter2( "device.config.xcode.workdir", "device.config.xcode.workdir", def );
def_work_dir.setValue( def );
def_work_dir.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param )
{
device_manager.setDefaultWorkingDirectory(new File( def_work_dir.getValue()));
}
});
// max xcode
final IntParameter max_xcode =
configModel.addIntParameter2(
"device.config.xcode.maxbps", "device.config.xcode.maxbps",
(int)(device_manager.getTranscodeManager().getQueue().getMaxBytesPerSecond()/1024),
0, Integer.MAX_VALUE );
max_xcode.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param)
{
device_manager.getTranscodeManager().getQueue().setMaxBytesPerSecond( max_xcode.getValue()*1024 );
}
});
// itunes
final ActionParameter btnITunes = configModel.addActionParameter2("devices.button.installitunes", "UpdateWindow.columns.install");
btnITunes.setEnabled(false);
AzureusCoreFactory.addCoreRunningListener(new AzureusCoreRunningListener() {
public void azureusCoreRunning(AzureusCore core) {
boolean hasItunes = core.getPluginManager().getPluginInterfaceByID(
"azitunes") != null;
btnITunes.setEnabled(!hasItunes);
}
});
btnITunes.addListener(new ParameterListener() {
public void parameterChanged(Parameter param) {
CoreWaiterSWT.waitForCoreRunning(new AzureusCoreRunningListener() {
public void azureusCoreRunning(AzureusCore core) {
try {
PluginInstaller installer = core.getPluginManager().getPluginInstaller();
StandardPlugin itunes_plugin = installer.getStandardPlugin("azitunes");
itunes_plugin.install(false);
} catch (Throwable e) {
Debug.printStackTrace(e);
}
}
});
}
});
configModel.createGroup(
"device.xcode.group",
new Parameter[]
{
def_work_dir, max_xcode, btnITunes
});
// rss
final BooleanParameter rss_enable =
configModel.addBooleanParameter2(
"device.rss.enable", "device.rss.enable",
device_manager.isRSSPublishEnabled());
rss_enable.addListener(
new ParameterListener()
{
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,
});
// offline downloaders
// enable
final DeviceOfflineDownloaderManager dodm = device_manager.getOfflineDownlaoderManager();
final BooleanParameter od_enable =
configModel.addBooleanParameter2(
"device.od.enable", "device.od.enable",
dodm.isOfflineDownloadingEnabled());
od_enable.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param)
{
dodm.setOfflineDownloadingEnabled( od_enable.getValue());
rebuildSideBarIfExists();
}
});
// auto manage
final BooleanParameter od_auto_enable =
configModel.addBooleanParameter2(
"device.odauto.enable", "device.odauto.enable",
dodm.getOfflineDownloadingIsAuto());
od_auto_enable.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param)
{
dodm.setOfflineDownloadingIsAuto( od_auto_enable.getValue());
}
});
// private torrents
final BooleanParameter od_pt_enable =
configModel.addBooleanParameter2(
"device.odpt.enable", "device.odpt.enable",
dodm.getOfflineDownloadingIncludePrivate());
od_pt_enable.addListener(
new ParameterListener()
{
public void
parameterChanged(
Parameter param)
{
dodm.setOfflineDownloadingIncludePrivate( od_pt_enable.getValue());
}
});
od_auto_enable.addEnabledOnSelection( od_pt_enable );
configModel.createGroup(
"device.od.group",
new Parameter[]
{
od_enable, od_auto_enable, od_pt_enable,
});
final BooleanParameter tivo_enable =
configModel.addBooleanParameter2(
"device.tivo.enable", "device.tivo.enable", false );
tivo_enable.setValue(device_manager.isTiVoEnabled());
tivo_enable.addListener(