* language favorites can now be restored after restart

* stricter embedded checksum pattern
* fixed weird selection behavior in subtitle files list
This commit is contained in:
Reinhard Pointner 2009-07-31 00:27:07 +00:00
parent d85d6c6356
commit 7ec6d49475
4 changed files with 18 additions and 12 deletions

View File

@ -21,14 +21,6 @@
<!-- main jar -->
<jar destfile="${dir.dist}/filebot.jar">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Built-Date" value="${today}" />
<attribute name="Application-Name" value="${title}" />
<attribute name="Application-Version" value="${version}" />
<attribute name="Main-Class" value="net.sourceforge.filebot.Main" />
</manifest>
<fileset dir="${dir.build}" excludes="**/*Test*" />
</jar>
@ -44,9 +36,17 @@
<mkdir dir="${dir.dist}/fatjar" />
<jar destfile="${dir.dist}/fatjar/FileBot.jar" filesetmanifest="merge" duplicate="fail">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Built-Date" value="${today}" />
<attribute name="Application-Name" value="${title}" />
<attribute name="Application-Version" value="${version}" />
<attribute name="Main-Class" value="net.sourceforge.filebot.Main" />
</manifest>
<!-- include main jar -->
<zipfileset src="${dir.dist}/filebot.jar" />
<!-- include libs -->
<zipfileset src="${dir.lib}/xercesImpl.jar">
<include name="org/apache/**" />

View File

@ -38,7 +38,7 @@ public final class FileBotUtilities {
* checksum string is a hex number with at least 8 digits. Capturing group 0 will contain
* the matched checksum string.
*/
public static final Pattern EMBEDDED_CHECKSUM_PATTERN = Pattern.compile("(?<=\\[|\\()(\\p{XDigit}{8,})(?=\\]|\\))");
public static final Pattern EMBEDDED_CHECKSUM_PATTERN = Pattern.compile("(?<=\\[|\\()(\\p{XDigit}{8})(?=\\]|\\))");
public static String getEmbeddedChecksum(CharSequence string) {
@ -55,6 +55,7 @@ public final class FileBotUtilities {
public static String removeEmbeddedChecksum(String string) {
// match embedded checksum and surrounding brackets
return string.replaceAll("[\\(\\[]\\p{XDigit}{8}[\\]\\)]", "");
}

View File

@ -101,6 +101,11 @@ class SubtitleDownloadComponent extends JComponent {
}
};
// better selection behaviour
EventSelectionModel<MemoryFile> fileSelection = new EventSelectionModel<MemoryFile>(files);
fileSelection.setSelectionMode(ListSelection.MULTIPLE_INTERVAL_SELECTION_DEFENSIVE);
fileList.setSelectionModel(fileSelection);
// install dnd and clipboard export handler
MemoryFileListExportHandler memoryFileExportHandler = new MemoryFileListExportHandler();
fileList.setTransferHandler(new DefaultTransferHandler(null, memoryFileExportHandler, memoryFileExportHandler));

View File

@ -53,7 +53,7 @@ public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, Subtitl
// restore favorite languages
for (String favoriteLanguage : persistentFavoriteLanguages) {
languageModel.favorites().add(0, Language.getLanguage(favoriteLanguage));
languageModel.favorites().add(languageModel.favorites().size(), Language.getLanguage(favoriteLanguage));
}
// guess favorite languages
@ -75,7 +75,7 @@ public class SubtitlePanel extends AbstractSearchPanel<SubtitleProvider, Subtitl
@Override
public String get(int index) {
return languageModel.favorites().get(0).getCode();
return languageModel.favorites().get(index).getCode();
}