Search in sources :

Example 1 with SWTSkinObjectText

use of com.biglybt.ui.swt.skin.SWTSkinObjectText in project BiglyBT by BiglySoftware.

the class SBC_DevicesView method setAdditionalInfoTitle.

/**
 * @param newVisibility
 *
 * @since 4.1.0.5
 */
protected void setAdditionalInfoTitle(boolean newVisibility) {
    SWTSkinObject soArea = getSkinObject("advinfo-area");
    if (soArea != null) {
        soArea.setVisible(newVisibility);
    }
    SWTSkinObject soText = getSkinObject("advinfo-title");
    if (soText instanceof SWTSkinObjectText) {
        String s = (newVisibility ? "[-]" : "[+]");
        if (device != null) {
            s += "Additional Device Info and Settings";
        } else {
            s += "General Options";
        }
        ((SWTSkinObjectText) soText).setText(s);
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText)

Example 2 with SWTSkinObjectText

use of com.biglybt.ui.swt.skin.SWTSkinObjectText in project BiglyBT by BiglySoftware.

the class PlayerInstallWindow method open.

public void open() {
    box = new VuzeMessageBox("", "", null, 0);
    box.setSubTitle(MessageText.getString("dlg.player.install.subtitle"));
    box.addResourceBundle(PlayerInstallWindow.class, SkinPropertiesImpl.PATH_SKIN_DEFS, "skin3_dlg_register");
    box.setIconResource("image.player.dlg.header");
    this.progressText = MessageText.getString("dlg.player.install.description");
    box.setListener(new VuzeMessageBoxListener() {

        @Override
        public void shellReady(Shell shell, SWTSkinObjectContainer soExtra) {
            SWTSkin skin = soExtra.getSkin();
            skin.createSkinObject("dlg.register.install", "dlg.register.install", soExtra);
            SWTSkinObjectContainer soProgressBar = (SWTSkinObjectContainer) skin.getSkinObject("progress-bar");
            if (soProgressBar != null) {
                progressBar = new ProgressBar(soProgressBar.getComposite(), SWT.HORIZONTAL);
                progressBar.setMinimum(0);
                progressBar.setMaximum(100);
                progressBar.setLayoutData(Utils.getFilledFormData());
            }
            soInstallPct = (SWTSkinObjectText) skin.getSkinObject("install-pct");
            soProgressText = (SWTSkinObjectText) skin.getSkinObject("progress-text");
            if (soProgressText != null && progressText != null) {
                soProgressText.setText(progressText);
            }
        }
    });
    box.open(new UserPrompterResultListener() {

        @Override
        public void prompterClosed(int result) {
            installer.setListener(null);
            installer.cancel();
        }
    });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText) SWTSkinObjectContainer(com.biglybt.ui.swt.skin.SWTSkinObjectContainer) VuzeMessageBoxListener(com.biglybt.ui.swt.views.skin.VuzeMessageBoxListener) VuzeMessageBox(com.biglybt.ui.swt.views.skin.VuzeMessageBox) SWTSkin(com.biglybt.ui.swt.skin.SWTSkin) ProgressBar(org.eclipse.swt.widgets.ProgressBar)

Example 3 with SWTSkinObjectText

use of com.biglybt.ui.swt.skin.SWTSkinObjectText in project BiglyBT by BiglySoftware.

the class SBC_DevicesView method skinObjectInitialShow.

// @see SkinView#skinObjectInitialShow(SWTSkinObject, java.lang.Object)
@Override
public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
    CoreFactory.addCoreRunningListener(new CoreRunningListener() {

        @Override
        public void coreRunning(Core core) {
            initColumns(core);
        }
    });
    device_manager = DeviceManagerFactory.getSingleton();
    transcode_manager = device_manager.getTranscodeManager();
    transcode_queue = transcode_manager.getQueue();
    MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
    if (mdi != null) {
        mdiEntry = mdi.getCurrentEntrySWT();
        Object ds = mdiEntry.getDatasource();
        if (!(ds instanceof Device)) {
            return (null);
        }
        device = (Device) ds;
    }
    if (device instanceof TranscodeTarget) {
        transTarget = (TranscodeTarget) device;
    }
    if (device == null) {
        new InfoBarUtil(skinObject, "devicesview.infobar", false, "DeviceView.infobar", "v3.deviceview.infobar") {

            @Override
            public boolean allowShow() {
                return true;
            }
        };
    } else if (device instanceof DeviceMediaRenderer) {
        DeviceMediaRenderer renderer = (DeviceMediaRenderer) device;
        int species = renderer.getRendererSpecies();
        String speciesID = null;
        switch(species) {
            case DeviceMediaRenderer.RS_ITUNES:
                speciesID = "itunes";
                break;
            case DeviceMediaRenderer.RS_PS3:
                speciesID = "ps3";
                break;
            case DeviceMediaRenderer.RS_XBOX:
                speciesID = "xbox";
                break;
            case DeviceMediaRenderer.RS_OTHER:
                {
                    String classification = renderer.getClassification();
                    if (classification.equals("sony.PSP")) {
                        speciesID = "psp";
                    } else if (classification.startsWith("tivo.")) {
                        speciesID = "tivo";
                    } else if (classification.toLowerCase().contains("android")) {
                        speciesID = "android";
                    }
                }
            default:
                break;
        }
        if (speciesID != null) {
            final String fSpeciesID = speciesID;
            new InfoBarUtil(skinObject, "devicesview.infobar", false, "DeviceView.infobar." + speciesID, "v3.deviceview.infobar") {

                @Override
                public boolean allowShow() {
                    return true;
                }

                // @see InfoBarUtil#created(SWTSkinObject)
                @Override
                protected void created(SWTSkinObject parent) {
                    SWTSkinObjectText soLine1 = (SWTSkinObjectText) skin.getSkinObject("line1", parent);
                    soLine1.setTextID("v3.deviceview.infobar.line1.generic", new String[] { device.getName() });
                    SWTSkinObjectText soLine2 = (SWTSkinObjectText) skin.getSkinObject("line2", parent);
                    soLine2.setTextID("v3.deviceview.infobar.line2." + fSpeciesID);
                }
            };
        }
    }
    SWTSkinObject soAdvInfo = getSkinObject("advinfo");
    if (soAdvInfo != null) {
        initAdvInfo(soAdvInfo);
    }
    if (device != null) {
        device_name = device.getName();
        SWTSkinObject soTitle = getSkinObject("title");
        if (soTitle instanceof SWTSkinObjectText) {
            ((SWTSkinObjectText) soTitle).setTextID("device.view.heading", new String[] { device_name });
        }
    }
    return null;
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText) CoreRunningListener(com.biglybt.core.CoreRunningListener) MultipleDocumentInterfaceSWT(com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT) SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) InfoBarUtil(com.biglybt.ui.swt.views.skin.InfoBarUtil) Core(com.biglybt.core.Core)

