Now using RB for more UI elements

This commit is contained in:
cyian-1756 2018-05-10 13:24:14 -04:00
parent c4ce162b48
commit dc9f7ea33e

View File

@ -289,7 +289,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
gbc.gridx = 3; ripPanel.add(stopButton, gbc); gbc.gridx = 3; ripPanel.add(stopButton, gbc);
gbc.weightx = 1; gbc.weightx = 1;
statusLabel = new JLabel("Inactive"); statusLabel = new JLabel(rb.getString("inactive"));
statusLabel.setHorizontalAlignment(JLabel.CENTER); statusLabel.setHorizontalAlignment(JLabel.CENTER);
openButton = new JButton(); openButton = new JButton();
openButton.setVisible(false); openButton.setVisible(false);
@ -402,9 +402,9 @@ public final class MainWindow implements Runnable, RipStatusHandler {
historyTable.getColumnModel().getColumn(i).setPreferredWidth(width); historyTable.getColumnModel().getColumn(i).setPreferredWidth(width);
} }
JScrollPane historyTableScrollPane = new JScrollPane(historyTable); JScrollPane historyTableScrollPane = new JScrollPane(historyTable);
historyButtonRemove = new JButton("Remove"); historyButtonRemove = new JButton(rb.getString("remove"));
historyButtonClear = new JButton("Clear"); historyButtonClear = new JButton(rb.getString("clear"));
historyButtonRerip = new JButton("Re-rip Checked"); historyButtonRerip = new JButton(rb.getString("re-rip.checked"));
gbc.gridx = 0; gbc.gridx = 0;
// History List Panel // History List Panel
JPanel historyTablePanel = new JPanel(new GridBagLayout()); JPanel historyTablePanel = new JPanel(new GridBagLayout());
@ -459,9 +459,9 @@ public final class MainWindow implements Runnable, RipStatusHandler {
configurationPanel.setBorder(emptyBorder); configurationPanel.setBorder(emptyBorder);
configurationPanel.setVisible(false); configurationPanel.setVisible(false);
// TODO Configuration components // TODO Configuration components
configUpdateButton = new JButton("Check for updates"); configUpdateButton = new JButton(rb.getString("check.for.updates"));
configUpdateLabel = new JLabel("Current version: " + UpdateUtils.getThisJarVersion(), JLabel.RIGHT); configUpdateLabel = new JLabel( rb.getString("current.version") + ": " + UpdateUtils.getThisJarVersion(), JLabel.RIGHT);
JLabel configThreadsLabel = new JLabel("Maximum download threads:", JLabel.RIGHT); JLabel configThreadsLabel = new JLabel(rb.getString("max.download.threads") + ":", JLabel.RIGHT);
JLabel configTimeoutLabel = new JLabel(rb.getString("timeout.mill"), JLabel.RIGHT); JLabel configTimeoutLabel = new JLabel(rb.getString("timeout.mill"), JLabel.RIGHT);
JLabel configRetriesLabel = new JLabel(rb.getString("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)));
@ -470,16 +470,16 @@ public final class MainWindow implements Runnable, RipStatusHandler {
configOverwriteCheckbox = addNewCheckbox(rb.getString("overwrite.existing.files"), "file.overwrite", false); configOverwriteCheckbox = addNewCheckbox(rb.getString("overwrite.existing.files"), "file.overwrite", false);
configAutoupdateCheckbox = addNewCheckbox(rb.getString("auto.update"), "auto.update", true); configAutoupdateCheckbox = addNewCheckbox(rb.getString("auto.update"), "auto.update", true);
configPlaySound = addNewCheckbox(rb.getString("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(rb.getString("notification.when.rip.starts"), "download.show_popup", false);
configSaveOrderCheckbox = addNewCheckbox(rb.getString("preserve.order"), "download.save_order", true); configSaveOrderCheckbox = addNewCheckbox(rb.getString("preserve.order"), "download.save_order", true);
configSaveLogs = addNewCheckbox(rb.getString("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(rb.getString("save.urls.only"), "urls_only.save", false);
configSaveAlbumTitles = addNewCheckbox("Save album titles", "album_titles.save", true); configSaveAlbumTitles = addNewCheckbox(rb.getString("save.album.titles"), "album_titles.save", true);
configClipboardAutorip = addNewCheckbox("Autorip from Clipboard", "clipboard.autorip", false); configClipboardAutorip = addNewCheckbox(rb.getString("autorip.from.clipboard"), "clipboard.autorip", false);
configSaveDescriptions = addNewCheckbox("Save descriptions", "descriptions.save", true); configSaveDescriptions = addNewCheckbox(rb.getString("save.descriptions"), "descriptions.save", true);
configPreferMp4 = addNewCheckbox("Prefer MP4 over GIF","prefer.mp4", false); configPreferMp4 = addNewCheckbox(rb.getString("prefer.mp4.over.gif"),"prefer.mp4", false);
configWindowPosition = addNewCheckbox("Restore window position", "window.position", true); configWindowPosition = addNewCheckbox(rb.getString("restore.window.position"), "window.position", true);
configURLHistoryCheckbox = addNewCheckbox("Remember URL history", "remember.url_history", true); configURLHistoryCheckbox = addNewCheckbox(rb.getString("remember.url.history"), "remember.url_history", true);
configLogLevelCombobox = new JComboBox(new String[] {"Log level: Error", "Log level: Warn", "Log level: Info", "Log level: Debug"}); configLogLevelCombobox = new JComboBox(new String[] {"Log level: Error", "Log level: Warn", "Log level: Info", "Log level: Debug"});
configLogLevelCombobox.setSelectedItem(Utils.getConfigString("log.level", "Log level: Debug")); configLogLevelCombobox.setSelectedItem(Utils.getConfigString("log.level", "Log level: Debug"));
@ -966,7 +966,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
HISTORY.clear(); HISTORY.clear();
if (historyFile.exists()) { if (historyFile.exists()) {
try { try {
logger.info("Loading history from " + historyFile.getCanonicalPath()); logger.info(rb.getString("loading.history.from") + " " + historyFile.getCanonicalPath());
HISTORY.fromFile(historyFile.getCanonicalPath()); HISTORY.fromFile(historyFile.getCanonicalPath());
} catch (IOException e) { } catch (IOException e) {
logger.error("Failed to load history from file " + historyFile, e); logger.error("Failed to load history from file " + historyFile, e);
@ -979,7 +979,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} }
} else { } else {
logger.info("Loading history from configuration"); logger.info(rb.getString("loading.history.from.configuration"));
HISTORY.fromList(Utils.getConfigList("download.history")); HISTORY.fromList(Utils.getConfigList("download.history"));
if (HISTORY.toList().size() == 0) { if (HISTORY.toList().size() == 0) {
// Loaded from config, still no entries. // Loaded from config, still no entries.
@ -1035,7 +1035,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
try { try {
Thread.sleep(500); Thread.sleep(500);
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
logger.error("Interrupted while waiting to rip next album", ie); logger.error(rb.getString("interrupted.while.waiting.to.rip.next.album"), ie);
} }
ripNextAlbum(); ripNextAlbum();
} else { } else {