Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stop button works! (By looks of it anyway)

  • Loading branch information...
commit c9652ae8b6243d62a2dda986ceeb8efe2a7b71e9 1 parent 897805a
Acerbic authored
View
10 src/dloader/GUI.java
@@ -209,7 +209,9 @@ public void actionPerformed(ActionEvent e) {
sl_panel.putConstraint(SpringLayout.EAST, btnStop, -10, SpringLayout.EAST, panel);
btnStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
- btnStop.setVisible(false);
+ if (theWorker != null) {
+ theWorker.stopJobsForPage(rootPage);
+ }
}
});
panel.add(btnStop);
@@ -342,7 +344,7 @@ else if (!p.getParent().childPages.contains(p))
// usually unfolding happens only after job is finished (for performance), but in
// case of new page downloads it is visually more pleasing to see what is going on asap
- if (message.equals("download finished") && parentNode.page.equals(pathToPage.getFirst()))
+ if (parentNode.page.equals(pathToPage.getFirst()))
unfoldFirst();
// pass message to the user object and refresh its visual if needed
@@ -355,6 +357,8 @@ private void disableButtons() {
btnUpdate.setEnabled(false);
textFieldURL.setEnabled(false);
textFieldDirectory.setEnabled(false);
+
+ btnStop.setEnabled(true);
}
private void enableButtons() {
@@ -363,6 +367,8 @@ private void enableButtons() {
btnUpdate.setEnabled(true);
textFieldURL.setEnabled(true);
textFieldDirectory.setEnabled(true);
+
+ btnStop.setEnabled(false);
}
private void reInit() {
View
6 src/dloader/gui/TreeNodePageWrapper.java
@@ -244,8 +244,10 @@ public void kidChanged(TreeNodePageWrapper kidWrapper, String message, long valu
public void updateSavingReqBunch(
HashMap<AbstractPage, Long> savingReqJobResults) {
-
- mustSavePage = savingReqJobResults.get(page) == 0;
+// if (savingReqJobResults == null) return;
+ Long value = savingReqJobResults.get(page);
+ if (value != null)
+ mustSavePage = value == 0;
kidsToSave = 0;
for (@SuppressWarnings("unchecked")
View
1  src/dloader/page/Track.java
@@ -326,6 +326,7 @@ public boolean isSavingNotRequired() {
// return true;
try {
Path p = Paths.get(getTrackFileName());
+
if ( ! (Files.isRegularFile(p) && Files.size(p) > 0))
return false;
View
4 src/dloader/pagejob/CheckSavingJob.java
@@ -19,14 +19,14 @@ public CheckSavingJob(AbstractPage page, JobMaster owner, boolean recurse) {
/**
* Summary of the messages reported by CheckSavingJob:
* "saving not required", 1
- * "saving required", 1
+ * "saving required", 0
*/
@Override
public void run() {
if (page.isSavingNotRequired())
report("saving not required", 1);
else
- report("saving required", 1);
+ report("saving required", 0);
if (recurse)
//note: this iterator does not require locking because of CopyOnWriteArrayList implementation
Please sign in to comment.
Something went wrong with that request. Please try again.