Search in sources :

Example 1 with RomDownloaderPlugin

use of jack.rm.plugins.types.RomDownloaderPlugin in project rom-manager by Jakz.

the class InfoPanel method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Object src = e.getSource();
    if (src == downloadButton) {
        try {
            MyGameSetFeatures helper = set.helper();
            Set<RomDownloaderPlugin> downloaders = helper.settings().plugins.getEnabledPlugins(PluginRealType.ROM_DOWNLOADER);
            URL url = downloaders.stream().filter(p -> p.isPlatformSupported(set.platform())).findFirst().get().getDownloadURL(set.platform(), game);
            Desktop.getDesktop().browse(url.toURI());
        } catch (Exception ee) {
            ee.printStackTrace();
        }
    } else if (src == openFolderButton) {
        Main.openFolder(game.rom().handle().path().getParent().toFile());
    // TODO: Main.openFolder(rom.getHandle().path().getParent().toFile());
    } else if (src == openArchiveButton) {
    // TODO: Main.openFolder(rom.getHandle().path().toFile());
    } else if (src == assetsButton) {
        if (game != null)
            Main.downloader.downloadArt(game);
    }
}
Also used : Color(java.awt.Color) Arrays(java.util.Arrays) URL(java.net.URL) JToggleButton(javax.swing.JToggleButton) MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures) GameSet(com.github.jakz.romlib.data.set.GameSet) MouseAdapter(java.awt.event.MouseAdapter) RomDownloaderPlugin(jack.rm.plugins.types.RomDownloaderPlugin) BorderLayout(java.awt.BorderLayout) Feature(com.github.jakz.romlib.data.set.Feature) Icon(com.github.jakz.romlib.ui.Icon) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) Set(java.util.Set) JMenu(javax.swing.JMenu) BorderFactory(javax.swing.BorderFactory) Collectors(java.util.stream.Collectors) Box(javax.swing.Box) Dimension(java.awt.Dimension) List(java.util.List) Stream(java.util.stream.Stream) Graphics(java.awt.Graphics) JPanel(javax.swing.JPanel) ActionListener(java.awt.event.ActionListener) GameAttribute(com.github.jakz.romlib.data.game.attributes.GameAttribute) Asset(com.github.jakz.romlib.data.assets.Asset) Game(com.github.jakz.romlib.data.game.Game) Attribute(com.github.jakz.romlib.data.game.attributes.Attribute) SwingConstants(javax.swing.SwingConstants) SwingUtilities(javax.swing.SwingUtilities) JMenuItem(javax.swing.JMenuItem) RomAttribute(com.github.jakz.romlib.data.game.attributes.RomAttribute) ImageIcon(javax.swing.ImageIcon) AssetData(com.github.jakz.romlib.data.assets.AssetData) BoxLayout(javax.swing.BoxLayout) Mediator(jack.rm.gui.Mediator) Desktop(java.awt.Desktop) JButton(javax.swing.JButton) MigLayout(net.miginfocom.swing.MigLayout) JPopupMenu(javax.swing.JPopupMenu) PluginRealType(jack.rm.plugins.PluginRealType) GameStatus(com.github.jakz.romlib.data.game.GameStatus) ActionEvent(java.awt.event.ActionEvent) MouseEvent(java.awt.event.MouseEvent) JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) AssetManager(com.github.jakz.romlib.data.assets.AssetManager) Main(jack.rm.Main) GameSetManager(jack.rm.data.romset.GameSetManager) Settings(jack.rm.data.romset.Settings) MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures) RomDownloaderPlugin(jack.rm.plugins.types.RomDownloaderPlugin) URL(java.net.URL)

Aggregations

Asset (com.github.jakz.romlib.data.assets.Asset)1 AssetData (com.github.jakz.romlib.data.assets.AssetData)1 AssetManager (com.github.jakz.romlib.data.assets.AssetManager)1 Game (com.github.jakz.romlib.data.game.Game)1 GameStatus (com.github.jakz.romlib.data.game.GameStatus)1 Attribute (com.github.jakz.romlib.data.game.attributes.Attribute)1 GameAttribute (com.github.jakz.romlib.data.game.attributes.GameAttribute)1 RomAttribute (com.github.jakz.romlib.data.game.attributes.RomAttribute)1 Feature (com.github.jakz.romlib.data.set.Feature)1 GameSet (com.github.jakz.romlib.data.set.GameSet)1 Icon (com.github.jakz.romlib.ui.Icon)1 Main (jack.rm.Main)1 GameSetManager (jack.rm.data.romset.GameSetManager)1 MyGameSetFeatures (jack.rm.data.romset.MyGameSetFeatures)1 Settings (jack.rm.data.romset.Settings)1 Mediator (jack.rm.gui.Mediator)1 PluginRealType (jack.rm.plugins.PluginRealType)1 RomDownloaderPlugin (jack.rm.plugins.types.RomDownloaderPlugin)1 BorderLayout (java.awt.BorderLayout)1 Color (java.awt.Color)1