@Override
    public void actionPerformed(ActionEvent arg0) {
      File selectedFile = DATA_MODEL.getFile(TABLE.getSelectedRow());

      // can't create torrents out of empty folders.
      if (selectedFile.isDirectory() && selectedFile.listFiles().length == 0) {
        JOptionPane.showMessageDialog(
            null,
            I18n.tr("The folder you selected is empty."),
            I18n.tr("Invalid Folder"),
            JOptionPane.ERROR_MESSAGE);
        return;
      }

      // can't create torrents if the folder/file can't be read
      if (!selectedFile.canRead()) {
        JOptionPane.showMessageDialog(
            null,
            I18n.tr("Error: You can't read on that file/folder."),
            I18n.tr("Error"),
            JOptionPane.ERROR_MESSAGE);
        return;
      }

      CreateTorrentDialog dlg = new CreateTorrentDialog(GUIMediator.getAppFrame());
      dlg.setChosenContent(selectedFile);
      dlg.setVisible(true);
    }
  /**
   * Runs through all the associations that this manager is handling and checks to see if they can
   * be enabled. If 'prompt' is true, this will prompt the user (respecting any 'do not ask again'
   * settings) prior to moving an association to LimeWire from another program. If 'prompt' is
   * false, this will only change associations that are currently unset.
   *
   * @param prompt whether to prompt the user
   * @return true if all allowed and supported associations are registered to us. (only meaningful
   *     if prompt is false).
   */
  public boolean checkAndGrab(boolean prompt) {
    boolean ret = true;
    for (LimeAssociationOption association : associations) {
      if (association.isAllowed()) {
        if (association.isAvailable()) // grab all available associations
        association.setEnabled(true);
        else if (!association.isEnabled()) ret = false;
      }
    }

    if (!ret && prompt) {
      DialogOption answer =
          GUIMediator.showYesNoOtherMessage(
              I18n.tr(
                  "One or more files or protocols that LimeWire uses are no longer associated with LimeWire. Would you like LimeWire to re-associate them?"),
              QuestionsHandler.GRAB_ASSOCIATIONS,
              I18n.tr("Details"));

      if (answer == DialogOption.YES) {
        for (LimeAssociationOption association : associations) {
          if (association.isAllowed() && !association.isEnabled()) association.setEnabled(true);
        }
      } else if (answer == DialogOption.OTHER) {
        new ConfigureOptionsAction(I18nMarker.marktr("File Associations")).actionPerformed(null);
      }
    }

    return ret;
  }
 public RebuildiTunesPlaylist() {
   super(I18n.tr("Rebuild iTunes \"FrostWire\" Playlist"));
   putValue(
       LONG_DESCRIPTION,
       I18n.tr(
           "Deletes and re-builds the \"FrostWire\" playlist on iTunes with all the audio files found on your Torrent Data Folder."));
 }
 public CopyPlaylistFilesAction() {
   putValue(Action.NAME, I18n.tr("Export playlist files to folder"));
   putValue(
       Action.SHORT_DESCRIPTION,
       I18n.tr("Copy all playlist files to a folder of your choosing"));
   putValue(LimeAction.ICON_NAME, "PLAYLIST_IMPORT_NEW");
 }
 public RemoveYouTubeAction() {
   super(true, true);
   putValue(Action.NAME, I18n.tr("Remove Download and Data"));
   putValue(LimeAction.SHORT_NAME, I18n.tr("Remove Download and Data"));
   putValue(
       Action.SHORT_DESCRIPTION, I18n.tr("Remove Download and Data from selected downloads"));
 }
 public RefreshID3TagsAction() {
   putValue(Action.NAME, I18n.tr("Refresh Audio Properties"));
   putValue(
       Action.SHORT_DESCRIPTION,
       I18n.tr("Refresh the audio properties based on ID3 tags of selected items"));
   putValue(LimeAction.ICON_NAME, "LIBRARY_REFRESH");
 }
 public ShareTorrentAction() {
   putValue(Action.NAME, I18n.tr("Send to friend"));
   putValue(LimeAction.SHORT_NAME, I18n.tr("Send to friend"));
   putValue(Action.SHORT_DESCRIPTION, I18n.tr("Send to friend"));
   putValue(LimeAction.ICON_NAME, "SEND_HASH");
   // putValue(Action.SMALL_ICON, GUIMediator.getThemeImage("share"));
 }
  protected JPopupMenu createPopupMenu(SearchResultDataLine[] lines) {
    //  do not return a menu if right-clicking on the dummy panel
    if (!isKillable()) return null;

    JPopupMenu menu = new SkinPopupMenu();

    if (lines.length > 0) {
      boolean allWithHash = true;
      for (int i = 0; i < lines.length; i++) {
        if (lines[i].getHash() == null) {
          allWithHash = false;
          break;
        }
      }
      PopupUtils.addMenuItem(
          I18n.tr("Copy Magnet"), COPY_MAGNET_ACTION_LISTENER, menu, allWithHash);
      PopupUtils.addMenuItem(I18n.tr("Copy Hash"), COPY_HASH_ACTION_LISTENER, menu, allWithHash);

      menu.add(createSearchAgainMenu(lines[0]));
    } else {
      menu.add(new SkinMenuItem(new RepeatSearchAction()));
    }

    return (new SearchResultMenu(this)).addToMenu(menu, lines);
  }
  private void setupPopupMenu() {
    _popup = new SkinPopupMenu();
    _popup.add(new SkinMenuItem(refreshAction));
    _popup.add(new SkinMenuItem(refreshID3TagsAction));
    _popup.add(new SkinMenuItem(renameAction));
    _popup.addSeparator();
    _popup.add(new SkinMenuItem(deleteAction));
    _popup.add(new SkinMenuItem(cleanupPlaylistAction));
    _popup.addSeparator();
    _popup.add(new SkinMenuItem(importToPlaylistAction));
    _popup.add(new SkinMenuItem(importToNewPlaylistAction));
    _popup.addSeparator();
    _popup.add(new SkinMenuItem(copyPlaylistFilesAction));
    _popup.add(new SkinMenuItem(exportPlaylistAction));
    _popup.addSeparator();

    if (OSUtils.isWindows() || OSUtils.isMacOSX()) {
      _popup.add(new SkinMenuItem(exportToiTunesAction));
    }

    _popup.addSeparator();
    _popup.add(
        new SkinMenuItem(
            new ConfigureOptionsAction(
                OptionsConstructor.LIBRARY_KEY,
                I18n.tr("Configure Options"),
                I18n.tr("You can configure the FrostWire\'s Options."))));
  }
 public ShowInLibraryAction() {
   putValue(Action.NAME, I18n.tr("Show"));
   putValue(LimeAction.SHORT_NAME, I18n.tr("Show"));
   putValue(
       Action.SHORT_DESCRIPTION,
       I18n.tr("Shows the contents of this transfer in the Library Tab"));
   putValue(LimeAction.ICON_NAME, "DOWNLOAD_SHOW_IN_LIBRARY");
 }
 public ClearInactiveAction() {
   putValue(Action.NAME, I18n.tr("Clear Inactive"));
   putValue(LimeAction.SHORT_NAME, I18n.tr("Clear Inactive"));
   putValue(
       Action.SHORT_DESCRIPTION,
       I18n.tr("Clear Inactive (completed) transfers from the Transfers list."));
   putValue(LimeAction.ICON_NAME, "DOWNLOAD_CLEAR_INACTIVE");
 }
 /**
  * Constructs the tab for monitors and uploads.
  *
  * @param MONITOR_VIEW the <tt>MonitorView</tt> instance containing all component for the monitor
  *     display and handling
  * @param UPLOAD_MEDIATOR the <tt>UploadMediator</tt> instance containing all component for the
  *     monitor display and handling
  */
 public MonitorUploadTab(final MonitorView MONITOR_VIEW, final ComponentMediator UPLOAD_MEDIATOR) {
   super(I18n.tr("Monitor"), I18n.tr("View Searches and Uploads"), "monitor_tab");
   SPLIT_PANE =
       new JSplitPane(JSplitPane.VERTICAL_SPLIT, MONITOR_VIEW, UPLOAD_MEDIATOR.getComponent());
   SPLIT_PANE.setContinuousLayout(true);
   SPLIT_PANE.setOneTouchExpandable(true);
   DividerLocationSettingUpdater.install(
       SPLIT_PANE, UISettings.UI_MONITOR_UPLOAD_TAB_DIVIDER_LOCATION);
 }
  /**
   * Create the legend
   *
   * <p>If basePanel is non-null, the legend panel replaces the contents of that panel.
   */
  private JPanel createLegendPanel(JPanel basePanel) {
    final JPanel panel;
    if (basePanel != null) {
      basePanel.removeAll();
      basePanel.setLayout(new GridBagLayout());
      panel = basePanel;
    } else {
      panel = new JPanel(new GridBagLayout());
    }

    panel.setBorder(BorderFactory.createTitledBorder(I18n.tr("Legend")));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(0, 4, 0, 6);

    JCheckBox checkBox = new JCheckBox();
    checkBox.setSelected(true);
    panel.add(createIconLabel(checkBox), gbc);

    MultiLineLabel label =
        new MultiLineLabel(I18n.tr("Folder and subfolders are included in the Library."), true);
    GridBagConstraints labelGbc = new GridBagConstraints();
    labelGbc.anchor = GridBagConstraints.WEST;
    labelGbc.fill = GridBagConstraints.HORIZONTAL;
    labelGbc.gridwidth = GridBagConstraints.REMAINDER;
    labelGbc.gridx = 1;
    labelGbc.weightx = 1;

    panel.add(label, labelGbc);

    checkBox.setSelected(false);
    gbc.gridy = 1;
    panel.add(createIconLabel(checkBox), gbc);

    label =
        new MultiLineLabel(
            I18n.tr("Folder is not included and no subfolders are included in the Library."), true);
    labelGbc.gridy = 1;
    panel.add(label, labelGbc);

    checkBox.setIcon(partiallyIncludedIcon);
    gbc.gridy = 2;
    gbc.insets = new Insets(0, 6, 0, 0);
    panel.add(createIconLabel(checkBox), gbc);

    label =
        new MultiLineLabel(
            I18n.tr("Folder\'s files and some subfolders are included in the Library."), true);
    labelGbc.gridy = 2;
    gbc.insets = null;
    panel.add(label, labelGbc);

    return panel;
  }
 public LaunchOSAction() {
   String os = "OS";
   if (OSUtils.isWindows()) {
     os = "Windows";
   } else if (OSUtils.isMacOSX()) {
     os = "Mac";
   } else if (OSUtils.isLinux()) {
     os = "Linux";
   }
   putValue(Action.NAME, I18n.tr("Launch in ") + os);
   putValue(Action.SHORT_DESCRIPTION, I18n.tr("Launch Selected Files in " + os));
   putValue(LimeAction.ICON_NAME, "LIBRARY_LAUNCH");
 }
  private void setupUI() {
    setLayout(new GridBagLayout());
    GridBagConstraints c;

    labelPlay = new JLabel(play_transparent);
    labelPlay.setToolTipText(I18n.tr("Play/Preview"));
    labelPlay.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent e) {
            labelPlay_mouseReleased(e);
          }
        });
    c = new GridBagConstraints();
    c.gridx = GridBagConstraints.RELATIVE;
    c.ipadx = 3;
    add(labelPlay, c);

    labelDownload = new JLabel(download_transparent);
    labelDownload.setToolTipText(I18n.tr("Download"));
    labelDownload.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent e) {
            labelDownload_mouseReleased(e);
          }
        });
    c = new GridBagConstraints();
    c.gridx = GridBagConstraints.RELATIVE;
    c.ipadx = 3;
    add(labelDownload, c);

    labelPartialDownload = new JLabel(details_solid);
    labelPartialDownload.setToolTipText(I18n.tr("Select content to download from this torrent."));
    labelPartialDownload.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseReleased(MouseEvent e) {
            labelPartialDownload_mouseReleased(e);
          }
        });
    c = new GridBagConstraints();
    c.gridx = GridBagConstraints.RELATIVE;
    c.ipadx = 3;
    add(labelPartialDownload, c);

    setEnabled(true);
  }
  public void refreshSelection() {

    LibraryPlaylistsListCell cell = (LibraryPlaylistsListCell) _list.getSelectedValue();

    if (cell == null) {
      // handle special case
      if (_model.getSize() == 2 && MediaPlayer.instance().getCurrentPlaylist() == null) {
        _list.setSelectedIndex(1);
      }
      return;
    }

    Playlist playlist = cell.getPlaylist();

    if (playlist != null) {
      playlist.refresh();
      LibraryMediator.instance().updateTableItems(playlist);
      String status =
          LibraryUtils.getPlaylistDurationInDDHHMMSS(playlist)
              + ", "
              + playlist.getItems().size()
              + " "
              + I18n.tr("tracks");
      LibraryMediator.instance().getLibrarySearch().setStatus(status);
    }

    executePendingRunnables();
  }
  public LibraryMediator() {
    GUIMediator.setSplashScreenString(I18n.tr("Loading Library Window..."));

    idScanned = new HashSet<Integer>();

    getComponent(); // creates MAIN_PANEL

    scrollbarValues = new HashMap<Object, Integer>();

    splitPane =
        new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getLibraryLeftPanel(), getLibraryRightPanel());
    splitPane.setContinuousLayout(true);
    splitPane.setResizeWeight(0.5);
    splitPane.addPropertyChangeListener(
        JSplitPane.LAST_DIVIDER_LOCATION_PROPERTY,
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            JSplitPane splitPane = (JSplitPane) evt.getSource();
            int current = splitPane.getDividerLocation();
            if (current > LibraryLeftPanel.MAX_WIDTH) {
              splitPane.setDividerLocation(LibraryLeftPanel.MAX_WIDTH);
            } else if (current < LibraryLeftPanel.MIN_WIDTH) {
              splitPane.setDividerLocation(LibraryLeftPanel.MIN_WIDTH);
            }
          }
        });

    DividerLocationSettingUpdater.install(splitPane, UISettings.UI_LIBRARY_MAIN_DIVIDER_LOCATION);

    MAIN_PANEL.add(splitPane);

    DeviceDiscoveryClerk clerk = new DeviceDiscoveryClerk();
    clerk.start();
  }
  private JComponent createSchemaBox() {
    schemaBox = new SchemaBox(this);

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
    panel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, ThemeMediator.LIGHT_BORDER_COLOR));

    final String strShowOpts = I18n.tr("Show Options");
    final String strHideOpts = I18n.tr("Hide Options");

    // reusing schema box panel for more options button
    // minor optimization to keep the layout as flat as possible
    final JButton buttonOptions = new JButton(strShowOpts);
    buttonOptions.setContentAreaFilled(false);
    // buttonOptions.setBorderPainted(false);
    buttonOptions.setOpaque(false);

    Dimension dim = new Dimension(120, 30);
    buttonOptions.setMinimumSize(dim);
    buttonOptions.setMaximumSize(dim);
    buttonOptions.setPreferredSize(dim);
    buttonOptions.setSize(dim);
    // buttonOptions.setMargin(new Insets(0, 0, 0, 0));
    // buttonOptions.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0,
    // ThemeMediator.LIGHT_BORDER_COLOR));

    buttonOptions.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            scrollPaneSearchOptions.setVisible(!scrollPaneSearchOptions.isVisible());

            buttonOptions.setText(scrollPaneSearchOptions.isVisible() ? strHideOpts : strShowOpts);
          }
        });

    JSeparator sep = new JSeparator(SwingConstants.VERTICAL);
    sep.setMaximumSize(new Dimension(2, 100));

    panel.add(schemaBox);
    panel.add(Box.createHorizontalGlue());
    panel.add(sep);
    panel.add(buttonOptions);

    return panel;
  }
 public AddToPlaylistAction(Playlist playlist) {
   super(getTruncatedString(playlist.getName(), MAX_VISIBLE_PLAYLIST_NAME_LENGTH_IN_MENU));
   putValue(
       Action.LONG_DESCRIPTION,
       I18n.tr("Add to playlist") + " \"" + getValue(Action.NAME) + "\"");
   System.out.println("Truncated playlist name was:" + " " + getValue(Action.NAME));
   this.playlist = playlist;
 }
  public void resetFilters() {
    sliderSeeds.setMinimum(0);
    sliderSeeds.setMaximum(1000);
    sliderSeeds.setLowerValue(0);
    sliderSeeds.setUpperValue(1000);

    sliderSize.setMinimum(0);
    sliderSize.setMaximum(1000);
    sliderSize.setLowerValue(0);
    sliderSize.setUpperValue(1000);

    sliderSeeds.getMinimumValueLabel().setText("0");
    sliderSeeds.getMaximumValueLabel().setText(I18n.tr("Max"));
    sliderSize.getMinimumValueLabel().setText("0");
    sliderSize.getMaximumValueLabel().setText(I18n.tr("Max"));

    textFieldKeywords.setText("");
  }
