diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuDownloaders.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuDownloaders.java index adb4a976486..a810bea8a55 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuDownloaders.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/CSubmenuDownloaders.java @@ -1,20 +1,16 @@ package forge.screens.home.settings; -import javax.swing.SwingUtilities; - import forge.UiCommand; -import forge.download.GuiDownloadPicturesLQ; -import forge.download.GuiDownloadPrices; -import forge.download.GuiDownloadQuestImages; -import forge.download.GuiDownloadSetPicturesLQ; -import forge.download.GuiDownloader; +import forge.download.*; import forge.error.BugReporter; import forge.gui.ImportDialog; import forge.gui.framework.ICDoc; -/** +import javax.swing.*; + +/** * Controls the utilities submenu in the home UI. - * + * *

(C at beginning of class name denotes a control class.) * */ @@ -42,6 +38,11 @@ public enum CSubmenuDownloaders implements ICDoc { new GuiDownloader(new GuiDownloadQuestImages()).show(); } }; + private final UiCommand cmdAchievementImages = new UiCommand() { + @Override public void run() { + new GuiDownloader(new GuiDownloadAchievementImages()).show(); + } + }; private final UiCommand cmdDownloadPrices = new UiCommand() { @Override public void run() { new GuiDownloader(new GuiDownloadPrices()).show(); @@ -76,6 +77,7 @@ public enum CSubmenuDownloaders implements ICDoc { view.setDownloadPicsCommand(cmdPicDownload); view.setDownloadSetPicsCommand(cmdSetDownload); view.setDownloadQuestImagesCommand(cmdQuestImages); + view.setDownloadAchievementImagesCommand(cmdAchievementImages); view.setReportBugCommand(cmdReportBug); view.setImportPicturesCommand(cmdImportPictures); view.setHowToPlayCommand(cmdHowToPlay); diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuDownloaders.java b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuDownloaders.java index b1879909bc9..c2334f95560 100644 --- a/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuDownloaders.java +++ b/forge-gui-desktop/src/main/java/forge/screens/home/settings/VSubmenuDownloaders.java @@ -20,7 +20,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -/** +/** * Assembles Swing components of utilities submenu singleton. * *

(V at beginning of class name denotes a view class.) @@ -38,19 +38,20 @@ public enum VSubmenuDownloaders implements IVSubmenu { private final JPanel pnlContent = new JPanel(new MigLayout("insets 0, gap 0, wrap, ay center")); private final FScrollPane scrContent = new FScrollPane(pnlContent, false); - private final FLabel btnDownloadSetPics = _makeButton("Download LQ Set Pictures"); - private final FLabel btnDownloadPics = _makeButton("Download LQ Card Pictures"); - private final FLabel btnDownloadQuestImages = _makeButton("Download Quest Images"); - private final FLabel btnReportBug = _makeButton("Report a Bug"); - private final FLabel btnImportPictures = _makeButton("Import Data"); - private final FLabel btnHowToPlay = _makeButton("How To Play"); - private final FLabel btnDownloadPrices = _makeButton("Download Card Prices"); - private final FLabel btnLicensing = _makeButton("License Details"); + private final FLabel btnDownloadSetPics = _makeButton("Download LQ Set Pictures"); + private final FLabel btnDownloadPics = _makeButton("Download LQ Card Pictures"); + private final FLabel btnDownloadQuestImages = _makeButton("Download Quest Images"); + private final FLabel btnDownloadAchievementImages = _makeButton("Download Achievement Images"); + private final FLabel btnReportBug = _makeButton("Report a Bug"); + private final FLabel btnImportPictures = _makeButton("Import Data"); + private final FLabel btnHowToPlay = _makeButton("How To Play"); + private final FLabel btnDownloadPrices = _makeButton("Download Card Prices"); + private final FLabel btnLicensing = _makeButton("License Details"); /** * Constructor. */ - private VSubmenuDownloaders() { + VSubmenuDownloaders() { final String constraintsLBL = "w 90%!, h 20px!, center, gap 0 0 3px 8px"; final String constraintsBTN = "h 30px!, w 50%!, center"; @@ -65,6 +66,9 @@ public enum VSubmenuDownloaders implements IVSubmenu { pnlContent.add(btnDownloadQuestImages, constraintsBTN); pnlContent.add(_makeLabel("Download tokens and icons used in Quest mode."), constraintsLBL); + pnlContent.add(btnDownloadAchievementImages, constraintsBTN); + pnlContent.add(_makeLabel("Download achievement images to really make your trophies stand out."), constraintsLBL); + pnlContent.add(btnDownloadPrices, constraintsBTN); pnlContent.add(_makeLabel("Download up-to-date price list for in-game card shops."), constraintsLBL); @@ -103,14 +107,15 @@ public enum VSubmenuDownloaders implements IVSubmenu { return EMenuGroup.SETTINGS; } - public void setDownloadPicsCommand(UiCommand command) { btnDownloadPics.setCommand(command); } - public void setDownloadSetPicsCommand(UiCommand command) { btnDownloadSetPics.setCommand(command); } - public void setDownloadQuestImagesCommand(UiCommand command) { btnDownloadQuestImages.setCommand(command); } - public void setReportBugCommand(UiCommand command) { btnReportBug.setCommand(command); } - public void setImportPicturesCommand(UiCommand command) { btnImportPictures.setCommand(command); } - public void setHowToPlayCommand(UiCommand command) { btnHowToPlay.setCommand(command); } - public void setDownloadPricesCommand(UiCommand command) { btnDownloadPrices.setCommand(command); } - public void setLicensingCommand(UiCommand command) { btnLicensing.setCommand(command); } + public void setDownloadPicsCommand(UiCommand command) { btnDownloadPics.setCommand(command); } + public void setDownloadSetPicsCommand(UiCommand command) { btnDownloadSetPics.setCommand(command); } + public void setDownloadQuestImagesCommand(UiCommand command) { btnDownloadQuestImages.setCommand(command); } + public void setDownloadAchievementImagesCommand(UiCommand command) { btnDownloadAchievementImages.setCommand(command); } + public void setReportBugCommand(UiCommand command) { btnReportBug.setCommand(command); } + public void setImportPicturesCommand(UiCommand command) { btnImportPictures.setCommand(command); } + public void setHowToPlayCommand(UiCommand command) { btnHowToPlay.setCommand(command); } + public void setDownloadPricesCommand(UiCommand command) { btnDownloadPrices.setCommand(command); } + public void setLicensingCommand(UiCommand command) { btnLicensing.setCommand(command); } public void focusTopButton() { btnDownloadPics.requestFocusInWindow(); @@ -123,7 +128,7 @@ public enum VSubmenuDownloaders implements IVSubmenu { FPanel p = new FPanel(new MigLayout("insets dialog, wrap, center")); p.setOpaque(false); p.setBackgroundTexture(FSkin.getIcon(FSkinProp.BG_TEXTURE)); - + final FButton btnClose = new FButton("OK"); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent arg0) { SOverlayUtils.hideOverlay(); } }); @@ -132,7 +137,7 @@ public enum VSubmenuDownloaders implements IVSubmenu { p.add(btnClose, "w 200!, h pref+12!, center, gaptop 30"); overlay.add(p, "gap 0 0 10% 10%"); SOverlayUtils.showOverlay(); - + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { @@ -143,7 +148,7 @@ public enum VSubmenuDownloaders implements IVSubmenu { } }); } - + public void showLicensing() { String license = "Forge License Information

" + "This program is free software : you can redistribute it and/or modify " @@ -156,7 +161,7 @@ public enum VSubmenuDownloaders implements IVSubmenu { + "GNU General Public License for more details.

" + "You should have received a copy of the GNU General Public License " + "along with this program. If not, see http://www.gnu.org/licenses/."; - + FLabel licenseLabel = new FLabel.Builder().text(license).fontSize(15).build(); _showDialog(licenseLabel, null); @@ -229,11 +234,11 @@ public enum VSubmenuDownloaders implements IVSubmenu { public DragCell getParentCell() { return parentCell; } - + private static FLabel _makeButton(String label) { return new FLabel.Builder().opaque().hoverable().text(label).fontSize(14).build(); } - + private static FLabel _makeLabel(String label) { return new FLabel.Builder().fontAlign(SwingConstants.CENTER) .text(label).fontStyle(Font.ITALIC).build(); diff --git a/forge-gui-mobile/src/forge/screens/settings/FilesPage.java b/forge-gui-mobile/src/forge/screens/settings/FilesPage.java index ab7d88043e1..8a4bae2ac77 100644 --- a/forge-gui-mobile/src/forge/screens/settings/FilesPage.java +++ b/forge-gui-mobile/src/forge/screens/settings/FilesPage.java @@ -1,5 +1,6 @@ package forge.screens.settings; +import forge.download.*; import org.apache.commons.lang3.StringUtils; import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment; @@ -8,11 +9,6 @@ import forge.Graphics; import forge.assets.FSkinColor; import forge.assets.FSkinFont; import forge.assets.FSkinImage; -import forge.download.GuiDownloadPicturesLQ; -import forge.download.GuiDownloadPrices; -import forge.download.GuiDownloadQuestImages; -import forge.download.GuiDownloadService; -import forge.download.GuiDownloadSetPicturesLQ; import forge.properties.ForgeProfileProperties; import forge.screens.TabPageScreen.TabPage; import forge.toolbox.FFileChooser; @@ -56,6 +52,13 @@ public class FilesPage extends TabPage { return new GuiDownloadQuestImages(); } }, 0); + lstItems.addItem(new ContentDownloader("Download Achievement Images", + "Download achievement images to really make your trophies stand out.") { + @Override + protected GuiDownloadService createService() { + return new GuiDownloadAchievementImages(); + } + }, 0); lstItems.addItem(new ContentDownloader("Download Card Prices", "Download up-to-date price list for in-game card shops.") { @Override @@ -98,7 +101,7 @@ public class FilesPage extends TabPage { protected String label; protected String description; - public FilesItem(String label0, String description0) { + FilesItem(String label0, String description0) { label = label0; description = description0; } @@ -131,12 +134,12 @@ public class FilesPage extends TabPage { g.drawText(value.label, font, foreColor, x, y, w, h, false, HAlignment.LEFT, false); h += SettingsScreen.SETTING_PADDING; - g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, HAlignment.LEFT, false); + g.drawText(value.description, SettingsScreen.DESC_FONT, SettingsScreen.DESC_COLOR, x, y + h, w, totalHeight - h + SettingsScreen.getInsets(w), true, HAlignment.LEFT, false); } } private abstract class ContentDownloader extends FilesItem { - public ContentDownloader(String label0, String description0) { + ContentDownloader(String label0, String description0) { super(label0, description0); } @@ -148,7 +151,7 @@ public class FilesPage extends TabPage { } private abstract class StorageOption extends FilesItem { - public StorageOption(String name0, String dir0) { + StorageOption(String name0, String dir0) { super(name0, dir0); } diff --git a/forge-gui/src/main/java/forge/properties/ForgeConstants.java b/forge-gui/src/main/java/forge/properties/ForgeConstants.java index 0cc2be00a53..0157edd1fb8 100644 --- a/forge-gui/src/main/java/forge/properties/ForgeConstants.java +++ b/forge-gui/src/main/java/forge/properties/ForgeConstants.java @@ -39,6 +39,7 @@ public final class ForgeConstants { public static final String IMAGE_LIST_QUEST_BOOSTERBOXES_FILE = LISTS_DIR + "boosterbox-images.txt"; public static final String IMAGE_LIST_QUEST_PRECONS_FILE = LISTS_DIR + "precon-images.txt"; public static final String IMAGE_LIST_QUEST_TOURNAMENTPACKS_FILE = LISTS_DIR + "tournamentpack-images.txt"; + public static final String IMAGE_LIST_ACHIEVEMENTS_FILE = LISTS_DIR + "achievement-images.txt"; public static final String NET_DECKS_LIST_FILE = LISTS_DIR + "net-decks.txt"; public static final String NET_DECKS_COMMANDER_LIST_FILE = LISTS_DIR + "net-decks-commander.txt";