1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-16 06:15:02 -05:00

* indicate Opportunistic / Strict Match Mode via Match Button Icon Color

This commit is contained in:
Reinhard Pointner 2014-08-17 10:25:54 +00:00
parent bd45c798d4
commit f438d91bb6
3 changed files with 17 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -33,9 +33,14 @@ class MatchAction extends AbstractAction {
public MatchAction(RenameModel model) { public MatchAction(RenameModel model) {
this.model = model; this.model = model;
// initialize with default values
setMatchMode(false);
}
public void setMatchMode(boolean strict) {
putValue(NAME, "Match"); putValue(NAME, "Match");
putValue(SMALL_ICON, ResourceManager.getIcon("action.match"));
putValue(SHORT_DESCRIPTION, "Match files and names"); putValue(SHORT_DESCRIPTION, "Match files and names");
putValue(SMALL_ICON, ResourceManager.getIcon(strict ? "action.match.strict" : "action.match"));
} }
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {

View File

@ -108,6 +108,9 @@ public class RenamePanel extends JComponent {
filesList.setTitle("Original Files"); filesList.setTitle("Original Files");
filesList.setTransferablePolicy(new FilesListTransferablePolicy(renameModel.files())); filesList.setTransferablePolicy(new FilesListTransferablePolicy(renameModel.files()));
// restore icon indicating current match mode
matchAction.setMatchMode(isMatchModeStrict());
try { try {
// restore custom episode formatter // restore custom episode formatter
renameModel.useFormatter(Episode.class, new ExpressionFormatter(persistentEpisodeFormat.getValue(), EpisodeFormat.SeasonEpisode, Episode.class)); renameModel.useFormatter(Episode.class, new ExpressionFormatter(persistentEpisodeFormat.getValue(), EpisodeFormat.SeasonEpisode, Episode.class));
@ -354,6 +357,10 @@ public class RenamePanel extends JComponent {
}); });
} }
private boolean isMatchModeStrict() {
return "strict".equalsIgnoreCase(persistentPreferredMatchMode.getValue());
}
protected ActionPopup createFetchPopup() { protected ActionPopup createFetchPopup() {
final ActionPopup actionPopup = new ActionPopup("Series / Movie Data", ResourceManager.getIcon("action.fetch")); final ActionPopup actionPopup = new ActionPopup("Series / Movie Data", ResourceManager.getIcon("action.fetch"));
@ -452,6 +459,9 @@ public class RenamePanel extends JComponent {
persistentPreferredMatchMode.setValue((String) modeCombo.getSelectedItem()); persistentPreferredMatchMode.setValue((String) modeCombo.getSelectedItem());
persistentPreferredLanguage.setValue(((Language) languageList.getSelectedValue()).getCode()); persistentPreferredLanguage.setValue(((Language) languageList.getSelectedValue()).getCode());
persistentPreferredEpisodeOrder.setValue(((SortOrder) orderCombo.getSelectedItem()).name()); persistentPreferredEpisodeOrder.setValue(((SortOrder) orderCombo.getSelectedItem()).name());
// update UI
matchAction.setMatchMode(isMatchModeStrict());
} }
} }
}); });
@ -645,7 +655,7 @@ public class RenamePanel extends JComponent {
renameModel.values().clear(); renameModel.values().clear();
final List<File> remainingFiles = new LinkedList<File>(renameModel.files()); final List<File> remainingFiles = new LinkedList<File>(renameModel.files());
final boolean strict = "strict".equalsIgnoreCase(persistentPreferredMatchMode.getValue()); final boolean strict = isMatchModeStrict();
final SortOrder order = SortOrder.forName(persistentPreferredEpisodeOrder.getValue()); final SortOrder order = SortOrder.forName(persistentPreferredEpisodeOrder.getValue());
final Locale locale = new Locale(persistentPreferredLanguage.getValue()); final Locale locale = new Locale(persistentPreferredLanguage.getValue());
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