+ added --mode option to force a mode in the GUI (e.g. --mode rename) and only display a specified panel
This commit is contained in:
parent
db3f84d076
commit
12cf2f7411
|
@ -59,9 +59,8 @@ import net.sourceforge.filebot.format.ExpressionFormat;
|
||||||
import net.sourceforge.filebot.gio.GVFS;
|
import net.sourceforge.filebot.gio.GVFS;
|
||||||
import net.sourceforge.filebot.media.MediaDetection;
|
import net.sourceforge.filebot.media.MediaDetection;
|
||||||
import net.sourceforge.filebot.ui.MainFrame;
|
import net.sourceforge.filebot.ui.MainFrame;
|
||||||
|
import net.sourceforge.filebot.ui.PanelBuilder;
|
||||||
import net.sourceforge.filebot.ui.SinglePanelFrame;
|
import net.sourceforge.filebot.ui.SinglePanelFrame;
|
||||||
import net.sourceforge.filebot.ui.sfv.SfvPanelBuilder;
|
|
||||||
import net.sourceforge.filebot.ui.transfer.FileTransferable;
|
|
||||||
import net.sourceforge.filebot.web.CachedResource;
|
import net.sourceforge.filebot.web.CachedResource;
|
||||||
import net.sourceforge.tuned.ByteBufferInputStream;
|
import net.sourceforge.tuned.ByteBufferInputStream;
|
||||||
import net.sourceforge.tuned.PreferencesMap.PreferencesEntry;
|
import net.sourceforge.tuned.PreferencesMap.PreferencesEntry;
|
||||||
|
@ -239,15 +238,21 @@ public class Main {
|
||||||
|
|
||||||
|
|
||||||
private static void startUserInterface(ArgumentBean args) {
|
private static void startUserInterface(ArgumentBean args) {
|
||||||
JFrame frame;
|
JFrame frame = null;
|
||||||
|
|
||||||
if (args.openSFV()) {
|
if (args.mode == null) {
|
||||||
// single panel frame
|
|
||||||
FileTransferable files = new FileTransferable(args.getFiles(false));
|
|
||||||
frame = new SinglePanelFrame(new SfvPanelBuilder()).publish(files);
|
|
||||||
} else {
|
|
||||||
// default frame
|
// default frame
|
||||||
frame = new MainFrame();
|
frame = new MainFrame();
|
||||||
|
} else {
|
||||||
|
// single panel frame
|
||||||
|
for (PanelBuilder it : MainFrame.createPanelBuilders()) {
|
||||||
|
if (args.mode.equalsIgnoreCase(it.getName())) {
|
||||||
|
frame = new SinglePanelFrame(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (frame == null) {
|
||||||
|
throw new IllegalArgumentException("Illegal mode: " + args.mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.setLocationByPlatform(true);
|
frame.setLocationByPlatform(true);
|
||||||
|
|
|
@ -13,8 +13,6 @@ import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import net.sourceforge.filebot.MediaTypes;
|
|
||||||
|
|
||||||
import org.kohsuke.args4j.Argument;
|
import org.kohsuke.args4j.Argument;
|
||||||
import org.kohsuke.args4j.Option;
|
import org.kohsuke.args4j.Option;
|
||||||
import org.kohsuke.args4j.spi.ExplicitBooleanOptionHandler;
|
import org.kohsuke.args4j.spi.ExplicitBooleanOptionHandler;
|
||||||
|
@ -94,8 +92,8 @@ public class ArgumentBean {
|
||||||
@Option(name = "-r", usage = "Resolve folders recursively")
|
@Option(name = "-r", usage = "Resolve folders recursively")
|
||||||
public boolean recursive = false;
|
public boolean recursive = false;
|
||||||
|
|
||||||
@Option(name = "-open", usage = "Open file in GUI", metaVar = "file")
|
@Option(name = "--mode", usage = "Open GUI with the specified mode only", metaVar = "[rename, sfv, etc]")
|
||||||
public boolean open = false;
|
public String mode = null;
|
||||||
|
|
||||||
@Option(name = "-clear-cache", usage = "Clear cached and temporary data")
|
@Option(name = "-clear-cache", usage = "Clear cached and temporary data")
|
||||||
public boolean clearCache = false;
|
public boolean clearCache = false;
|
||||||
|
@ -127,11 +125,6 @@ public class ArgumentBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean openSFV() {
|
|
||||||
return open && containsOnly(getFiles(false), MediaTypes.getDefaultFilter("verification"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public boolean printVersion() {
|
public boolean printVersion() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ public class MainFrame extends JFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected PanelBuilder[] createPanelBuilders() {
|
public static PanelBuilder[] createPanelBuilders() {
|
||||||
return new PanelBuilder[] { new ListPanelBuilder(), new RenamePanelBuilder(), new AnalyzePanelBuilder(), new EpisodeListPanelBuilder(), new SubtitlePanelBuilder(), new SfvPanelBuilder() };
|
return new PanelBuilder[] { new ListPanelBuilder(), new RenamePanelBuilder(), new AnalyzePanelBuilder(), new EpisodeListPanelBuilder(), new SubtitlePanelBuilder(), new SfvPanelBuilder() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import javax.swing.JFrame;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sourceforge.filebot.ResourceManager;
|
import net.sourceforge.filebot.ResourceManager;
|
||||||
|
import net.sourceforge.filebot.Settings;
|
||||||
import net.sourceforge.filebot.ui.transfer.TransferablePolicy;
|
import net.sourceforge.filebot.ui.transfer.TransferablePolicy;
|
||||||
import net.sourceforge.filebot.ui.transfer.TransferablePolicy.TransferAction;
|
import net.sourceforge.filebot.ui.transfer.TransferablePolicy.TransferAction;
|
||||||
import net.sourceforge.tuned.ExceptionUtilities;
|
import net.sourceforge.tuned.ExceptionUtilities;
|
||||||
|
@ -23,8 +24,7 @@ public class SinglePanelFrame extends JFrame {
|
||||||
|
|
||||||
|
|
||||||
public SinglePanelFrame(PanelBuilder builder) {
|
public SinglePanelFrame(PanelBuilder builder) {
|
||||||
super(builder.getName());
|
super(Settings.getApplicationName() + " - " + builder.getName());
|
||||||
|
|
||||||
panel = builder.create();
|
panel = builder.create();
|
||||||
|
|
||||||
// set taskbar / taskswitch icons
|
// set taskbar / taskswitch icons
|
||||||
|
|
Loading…
Reference in New Issue