From ed429b0c371e37bcca12acac9717d13103616527 Mon Sep 17 00:00:00 2001 From: spjspj Date: Wed, 27 Sep 2017 16:04:13 +1000 Subject: [PATCH] Add option to preferences to display full path to image of cards missing images. --- .../mage/card/arcane/CardPanelComponentImpl.java | 2 +- .../org/mage/plugins/card/images/ImageCache.java | 2 +- .../org/mage/plugins/card/utils/CardImageUtils.java | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java index 8a81a208d2..c57a41f043 100644 --- a/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java +++ b/Mage.Client/src/main/java/org/mage/card/arcane/CardPanelComponentImpl.java @@ -222,7 +222,7 @@ public class CardPanelComponentImpl extends CardPanel { } displayTitleAnyway = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_CARD_NAMES, "true").equals("true"); - displayFullImagePath = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_FULL_IMAGE_PATH, "true").equals("true"); + displayFullImagePath = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_FULL_IMAGE_PATH, "false").equals("true"); // Title Text titleText = new GlowText(); diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java b/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java index 3f033bdaec..97cbd4af82 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/images/ImageCache.java @@ -187,7 +187,7 @@ public final class ImageCache { String path; if (collectorId.isEmpty() || "0".equals(collectorId)) { info.setToken(true); - path = CardImageUtils.generateTokenImagePath(info); + path = CardImageUtils.generateFullTokenImagePath(info); if (path == null) { path = DirectLinksForDownload.outDir + File.separator + DirectLinksForDownload.cardbackFilename; } diff --git a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java index cba58f353f..ac45d2a2f8 100644 --- a/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java +++ b/Mage.Client/src/main/java/org/mage/plugins/card/utils/CardImageUtils.java @@ -48,6 +48,19 @@ public final class CardImageUtils { log.warn("Token image file not found: " + card.getSet() + " - " + card.getTokenSetCode() + " - " + card.getName()); return null; } + + /** + * + * @param card + * @return String regardless of whether image exists + */ + public static String generateFullTokenImagePath(CardDownloadData card) { + if (card.isToken()) { + String filePath = getTokenImagePath(card); + return filePath; + } + return ""; + } private static String getTokenImagePath(CardDownloadData card) { String filename = generateImagePath(card);