1.0.63 - Hopefully fixing dead-lock issue while re-ripping all for #22

This commit is contained in:
4pr0n 2014-06-12 20:41:45 -07:00
parent 2307dc454a
commit 15142dd898
3 changed files with 24 additions and 15 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.rarchives.ripme</groupId> <groupId>com.rarchives.ripme</groupId>
<artifactId>ripme</artifactId> <artifactId>ripme</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0.62</version> <version>1.0.63</version>
<name>ripme</name> <name>ripme</name>
<url>http://rip.rarchives.com</url> <url>http://rip.rarchives.com</url>
<properties> <properties>

View File

@ -160,7 +160,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
} }
public void run() { public void run() {
mainFrame.pack(); pack();
mainFrame.setLocationRelativeTo(null); mainFrame.setLocationRelativeTo(null);
mainFrame.setVisible(true); mainFrame.setVisible(true);
} }
@ -191,8 +191,17 @@ public class MainWindow implements Runnable, RipStatusHandler {
private void statusWithColor(String text, Color color) { private void statusWithColor(String text, Color color) {
statusLabel.setForeground(color); statusLabel.setForeground(color);
statusLabel.setText(text); statusLabel.setText(text);
pack();
}
private void pack() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
mainFrame.pack(); mainFrame.pack();
} }
});
}
private void createUI(Container pane) { private void createUI(Container pane) {
setupTrayIcon(); setupTrayIcon();
@ -405,7 +414,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
ripTextfield.setEnabled(true); ripTextfield.setEnabled(true);
statusProgress.setValue(0); statusProgress.setValue(0);
statusProgress.setVisible(false); statusProgress.setVisible(false);
mainFrame.pack(); pack();
statusProgress.setValue(0); statusProgress.setValue(0);
status("Ripping interrupted"); status("Ripping interrupted");
appendLog("Ripper interrupted", Color.RED); appendLog("Ripper interrupted", Color.RED);
@ -421,7 +430,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
optionLog.setFont(optionLog.getFont().deriveFont(Font.BOLD)); optionLog.setFont(optionLog.getFont().deriveFont(Font.BOLD));
optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionHistory.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
mainFrame.pack(); pack();
} }
}); });
optionHistory.addActionListener(new ActionListener() { optionHistory.addActionListener(new ActionListener() {
@ -433,7 +442,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionLog.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
optionHistory.setFont(optionLog.getFont().deriveFont(Font.BOLD)); optionHistory.setFont(optionLog.getFont().deriveFont(Font.BOLD));
optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN)); optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.PLAIN));
mainFrame.pack(); pack();
} }
}); });
optionConfiguration.addActionListener(new ActionListener() { optionConfiguration.addActionListener(new ActionListener() {
@ -445,7 +454,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
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));
optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.BOLD)); optionConfiguration.setFont(optionLog.getFont().deriveFont(Font.BOLD));
mainFrame.pack(); pack();
} }
}); });
historyButtonRemove.addActionListener(new ActionListener() { historyButtonRemove.addActionListener(new ActionListener() {
@ -732,9 +741,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
statusProgress.setValue(100); statusProgress.setValue(100);
openButton.setVisible(false); openButton.setVisible(false);
statusLabel.setVisible(true); statusLabel.setVisible(true);
synchronized (this) { pack();
mainFrame.pack();
}
boolean failed = false; boolean failed = false;
try { try {
ripper = AbstractRipper.getRipper(url); ripper = AbstractRipper.getRipper(url);
@ -746,7 +753,9 @@ public class MainWindow implements Runnable, RipStatusHandler {
} }
if (!failed) { if (!failed) {
try { try {
synchronized (this) {
ripTextfield.setText(ripper.getURL().toExternalForm()); ripTextfield.setText(ripper.getURL().toExternalForm());
}
status("Starting rip..."); status("Starting rip...");
ripper.setObserver((RipStatusHandler) this); ripper.setObserver((RipStatusHandler) this);
Thread t = new Thread(ripper); Thread t = new Thread(ripper);
@ -768,7 +777,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
stopButton.setVisible(false); stopButton.setVisible(false);
ripTextfield.setEnabled(true); ripTextfield.setEnabled(true);
statusProgress.setValue(0); statusProgress.setValue(0);
mainFrame.pack(); pack();
return null; return null;
} }
@ -826,7 +835,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
statusProgress.setValue(0); statusProgress.setValue(0);
statusProgress.setVisible(false); statusProgress.setVisible(false);
openButton.setVisible(false); openButton.setVisible(false);
mainFrame.pack(); pack();
statusWithColor("Error: " + (String) msg.getObject(), Color.RED); statusWithColor("Error: " + (String) msg.getObject(), Color.RED);
break; break;
@ -863,7 +872,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
} }
} }
}); });
mainFrame.pack(); pack();
break; break;
case COMPLETED_BYTES: case COMPLETED_BYTES:
// Update completed bytes // Update completed bytes

View File

@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils;
public class UpdateUtils { public class UpdateUtils {
private static final Logger logger = Logger.getLogger(UpdateUtils.class); private static final Logger logger = Logger.getLogger(UpdateUtils.class);
private static final String DEFAULT_VERSION = "1.0.62"; private static final String DEFAULT_VERSION = "1.0.63";
private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJsonURL = "http://rarchives.com/ripme.json";
private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String updateJarURL = "http://rarchives.com/ripme.jar";
private static final String mainFileName = "ripme.jar"; private static final String mainFileName = "ripme.jar";