Add Disable Card Images Option

This commit is contained in:
Anthony Calosa
2021-03-04 02:15:16 +08:00
parent 083c34acc5
commit 17944c0e41
14 changed files with 53 additions and 0 deletions

View File

@@ -3,6 +3,9 @@ package forge;
import com.google.common.cache.CacheLoader;
import forge.error.BugReporter;
import forge.model.FModel;
import forge.properties.ForgePreferences;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
@@ -12,6 +15,9 @@ import java.io.IOException;
final class ImageLoader extends CacheLoader<String, BufferedImage> {
@Override
public BufferedImage load(String key) {
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DISABLE_CARD_IMAGES))
return null;
File file = ImageKeys.getImageFile(key);
if (file != null) {
if (!file.exists()) {

View File

@@ -131,6 +131,7 @@ public enum CSubmenuPreferences implements ICDoc {
lstControls.add(Pair.of(view.getCbEnableNonLegalCards(), FPref.UI_LOAD_NONLEGAL_CARDS));
lstControls.add(Pair.of(view.getCbUseExperimentalNetworkStream(), FPref.UI_NETPLAY_COMPAT));
lstControls.add(Pair.of(view.getCbImageFetcher(), FPref.UI_ENABLE_ONLINE_IMAGE_FETCHER));
lstControls.add(Pair.of(view.getCbDisableCardImages(), FPref.UI_DISABLE_CARD_IMAGES));
lstControls.add(Pair.of(view.getCbDisplayFoil(), FPref.UI_OVERLAY_FOIL_EFFECT));
lstControls.add(Pair.of(view.getCbRandomFoil(), FPref.UI_RANDOM_FOIL));
lstControls.add(Pair.of(view.getCbEnableSounds(), FPref.UI_ENABLE_SOUNDS));

View File

@@ -80,6 +80,7 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
private final JCheckBox cbSROptimize = new OptionsCheckBox(localizer.getMessage("cbSROptimize"));
private final JCheckBox cbFilteredHands = new OptionsCheckBox(localizer.getMessage("cbFilteredHands"));
private final JCheckBox cbImageFetcher = new OptionsCheckBox(localizer.getMessage("cbImageFetcher"));
private final JCheckBox cbDisableCardImages = new OptionsCheckBox(localizer.getMessage("lblDisableCardImages"));
private final JCheckBox cbCloneImgSource = new OptionsCheckBox(localizer.getMessage("cbCloneImgSource"));
private final JCheckBox cbScaleLarger = new OptionsCheckBox(localizer.getMessage("cbScaleLarger"));
private final JCheckBox cbRenderBlackCardBorders = new OptionsCheckBox(localizer.getMessage("cbRenderBlackCardBorders"));
@@ -313,6 +314,9 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
pnlPrefs.add(cbImageFetcher, titleConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlImageFetcher")), descriptionConstraints);
pnlPrefs.add(cbDisableCardImages, titleConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlDisableCardImages")), descriptionConstraints);
pnlPrefs.add(cbDisplayFoil, titleConstraints);
pnlPrefs.add(new NoteLabel(localizer.getMessage("nlDisplayFoil")), descriptionConstraints);
@@ -617,6 +621,11 @@ public enum VSubmenuPreferences implements IVSubmenu<CSubmenuPreferences> {
return cbImageFetcher;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbDisableCardImages() {
return cbDisableCardImages;
}
/** @return {@link javax.swing.JCheckBox} */
public JCheckBox getCbDisplayFoil() {
return cbDisplayFoil;