コード例 #1
0
    public void updateStatus() {
      if (quickCopy == null) {
        // this called before createPart from preference monitor.
        // ignore it
      }

      String ffmpegPath = FFMpegUI.getFFmpeg();
      if (ffmpegPath == null) {
        if (noFFMpegImage != null) { // initial call,there are null image
          dragHere.setImage(noFFMpegImage);
        }
        setMessage(""); // setMessage(Messages.getString(""));
        if (quickCopy != null) {

          setCanConvert(quickCopy.getSelection()); // enable only if copy on
          setCantConvertStatusbarMessage(Messages.getString("ffmpeg_statusbar.no_ffmpeg"));
        } else {
          log.warn("this never called");
          // before initialize
          setCanConvert(getPreferenceStore().getBoolean(getPreferenceKey() + "." + "quickcopy"));
        }
      } else {
        if (canConvertImage != null) dragHere.setImage(canConvertImage);
        if (samefolder.getSelection() || directoryChooser.getFile() != null) {
          setMessage(Messages.getString("dropsomething.drag_folder"));
          setCanConvert(true);
        } else {
          setErrorMessage(Messages.getString("dropsomething.choose_folder"));
          setCanConvert(false);
        }
      }
      log.info("currentStatus:" + isCanConvert());
    }
コード例 #2
0
      // just before run process
      public void startConvert(File file) {
        // log.info("start:");
        // check command valid.
        String ffmpegPath = ffmpegExecuter.getFfmpegPreference().getFfmpegPath();
        String codec = ffmpegExecuter.getFfmpegPreference().getAudioCodec();

        System.out.println("executer:" + ffmpegPath);

        if (FFMpegUI.isPureFFMpeg(ffmpegPath)) {
          if (!FFMpegUI.isPureFFMpegSupportedAudioCodec(codec)) { // MP3 not support pure_ffmpeg.exe
            StatusBarUtils.showStatusBar(Messages.getString("ffmpeg_statusbar.no_ffmpeg"));
            try {
              getProcessPrinter().printError(Messages.getString("ffmpeg_error.no_ffmpeg"));
            } catch (IOException e) {

              e.printStackTrace();
            }
            perfomeCancel();
            return;
          }
        }

        log.info("set guess:" + ffmpegExecuter.getGuessSize() + "kB");
        setProgressMaxBytes(ffmpegExecuter.getGuessSize());
      }
コード例 #3
0
      public void faildConvert(File file, String message) {
        if (FFMpegUtils.isMP4FileName(file.getName())) { // MP4 not support pure_ffmpeg.exe
          StatusBarUtils.showStatusBar(Messages.getString("ffmpeg_statusbar.no_ffmpeg"));
          try {
            getProcessPrinter().printError(Messages.getString("ffmpeg_error.no_ffmpeg_mp4"));
          } catch (IOException e) {

            e.printStackTrace();
          }
          perfomeCancel();
          return;
        } else {
          StatusBarUtils.showStatusBar(Messages.getString("ffmpeg_statusbar.faild"));
          Akj_betasPlugin.getDefault()
              .getProcessPrinter()
              .printOutput("[faild:mp3]" + message + "," + file.getAbsolutePath() + "\n\n");
        }
      }
