* don't block DnD operation / File Browser while downloading subs
This commit is contained in:
parent
49e432dd81
commit
254e48fc12
|
@ -134,7 +134,7 @@ abstract class SubtitleDropTarget extends JButton {
|
||||||
private boolean handleDrop(List<File> files) {
|
private boolean handleDrop(List<File> files) {
|
||||||
// perform a drop action depending on the given files
|
// perform a drop action depending on the given files
|
||||||
if (containsOnly(files, VIDEO_FILES)) {
|
if (containsOnly(files, VIDEO_FILES)) {
|
||||||
return handleDownload(files);
|
return handleDownloadLater(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (containsOnly(files, FOLDERS)) {
|
if (containsOnly(files, FOLDERS)) {
|
||||||
|
@ -142,7 +142,7 @@ abstract class SubtitleDropTarget extends JButton {
|
||||||
List<File> videoFiles = filter(listFiles(files, 5, false), VIDEO_FILES);
|
List<File> videoFiles = filter(listFiles(files, 5, false), VIDEO_FILES);
|
||||||
|
|
||||||
if (videoFiles.size() > 0) {
|
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) {
|
private boolean containsOnlyVideoSubtitleMatches(List<File> files) {
|
||||||
List<File> subtitles = filter(files, SUBTITLE_FILES);
|
List<File> subtitles = filter(files, SUBTITLE_FILES);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue