Started using resourceBUndle

This commit is contained in:
cyian-1756 2018-05-10 12:43:01 -04:00
parent bba39a5337
commit c51710b833

View File

@ -16,9 +16,7 @@ import java.net.URL;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Collections; import java.util.*;
import java.util.Date;
import java.util.Enumeration;
import java.util.List; import java.util.List;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -138,6 +136,8 @@ public final class MainWindow implements Runnable, RipStatusHandler {
private static AbstractRipper ripper; private static AbstractRipper ripper;
private ResourceBundle rb = Utils.getResourceBundle();
private static void addCheckboxListener(JCheckBox checkBox, String configString) { private static void addCheckboxListener(JCheckBox checkBox, String configString) {
checkBox.addActionListener(arg0 -> { checkBox.addActionListener(arg0 -> {
Utils.setConfigBoolean(configString, checkBox.isSelected()); Utils.setConfigBoolean(configString, checkBox.isSelected());
@ -462,17 +462,17 @@ public final class MainWindow implements Runnable, RipStatusHandler {
configUpdateButton = new JButton("Check for updates"); configUpdateButton = new JButton("Check for updates");
configUpdateLabel = new JLabel("Current version: " + UpdateUtils.getThisJarVersion(), JLabel.RIGHT); configUpdateLabel = new JLabel("Current version: " + UpdateUtils.getThisJarVersion(), JLabel.RIGHT);
JLabel configThreadsLabel = new JLabel("Maximum download threads:", JLabel.RIGHT); JLabel configThreadsLabel = new JLabel("Maximum download threads:", JLabel.RIGHT);
JLabel configTimeoutLabel = new JLabel("Timeout (in milliseconds):", JLabel.RIGHT); JLabel configTimeoutLabel = new JLabel(rb.getString("timeout.mill"), JLabel.RIGHT);
JLabel configRetriesLabel = new JLabel("Retry download count:", JLabel.RIGHT); JLabel configRetriesLabel = new JLabel(rb.getString("retry.download.count"), JLabel.RIGHT);
configThreadsText = new JTextField(Integer.toString(Utils.getConfigInteger("threads.size", 3))); configThreadsText = new JTextField(Integer.toString(Utils.getConfigInteger("threads.size", 3)));
configTimeoutText = new JTextField(Integer.toString(Utils.getConfigInteger("download.timeout", 60000))); configTimeoutText = new JTextField(Integer.toString(Utils.getConfigInteger("download.timeout", 60000)));
configRetriesText = new JTextField(Integer.toString(Utils.getConfigInteger("download.retries", 3))); configRetriesText = new JTextField(Integer.toString(Utils.getConfigInteger("download.retries", 3)));
configOverwriteCheckbox = addNewCheckbox("Overwrite existing files?", "file.overwrite", false); configOverwriteCheckbox = addNewCheckbox(rb.getString("overwrite.existing.files"), "file.overwrite", false);
configAutoupdateCheckbox = addNewCheckbox("Auto-update?", "auto.update", true); configAutoupdateCheckbox = addNewCheckbox(rb.getString("auto.update"), "auto.update", true);
configPlaySound = addNewCheckbox("Sound when rip completes", "play.sound", false); configPlaySound = addNewCheckbox(rb.getString("sound.when.rip.completes"), "play.sound", false);
configShowPopup = addNewCheckbox("Notification when rip starts", "download.show_popup", false); configShowPopup = addNewCheckbox("Notification when rip starts", "download.show_popup", false);
configSaveOrderCheckbox = addNewCheckbox("Preserve order", "download.save_order", true); configSaveOrderCheckbox = addNewCheckbox(rb.getString("preserve.order"), "download.save_order", true);
configSaveLogs = addNewCheckbox("Save logs", "log.save", false); configSaveLogs = addNewCheckbox(rb.getString("save.logs"), "log.save", false);
configSaveURLsOnly = addNewCheckbox("Save URLs only", "urls_only.save", false); configSaveURLsOnly = addNewCheckbox("Save URLs only", "urls_only.save", false);
configSaveAlbumTitles = addNewCheckbox("Save album titles", "album_titles.save", true); configSaveAlbumTitles = addNewCheckbox("Save album titles", "album_titles.save", true);
configClipboardAutorip = addNewCheckbox("Autorip from Clipboard", "clipboard.autorip", false); configClipboardAutorip = addNewCheckbox("Autorip from Clipboard", "clipboard.autorip", false);