use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.
the class PMSWTImpl method initialise.
@Override
public void initialise(final PluginInterface pi, final BooleanParameter icon_enable) {
final NetworkAdmin na = NetworkAdmin.getSingleton();
na.addPropertyChangeListener(new NetworkAdminPropertyChangeListener() {
@Override
public void propertyChanged(String property) {
if (property == NetworkAdmin.PR_NETWORK_INTERFACES) {
updateLocalAddresses(na);
}
}
});
updateLocalAddresses(na);
pi.getUIManager().addUIListener(new UIManagerListener() {
@Override
public void UIAttached(final UIInstance instance) {
if (instance instanceof UISWTInstance) {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (uif != null) {
uiUpdaterListener = new UIUpdaterListener() {
@Override
public void updateComplete(int count) {
last_update_count = count;
updateStatus(true);
}
};
uif.getUIUpdater().addListener(uiUpdaterListener);
}
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
ImageLoader imageLoader = ImageLoader.getInstance();
icon_idle = imageLoader.getImage("pair_sb_idle");
icon_green = imageLoader.getImage("pair_sb_green");
icon_red = imageLoader.getImage("pair_sb_red");
UISWTInstance ui_instance = (UISWTInstance) instance;
status = ui_instance.createStatusEntry();
last_tooltip_text = MessageText.getString("pairing.ui.icon.tip");
status.setTooltipText(last_tooltip_text);
status.setImageEnabled(true);
status.setImage(icon_idle);
last_image = icon_idle;
boolean is_visible = icon_enable.getValue();
status.setVisible(is_visible);
if (is_visible) {
updateStatus(false);
}
final MenuItem mi_show = pi.getUIManager().getMenuManager().addMenuItem(status.getMenuContext(), "pairing.ui.icon.show");
mi_show.setStyle(MenuItem.STYLE_CHECK);
mi_show.setData(Boolean.valueOf(is_visible));
mi_show.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
icon_enable.setValue(false);
}
});
iconEnableListener = new ParameterListener() {
@Override
public void parameterChanged(Parameter param) {
boolean is_visible = icon_enable.getValue();
status.setVisible(is_visible);
mi_show.setData(Boolean.valueOf(is_visible));
if (is_visible) {
updateStatus(false);
}
}
};
icon_enable.addListener(iconEnableListener);
MenuItem mi_pairing = pi.getUIManager().getMenuManager().addMenuItem(status.getMenuContext(), "MainWindow.menu.pairing");
mi_pairing.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (uif == null) {
Debug.out("UIFunctions not available, can't open remote pairing window");
} else {
uif.openRemotePairingWindow();
}
}
});
MenuItem mi_sep = pi.getUIManager().getMenuManager().addMenuItem(status.getMenuContext(), "");
mi_sep.setStyle(MenuItem.STYLE_SEPARATOR);
MenuItem mi_options = pi.getUIManager().getMenuManager().addMenuItem(status.getMenuContext(), "MainWindow.menu.view.configuration");
mi_options.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (uif != null) {
uif.getMDI().showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_CONFIG, PairingManager.CONFIG_SECTION_ID);
}
}
});
UISWTStatusEntryListener click_listener = new UISWTStatusEntryListener() {
@Override
public void entryClicked(UISWTStatusEntry entry) {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (uif != null) {
uif.getMDI().showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_CONFIG, PairingManager.CONFIG_SECTION_ID);
}
}
};
status.setListener(click_listener);
}
});
}
}
@Override
public void UIDetached(UIInstance instance) {
if (instance instanceof UISWTInstance) {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (uif != null && uiUpdaterListener != null) {
uif.getUIUpdater().removeListener(uiUpdaterListener);
uiUpdaterListener = null;
}
if (status != null) {
// menu items get destroyed with this call
status.destroy();
status = null;
}
if (icon_enable != null && iconEnableListener != null) {
icon_enable.removeListener(iconEnableListener);
iconEnableListener = null;
}
}
}
});
}
use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.
the class MainStatusBar method initStatusBar.
/**
* @return composite holding the statusbar
*/
public Composite initStatusBar(final Composite _parent) {
this.parent = _parent;
this.display = parent.getDisplay();
this.uiFunctions = UIFunctionsManager.getUIFunctions();
ImageLoader imageLoader = ImageLoader.getInstance();
FormData formData;
Color fgColor = parent.getForeground();
statusBar = new Composite(parent, SWT.NONE);
statusBar.setForeground(fgColor);
isAZ3 = "az3".equalsIgnoreCase(COConfigurationManager.getStringParameter("ui"));
statusBar.getShell().addListener(SWT.Deiconify, new Listener() {
@Override
public void handleEvent(Event event) {
Utils.execSWTThreadLater(0, new AERunnable() {
@Override
public void runSupport() {
if (!statusBar.isDisposed()) {
statusBar.layout();
}
}
});
}
});
statusBar.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (uiFunctions != null) {
UIUpdater uiUpdater = uiFunctions.getUIUpdater();
if (uiUpdater != null) {
uiUpdater.removeUpdater(MainStatusBar.this);
}
}
PRManager.removeListener(progressListener);
Utils.disposeSWTObjects(imgRec, imgSent);
Utils.removeParameterListeners(mapConfigListeners);
if (alert_flasher_event != null) {
alert_flasher_event.cancel();
alert_flasher_event = null;
}
if (alertHistoryListener != null) {
Alerts.removeMessageHistoryListener(alertHistoryListener);
alertHistoryListener = null;
}
}
});
GridLayout layout_status = new GridLayout();
layout_status.numColumns = 20;
layout_status.horizontalSpacing = 0;
layout_status.verticalSpacing = 0;
layout_status.marginHeight = 0;
if (Constants.isOSX) {
// OSX has a resize widget on the bottom right. It's about 15px wide.
try {
layout_status.marginRight = 15;
} catch (NoSuchFieldError e) {
// Pre SWT 3.1
layout_status.marginWidth = 15;
}
} else {
layout_status.marginWidth = 0;
}
statusBar.setLayout(layout_status);
// Either the Status Text
statusText = new CLabel(statusBar, borderFlag);
statusText.setForeground(fgColor);
Utils.setLayoutData(statusText, new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
addStatusBarMenu(statusText);
GC gc = new GC(statusText);
// add 6, because CLabel forces a 3 pixel indent
int height = Math.max(16, gc.getFontMetrics().getHeight()) + 6;
gc.dispose();
formData = new FormData();
formData.height = height;
// 2 params for Pre SWT 3.0
formData.bottom = new FormAttachment(100, 0);
// 2 params for Pre SWT 3.0
formData.left = new FormAttachment(0, 0);
// 2 params for Pre SWT 3.0
formData.right = new FormAttachment(100, 0);
statusBar.setLayoutData(formData);
Listener listener = new Listener() {
@Override
public void handleEvent(Event e) {
if (clickListener == null) {
if (updateWindow != null) {
updateWindow.show();
}
} else {
clickListener.UIStatusTextClicked();
}
}
};
statusText.addListener(SWT.MouseUp, listener);
statusText.addListener(SWT.MouseDoubleClick, listener);
// KN: Don't know why OSX is treated differently but this check was already here from the previous code
if (Constants.isOSX) {
progressBar = new AZProgressBar(statusBar, true);
} else {
progressBar = new AZProgressBar(statusBar, false);
}
progressBar.setVisible(false);
progressGridData = new GridData(SWT.CENTER, SWT.CENTER, false, false);
progressGridData.widthHint = 5;
Utils.setLayoutData(progressBar, progressGridData);
// addRIP();
/*
* Progress reporting window image label
*/
progressViewerImageLabel = new CLabelPadding(statusBar, SWT.NONE);
// image set below after adding listener
progressViewerImageLabel.setToolTipText(MessageText.getString("Progress.reporting.statusbar.button.tooltip"));
progressViewerImageLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
/*
* Opens the progress viewer if any of the reporters in the array is NOT already opened
* KN: TODO -- This is only a partial solution to minimize the occurrence of the main progress window
* opening more than once. The one remaining case where multiple windows will still open is
* when you have one opened already... then run another process such as a torrent file download...
* at this point this new process is not in the already opened window so the check would
* allow the second window to open.
*/
IProgressReporter[] reporters = PRManager.getReportersArray(false);
if (reporters.length == 0) {
/*
* If there's nothing to see then open the window; the default widow will say there's nothing to see
* KN: calling isShowingEmpty return true is there is already a window opened showing the empty panel
*/
if (!ProgressReporterWindow.isShowingEmpty()) {
ProgressReporterWindow.open(reporters, ProgressReporterWindow.SHOW_TOOLBAR);
}
} else {
for (int i = 0; i < reporters.length; i++) {
if (!ProgressReporterWindow.isOpened(reporters[i])) {
ProgressReporterWindow.open(reporters, ProgressReporterWindow.SHOW_TOOLBAR);
break;
}
}
}
}
});
progressViewerImageLabel.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.releaseImage("progress_error");
imageLoader.releaseImage("progress_info");
imageLoader.releaseImage("progress_viewer");
}
});
this.plugin_label_composite = new Composite(statusBar, SWT.NONE);
this.plugin_label_composite.setForeground(fgColor);
GridLayout gridLayout = new GridLayout();
gridLayout.horizontalSpacing = 0;
gridLayout.verticalSpacing = 0;
gridLayout.marginHeight = 0;
gridLayout.marginBottom = 0;
gridLayout.marginTop = 0;
gridLayout.marginLeft = 0;
gridLayout.marginRight = 0;
// Something nice and big. :)
gridLayout.numColumns = 20;
GridData gridData = new GridData(GridData.FILL_VERTICAL);
gridData.heightHint = height;
gridData.minimumHeight = height;
plugin_label_composite.setLayout(gridLayout);
plugin_label_composite.setLayoutData(gridData);
srStatus = new CLabelPadding(statusBar, borderFlag);
srStatus.setText(MessageText.getString("SpeedView.stats.ratio"));
Utils.addAndFireParameterListener(mapConfigListeners, true, "Status Area Show SR", new ParameterListener() {
@Override
public void parameterChanged(String parameterName) {
srStatus.setVisible(COConfigurationManager.getBooleanParameter(parameterName));
statusBar.layout();
}
});
natStatus = new CLabelPadding(statusBar, borderFlag);
natStatus.setText("");
final Menu natStatusMenu = new Menu(statusBar.getShell(), SWT.POP_UP);
natStatus.setMenu(natStatusMenu);
MenuItem nat_test = new MenuItem(natStatusMenu, SWT.PUSH);
Messages.setLanguageText(nat_test, "MainWindow.menu.tools.nattest");
nat_test.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
new NatTestWindow();
}
});
Utils.addAndFireParameterListener(mapConfigListeners, true, "Status Area Show NAT", new ParameterListener() {
@Override
public void parameterChanged(String parameterName) {
natStatus.setVisible(COConfigurationManager.getBooleanParameter(parameterName));
statusBar.layout();
}
});
dhtStatus = new CLabelPadding(statusBar, borderFlag);
dhtStatus.setText("");
dhtStatus.setToolTipText(MessageText.getString("MainWindow.dht.status.tooltip"));
Utils.addAndFireParameterListener(mapConfigListeners, true, "Status Area Show DDB", new ParameterListener() {
@Override
public void parameterChanged(String parameterName) {
dhtStatus.setVisible(COConfigurationManager.getBooleanParameter(parameterName));
statusBar.layout();
}
});
// ip filters
ipBlocked = new CLabelPadding(statusBar, borderFlag);
// $NON-NLS-1$
ipBlocked.setText("{} IPs:");
Messages.setLanguageText(ipBlocked, "MainWindow.IPs.tooltip");
ipBlocked.addListener(SWT.MouseDoubleClick, new ListenerNeedingCoreRunning() {
@Override
public void handleEvent(Core core, Event event) {
BlockedIpsWindow.showBlockedIps(core, parent.getShell());
}
});
final Menu menuIPFilter = new Menu(statusBar.getShell(), SWT.POP_UP);
ipBlocked.setMenu(menuIPFilter);
menuIPFilter.addListener(SWT.Show, new Listener() {
@Override
public void handleEvent(Event e) {
MenuItem[] oldItems = menuIPFilter.getItems();
for (int i = 0; i < oldItems.length; i++) {
oldItems[i].dispose();
}
if (!CoreFactory.isCoreRunning()) {
return;
}
Core core = CoreFactory.getSingleton();
final IpFilter ip_filter = core.getIpFilterManager().getIPFilter();
final MenuItem ipfEnable = new MenuItem(menuIPFilter, SWT.CHECK);
ipfEnable.setSelection(ip_filter.isEnabled());
Messages.setLanguageText(ipfEnable, "MyTorrentsView.menu.ipf_enable");
ipfEnable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ip_filter.setEnabled(ipfEnable.getSelection());
}
});
final MenuItem ipfOptions = new MenuItem(menuIPFilter, SWT.PUSH);
Messages.setLanguageText(ipfOptions, "ipfilter.options");
ipfOptions.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (uif != null) {
uif.getMDI().showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_CONFIG, "ipfilter");
}
}
});
}
});
Utils.addAndFireParameterListener(mapConfigListeners, true, "Status Area Show IPF", new ParameterListener() {
@Override
public void parameterChanged(String parameterName) {
ipBlocked.setVisible(COConfigurationManager.getBooleanParameter(parameterName));
statusBar.layout();
}
});
// down speed
statusDown = new CLabelPadding(statusBar, borderFlag);
statusDown.setImage(imageLoader.getImage("down"));
// statusDown.setText(/*MessageText.getString("ConfigView.download.abbreviated") +*/"n/a");
Messages.setLanguageText(statusDown, "MainWindow.status.updowndetails.tooltip");
Listener lStats = new Listener() {
@Override
public void handleEvent(Event e) {
uiFunctions.getMDI().loadEntryByID(StatsView.VIEW_ID, true, false, "TransferStatsView");
}
};
statusUp = new CLabelPadding(statusBar, borderFlag);
statusUp.setImage(imageLoader.getImage("up"));
// statusUp.setText(/*MessageText.getString("ConfigView.upload.abbreviated") +*/"n/a");
Messages.setLanguageText(statusUp, "MainWindow.status.updowndetails.tooltip");
statusDown.addListener(SWT.MouseDoubleClick, lStats);
statusUp.addListener(SWT.MouseDoubleClick, lStats);
Listener lDHT = new Listener() {
@Override
public void handleEvent(Event e) {
uiFunctions.getMDI().loadEntryByID(StatsView.VIEW_ID, true, false, "DHTView");
}
};
dhtStatus.addListener(SWT.MouseDoubleClick, lDHT);
Listener lSR = new Listener() {
@Override
public void handleEvent(Event e) {
uiFunctions.getMDI().loadEntryByID(StatsView.VIEW_ID, true, false, "SpeedView");
OverallStats stats = StatsFactory.getStats();
if (stats == null) {
return;
}
long ratio = (1000 * stats.getUploadedBytes() / (stats.getDownloadedBytes() + 1));
if (ratio < 900) {
// Utils.launch(Constants.AZUREUS_WIKI + "Share_Ratio");
}
}
};
srStatus.addListener(SWT.MouseDoubleClick, lSR);
Listener lNAT = new ListenerNeedingCoreRunning() {
@Override
public void handleEvent(Core core, Event e) {
uiFunctions.getMDI().loadEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_CONFIG, true, false, ConfigSection.SECTION_CONNECTION);
if (PluginInitializer.getDefaultInterface().getConnectionManager().getNATStatus() != ConnectionManager.NAT_OK) {
Utils.launch(Constants.AZUREUS_WIKI + "NAT_problem");
}
}
};
natStatus.addListener(SWT.MouseDoubleClick, lNAT);
boolean bSpeedMenu = COConfigurationManager.getBooleanParameter("GUI_SWT_bOldSpeedMenu");
if (bSpeedMenu) {
// Status Bar Menu construction
final Menu menuUpSpeed = new Menu(statusBar.getShell(), SWT.POP_UP);
menuUpSpeed.addListener(SWT.Show, new Listener() {
@Override
public void handleEvent(Event e) {
if (!CoreFactory.isCoreRunning()) {
return;
}
Core core = CoreFactory.getSingleton();
GlobalManager globalManager = core.getGlobalManager();
SelectableSpeedMenu.generateMenuItems(menuUpSpeed, core, globalManager, true);
}
});
statusUp.setMenu(menuUpSpeed);
} else {
statusUp.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
if (!(e.button == 3 || (e.button == 1 && e.stateMask == SWT.CONTROL))) {
return;
}
Event event = new Event();
event.type = SWT.MouseUp;
event.widget = e.widget;
event.stateMask = e.stateMask;
event.button = e.button;
e.widget.getDisplay().post(event);
CoreWaiterSWT.waitForCoreRunning(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
SelectableSpeedMenu.invokeSlider(statusUp, core, true);
}
});
}
});
}
if (bSpeedMenu) {
final Menu menuDownSpeed = new Menu(statusBar.getShell(), SWT.POP_UP);
menuDownSpeed.addListener(SWT.Show, new Listener() {
@Override
public void handleEvent(Event e) {
if (!CoreFactory.isCoreRunning()) {
return;
}
Core core = CoreFactory.getSingleton();
GlobalManager globalManager = core.getGlobalManager();
SelectableSpeedMenu.generateMenuItems(menuDownSpeed, core, globalManager, false);
}
});
statusDown.setMenu(menuDownSpeed);
} else {
statusDown.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
if (!(e.button == 3 || (e.button == 1 && e.stateMask == SWT.CONTROL))) {
return;
}
Event event = new Event();
event.type = SWT.MouseUp;
event.widget = e.widget;
event.stateMask = e.stateMask;
event.button = e.button;
e.widget.getDisplay().post(event);
CoreWaiterSWT.waitForCoreRunning(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
SelectableSpeedMenu.invokeSlider(statusDown, core, false);
}
});
}
});
}
statusWarnings = new CLabelPadding(statusBar, borderFlag);
warningIcon = imageLoader.getImage("image.sidebar.vitality.alert");
warningGreyIcon = imageLoader.getImage("image.sidebar.vitality.alert-gray");
infoIcon = imageLoader.getImage("image.sidebar.vitality.info");
updateStatusWarnings(null, false);
Messages.setLanguageText(statusWarnings, "MainWindow.status.warning.tooltip");
alertHistoryListener = new AlertHistoryListener() {
@Override
public void alertHistoryAdded(LogAlert alert) {
updateStatusWarnings(alert, true);
}
@Override
public void alertHistoryRemoved(LogAlert alert) {
updateStatusWarnings(alert, false);
}
};
Alerts.addMessageHistoryListener(alertHistoryListener);
statusWarnings.addMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent e) {
if (e.button != 1) {
return;
}
if (SystemWarningWindow.numWarningWindowsOpen > 0) {
return;
}
ArrayList<LogAlert> alerts = Alerts.getUnviewedLogAlerts();
if (alerts.size() == 0) {
return;
}
Shell shell = statusWarnings.getShell();
Rectangle bounds = statusWarnings.getClientArea();
Point ptBottomRight = statusWarnings.toDisplay(bounds.x + bounds.width, bounds.y);
new SystemWarningWindow(alerts.get(0), ptBottomRight, shell, 0);
}
@Override
public void mouseDown(MouseEvent e) {
}
@Override
public void mouseDoubleClick(MouseEvent e) {
}
});
Menu menuStatusWarnings = new Menu(statusBar.getShell(), SWT.POP_UP);
statusWarnings.setMenu(menuStatusWarnings);
final MenuItem dismissAllItem = new MenuItem(menuStatusWarnings, SWT.PUSH);
menuStatusWarnings.addListener(SWT.Show, new Listener() {
@Override
public void handleEvent(Event e) {
dismissAllItem.setEnabled(Alerts.getUnviewedLogAlerts().size() > 0);
}
});
Messages.setLanguageText(dismissAllItem, "label.dismiss.all");
dismissAllItem.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
ArrayList<LogAlert> alerts = Alerts.getUnviewedLogAlerts();
for (LogAlert a : alerts) {
Alerts.markAlertAsViewed(a);
}
}
});
Utils.addAndFireParameterListener(mapConfigListeners, true, "status.rategraphs", new ParameterListener() {
@Override
public void parameterChanged(String parameterName) {
boolean doRateGraphs = COConfigurationManager.getBooleanParameter("status.rategraphs");
if (doRateGraphs) {
if (imgRec == null || imgRec.isDisposed()) {
imgRec = new Image(display, 100, 20);
GC gc = new GC(imgRec);
gc.setBackground(statusDown.getBackground());
gc.fillRectangle(0, 0, 100, 20);
gc.dispose();
statusDown.setBackgroundImage(imgRec);
}
if (imgSent == null || imgSent.isDisposed()) {
imgSent = new Image(display, 100, 20);
GC gc = new GC(imgSent);
gc.setBackground(statusUp.getBackground());
gc.fillRectangle(0, 0, 100, 20);
gc.dispose();
statusUp.setBackgroundImage(imgSent);
}
} else {
statusUp.setBackgroundImage(null);
statusDown.setBackgroundImage(null);
Utils.disposeSWTObjects(imgRec, imgSent);
imgRec = imgSent = null;
}
}
});
// ///////
progressListener = new ProgressListener();
PRManager.addListener(progressListener);
uiFunctions.getUIUpdater().addUpdater(this);
ArrayList<Runnable> list;
this_mon.enter();
try {
list = listRunAfterInit;
listRunAfterInit = null;
} finally {
this_mon.exit();
}
for (Runnable runnable : list) {
try {
runnable.run();
} catch (Exception e) {
Debug.out(e);
}
}
statusBar.layout(true);
return statusBar;
}
use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.
the class AboutWindow method disposeImage.
public static void disposeImage() {
try {
class_mon.enter();
Utils.disposeSWTObjects(new Object[] { imageToDispose });
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.releaseImage(IMG_SPLASH);
image = null;
imgSrc = null;
} finally {
class_mon.exit();
}
}
use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.
the class ColumnTJ_Completion method cellPaint.
@Override
public void cellPaint(GC gcImage, TableCellSWT cell) {
TranscodeFile tf = (TranscodeFile) cell.getDataSource();
int perThouDone = getPerThouDone(tf);
Rectangle bounds = cell.getBounds();
int yOfs = (bounds.height - 13) / 2;
int x1 = bounds.width - borderWidth - 2;
int y1 = bounds.height - 3 - yOfs;
if (x1 < 10 || y1 < 3) {
return;
}
ImageLoader imageLoader = ImageLoader.getInstance();
Image imgEnd = imageLoader.getImage("tc_bar_end");
Image img0 = imageLoader.getImage("tc_bar_0");
Image img1 = imageLoader.getImage("tc_bar_1");
// draw begining and end
if (!imgEnd.isDisposed()) {
gcImage.drawImage(imgEnd, bounds.x, bounds.y + yOfs);
gcImage.drawImage(imgEnd, bounds.x + x1 + 1, bounds.y + yOfs);
}
int limit = (x1 * perThouDone) / 1000;
if (!img1.isDisposed() && limit > 0) {
Rectangle imgBounds = img1.getBounds();
gcImage.drawImage(img1, 0, 0, imgBounds.width, imgBounds.height, bounds.x + 1, bounds.y + yOfs, limit, imgBounds.height);
}
if (perThouDone < 1000 && !img0.isDisposed()) {
Rectangle imgBounds = img0.getBounds();
gcImage.drawImage(img0, 0, 0, imgBounds.width, imgBounds.height, bounds.x + limit + 1, bounds.y + yOfs, x1 - limit, imgBounds.height);
}
imageLoader.releaseImage("tc_bar_end");
imageLoader.releaseImage("tc_bar_0");
imageLoader.releaseImage("tc_bar_1");
if (textColor == null) {
textColor = ColorCache.getColor(gcImage.getDevice(), "#006600");
}
gcImage.setForeground(textColor);
if (fontText == null) {
fontText = FontUtils.getFontWithHeight(gcImage.getFont(), gcImage, 10);
}
gcImage.setFont(fontText);
String sText;
if (tf != null && perThouDone == 1000 && !tf.getTranscodeRequired()) {
sText = na_text;
} else {
// DisplayFormatters.formatPercentFromThousands(perThouDone);
sText = percentage_format.format(perThouDone / 1000.0);
if (tf != null && perThouDone < 1000) {
String eta = getETA(tf);
if (eta != null) {
sText += " - " + eta;
}
}
}
GCStringPrinter.printString(gcImage, sText, new Rectangle(bounds.x + 4, bounds.y + yOfs, bounds.width - 4, 13), true, false, SWT.CENTER);
}
use of com.biglybt.ui.swt.imageloader.ImageLoader in project BiglyBT by BiglySoftware.
the class BuddyPluginViewInstance method createBeta.
private void createBeta(Composite main) {
Utils.disposeComposite(main, false);
final BuddyPluginBeta plugin_beta = plugin.getBeta();
GridLayout layout = new GridLayout();
layout.numColumns = 3;
main.setLayout(layout);
GridData grid_data = new GridData(GridData.FILL_BOTH);
Utils.setLayoutData(main, grid_data);
beta_enabled = plugin.isBetaEnabled();
if (!beta_enabled) {
Label control_label = new Label(main, SWT.NULL);
control_label.setText(lu.getLocalisedMessageText("azbuddy.disabled"));
Label label = new Label(main, SWT.NULL);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
label.setLayoutData(grid_data);
final Button config_button = new Button(main, SWT.NULL);
config_button.setText(lu.getLocalisedMessageText("plugins.basicview.config"));
config_button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
plugin.showConfig();
}
});
return;
}
final BuddyPluginBeta beta = plugin.getBeta();
boolean i2p_enabled = plugin_beta.isI2PAvailable();
// info
Composite info_area = new Composite(main, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 4;
layout.marginHeight = 0;
layout.marginWidth = 0;
info_area.setLayout(layout);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 3;
Utils.setLayoutData(info_area, grid_data);
Label label = new Label(info_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.info"));
new LinkLabel(info_area, "ConfigView.label.please.visit.here", lu.getLocalisedMessageText("azbuddy.dchat.link.url"));
label = new Label(info_area, SWT.NULL);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
label.setLayoutData(grid_data);
final Button config_button = new Button(info_area, SWT.NULL);
config_button.setText(lu.getLocalisedMessageText("plugins.basicview.config"));
config_button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
plugin.showConfig();
}
});
// install plugin
label = new Label(info_area, SWT.NULL);
label.setText(MessageText.getString("azmsgsync.install.text"));
plugin_install_button = new Button(info_area, SWT.NULL);
plugin_install_button.setText(MessageText.getString("UpdateWindow.columns.install"));
plugin_install_button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
plugin_install_button.setEnabled(false);
new AEThread2("installer") {
@Override
public void run() {
boolean ok = false;
String msg;
try {
installMsgSyncPlugin();
msg = MessageText.getString("azmsgsync.install.ok.msg");
ok = true;
} catch (Throwable e) {
msg = MessageText.getString("azmsgsync.install.fail.msg", new String[] { Debug.getNestedExceptionMessage(e) });
} finally {
if (!checkMsgSyncPlugin()) {
if (ok) {
// something weird happened
ok = false;
msg = MessageText.getString("azmsgsync.install.fail.msg", new String[] { "Unexpected error, check logs" });
}
}
}
plugin.getPluginInterface().getUIManager().showMessageBox(ok ? "aztorplugin.browser.install.ok" : "aztorplugin.browser.install.fail", "!" + msg + "!", UIManagerEvent.MT_OK);
}
}.start();
}
});
label = new Label(info_area, SWT.NULL);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 2;
label.setLayoutData(grid_data);
checkMsgSyncPlugin();
// UI
final Group ui_area = new Group(main, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
ui_area.setLayout(layout);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 3;
Utils.setLayoutData(ui_area, grid_data);
ui_area.setText(lu.getLocalisedMessageText("ConfigView.section.style"));
// shared public nick
label = new Label(ui_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.public.nick"));
public_nickname = new Text(ui_area, SWT.BORDER);
grid_data = new GridData();
grid_data.widthHint = 200;
Utils.setLayoutData(public_nickname, grid_data);
public_nickname.setText(plugin_beta.getSharedPublicNickname());
public_nickname.addListener(SWT.FocusOut, new Listener() {
@Override
public void handleEvent(Event event) {
plugin_beta.setSharedPublicNickname(public_nickname.getText().trim());
}
});
label = new Label(ui_area, SWT.NULL);
// shared anon nick
label = new Label(ui_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.anon.nick"));
anon_nickname = new Text(ui_area, SWT.BORDER);
grid_data = new GridData();
grid_data.widthHint = 200;
Utils.setLayoutData(anon_nickname, grid_data);
anon_nickname.setText(plugin_beta.getSharedAnonNickname());
anon_nickname.addListener(SWT.FocusOut, new Listener() {
@Override
public void handleEvent(Event event) {
plugin_beta.setSharedAnonNickname(anon_nickname.getText().trim());
}
});
label = new Label(ui_area, SWT.NULL);
// max lines
label = new Label(ui_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.ui.max.lines"));
final IntParameter max_lines = new IntParameter(ui_area, "azbuddy.chat.temp.ui.max.lines", 128, Integer.MAX_VALUE);
max_lines.setValue(beta.getMaxUILines());
max_lines.addChangeListener(new ParameterChangeAdapter() {
@Override
public void parameterChanged(Parameter p, boolean caused_internally) {
beta.setMaxUILines(max_lines.getValue());
}
});
label = new Label(ui_area, SWT.NULL);
// max chars
label = new Label(ui_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.ui.max.kb"));
final IntParameter max_chars = new IntParameter(ui_area, "azbuddy.chat.temp.ui.max.chars", 1, 512);
max_chars.setValue(beta.getMaxUICharsKB());
max_chars.addChangeListener(new ParameterChangeAdapter() {
@Override
public void parameterChanged(Parameter p, boolean caused_internally) {
beta.setMaxUICharsKB(max_chars.getValue());
}
});
label = new Label(ui_area, SWT.NULL);
// hide ratings
final Button hide_ratings = new Button(ui_area, SWT.CHECK);
hide_ratings.setText(lu.getLocalisedMessageText("azbuddy.dchat.ui.hide.ratings"));
hide_ratings.setSelection(plugin_beta.getHideRatings());
hide_ratings.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setHideRatings(hide_ratings.getSelection());
}
});
label = new Label(ui_area, SWT.NULL);
grid_data = new GridData();
grid_data.horizontalSpan = 2;
Utils.setLayoutData(label, grid_data);
// hide search/subcriptions
final Button hide_search_subs = new Button(ui_area, SWT.CHECK);
hide_search_subs.setText(lu.getLocalisedMessageText("azbuddy.dchat.ui.hide.search_subs"));
hide_search_subs.setSelection(plugin_beta.getHideSearchSubs());
hide_search_subs.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setHideSearchSubs(hide_search_subs.getSelection());
}
});
label = new Label(ui_area, SWT.NULL);
grid_data = new GridData();
grid_data.horizontalSpan = 2;
Utils.setLayoutData(label, grid_data);
// standalone windows
final Button stand_alone = new Button(ui_area, SWT.CHECK);
stand_alone.setText(lu.getLocalisedMessageText("azbuddy.dchat.ui.standalone.windows"));
stand_alone.setSelection(plugin_beta.getStandAloneWindows());
stand_alone.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setStandAloneWindows(stand_alone.getSelection());
}
});
label = new Label(ui_area, SWT.NULL);
grid_data = new GridData();
grid_data.horizontalSpan = 2;
Utils.setLayoutData(label, grid_data);
// popout windows -> sidebar
final Button windows_to_sidebar = new Button(ui_area, SWT.CHECK);
windows_to_sidebar.setText(lu.getLocalisedMessageText("azbuddy.dchat.ui.windows.to.sidebar"));
windows_to_sidebar.setSelection(plugin_beta.getWindowsToSidebar());
windows_to_sidebar.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setWindowsToSidebar(windows_to_sidebar.getSelection());
}
});
// notifications
final Group noti_area = new Group(main, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 4;
noti_area.setLayout(layout);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 3;
Utils.setLayoutData(noti_area, grid_data);
noti_area.setText(lu.getLocalisedMessageText("v3.MainWindow.tab.events"));
final Button sound_enable = new Button(noti_area, SWT.CHECK);
sound_enable.setText(lu.getLocalisedMessageText("azbuddy.dchat.noti.sound"));
boolean sound_enabled = plugin_beta.getSoundEnabled();
sound_enable.setSelection(sound_enabled);
sound_enable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setSoundEnabled(sound_enable.getSelection());
}
});
final Text noti_file = new Text(noti_area, SWT.BORDER);
grid_data = new GridData();
grid_data.widthHint = 400;
Utils.setLayoutData(noti_file, grid_data);
String sound_file = plugin_beta.getSoundFile();
if (sound_file.length() == 0) {
sound_file = "<default>";
}
noti_file.setText(sound_file);
noti_file.addListener(SWT.FocusOut, new Listener() {
@Override
public void handleEvent(Event event) {
String val = noti_file.getText().trim();
if (val.length() == 0 || val.startsWith("<")) {
noti_file.setText("<default>");
val = "";
}
if (!val.equals(plugin_beta.getSoundFile())) {
plugin_beta.setSoundFile(val);
}
}
});
final Button noti_browse = new Button(noti_area, SWT.PUSH);
final ImageLoader imageLoader = ImageLoader.getInstance();
final Image imgOpenFolder = imageLoader.getImage("openFolderButton");
noti_area.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
imageLoader.releaseImage("openFolderButton");
}
});
noti_browse.setImage(imgOpenFolder);
imgOpenFolder.setBackground(noti_browse.getBackground());
noti_browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
noti_browse.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
FileDialog dialog = new FileDialog(noti_area.getShell(), SWT.APPLICATION_MODAL);
dialog.setFilterExtensions(new String[] { "*.wav" });
dialog.setFilterNames(new String[] { "*.wav" });
dialog.setText(MessageText.getString("ConfigView.section.interface.wavlocation"));
String path = dialog.open();
if (path != null) {
path = path.trim();
if (path.startsWith("<")) {
path = "";
}
plugin_beta.setSoundFile(path.trim());
}
view.playSound();
}
});
label = new Label(noti_area, SWT.WRAP);
label.setText(MessageText.getString("ConfigView.section.interface.wavlocation.info"));
if (!sound_enabled) {
noti_file.setEnabled(false);
noti_browse.setEnabled(false);
}
final Button flash_enable = new Button(noti_area, SWT.CHECK);
flash_enable.setText(lu.getLocalisedMessageText("azbuddy.dchat.noti.flash"));
flash_enable.setSelection(plugin_beta.getFlashEnabled());
flash_enable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setFlashEnabled(flash_enable.getSelection());
}
});
// private chats
Group private_chat_area = new Group(main, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
// layout.marginHeight = 0;
// layout.marginWidth = 0;
private_chat_area.setLayout(layout);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 3;
Utils.setLayoutData(private_chat_area, grid_data);
private_chat_area.setText(lu.getLocalisedMessageText("label.private.chat"));
label = new Label(private_chat_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.pc.enable"));
final Button private_chat_enable = new Button(private_chat_area, SWT.CHECK);
label = new Label(private_chat_area, SWT.NULL);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(label, grid_data);
private_chat_enable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setPrivateChatState(private_chat_enable.getSelection() ? BuddyPluginBeta.PRIVATE_CHAT_ENABLED : BuddyPluginBeta.PRIVATE_CHAT_DISABLED);
}
});
final Label pc_pinned_only = new Label(private_chat_area, SWT.NULL);
pc_pinned_only.setText(lu.getLocalisedMessageText("azbuddy.dchat.pc.pinned.only"));
final Button private_chat_pinned = new Button(private_chat_area, SWT.CHECK);
label = new Label(private_chat_area, SWT.NULL);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(label, grid_data);
private_chat_pinned.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setPrivateChatState(private_chat_pinned.getSelection() ? BuddyPluginBeta.PRIVATE_CHAT_PINNED_ONLY : BuddyPluginBeta.PRIVATE_CHAT_ENABLED);
}
});
int pc_state = plugin_beta.getPrivateChatState();
private_chat_enable.setSelection(pc_state != BuddyPluginBeta.PRIVATE_CHAT_DISABLED);
private_chat_pinned.setSelection(pc_state == BuddyPluginBeta.PRIVATE_CHAT_PINNED_ONLY);
private_chat_pinned.setEnabled(pc_state != BuddyPluginBeta.PRIVATE_CHAT_DISABLED);
pc_pinned_only.setEnabled(pc_state != BuddyPluginBeta.PRIVATE_CHAT_DISABLED);
// import
Group import_area = new Group(main, SWT.NULL);
layout = new GridLayout();
layout.numColumns = 3;
import_area.setLayout(layout);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 3;
Utils.setLayoutData(import_area, grid_data);
import_area.setText(lu.getLocalisedMessageText("azbuddy.dchat.cannel.import"));
label = new Label(import_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.import.data"));
final Text import_data = new Text(import_area, SWT.BORDER);
grid_data = new GridData();
grid_data.widthHint = 400;
Utils.setLayoutData(import_data, grid_data);
final Button import_button = new Button(import_area, SWT.NULL);
import_button.setText(lu.getLocalisedMessageText("br.restore"));
import_button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
import_button.setEnabled(false);
final Display display = composite.getDisplay();
final String data = import_data.getText().trim();
new AEThread2("async") {
@Override
public void run() {
if (display.isDisposed()) {
return;
}
try {
final BuddyPluginBeta.ChatInstance inst = plugin_beta.importChat(data);
display.asyncExec(new Runnable() {
@Override
public void run() {
if (!display.isDisposed()) {
BuddyPluginViewBetaChat.createChatWindow(view, plugin, inst);
import_button.setEnabled(true);
}
}
});
} catch (Throwable e) {
display.asyncExec(new Runnable() {
@Override
public void run() {
if (!import_button.isDisposed()) {
import_button.setEnabled(true);
}
}
});
Debug.out(e);
}
}
}.start();
}
});
// Advanced
Group adv_area = new Group(main, SWT.NULL);
adv_area.setText(lu.getLocalisedMessageText("MyTorrentsView.menu.advancedmenu"));
layout = new GridLayout();
layout.numColumns = 3;
adv_area.setLayout(layout);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 3;
Utils.setLayoutData(adv_area, grid_data);
// shared endpoint
label = new Label(adv_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.anon.share.endpoint"));
final Button shared_endpoint = new Button(adv_area, SWT.CHECK);
shared_endpoint.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
plugin_beta.setSharedAnonEndpoint(shared_endpoint.getSelection());
}
});
shared_endpoint.setSelection(plugin_beta.getSharedAnonEndpoint());
label = new Label(adv_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.anon.share.endpoint.info"));
grid_data = new GridData(GridData.FILL_HORIZONTAL);
Utils.setLayoutData(label, grid_data);
// testing
Group test_area = new Group(main, SWT.NULL);
test_area.setText(lu.getLocalisedMessageText("br.test"));
layout = new GridLayout();
layout.numColumns = 4;
test_area.setLayout(layout);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 3;
Utils.setLayoutData(test_area, grid_data);
// public beta channel
label = new Label(test_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.public.beta"));
Button beta_button = new Button(test_area, SWT.NULL);
setupButton(beta_button, lu.getLocalisedMessageText("Button.open"), AENetworkClassifier.AT_PUBLIC, new String[] { BuddyPluginBeta.BETA_CHAT_KEY, BuddyPluginBeta.LEGACY_BETA_CHAT_KEY });
label = new Label(test_area, SWT.NULL);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 2;
Utils.setLayoutData(label, grid_data);
// anonymous beta channel
label = new Label(test_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.anon.beta"));
Button beta_i2p_button = new Button(test_area, SWT.NULL);
setupButton(beta_i2p_button, lu.getLocalisedMessageText("Button.open"), AENetworkClassifier.AT_I2P, new String[] { BuddyPluginBeta.BETA_CHAT_KEY, BuddyPluginBeta.LEGACY_BETA_CHAT_KEY });
beta_i2p_button.setEnabled(i2p_enabled);
label = new Label(test_area, SWT.NULL);
grid_data = new GridData(GridData.FILL_HORIZONTAL);
grid_data.horizontalSpan = 2;
Utils.setLayoutData(label, grid_data);
// create custom channel
label = new Label(test_area, SWT.NULL);
label.setText(lu.getLocalisedMessageText("azbuddy.dchat.create.join.key"));
final Text channel_key = new Text(test_area, SWT.BORDER);
grid_data = new GridData();
grid_data.widthHint = 200;
Utils.setLayoutData(channel_key, grid_data);
final Button create_i2p_button = new Button(test_area, SWT.CHECK);
create_i2p_button.setText(lu.getLocalisedMessageText("label.anon.i2p"));
create_i2p_button.setEnabled(i2p_enabled);
final Button create_button = new Button(test_area, SWT.NULL);
create_button.setText(lu.getLocalisedMessageText("Button.open"));
create_button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent ev) {
create_button.setEnabled(false);
final Display display = composite.getDisplay();
final String network = create_i2p_button.getSelection() ? AENetworkClassifier.AT_I2P : AENetworkClassifier.AT_PUBLIC;
final String key = channel_key.getText().trim();
new AEThread2("async") {
@Override
public void run() {
if (display.isDisposed()) {
return;
}
try {
final BuddyPluginBeta.ChatInstance inst = plugin_beta.getChat(network, key);
display.asyncExec(new Runnable() {
@Override
public void run() {
if (!display.isDisposed()) {
BuddyPluginViewBetaChat.createChatWindow(view, plugin, inst);
create_button.setEnabled(true);
}
}
});
} catch (Throwable e) {
display.asyncExec(new Runnable() {
@Override
public void run() {
if (!create_button.isDisposed()) {
create_button.setEnabled(true);
}
}
});
Debug.out(e);
}
}
}.start();
}
});
// end of UI
List<Button> buttons = new ArrayList<>();
buttons.add(create_button);
buttons.add(beta_button);
buttons.add(beta_i2p_button);
buttons.add(import_button);
Utils.makeButtonsEqualWidth(buttons);
plugin.addListener(new BuddyPluginAdapter() {
@Override
public void updated() {
if (public_nickname.isDisposed()) {
plugin.removeListener(this);
} else {
public_nickname.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
if (public_nickname.isDisposed()) {
return;
}
String nick = plugin_beta.getSharedPublicNickname();
if (!public_nickname.getText().equals(nick)) {
public_nickname.setText(nick);
}
nick = plugin_beta.getSharedAnonNickname();
if (!anon_nickname.getText().equals(nick)) {
anon_nickname.setText(nick);
}
shared_endpoint.setSelection(plugin_beta.getSharedAnonEndpoint());
int pc_state = plugin_beta.getPrivateChatState();
private_chat_enable.setSelection(pc_state != BuddyPluginBeta.PRIVATE_CHAT_DISABLED);
private_chat_pinned.setSelection(pc_state == BuddyPluginBeta.PRIVATE_CHAT_PINNED_ONLY);
private_chat_pinned.setEnabled(pc_state != BuddyPluginBeta.PRIVATE_CHAT_DISABLED);
pc_pinned_only.setEnabled(pc_state != BuddyPluginBeta.PRIVATE_CHAT_DISABLED);
String str = plugin_beta.getSoundFile();
if (str.length() == 0) {
noti_file.setText("<default>");
} else {
noti_file.setText(str);
}
boolean se = plugin_beta.getSoundEnabled();
noti_file.setEnabled(se);
noti_browse.setEnabled(se);
}
});
}
}
});
}
Aggregations