Example 4 with SWTSkinObjectText

use of com.biglybt.ui.swt.skin.SWTSkinObjectText in project BiglyBT by BiglySoftware.

the class SBC_DevicesView method deviceChanged.

@Override
public void deviceChanged(Device device) {
    String name = device.getName();
    if (!name.equals(device_name)) {
        device_name = name;
        // ensure name is up to date
        SWTSkinObject soTitle = getSkinObject("title");
        if (soTitle instanceof SWTSkinObjectText) {
            ((SWTSkinObjectText) soTitle).setTextID("device.view.heading", new String[] { name });
        }
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText)

Example 5 with SWTSkinObjectText

use of com.biglybt.ui.swt.skin.SWTSkinObjectText in project BiglyBT by BiglySoftware.

the class DeviceTemplateChooser method createDeviceTemplateList2.

private void createDeviceTemplateList2(SWTSkinObjectContainer soList) {
    DeviceTemplate[] devices = mf.getDeviceTemplates();
    if (devices.length == 0) {
        noDevices();
        return;
    }
    Arrays.sort(devices, new Comparator<DeviceTemplate>() {

        @Override
        public int compare(DeviceTemplate o1, DeviceTemplate o2) {
            return o1.getName().compareToIgnoreCase(o2.getName());
        }
    });
    Composite parent = soList.getComposite();
    if (parent.getChildren().length > 0) {
        Utils.disposeComposite(parent, false);
    }
    SWTSkin skin = skinnedDialog.getSkin();
    RowLayout layout = new RowLayout(SWT.HORIZONTAL);
    layout.spacing = 0;
    layout.marginLeft = layout.marginRight = 0;
    layout.wrap = true;
    layout.justify = true;
    layout.fill = true;
    parent.setLayout(layout);
    Listener clickListener = new Listener() {

        boolean down = false;

        @Override
        public void handleEvent(Event event) {
            if (event.type == SWT.MouseDown) {
                down = true;
            } else if (event.type == SWT.MouseUp && down) {
                Widget widget = (event.widget instanceof Label) ? ((Label) event.widget).getParent() : event.widget;
                selectedDeviceTemplate = (DeviceTemplate) widget.getData("obj");
                if (selectedDeviceTemplate == null) {
                    Debug.out("selectedDeviceTemplate is null!");
                }
                skinnedDialog.close();
                down = false;
            }
        }
    };
    for (DeviceTemplate deviceTemplate : devices) {
        if (deviceTemplate.isAuto()) {
            continue;
        }
        // deviceTemplate.getIconURL();
        String iconURL = null;
        TranscodeChooser.addImageBox(parent, clickListener, null, deviceTemplate, iconURL, deviceTemplate.getName());
    }
    SWTSkinObjectText soTitle = (SWTSkinObjectText) skin.getSkinObject("title");
    if (soTitle != null) {
        soTitle.setTextID("devices.choose.device.title");
    }
    SWTSkinObjectText soSubTitle = (SWTSkinObjectText) skin.getSkinObject("subtitle");
    if (soSubTitle != null) {
        soSubTitle.setTextID("label.clickone");
    }
    Shell shell = skinnedDialog.getShell();
    Point computeSize = shell.computeSize(shell.getSize().x, SWT.DEFAULT, true);
    shell.setSize(computeSize);
    UIFunctionsSWT uiFunctionsSWT = UIFunctionsManagerSWT.getUIFunctionsSWT();
    if (uiFunctionsSWT != null) {
        Shell mainShell = uiFunctionsSWT.getMainShell();
        Utils.centerWindowRelativeTo(shell, mainShell);
    }
}
Also used : SkinnedDialogClosedListener(com.biglybt.ui.swt.views.skin.SkinnedDialog.SkinnedDialogClosedListener) SWTSkinObjectText(com.biglybt.ui.swt.skin.SWTSkinObjectText) UIFunctionsSWT(com.biglybt.ui.swt.UIFunctionsSWT) Point(org.eclipse.swt.graphics.Point) SWTSkin(com.biglybt.ui.swt.skin.SWTSkin) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) DeviceTemplate(com.biglybt.core.devices.DeviceTemplate) RowLayout(org.eclipse.swt.layout.RowLayout)

