forked from External/mage
Refactor and fixed and images downloading and paths loading:
- Added new images and symbols downloading; - Fixed user defined images path (now work for all images: cards, symbols, temp downloading); - Fixed not working cancel button at download window (it close window, but tasks is working, download and didn't save); - Fixed temp files trash all around images folder (on cancel button); - Fixed not saving new downloaded cards on cancel button (zip file didn't close on cancel);
This commit is contained in:
parent
efee0b5328
commit
c29bac08d8
13 changed files with 303 additions and 215 deletions
|
|
@ -92,6 +92,8 @@ import org.mage.plugins.card.images.DownloadPictures;
|
|||
import org.mage.plugins.card.info.CardInfoPaneImpl;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ public final class Constants {
|
|||
public static final Rectangle CARD_SIZE_FULL = new Rectangle(101, 149);
|
||||
public static final Rectangle THUMBNAIL_SIZE_FULL = new Rectangle(102, 146);
|
||||
|
||||
// resources - default images
|
||||
public static final String RESOURCE_PATH_DEFAUL_IMAGES = File.separator + "default";
|
||||
|
||||
// resources - symbols
|
||||
public static final String RESOURCE_PATH_SYMBOLS = File.separator + "symbols";
|
||||
public static final String RESOURCE_SYMBOL_FOLDER_SMALL = "small";
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ public class MageBook extends JComponent {
|
|||
if (setImage != null) {
|
||||
tab.setOverlayImage(setImage);
|
||||
} else {
|
||||
System.out.println("Couldn't find symbol image: " + "/plugins/images/sets/" + set + "-C.jpg");
|
||||
System.out.println("Couldn't find symbol image: " + set + "-C.jpg");
|
||||
}
|
||||
tab.setSet(set);
|
||||
tab.setBounds(0, y, 39, 120);
|
||||
|
|
|
|||
|
|
@ -29,13 +29,14 @@ import mage.view.PermanentView;
|
|||
import net.xeoh.plugins.base.PluginManager;
|
||||
import net.xeoh.plugins.base.impl.PluginManagerFactory;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
import org.mage.plugins.card.CardPluginImpl;
|
||||
import org.mage.plugins.theme.ThemePluginImpl;
|
||||
|
||||
import static org.mage.plugins.card.utils.CardImageUtils.getImagesDir;
|
||||
|
||||
public enum Plugins implements MagePlugins {
|
||||
instance;
|
||||
public static final String PLUGINS_DIRECTORY = File.separator + "plugins";
|
||||
public static final String PLUGINS_DIRECTORY = "plugins";
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(Plugins.class);
|
||||
private static PluginManager pm;
|
||||
|
|
@ -49,6 +50,7 @@ public enum Plugins implements MagePlugins {
|
|||
|
||||
@Override
|
||||
public void loadPlugins() {
|
||||
|
||||
LOGGER.info("Loading plugins...");
|
||||
pm = PluginManagerFactory.createPluginManager();
|
||||
pm.addPluginsFrom(new File(PLUGINS_DIRECTORY + File.separator).toURI());
|
||||
|
|
@ -132,9 +134,8 @@ public enum Plugins implements MagePlugins {
|
|||
|
||||
@Override
|
||||
public void downloadSymbols() {
|
||||
String path = ManaSymbols.getImagesDir() + File.separator;
|
||||
if (this.cardPlugin != null) {
|
||||
this.cardPlugin.downloadSymbols(path);
|
||||
this.cardPlugin.downloadSymbols(getImagesDir());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue