* don't block DnD operation / File Browser while downloading subs

This commit is contained in:
Reinhard Pointner 2011-12-07 05:48:23 +00:00
parent 49e432dd81
commit 254e48fc12
1 changed files with 30 additions and 16 deletions

View File

@ -134,7 +134,7 @@ abstract class SubtitleDropTarget extends JButton {
private boolean handleDrop(List<File> files) {
// perform a drop action depending on the given files
if (containsOnly(files, VIDEO_FILES)) {
return handleDownload(files);
return handleDownloadLater(files);
}
if (containsOnly(files, FOLDERS)) {
@ -142,7 +142,7 @@ abstract class SubtitleDropTarget extends JButton {
List<File> videoFiles = filter(listFiles(files, 5, false), VIDEO_FILES);
if (videoFiles.size() > 0) {
return handleDownload(videoFiles);
return handleDownloadLater(videoFiles);
}
}
@ -160,6 +160,20 @@ abstract class SubtitleDropTarget extends JButton {
}
private boolean handleDownloadLater(final List<File> videoFiles) {
// invoke later so we don't block the DnD operation with the download dialog
invokeLater(0, new Runnable() {
@Override
public void run() {
handleDownload(videoFiles);
}
});
return true;
}
private boolean containsOnlyVideoSubtitleMatches(List<File> files) {
List<File> subtitles = filter(files, SUBTITLE_FILES);