Aggregations

SWTSkinObjectText (com.biglybt.ui.swt.skin.SWTSkinObjectText)7 SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)4 SWTSkin (com.biglybt.ui.swt.skin.SWTSkin)3 UserPrompterResultListener (com.biglybt.ui.UserPrompterResultListener)2 SWTSkinObjectContainer (com.biglybt.ui.swt.skin.SWTSkinObjectContainer)2 VuzeMessageBox (com.biglybt.ui.swt.views.skin.VuzeMessageBox)2 VuzeMessageBoxListener (com.biglybt.ui.swt.views.skin.VuzeMessageBoxListener)2 ProgressBar (org.eclipse.swt.widgets.ProgressBar)2 Shell (org.eclipse.swt.widgets.Shell)2 Core (com.biglybt.core.Core)1 CoreRunningListener (com.biglybt.core.CoreRunningListener)1 DeviceTemplate (com.biglybt.core.devices.DeviceTemplate)1 ToolBarItem (com.biglybt.ui.common.ToolBarItem)1 UIFunctionsSWT (com.biglybt.ui.swt.UIFunctionsSWT)1 MultipleDocumentInterfaceSWT (com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT)1 MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)1 SWTSkinButtonUtility (com.biglybt.ui.swt.skin.SWTSkinButtonUtility)1 InfoBarUtil (com.biglybt.ui.swt.views.skin.InfoBarUtil)1 SkinnedDialogClosedListener (com.biglybt.ui.swt.views.skin.SkinnedDialog.SkinnedDialogClosedListener)1 Point (org.eclipse.swt.graphics.Point)1