コード例 #4
0
    public Composite createControls(Composite parent) {
      setPreferenceKey("mp3converttab");

      // set default for preferences.
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "quickcopy", true);
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "forceconvert", false);

      getPreferenceStore().setDefault(getPreferenceKey() + "." + "audioBitrate", "128");
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "useAvisynth", false);

      Composite composite = new Composite(parent, SWT.NULL);
      composite.setLayout(new GridLayout(1, true));

      Group exportDir = new Group(composite, SWT.NULL);
      exportDir.setToolTipText(Messages.getString("mp3convert.exportDir.tooltip"));
      exportDir.setLayout(new GridLayout());
      exportDir.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      exportDir.setText(Messages.getString("mp3convert.exportDir"));

      createDirectoryInfo(exportDir);

      Group detailSetting = new Group(composite, SWT.NULL);
      detailSetting.setLayout(new FillLayout());
      detailSetting.setLayoutData(new GridData(GridData.FILL_BOTH));
      detailSetting.setText(Messages.getString("mp3convert.detail"));

      ExpandBar bar = new ExpandBar(detailSetting, SWT.V_SCROLL);

      Composite copybase = new Composite(bar, SWT.NULL);
      copybase.setLayout(new RowLayout());
      quickCopy = new Button(copybase, SWT.CHECK);
      quickCopy.setText(Messages.getString("mp3convert.quickcopy"));
      quickCopy.addSelectionListener(
          new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {}

            public void widgetSelected(SelectionEvent e) {
              updateStatus();
            }
          });
      // quickCopy.setSelection(true);//

      ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
      item0.setText(Messages.getString("mp3convert.aboutcopy"));
      item0.setHeight(copybase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item0.setControl(copybase);

      Composite advancedSetting = new Composite(bar, SWT.NULL);
      advancedSetting.setLayout(new GridLayout(1, false));

      Composite changebase = new Composite(advancedSetting, SWT.NULL);
      changebase.setLayout(new GridLayout(1, false));
      forceConvert = new Button(changebase, SWT.CHECK);
      forceConvert.setText(Messages.getString("mp3convert.forceconvert"));
      mp3setting = new MP3AudioSettingComposite(changebase, SWT.NULL, false, getPreferenceKey());
      ExpandItem item1 = new ExpandItem(bar, SWT.NONE, 1);
      item1.setText(Messages.getString("mp3convert.convertsetting"));
      item1.setHeight(advancedSetting.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item1.setControl(advancedSetting);

      Composite bitrateBase = new Composite(bar, SWT.NULL);
      bitrateBase.setLayout(new RowLayout());
      Label label1 = new Label(bitrateBase, SWT.NULL);
      label1.setText(Messages.getString("mp3convert.defaultBitrate"));
      defaultBitrate = new CCombo(bitrateBase, SWT.NULL);
      int bitrates[] = {64, 80, 96, 112, 128, 160, 192, 224, 256, 320};
      for (int i = 0; i < bitrates.length; i++) {
        defaultBitrate.add("" + bitrates[i]);
      }
      defaultBitrate.select(4);
      Label label = new Label(bitrateBase, SWT.NULL);
      label.setText("kbps");

      ExpandItem item2 = new ExpandItem(bar, SWT.NONE, 2);
      item2.setText(Messages.getString("mp3convert.optionbitrate"));
      item2.setHeight(bitrateBase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item2.setControl(bitrateBase);

      forceConvert.addSelectionListener(new SynchEnabled(mp3setting));

      Composite avisynthBase = new Composite(bar, SWT.NULL);
      avisynthBase.setLayout(new RowLayout());
      useAvisynth = new Button(avisynthBase, SWT.CHECK);
      useAvisynth.setText(Messages.getString("mp3convert.useAvisynth"));
      // quickCopy.setSelection(true);//

      ExpandItem item3 = new ExpandItem(bar, SWT.NONE, 3);
      item3.setText(Messages.getString("mp3convert.about_useAvisynth"));
      item3.setHeight(avisynthBase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item3.setControl(avisynthBase);

      canConvertImage =
          AbstractUIPlugin.imageDescriptorFromPlugin(
                  "jp.sourceforge.akjrcp.akj_betas", "icons/dandd_mp3.png")
              .createImage();
      noFFMpegImage =
          AbstractUIPlugin.imageDescriptorFromPlugin(
                  "jp.sourceforge.akjrcp.akj_betas", "icons/dandd_noffmpeg.png")
              .createImage();
      // bitrate
      // framerate
      // channel

      dragHere = new CLabel(composite, SWT.BORDER | SWT.LEFT);
      dragHere.setBackground(ColorConstants.white);
      dragHere.setImage(canConvertImage);
      dragHere.setAlignment(SWT.CENTER);

      dragHere.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      // keep preference store
      SavePreferenceStore sps = new SavePreferenceStore();

      // restore from setting..
      restoreControl(forceConvert);
      restoreControl(quickCopy);
      restoreControl(defaultBitrate);
      restoreControl(useAvisynth);

      forceConvert.addSelectionListener(sps);
      quickCopy.addSelectionListener(sps);
      defaultBitrate.addSelectionListener(sps);
      useAvisynth.addSelectionListener(sps);

      mp3setting.setEnabled(forceConvert.getSelection());
      mp3setting.setPreferenceStore(getPreferenceStore());

      // update status
      setCanConvert(true);
      updateStatus();
      PlatformUI.getPreferenceStore().addPropertyChangeListener(new SettingMonitor());
      return composite;
    }
コード例 #5
0
  public void createTab(ViewPart part, CTabFolder tab) {
    tabItem1 = new CTabItem(tab, SWT.NONE);
    tabItem1.setText(Messages.getString("dropsomething.mp3audio"));

    this.tab = tab;
  }