Now uses translation for more strings

This commit is contained in:
cyian-1756 2018-05-12 03:00:25 -04:00
parent dc9f7ea33e
commit 4a160deaa5

View File

@ -138,6 +138,15 @@ public final class MainWindow implements Runnable, RipStatusHandler {
private ResourceBundle rb = Utils.getResourceBundle(); private ResourceBundle rb = Utils.getResourceBundle();
private void updateQueueLabel() {
if (queueListModel.size() > 0) {
optionQueue.setText( rb.getString("Queue") + " (" + queueListModel.size() + ")");
} else {
optionQueue.setText(rb.getString("Queue"));
}
}
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());
@ -307,10 +316,10 @@ public final class MainWindow implements Runnable, RipStatusHandler {
JPanel optionsPanel = new JPanel(new GridBagLayout()); JPanel optionsPanel = new JPanel(new GridBagLayout());
optionsPanel.setBorder(emptyBorder); optionsPanel.setBorder(emptyBorder);
optionLog = new JButton("Log"); optionLog = new JButton(rb.getString("Log"));
optionHistory = new JButton("History"); optionHistory = new JButton(rb.getString("History"));
optionQueue = new JButton("Queue"); optionQueue = new JButton(rb.getString("Queue"));
optionConfiguration = new JButton("Configuration"); optionConfiguration = new JButton(rb.getString("Configuration"));
optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionQueue.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionQueue.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
@ -440,11 +449,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
for (String item : Utils.getConfigList("queue")) { for (String item : Utils.getConfigList("queue")) {
queueListModel.addElement(item); queueListModel.addElement(item);
} }
if (queueListModel.size() > 0) { updateQueueLabel();
optionQueue.setText("Queue (" + queueListModel.size() + ")");
} else {
optionQueue.setText("Queue");
}
gbc.gridx = 0; gbc.gridx = 0;
JPanel queueListPanel = new JPanel(new GridBagLayout()); JPanel queueListPanel = new JPanel(new GridBagLayout());
gbc.fill = GridBagConstraints.BOTH; gbc.fill = GridBagConstraints.BOTH;
@ -785,11 +790,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
queueListModel.addListDataListener(new ListDataListener() { queueListModel.addListDataListener(new ListDataListener() {
@Override @Override
public void intervalAdded(ListDataEvent arg0) { public void intervalAdded(ListDataEvent arg0) {
if (queueListModel.size() > 0) { updateQueueLabel();
optionQueue.setText("Queue (" + queueListModel.size() + ")");
} else {
optionQueue.setText("Queue");
}
if (!isRipping) { if (!isRipping) {
ripNextAlbum(); ripNextAlbum();
} }
@ -1025,11 +1026,7 @@ public final class MainWindow implements Runnable, RipStatusHandler {
return; return;
} }
String nextAlbum = (String) queueListModel.remove(0); String nextAlbum = (String) queueListModel.remove(0);
if (queueListModel.isEmpty()) { updateQueueLabel();
optionQueue.setText("Queue");
} else {
optionQueue.setText("Queue (" + queueListModel.size() + ")");
}
Thread t = ripAlbum(nextAlbum); Thread t = ripAlbum(nextAlbum);
if (t == null) { if (t == null) {
try { try {