* remember select dialog size
This commit is contained in:
parent
6579d8ce1d
commit
6b6d7e380d
|
@ -39,6 +39,7 @@ import javax.swing.Action;
|
|||
import javax.swing.SwingUtilities;
|
||||
|
||||
import net.sourceforge.filebot.Analytics;
|
||||
import net.sourceforge.filebot.Settings;
|
||||
import net.sourceforge.filebot.similarity.CommonSequenceMatcher;
|
||||
import net.sourceforge.filebot.similarity.EpisodeMatcher;
|
||||
import net.sourceforge.filebot.similarity.Match;
|
||||
|
@ -99,13 +100,22 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
|||
|
||||
selectDialog.getHeaderLabel().setText(String.format("Shows matching '%s':", query));
|
||||
selectDialog.getCancelAction().putValue(Action.NAME, "Ignore");
|
||||
selectDialog.setMinimumSize(new Dimension(250, 150));
|
||||
|
||||
// restore original dialog size
|
||||
Settings prefs = Settings.forPackage(EpisodeListMatcher.class);
|
||||
int w = Integer.parseInt(prefs.get("dialog.select.w", "280"));
|
||||
int h = Integer.parseInt(prefs.get("dialog.select.h", "300"));
|
||||
selectDialog.setPreferredSize(new Dimension(w, h));
|
||||
selectDialog.pack();
|
||||
|
||||
// show dialog
|
||||
selectDialog.setLocation(getOffsetLocation(selectDialog.getOwner()));
|
||||
selectDialog.setVisible(true);
|
||||
|
||||
// remember dialog size
|
||||
prefs.put("dialog.select.w", Integer.toString(selectDialog.getWidth()));
|
||||
prefs.put("dialog.select.h", Integer.toString(selectDialog.getHeight()));
|
||||
|
||||
// selected value or null if the dialog was canceled by the user
|
||||
return selectDialog.getSelectedValue();
|
||||
}
|
||||
|
@ -257,8 +267,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher {
|
|||
}
|
||||
|
||||
|
||||
public List<Match<File, ?>> matchEpisodeSet(final List<File> files, Collection<String> queries, SortOrder sortOrder, Locale locale, boolean autodetection, Map<String, SearchResult> selectionMemory,
|
||||
Map<String, List<String>> inputMemory, Component parent) throws Exception {
|
||||
public List<Match<File, ?>> matchEpisodeSet(final List<File> files, Collection<String> queries, SortOrder sortOrder, Locale locale, boolean autodetection, Map<String, SearchResult> selectionMemory, Map<String, List<String>> inputMemory, Component parent) throws Exception {
|
||||
Set<Episode> episodes = emptySet();
|
||||
|
||||
// detect series name and fetch episode list
|
||||
|
|
|
@ -46,6 +46,7 @@ import javax.swing.SwingUtilities;
|
|||
|
||||
import net.sourceforge.filebot.Analytics;
|
||||
import net.sourceforge.filebot.ResourceManager;
|
||||
import net.sourceforge.filebot.Settings;
|
||||
import net.sourceforge.filebot.similarity.Match;
|
||||
import net.sourceforge.filebot.similarity.NameSimilarityMetric;
|
||||
import net.sourceforge.filebot.similarity.SimilarityMetric;
|
||||
|
@ -98,7 +99,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||
|
||||
// match movie hashes online
|
||||
final Map<File, Movie> movieByFile = new TreeMap<File, Movie>();
|
||||
if (movieFiles.size() > 0) {
|
||||
if (autodetect && movieFiles.size() > 0) {
|
||||
try {
|
||||
Map<File, Movie> hashLookup = service.getMovieDescriptors(movieFiles, locale);
|
||||
movieByFile.putAll(hashLookup);
|
||||
|
@ -328,8 +329,6 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||
selectDialog.setTitle(folderQuery.isEmpty() ? fileQuery : String.format("%s / %s", folderQuery, fileQuery));
|
||||
selectDialog.getHeaderLabel().setText(String.format("Movies matching '%s':", fileQuery.length() >= 2 || folderQuery.length() <= 2 ? fileQuery : folderQuery));
|
||||
selectDialog.getCancelAction().putValue(Action.NAME, "Ignore");
|
||||
selectDialog.setMinimumSize(new Dimension(280, 300));
|
||||
selectDialog.pack();
|
||||
|
||||
// add repeat button
|
||||
JCheckBox checkBox = new JCheckBox();
|
||||
|
@ -340,10 +339,21 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||
JComponent c = (JComponent) selectDialog.getContentPane();
|
||||
c.add(checkBox, "pos 1al select.y n select.y2");
|
||||
|
||||
// restore original dialog size
|
||||
Settings prefs = Settings.forPackage(MovieHashMatcher.class);
|
||||
int w = Integer.parseInt(prefs.get("dialog.select.w", "280"));
|
||||
int h = Integer.parseInt(prefs.get("dialog.select.h", "300"));
|
||||
selectDialog.setPreferredSize(new Dimension(w, h));
|
||||
selectDialog.pack();
|
||||
|
||||
// show dialog
|
||||
selectDialog.setLocation(getOffsetLocation(selectDialog.getOwner()));
|
||||
selectDialog.setVisible(true);
|
||||
|
||||
// remember dialog size
|
||||
prefs.put("dialog.select.w", Integer.toString(selectDialog.getWidth()));
|
||||
prefs.put("dialog.select.h", Integer.toString(selectDialog.getHeight()));
|
||||
|
||||
// remember if we should auto-repeat the chosen action in the future
|
||||
if (checkBox.isSelected()) {
|
||||
memory.put("repeat", selectDialog.getSelectedValue() != null ? "select" : "ignore");
|
||||
|
|
Loading…
Reference in New Issue