mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 16:58:51 -05:00
* refactoring
This commit is contained in:
parent
8c7d6985c5
commit
327219679c
@ -3,6 +3,7 @@ package net.filebot.mac;
|
|||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@ -85,4 +86,8 @@ public class MacAppUtilities {
|
|||||||
return folder.isDirectory() && !folder.canRead() && !folder.canWrite();
|
return folder.isDirectory() && !folder.canRead() && !folder.canWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean askUnlockFolders(final Window owner, final Collection<File> files) {
|
||||||
|
return DropToUnlock.showUnlockFoldersDialog(owner, files);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import java.util.logging.Level;
|
|||||||
|
|
||||||
import javax.swing.tree.TreeNode;
|
import javax.swing.tree.TreeNode;
|
||||||
|
|
||||||
import net.filebot.mac.DropToUnlock;
|
import net.filebot.mac.MacAppUtilities;
|
||||||
import net.filebot.ui.analyze.FileTree.FileNode;
|
import net.filebot.ui.analyze.FileTree.FileNode;
|
||||||
import net.filebot.ui.analyze.FileTree.FolderNode;
|
import net.filebot.ui.analyze.FileTree.FolderNode;
|
||||||
import net.filebot.ui.transfer.BackgroundFileTransferablePolicy;
|
import net.filebot.ui.transfer.BackgroundFileTransferablePolicy;
|
||||||
@ -59,7 +59,7 @@ class FileTreeTransferablePolicy extends BackgroundFileTransferablePolicy<TreeNo
|
|||||||
|
|
||||||
// make sure we have access to the parent folder structure, not just the dropped file
|
// make sure we have access to the parent folder structure, not just the dropped file
|
||||||
if (isMacSandbox()) {
|
if (isMacSandbox()) {
|
||||||
DropToUnlock.showUnlockFoldersDialog(getWindow(tree), files);
|
MacAppUtilities.askUnlockFolders(getWindow(tree), files);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ import net.filebot.Settings;
|
|||||||
import net.filebot.format.BindingException;
|
import net.filebot.format.BindingException;
|
||||||
import net.filebot.format.ExpressionFormat;
|
import net.filebot.format.ExpressionFormat;
|
||||||
import net.filebot.format.MediaBindingBean;
|
import net.filebot.format.MediaBindingBean;
|
||||||
import net.filebot.mac.DropToUnlock;
|
import net.filebot.mac.MacAppUtilities;
|
||||||
import net.filebot.util.DefaultThreadFactory;
|
import net.filebot.util.DefaultThreadFactory;
|
||||||
import net.filebot.util.ExceptionUtilities;
|
import net.filebot.util.ExceptionUtilities;
|
||||||
import net.filebot.util.PreferencesList;
|
import net.filebot.util.PreferencesList;
|
||||||
@ -220,7 +220,7 @@ public class FormatDialog extends JDialog {
|
|||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (isMacSandbox()) {
|
if (isMacSandbox()) {
|
||||||
if (sample != null && sample.getMediaFile() != null && sample.getMediaFile().exists()) {
|
if (sample != null && sample.getMediaFile() != null && sample.getMediaFile().exists()) {
|
||||||
DropToUnlock.showUnlockFoldersDialog(getWindow(evt.getSource()), singleton(sample.getMediaFile()));
|
MacAppUtilities.askUnlockFolders(getWindow(evt.getSource()), singleton(sample.getMediaFile()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkFormatInBackground();
|
checkFormatInBackground();
|
||||||
|
@ -72,7 +72,7 @@ import net.filebot.History.Element;
|
|||||||
import net.filebot.History.Sequence;
|
import net.filebot.History.Sequence;
|
||||||
import net.filebot.ResourceManager;
|
import net.filebot.ResourceManager;
|
||||||
import net.filebot.Settings;
|
import net.filebot.Settings;
|
||||||
import net.filebot.mac.DropToUnlock;
|
import net.filebot.mac.MacAppUtilities;
|
||||||
import net.filebot.media.MetaAttributes;
|
import net.filebot.media.MetaAttributes;
|
||||||
import net.filebot.ui.transfer.FileExportHandler;
|
import net.filebot.ui.transfer.FileExportHandler;
|
||||||
import net.filebot.ui.transfer.FileTransferablePolicy;
|
import net.filebot.ui.transfer.FileTransferablePolicy;
|
||||||
@ -533,7 +533,7 @@ class HistoryDialog extends JDialog {
|
|||||||
private void rename(File directory, List<Element> elements) {
|
private void rename(File directory, List<Element> elements) {
|
||||||
Map<File, File> renamePlan = getRenameMap(directory);
|
Map<File, File> renamePlan = getRenameMap(directory);
|
||||||
if (isMacSandbox()) {
|
if (isMacSandbox()) {
|
||||||
if (!DropToUnlock.showUnlockFoldersDialog(parent(), Stream.of(renamePlan.keySet(), renamePlan.values()).flatMap(c -> c.stream()).collect(Collectors.toList()))) {
|
if (!MacAppUtilities.askUnlockFolders(parent(), Stream.of(renamePlan.keySet(), renamePlan.values()).flatMap(c -> c.stream()).collect(Collectors.toList()))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ import net.filebot.HistorySpooler;
|
|||||||
import net.filebot.NativeRenameAction;
|
import net.filebot.NativeRenameAction;
|
||||||
import net.filebot.ResourceManager;
|
import net.filebot.ResourceManager;
|
||||||
import net.filebot.StandardRenameAction;
|
import net.filebot.StandardRenameAction;
|
||||||
import net.filebot.mac.DropToUnlock;
|
import net.filebot.mac.MacAppUtilities;
|
||||||
import net.filebot.media.MediaDetection;
|
import net.filebot.media.MediaDetection;
|
||||||
import net.filebot.similarity.Match;
|
import net.filebot.similarity.Match;
|
||||||
import net.filebot.util.ui.ProgressDialog;
|
import net.filebot.util.ui.ProgressDialog;
|
||||||
@ -155,7 +155,7 @@ class RenameAction extends AbstractAction {
|
|||||||
private Map<File, File> checkRenamePlan(List<Entry<File, File>> renamePlan, Window parent) throws IOException {
|
private Map<File, File> checkRenamePlan(List<Entry<File, File>> renamePlan, Window parent) throws IOException {
|
||||||
// ask for user permissions to output paths
|
// ask for user permissions to output paths
|
||||||
if (isMacSandbox()) {
|
if (isMacSandbox()) {
|
||||||
if (!DropToUnlock.showUnlockFoldersDialog(parent, renamePlan.stream().flatMap(e -> Stream.of(e.getKey(), resolveDestination(e.getKey(), e.getValue()))).map(f -> new File(f.getAbsolutePath())).collect(Collectors.toList()))) {
|
if (!MacAppUtilities.askUnlockFolders(parent, renamePlan.stream().flatMap(e -> Stream.of(e.getKey(), resolveDestination(e.getKey(), e.getValue()))).map(f -> new File(f.getAbsolutePath())).collect(Collectors.toList()))) {
|
||||||
return emptyMap();
|
return emptyMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ import net.filebot.StandardRenameAction;
|
|||||||
import net.filebot.UserFiles;
|
import net.filebot.UserFiles;
|
||||||
import net.filebot.WebServices;
|
import net.filebot.WebServices;
|
||||||
import net.filebot.format.MediaBindingBean;
|
import net.filebot.format.MediaBindingBean;
|
||||||
import net.filebot.mac.DropToUnlock;
|
import net.filebot.mac.MacAppUtilities;
|
||||||
import net.filebot.media.MediaDetection;
|
import net.filebot.media.MediaDetection;
|
||||||
import net.filebot.similarity.Match;
|
import net.filebot.similarity.Match;
|
||||||
import net.filebot.ui.rename.FormatDialog.Mode;
|
import net.filebot.ui.rename.FormatDialog.Mode;
|
||||||
@ -665,7 +665,7 @@ public class RenamePanel extends JComponent {
|
|||||||
final boolean autodetection = !isShiftOrAltDown(evt); // skip name auto-detection if SHIFT is pressed
|
final boolean autodetection = !isShiftOrAltDown(evt); // skip name auto-detection if SHIFT is pressed
|
||||||
|
|
||||||
if (isMacSandbox()) {
|
if (isMacSandbox()) {
|
||||||
if (!DropToUnlock.showUnlockFoldersDialog(getWindow(RenamePanel.this), remainingFiles)) {
|
if (!MacAppUtilities.askUnlockFolders(getWindow(RenamePanel.this), remainingFiles)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ import javax.swing.table.DefaultTableCellRenderer;
|
|||||||
|
|
||||||
import net.filebot.Analytics;
|
import net.filebot.Analytics;
|
||||||
import net.filebot.ResourceManager;
|
import net.filebot.ResourceManager;
|
||||||
import net.filebot.mac.DropToUnlock;
|
import net.filebot.mac.MacAppUtilities;
|
||||||
import net.filebot.similarity.EpisodeMetrics;
|
import net.filebot.similarity.EpisodeMetrics;
|
||||||
import net.filebot.similarity.MetricCascade;
|
import net.filebot.similarity.MetricCascade;
|
||||||
import net.filebot.similarity.SimilarityMetric;
|
import net.filebot.similarity.SimilarityMetric;
|
||||||
@ -270,7 +270,7 @@ class SubtitleAutoMatchDialog extends JDialog {
|
|||||||
|
|
||||||
// make sure we have access to the parent folder structure, not just the dropped file
|
// make sure we have access to the parent folder structure, not just the dropped file
|
||||||
if (isMacSandbox()) {
|
if (isMacSandbox()) {
|
||||||
DropToUnlock.showUnlockFoldersDialog(getWindow(evt.getSource()), mappingModel.getVideoFiles());
|
MacAppUtilities.askUnlockFolders(getWindow(evt.getSource()), mappingModel.getVideoFiles());
|
||||||
}
|
}
|
||||||
|
|
||||||
// collect the subtitles that will be fetched
|
// collect the subtitles that will be fetched
|
||||||
|
Loading…
Reference in New Issue
Block a user