Changeset 146
- Timestamp:
- 02/16/07 18:26:07 (2 years ago)
- Files:
-
- trunk/build.xml (modified) (3 diffs)
- trunk/src/org/thestaticvoid/iriverter/Converter.java (modified) (1 diff)
- trunk/src/org/thestaticvoid/iriverter/ConverterOptions.java (modified) (1 diff)
- trunk/src/org/thestaticvoid/iriverter/ConverterUI.java (modified) (6 diffs)
- trunk/src/org/thestaticvoid/iriverter/DVD.java (modified) (2 diffs)
- trunk/src/org/thestaticvoid/iriverter/MPlayerPathDialog.java (modified) (1 diff)
- trunk/src/org/thestaticvoid/iriverter/ManualSplit.java (modified) (1 diff)
- trunk/web/iriverter-nocodecs.jnlp (added)
- trunk/web/iriverter.jnlp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build.xml
r141 r146 2 2 <project name="iriverter" default="jar" basedir="."> 3 3 <property name="package" value="org/thestaticvoid/iriverter" /> 4 <property name="mplayer.package" value="hu/mplayerhq" /> 4 5 <property name="main.class" value="${package}/ConverterUI" /> 5 6 <property name="src.dir" value="src" /> … … 65 66 <fileset dir="${src.dir}/${icons.dir}" /> 66 67 </copy> 68 69 <mkdir dir="${build.dir}/${mplayer.package}" /> 70 71 <ftp action="get" depends="yes" verbose="yes" server="ftp1.mplayerhq.hu" remotedir="/MPlayer/releases" userid="anonymous" password="jlee@iriverter.thestatictvoid.org"> 72 <fileset dir="${build.dir}/${mplayer.package}"> 73 <include name="win32/MPlayer-mingw32-1.0rc1.zip" /> 74 <include name="codecs/windows-all-20061022.zip" /> 75 </fileset> 76 </ftp> 67 77 </target> 68 78 69 79 <target name="jar" depends="compile,resources"> 70 80 <mkdir dir="${jar.dir}" /> 71 <jar destfile="${jar.dir}/iriverter.jar" basedir="${build.dir}" /> 81 <jar destfile="${jar.dir}/iriverter.jar" basedir="${build.dir}" includes="${package}/**" /> 82 <jar destfile="${jar.dir}/mplayer-win32.jar" basedir="${build.dir}" includes="${mplayer.package}/win32/**" /> 83 <jar destfile="${jar.dir}/codecs-win32.jar" basedir="${build.dir}" includes="${mplayer.package}/codecs/**" /> 72 84 </target> 73 85 … … 83 95 84 96 <copy todir="${dist.dir}"> 85 <fileset file="${jar.dir}/iriverter.jar" />97 <fileset dir="${jar.dir}" includes="*.jar" /> 86 98 <fileset dir="${web.dir}" /> 87 99 <fileset dir="${basedir}" includes="${doc.dir}/**" /> trunk/src/org/thestaticvoid/iriverter/Converter.java
r143 r146 320 320 progressDialogInfo.setStatus("Gathering information about the input video..."); 321 321 322 MPlayerInfo info = new MPlayerInfo("dvd://" + dvdInfo.getTitle(), dvdInfo.getDrive(), ConverterOptions.getMPlayerPath());322 MPlayerInfo info = new MPlayerInfo("dvd://" + dvdInfo.getTitle(), dvdInfo.getDrive(), mplayerPath); 323 323 324 324 List commandList = prepareBaseCommandList("dvd://" + dvdInfo.getTitle(), dvdInfo.getOutputVideo(), info); trunk/src/org/thestaticvoid/iriverter/ConverterOptions.java
r142 r146 258 258 } 259 259 260 public static String getMPlayerSource() {261 String mplayerSource = readOption("mplayerSource");262 if (mplayerSource.equals(""))263 if (System.getProperty("os.name").indexOf("Windows") >= 0)264 return "download";265 else266 return "local";267 268 return mplayerSource;269 }270 271 public static void setMPlayerSource(String mplayerSource) {272 writeOption("mplayerSource", mplayerSource);273 }274 275 public static boolean getDownloadExtraCodecs() {276 String downloadExtraCodecs = readOption("downloadExtraCodecs");277 if (downloadExtraCodecs.equals(""))278 return false;279 280 return downloadExtraCodecs.equals("true");281 }282 283 public static void setDownloadExtraCodecs(boolean downloadExtraCodecs) {284 writeOption("downloadExtraCodecs", "" + downloadExtraCodecs);285 }286 287 public static boolean getKeepUpdated() {288 String keepUpdated = readOption("keepUpdated");289 if (keepUpdated.equals(""))290 return true;291 292 return keepUpdated.equals("true");293 }294 295 public static void setKeepUpdated(boolean keepUpdated) {296 writeOption("keepUpdated", "" + keepUpdated);297 }298 299 260 public static String getMPlayerPath() { 300 261 String mplayerPath = readOption("mplayerPath"); 301 262 if (mplayerPath.equals("") || !new File(mplayerPath).isDirectory()) 302 263 if (System.getProperty("os.name").indexOf("Windows") >= 0) 303 return ".";264 return ConverterOptions.CONF_DIR + File.separator + "mplayer"; 304 265 else 305 266 return "/usr/bin"; trunk/src/org/thestaticvoid/iriverter/ConverterUI.java
r145 r146 61 61 shell.setLayout(gridLayout); 62 62 63 extractResources(); 63 extractResources("/org/thestaticvoid/iriverter/resources.zip", ConverterOptions.CONF_DIR.toString()); 64 extractResources("/hu/mplayerhq/win32/MPlayer-mingw32-1.0rc1.zip", ConverterOptions.CONF_DIR.toString()); 65 File mplayerDir = new File(ConverterOptions.CONF_DIR + File.separator + "mplayer"); 66 extractResources("/hu/mplayerhq/codecs/windows-all-20061022.zip", mplayerDir.toString()); 67 new File(mplayerDir, "windows-all-20061022").renameTo(new File(mplayerDir, "codecs")); 68 64 69 setupMenus(); 65 70 setupToolBar(); … … 275 280 276 281 mplayerPath = new MenuItem(advancedOptionsMenu, SWT.PUSH); 282 if (System.getProperty("os.name").indexOf("Windows") >= 0) 283 mplayerPath.setMenu(null); 277 284 mplayerPath.setText("&MPlayer Path..."); 278 285 mplayerPath.addSelectionListener(this); … … 303 310 } 304 311 305 public void extractResources() { 306 ZipInputStream in = new ZipInputStream(getClass().getResourceAsStream("resources.zip")); 312 public void extractResources(String resourceName, String toDir) { 313 InputStream inputStream = getClass().getResourceAsStream(resourceName); 314 if (inputStream == null) 315 return; 316 317 ZipInputStream in = new ZipInputStream(inputStream); 307 318 308 319 try { 309 320 ZipEntry entry; 310 321 while ((entry = in.getNextEntry()) != null) { 311 File extractedFile = new File( ConverterOptions.CONF_DIR+ File.separator + entry.getName());322 File extractedFile = new File(toDir + File.separator + entry.getName()); 312 323 if (entry.isDirectory() && !extractedFile.exists()) 313 324 extractedFile.mkdirs(); … … 397 408 canceled = true; 398 409 } catch (MPlayerNotFoundException mpe) { 399 canceled = new MPlayerPathDialog(shell , SWT.NONE).open();410 canceled = new MPlayerPathDialog(shell).open() == null; 400 411 } 401 412 } … … 418 429 canceled = true; 419 430 } catch (MPlayerNotFoundException mpe) { 420 canceled = new MPlayerPathDialog(shell , SWT.NONE).open();431 canceled = new MPlayerPathDialog(shell).open() == null; 421 432 } 422 433 } … … 534 545 535 546 if (e.getSource() == mplayerPath) { 536 new MPlayerPathDialog(shell , SWT.NONE).open();547 new MPlayerPathDialog(shell).open(); 537 548 } 538 549 trunk/src/org/thestaticvoid/iriverter/DVD.java
r143 r146 250 250 canceled = true; 251 251 } catch (MPlayerNotFoundException mpe) { 252 canceled = new MPlayerPathDialog(getParent().getShell() , SWT.NONE).open();252 canceled = new MPlayerPathDialog(getParent().getShell()).open() == null; 253 253 } 254 254 } … … 343 343 canceled = true; 344 344 } catch (MPlayerNotFoundException mpe) { 345 canceled = new MPlayerPathDialog(getParent().getShell() , SWT.NONE).open();345 canceled = new MPlayerPathDialog(getParent().getShell()).open() == null; 346 346 if (canceled) 347 347 progressDialog.close(); trunk/src/org/thestaticvoid/iriverter/MPlayerPathDialog.java
r142 r146 22 22 package org.thestaticvoid.iriverter; 23 23 24 import org.eclipse.swt.*;25 24 import org.eclipse.swt.widgets.*; 26 import org.eclipse.swt.events.*;27 import org.eclipse.swt.layout.*;28 import org.eclipse.swt.graphics.*;29 25 30 public class MPlayerPathDialog extends Dialog implements SelectionListener { 31 private Shell shell; 32 private Button download, extraCodecs, keepUpdated, local, localDirSelect, cancel, ok; 33 private Text localDir; 34 private boolean canceled; 35 36 public MPlayerPathDialog(Shell parent, int style) { 37 super(parent, style); 26 public class MPlayerPathDialog extends DirectoryDialog { 27 public MPlayerPathDialog(Shell shell) { 28 super(shell); 38 29 } 39 30 40 public boolean open() { 41 shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); 42 shell.setText("MPlayer Path"); 43 GridLayout gridLayout = new GridLayout(); 44 gridLayout.horizontalSpacing = 6; 45 gridLayout.verticalSpacing = 6; 46 gridLayout.marginHeight = 12; 47 gridLayout.marginWidth = 12; 48 shell.setLayout(gridLayout); 31 public String open() { 32 setFilterPath(ConverterOptions.getMPlayerPath()); 33 setText("MPlayer Path"); 34 setMessage("Select the path to MPlayer"); 35 String directory = open(); 36 if (directory != null) 37 ConverterOptions.setMPlayerPath(directory); 49 38 50 Label audioSyncLabel = new Label(shell, SWT.NONE); 51 audioSyncLabel.setText("MPlayer Path"); 52 FontData[] fontData = audioSyncLabel.getFont().getFontData(); 53 fontData[0].setStyle(SWT.BOLD); 54 audioSyncLabel.setFont(new Font(getParent().getDisplay(), fontData)); 55 56 Composite downloadComposite = new Composite(shell, SWT.RADIO); 57 gridLayout = new GridLayout(); 58 gridLayout.horizontalSpacing = 6; 59 gridLayout.verticalSpacing = 3; 60 gridLayout.marginHeight = 0; 61 gridLayout.marginWidth = 0; 62 downloadComposite.setLayout(gridLayout); 63 64 download = new Button(downloadComposite, SWT.RADIO); 65 download.setText("Attempt to download MPlayer from the Internet"); 66 download.addSelectionListener(this); 67 68 extraCodecs = new Button(downloadComposite, SWT.CHECK); 69 extraCodecs.setText("Also download non-free codecs"); 70 extraCodecs.setSelection(ConverterOptions.getDownloadExtraCodecs()); 71 GridData gridData = new GridData(); 72 gridData.horizontalIndent = 24; 73 extraCodecs.setLayoutData(gridData); 74 75 keepUpdated = new Button(downloadComposite, SWT.CHECK); 76 keepUpdated.setText("Keep updated"); 77 keepUpdated.setSelection(ConverterOptions.getKeepUpdated()); 78 gridData = new GridData(); 79 gridData.horizontalIndent = 24; 80 keepUpdated.setLayoutData(gridData); 81 82 Composite localComposite = new Composite(shell, SWT.NONE); 83 gridLayout = new GridLayout(); 84 gridLayout.horizontalSpacing = 6; 85 gridLayout.verticalSpacing = 3; 86 gridLayout.marginHeight = 0; 87 gridLayout.marginWidth = 0; 88 gridLayout.numColumns = 2; 89 localComposite.setLayout(gridLayout); 90 localComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); 91 92 local = new Button(localComposite, SWT.RADIO); 93 local.setText("Use MPlayer installed locally in:"); 94 gridData = new GridData(); 95 gridData.horizontalSpan = 2; 96 local.setLayoutData(gridData); 97 local.addSelectionListener(this); 98 99 localDir = new Text(localComposite, SWT.BORDER); 100 gridData = new GridData(GridData.FILL_HORIZONTAL); 101 gridData.horizontalIndent = 24; 102 localDir.setLayoutData(gridData); 103 104 localDirSelect = new Button(localComposite, SWT.PUSH); 105 localDirSelect.setText("Select"); 106 gridData = new GridData(); 107 gridData.widthHint = 75; 108 localDirSelect.setLayoutData(gridData); 109 110 Composite dismissComposite = new Composite(shell, SWT.NONE); 111 dismissComposite.setLayout(new RowLayout()); 112 gridData = new GridData(); 113 gridData.horizontalAlignment = SWT.RIGHT; 114 dismissComposite.setLayoutData(gridData); 115 116 cancel = new Button(dismissComposite, SWT.PUSH); 117 cancel.setText("Cancel"); 118 RowData rowData = new RowData(); 119 rowData.width = 75; 120 cancel.setLayoutData(rowData); 121 cancel.addSelectionListener(this); 122 123 ok = new Button(dismissComposite, SWT.PUSH); 124 ok.setText("OK"); 125 rowData = new RowData(); 126 rowData.width = 75; 127 ok.setLayoutData(rowData); 128 ok.addSelectionListener(this); 129 130 if (System.getProperty("os.name").indexOf("Windows") == -1) { 131 download.setEnabled(false); 132 extraCodecs.setEnabled(false); 133 keepUpdated.setEnabled(false); 134 } 135 136 if (ConverterOptions.getMPlayerSource().equals("download")) { 137 download.setSelection(true); 138 localDir.setEnabled(false); 139 localDirSelect.setEnabled(false); 140 } else { 141 local.setSelection(true); 142 extraCodecs.setEnabled(false); 143 localDir.setText(ConverterOptions.getMPlayerPath()); 144 } 145 146 shell.pack(); 147 shell.setSize(450, shell.getSize().y); 148 shell.open(); 149 while (!shell.isDisposed()) 150 if (!getParent().getDisplay().readAndDispatch()) 151 getParent().getDisplay().sleep(); 152 153 return canceled; 154 } 155 156 public void widgetDefaultSelected(SelectionEvent event) { 157 widgetSelected(event); 158 } 159 160 public void widgetSelected(SelectionEvent event) { 161 if (event.getSource() == download) { 162 extraCodecs.setEnabled(true); 163 keepUpdated.setEnabled(true); 164 local.setSelection(false); 165 localDir.setEnabled(false); 166 localDirSelect.setEnabled(false); 167 } 168 169 if (event.getSource() == local) { 170 download.setSelection(false); 171 extraCodecs.setEnabled(false); 172 keepUpdated.setEnabled(false); 173 localDir.setEnabled(true); 174 localDirSelect.setEnabled(true); 175 } 176 177 if (event.getSource() == cancel) { 178 canceled = true; 179 shell.dispose(); 180 } 39 return directory; 181 40 } 182 41 } trunk/src/org/thestaticvoid/iriverter/ManualSplit.java
r143 r146 190 190 canceled = true; 191 191 } catch (MPlayerNotFoundException mpe) { 192 canceled = new MPlayerPathDialog(getParent().getShell() , SWT.NONE).open();192 canceled = new MPlayerPathDialog(getParent().getShell()).open() == null; 193 193 } 194 194 } trunk/web/iriverter.jnlp
r144 r146 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <jnlp spec="1.0+" 3 codebase="http://iriverter.thestaticvoid.org/dist "3 codebase="http://iriverter.thestaticvoid.org/dist/latest" 4 4 href="iriverter.jnlp"> 5 5 <information> … … 28 28 <nativelib href="swt-native-win32-win32-x86.jar" /> 29 29 <jar href="swt-win32-win32-x86.jar" /> 30 <jar href="mplayer-win32.jar" /> 31 <jar href="codecs-win32.jar" /> 30 32 </resources> 31 33
