Search in sources :

Example 1 with InfoBarUtil

use of com.biglybt.ui.swt.views.skin.InfoBarUtil 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 2 with InfoBarUtil

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

the class SideBarEntrySWT method setToolbarVisibility.

// @see BaseMdiEntry#setToolbarVisibility(boolean)
@Override
protected void setToolbarVisibility(boolean visible) {
    if (toolBarInfoBar != null) {
        if (visible) {
            toolBarInfoBar.show();
        } else {
            toolBarInfoBar.hide(false);
        }
        return;
    }
    SWTSkinObject soMaster = getSkinObjectMaster();
    if (soMaster == null) {
        return;
    }
    SWTSkinObject so = getSkinObject();
    if (so == null) {
        return;
    }
    SWTSkinObject soToolbar = skin.getSkinObject(SkinConstants.VIEWID_VIEW_TOOLBAR, soMaster);
    if (soToolbar == null && visible) {
        toolBarInfoBar = new InfoBarUtil(so, SO_ID_TOOLBAR, true, "", "") {

            @Override
            public boolean allowShow() {
                return true;
            }
        };
    } else if (soToolbar != null) {
        soToolbar.setVisible(visible);
    }
}
Also used : SWTSkinObject(com.biglybt.ui.swt.skin.SWTSkinObject) InfoBarUtil(com.biglybt.ui.swt.views.skin.InfoBarUtil)

Aggregations

SWTSkinObject (com.biglybt.ui.swt.skin.SWTSkinObject)2 InfoBarUtil (com.biglybt.ui.swt.views.skin.InfoBarUtil)2 Core (com.biglybt.core.Core)1 CoreRunningListener (com.biglybt.core.CoreRunningListener)1 MultipleDocumentInterfaceSWT (com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT)1 SWTSkinObjectText (com.biglybt.ui.swt.skin.SWTSkinObjectText)1