Search in sources :

Example 1 with MyGameSetFeatures

use of jack.rm.data.romset.MyGameSetFeatures 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)

Example 2 with MyGameSetFeatures

use of jack.rm.data.romset.MyGameSetFeatures in project rom-manager by Jakz.

the class MenuListener method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    JMenuItem item = (JMenuItem) source;
    MenuElement tag = MenuElement.elementForItem(item);
    MyGameSetFeatures helper = Main.current.helper();
    try {
        if (tag == MenuElement.ROMS_SCAN_FOR_ROMS) {
            helper.scanner().scanForRoms(true);
            Main.mainFrame.rebuildGameList();
        } else if (tag == MenuElement.ROMS_SCAN_FOR_NEW_ROMS) {
            helper.scanner().scanForRoms(false);
            Main.mainFrame.rebuildGameList();
        } else {
        // StringManager.loadLanguage(((JMenuItem)source).getText());
        }
    } catch (IOException ee) {
        ee.printStackTrace();
    }
}
Also used : MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures) IOException(java.io.IOException) JMenuItem(javax.swing.JMenuItem)

Example 3 with MyGameSetFeatures

use of jack.rm.data.romset.MyGameSetFeatures in project rom-manager by Jakz.

the class PatternRenamerPanel method updateFields.

public void updateFields() {
    MyGameSetFeatures helper = getGameSet().helper();
    patternField.setText(helper.settings().renamingPattern);
    patterns.clear();
    helper.settings().getRenamingPatterns().forEach(patterns::add);
// TODO: should be invoked even when plugins are changed
}
Also used : MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures)

Example 4 with MyGameSetFeatures

use of jack.rm.data.romset.MyGameSetFeatures in project rom-manager by Jakz.

the class PatternRenamerPanel method caretUpdate.

@Override
public void caretUpdate(CaretEvent e) {
    MyGameSetFeatures helper = getGameSet().helper();
    helper.settings().renamingPattern = patternField.getText();
    exampleField.setText(getGameSet().getAny().getCorrectName());
}
Also used : MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures)

Example 5 with MyGameSetFeatures

use of jack.rm.data.romset.MyGameSetFeatures in project rom-manager by Jakz.

the class InfoPanel method updateFields.

public void updateFields(Game game) {
    this.game = game;
    attachments.setRom(game);
    clonesTable.update(game);
    romTable.update(game);
    this.setVisible(true);
    for (AttributeField field : fields) {
        try {
            field.setValue(game);
        } catch (NullPointerException e) {
            field.clear();
        // throw new RuntimeException(String.format("Attribute %s of %s is null", field.attrib.name(), rom.getTitle()));
        }
    }
    if (game != null) {
        for (AssetImage image : images) setImage(game, image.asset, image.image);
        buttons[4].setEnabled(game.getStatus() != GameStatus.MISSING);
        // TODO: missing management for INCOMPLETE
        if (game.getStatus() == GameStatus.MISSING) {
            buttons[2].setEnabled(false);
            buttons[3].setEnabled(false);
            MyGameSetFeatures helper = set.helper();
            buttons[0].setEnabled(helper.settings().hasDownloader(set.platform()));
        } else {
            buttons[3].setEnabled(true);
            // TODO: different management for multiple roms per game
            /*if (game.getHandle().isArchive())
    	      openArchiveButton.setEnabled(true);*/
            buttons[0].setEnabled(false);
        }
    }
    buttons[1].setEnabled(game != null && !game.hasAllAssets());
}
Also used : MyGameSetFeatures(jack.rm.data.romset.MyGameSetFeatures)

Aggregations

MyGameSetFeatures (jack.rm.data.romset.MyGameSetFeatures)16 GameSet (com.github.jakz.romlib.data.set.GameSet)8 Settings (jack.rm.data.romset.Settings)7 Dimension (java.awt.Dimension)6 Game (com.github.jakz.romlib.data.game.Game)5 Attribute (com.github.jakz.romlib.data.game.attributes.Attribute)5 GameAttribute (com.github.jakz.romlib.data.game.attributes.GameAttribute)5 Feature (com.github.jakz.romlib.data.set.Feature)5 Main (jack.rm.Main)5 GameSetManager (jack.rm.data.romset.GameSetManager)5 BorderLayout (java.awt.BorderLayout)5 Arrays (java.util.Arrays)5 List (java.util.List)5 JMenuItem (javax.swing.JMenuItem)5 Asset (com.github.jakz.romlib.data.assets.Asset)4 RomAttribute (com.github.jakz.romlib.data.game.attributes.RomAttribute)4 PluginRealType (jack.rm.plugins.PluginRealType)4 Color (java.awt.Color)4 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4