Beispiel #1
0
  public static boolean canPlayDS(Object ds, int file_index) {

    if (!(Constants.isWindows || Constants.isOSX)) {

      return (false);
    }

    if (ds == null) {
      return false;
    }

    if (ds instanceof org.gudy.azureus2.core3.disk.DiskManagerFileInfo) {
      org.gudy.azureus2.core3.disk.DiskManagerFileInfo fi =
          (org.gudy.azureus2.core3.disk.DiskManagerFileInfo) ds;
      return canPlayDS(fi.getDownloadManager(), fi.getIndex());
    }

    DownloadManager dm = DataSourceUtils.getDM(ds);
    if (dm != null) {
      return canPlay(dm, file_index);
    }
    TOTorrent torrent = DataSourceUtils.getTorrent(ds);
    if (torrent != null) {
      return canPlay(torrent, file_index);
    }
    if (ds instanceof VuzeActivitiesEntry) {
      return ((VuzeActivitiesEntry) ds).isPlayable();
    }

    if (ds instanceof SelectedContentV3) {
      SelectedContentV3 sel = (SelectedContentV3) ds;
      return sel.canPlay();
    }

    return false;
  }
Beispiel #2
0
  public void shareTorrent(final SelectedContentV3 currentContent, final String referer) {

    PlatformBuddyMessenger.startShare(
        referer, currentContent.isPlatformContent() ? currentContent.getHash() : null);

    if (!VuzeBuddyManager.isEnabled()) {
      VuzeBuddyManager.showDisabledDialog();
      return;
    }

    // TODO : Gudy : make sure that this private detection method is reliable enough
    if (currentContent.getDM() != null
        && (TorrentUtils.isReallyPrivate(currentContent.getDM().getTorrent()))) {
      Utils.openMessageBox(Utils.findAnyShell(), SWT.OK, "v3.share.private", (String[]) null);
      return;
    }

    SWTLoginUtils.waitForLogin(
        new SWTLoginUtils.loginWaitListener() {
          public void loginComplete() {
            if (null != sharePage) {
              try {
                // sharePage.setShareItem(currentContent, referer);

                ShareWizard wizard =
                    new ShareWizard(
                        UIFunctionsManagerSWT.getUIFunctionsSWT().getMainShell(),
                        SWT.DIALOG_TRIM | SWT.RESIZE);
                wizard.setText("Vuze - Wizard");
                wizard.setSize(500, 550);

                com.aelitis.azureus.ui.swt.shells.friends.SharePage newSharePage =
                    (com.aelitis.azureus.ui.swt.shells.friends.SharePage)
                        wizard.getPage(com.aelitis.azureus.ui.swt.shells.friends.SharePage.ID);
                newSharePage.setShareItem(currentContent, referer);

                /*
                 * Opens a centered free-floating shell
                 */

                UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
                if (null == uiFunctions) {
                  /*
                   * Centers on the active monitor
                   */
                  Utils.centreWindow(wizard.getShell());
                } else {
                  /*
                   * Centers on the main application window
                   */
                  Utils.centerWindowRelativeTo(wizard.getShell(), uiFunctions.getMainShell());
                }

                wizard.open();

              } catch (Exception e) {
                e.printStackTrace();
              }
            }
          }
        });
  }