Exemple #21
0
  @Override
  protected void createPageContent(JPanel panel) {
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

    TitledPaddedPanel commercialUsePanel =
        new TitledPaddedPanel(I18n.tr("Allow commercial use of your work?"));

    // make sure the panel expands horizontally
    commercialUsePanel.add(Box.createHorizontalGlue());

    ButtonGroup bg = new ButtonGroup();
    bg.add(ALLOW_COMMERCIAL_YES);
    bg.add(ALLOW_COMMERCIAL_NO);

    BoxPanel buttonPanel = new BoxPanel();
    commercialUsePanel.add(buttonPanel);
    buttonPanel.add(ALLOW_COMMERCIAL_YES);
    buttonPanel.add(ALLOW_COMMERCIAL_NO);
    panel.add(commercialUsePanel);

    panel.add(Box.createRigidArea(BoxPanel.LINE_GAP));

    TitledPaddedPanel modificationsPanel =
        new TitledPaddedPanel(I18n.tr("Allow modification of your work?"));

    // make sure the panel expands horizontally
    modificationsPanel.add(Box.createHorizontalGlue());

    bg = new ButtonGroup();
    bg.add(ALLOW_MODIFICATIONS_SHAREALIKE);
    bg.add(ALLOW_MODIFICATIONS_YES);
    bg.add(ALLOW_MODIFICATIONS_NO);

    buttonPanel = new BoxPanel();
    modificationsPanel.add(buttonPanel);
    buttonPanel.add(ALLOW_MODIFICATIONS_SHAREALIKE);
    buttonPanel.add(ALLOW_MODIFICATIONS_YES);
    buttonPanel.add(ALLOW_MODIFICATIONS_NO);
    panel.add(modificationsPanel);

    // set defaults
    ALLOW_COMMERCIAL_NO.setSelected(true);
    ALLOW_MODIFICATIONS_NO.setSelected(true);
  }
  public JPopupMenu createMenu(
      JPopupMenu popupMenu,
      TableLine[] lines,
      boolean markAsSpam,
      boolean markAsNot,
      ResultPanel resultPanel) {
    JPopupMenu menu = new JPopupMenu();
    List<JLabel> labels = new ArrayList<JLabel>(5);
    for (TableLine line : lines) {
      SharedSearchResult result = (SharedSearchResult) line.getSearchResult();
      JLabel label = new JLabel(I18n.tr("Path") + ": " + result.getFileDesc().getPath());
      menu.insert(label, labels.size());
      labels.add(label);
      if (labels.size() == 5 && lines.length > labels.size()) {
        int numberOfMore = lines.length - labels.size();
        label = new JLabel(I18n.trn("... {0} more.", "... {0} more.", numberOfMore, numberOfMore));
        menu.insert(label, labels.size());
        labels.add(label);
        break;
      }
    }
    menu.addSeparator();

    // TODO: fix this hidden coupling, SharedSearchResult needs to be tied MyFilesResultPanel
    //        explicitly
    JMenuItem menuItem =
        new JMenuItem(((MySharedFilesResultPanel) resultPanel).getUnshareAction(lines.length));
    menu.add(menuItem);

    // configure label to have the same borders and margins as a menu item
    Insets margin = menuItem.getMargin();
    Insets border = menuItem.getInsets();
    for (JLabel label : labels) {
      label.setBorder(
          BorderFactory.createEmptyBorder(
              border.top, margin.left + border.left, border.bottom, margin.right + border.right));
      label.setIconTextGap(menuItem.getIconTextGap());
      // if icon is null, icon text gap value is ignored
      label.setIcon(new GUIUtils.EmptyIcon("empty", 0, 0));
    }

    return menu;
  }
    @Override
    public void actionPerformed(ActionEvent arg0) {

      DialogOption result =
          GUIMediator.showYesNoMessage(
              I18n.tr(
                  "This will remove your \"FrostWire\" playlist in iTunes and replace\n"
                      + "it with one containing all the iTunes compatible files in your \n"
                      + "Frostwire \"Torrent Data Folder\"\n\n"
                      + "Please note that it will add the files to the iTunes library as well\n"
                      + "and this could result in duplicate files on your iTunes library\n\n"
                      + "Are you sure you want to continue?"),
              I18n.tr("Warning"),
              JOptionPane.WARNING_MESSAGE);

      if (result == DialogOption.YES) {
        iTunesMediator.instance().resetFrostWirePlaylist();
      }
    }
  /** Saves a playlist. */
  public void exportM3U(Playlist playlist) {

    if (playlist == null) {
      return;
    }

    String suggestedName = CommonUtils.convertFileName(playlist.getName());

    // get the user to select a new one.... avoid FrostWire installation folder.
    File suggested;
    File suggestedDirectory = FileChooserHandler.getLastInputDirectory();
    if (suggestedDirectory.equals(CommonUtils.getCurrentDirectory())) {
      suggestedDirectory = new File(CommonUtils.getUserHomeDir(), "Desktop");
    }

    suggested = new File(suggestedDirectory, suggestedName + ".m3u");

    File selFile =
        FileChooserHandler.getSaveAsFile(
            GUIMediator.getAppFrame(),
            I18nMarker.marktr("Save Playlist As"),
            suggested,
            new PlaylistListFileFilter());

    // didn't select a file?  nothing we can do.
    if (selFile == null) {
      return;
    }

    // if the file already exists and not the one just opened, ask if it should be
    //  overwritten.
    // TODO: this should be handled in the jfilechooser
    if (selFile.exists()) {
      DialogOption choice =
          GUIMediator.showYesNoMessage(
              I18n.tr(
                  "Warning: a file with the name {0} already exists in the folder. Overwrite this file?",
                  selFile.getName()),
              QuestionsHandler.PLAYLIST_OVERWRITE_OK,
              DialogOption.NO);
      if (choice != DialogOption.YES) return;
    }

    String path = selFile.getPath();
    try {
      path = FileUtils.getCanonicalPath(selFile);
    } catch (IOException ignored) {
      // LOG.warn("unable to get canonical path for file: " + selFile, ignored);
    }
    // force m3u on the end.
    if (!path.toLowerCase().endsWith(".m3u")) path += ".m3u";

    // create a new thread to handle saving the playlist to disk
    saveM3U(playlist, path);
  }
    @Override
    public void actionPerformed(ActionEvent e) {
      final short videoCount = (short) TABLE.getSelectedRows().length;

      // can't happen, but just in case.
      if (videoCount < 1) {
        return;
      }

      // get selected files before we switch to audio and loose the selection
      final List<File> selectedFiles = getSelectedFiles();

      selectAudio();

      String status = I18n.tr("Extracting audio from " + videoCount + " selected videos...");
      if (videoCount == 1) {
        status = I18n.tr("Extracting audio from selected video...");
      }
      LibraryMediator.instance().getLibrarySearch().pushStatus(status);

      SwingWorker<Void, Void> demuxWorker =
          new SwingWorker<Void, Void>() {

            @Override
            protected Void doInBackground() throws Exception {
              isDemuxing = true;
              demuxFiles(selectedFiles);
              isDemuxing = false;
              return null;
            }

            @Override
            protected void done() {
              int failed = videoCount - demuxedFiles.size();
              String failedStr = (failed > 0) ? " (" + failed + " " + I18n.tr("failed") + ")" : "";
              LibraryMediator.instance()
                  .getLibrarySearch()
                  .pushStatus(I18n.tr("Done extracting audio.") + failedStr);
            }
          };
      demuxWorker.execute();
    }
  private LabeledRangeSlider createSeedsFilter() {
    LabeledRangeSlider slider = new LabeledRangeSlider(I18n.tr("Seeds"), null, 0, 1000);
    slider.setPreferredSize(new Dimension(200, (int) slider.getPreferredSize().getHeight()));
    slider.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            sliderSeeds_stateChanged(e);
          }
        });

    return slider;
  }
    public void performAction(ActionEvent e) {
      if (_deleteData) {

        DialogOption result =
            GUIMediator.showYesNoMessage(
                I18n.tr(
                    "Are you sure you want to remove the data files from your computer?\n\nYou won't be able to recover the files."),
                I18n.tr("Are you sure?"),
                JOptionPane.QUESTION_MESSAGE);

        if (result != DialogOption.YES) return;
      }

      BTDownload[] downloaders = BTDownloadMediator.instance().getSelectedDownloaders();
      for (int i = 0; i < downloaders.length; i++) {
        downloaders[i].setDeleteTorrentWhenRemove(_deleteTorrent);
        downloaders[i].setDeleteDataWhenRemove(_deleteData);
      }
      BTDownloadMediator.instance().removeSelection();
      UXStats.instance().log(UXAction.DOWNLOAD_REMOVE);
    }
  /**
   * Creates a new <tt>ToolsMenu</tt>, using the <tt>key</tt> argument for setting the
   * locale-specific title and accessibility text.
   *
   * @param key the key for locale-specific string resources unique to the menu
   */
  ToolsMenu() {
    super(I18n.tr("&Tools"));

    this.updateAction = new UpdateAction();

    if (OSUtils.isMacOSX() || OSUtils.isWindows()) {
      addMenuItem(new RebuildiTunesPlaylist());
    }

    addMenuItem(new ShowOptionsAction());
    addMenuItem(updateAction);
  }
  private JMenu createSearchSubMenu(LibraryPlaylistsTableDataLine dl) {
    JMenu menu = new SkinMenu(I18n.tr("Search"));

    if (dl != null) {
      File f = dl.getFile();
      String keywords = QueryUtils.createQueryString(f.getName());
      if (keywords.length() > 0) menu.add(new SkinMenuItem(new SearchAction(keywords)));
    }

    if (menu.getItemCount() == 0) menu.setEnabled(false);

    return menu;
  }
    public void refresh() {
      String text;
      boolean enabled = true;

      if (UpdateMediator.instance().isUpdated()) {
        text =
            I18n.tr("You are up to date with FrostWire")
                + " v."
                + UpdateMediator.instance().getLatestVersion();
      } else if (UpdateMediator.instance().isUpdateDownloading()) {
        text = I18n.tr("Downloading update...");
        enabled = false;
      } else if (UpdateMediator.instance().isUpdateDownloaded()) {
        text = I18n.tr("Install update") + " v." + UpdateMediator.instance().getLatestVersion();
      } else {
        text = I18n.tr("Check for update");
      }

      putValue(NAME, text);
      putValue(LONG_DESCRIPTION, text);
      setEnabled(enabled);
    }