use of com.biglybt.core.CoreLifecycleAdapter in project BiglyBT by BiglySoftware.
the class UIConfigDefaultsSWTv3 method initialize.
public static void initialize(Core core) {
ConfigurationManager config = ConfigurationManager.getInstance();
if ("az2".equalsIgnoreCase(config.getStringParameter("ui", "az3"))) {
return;
}
int userMode = COConfigurationManager.getIntParameter("User Mode");
boolean startAdvanced = userMode > 1;
boolean configNeedsSave = false;
if (System.getProperty("FORCE_PROGRESSIVE", "").length() > 0) {
// TODO HACK FOR DEMO PURPOSES ONLY!
config.setParameter("Prioritize First Piece", true);
configNeedsSave = true;
}
final ConfigurationDefaults defaults = ConfigurationDefaults.getInstance();
defaults.addParameter("ui", "az3");
defaults.addParameter("Auto Upload Speed Enabled", true);
defaults.addParameter(ConfigurationDefaults.CFG_TORRENTADD_OPENOPTIONS, startAdvanced ? ConfigurationDefaults.CFG_TORRENTADD_OPENOPTIONS_ALWAYS : ConfigurationDefaults.CFG_TORRENTADD_OPENOPTIONS_MANY);
// defaults.addParameter("Add URL Silently", true); not used 11/30/2015 - see "Activate Window On External Download"
// defaults.addParameter("add_torrents_silently", true); not used 11/30/2015
defaults.addParameter("Popup Download Finished", false);
defaults.addParameter("Popup Download Added", false);
defaults.addParameter("Status Area Show SR", false);
defaults.addParameter("Status Area Show NAT", false);
defaults.addParameter("Status Area Show IPF", false);
defaults.addParameter("Status Area Show RIP", true);
defaults.addParameter("Message Popup Autoclose in Seconds", 10);
defaults.addParameter("window.maximized", true);
defaults.addParameter("update.autodownload", true);
// defaults.addParameter("suppress_file_download_dialog", true);
defaults.addParameter("auto_remove_inactive_items", false);
defaults.addParameter("show_torrents_menu", false);
config.removeParameter("v3.home-tab.starttab");
defaults.addParameter("MyTorrentsView.table.style", 0);
defaults.addParameter("v3.Show Welcome", true);
defaults.addParameter("Library.viewmode", startAdvanced ? 1 : 0);
defaults.addParameter("LibraryDL.viewmode", startAdvanced ? 1 : 0);
defaults.addParameter("LibraryDL.UseDefaultIndicatorColor", false);
defaults.addParameter("LibraryUnopened.viewmode", startAdvanced ? 1 : 0);
defaults.addParameter("LibraryCD.viewmode", startAdvanced ? 1 : 0);
defaults.addParameter("Library.EnableSimpleView", 1);
defaults.addParameter("Library.CatInSideBar", startAdvanced ? 1 : 0);
defaults.addParameter("Library.TagInSideBar", 1);
defaults.addParameter("Library.ShowTabsInTorrentView", 1);
defaults.addParameter("list.dm.dblclick", "0");
// === defaults used by MainWindow
defaults.addParameter("vista.adminquit", false);
defaults.addParameter("Start Minimized", false);
defaults.addParameter("Password enabled", false);
defaults.addParameter("ToolBar.showText", true);
defaults.addParameter("Table.extendedErase", !Constants.isWindowsXP);
defaults.addParameter("Table.useTree", true);
// by default, turn off some slidey warning
// Since they are plugin configs, we need to set the default after the
// plugin sets the default
core.addLifecycleListener(new CoreLifecycleAdapter() {
@Override
public void started(Core core) {
defaults.addParameter("Plugin.DHT.dht.warn.user", false);
defaults.addParameter("Plugin.UPnP.upnp.alertothermappings", false);
defaults.addParameter("Plugin.UPnP.upnp.alertdeviceproblems", false);
}
});
// run
if (!COConfigurationManager.hasParameter("v3.StartTab", true)) {
// Reset 'big' columns, remove some tables that no longer exist
Map<?, ?> map = FileUtil.readResilientConfigFile("tables.config");
if (map != null && map.size() > 0) {
Object[] keys = map.keySet().toArray();
boolean removedSome = false;
for (int i = 0; i < keys.length; i++) {
if (keys[i] instanceof String) {
String sKey = (String) keys[i];
if (sKey.endsWith(".big") || sKey.startsWith("Table.library-") || sKey.startsWith("Table.Media") || sKey.startsWith("Table.activity.table") || sKey.equals("Table.Activity.big") || sKey.equals("Table.Activity_SB")) {
map.remove(sKey);
removedSome = true;
}
}
}
if (removedSome) {
FileUtil.writeResilientConfigFile("tables.config", map);
}
}
}
if (configNeedsSave) {
config.save();
}
}
use of com.biglybt.core.CoreLifecycleAdapter in project BiglyBT by BiglySoftware.
the class SBC_DashboardView method build.
private void build() {
synchronized (SBC_DashboardView.class) {
if (!core_running) {
Core core = CoreFactory.getSingleton();
if (core.isStarted()) {
core_running = true;
} else {
if (!core_running_listener_added) {
core_running_listener_added = true;
core.addLifecycleListener(new CoreLifecycleAdapter() {
@Override
public boolean requiresPluginInitCompleteBeforeStartedEvent() {
return (true);
}
@Override
public void started(Core core) {
synchronized (SBC_DashboardView.class) {
core_running = true;
}
Utils.execSWTThread(new Runnable() {
public void run() {
buildSupport();
}
});
}
});
}
return;
}
}
}
buildSupport();
}
Aggregations