mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-04-29 22:24:32 +02:00
7.50
Trying to MITIGATE: https://github.com/tonikelope/megabasterd/issues/394 https://github.com/tonikelope/megabasterd/issues/391 (NEW CANCEL ALL DOWNLOADS MENU ITEM)
This commit is contained in:
parent
e35f87f549
commit
07d8ed7815
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>7.49</version>
|
||||
<version>7.50</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -100,6 +100,11 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
private volatile boolean _finalizing;
|
||||
private final Object _progress_watchdog_lock;
|
||||
private final boolean _priority;
|
||||
private volatile boolean global_cancel = false;
|
||||
|
||||
public void setGlobal_cancel(boolean global_cancel) {
|
||||
this.global_cancel = global_cancel;
|
||||
}
|
||||
|
||||
public String getStatus_error() {
|
||||
return _status_error;
|
||||
@ -204,7 +209,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
}
|
||||
|
||||
public boolean isCanceled() {
|
||||
return _canceled;
|
||||
return (_canceled && !global_cancel);
|
||||
}
|
||||
|
||||
public boolean isTurbo() {
|
||||
@ -911,7 +916,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
}
|
||||
}
|
||||
|
||||
if (_status_error == null && !_canceled) {
|
||||
if ((_status_error == null && !_canceled) || global_cancel || !_auto_retry_on_error) {
|
||||
|
||||
try {
|
||||
deleteDownload(_url);
|
||||
@ -936,11 +941,11 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getClose_button().setVisible(true);
|
||||
|
||||
if ((_status_error != null || _canceled) && isProvision_ok()) {
|
||||
if ((_status_error != null || _canceled) && isProvision_ok() && !global_cancel) {
|
||||
|
||||
getView().getRestart_button().setVisible(true);
|
||||
|
||||
} else {
|
||||
} else if (!global_cancel) {
|
||||
|
||||
getView().getClose_button().setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-ok-30.png")));
|
||||
}
|
||||
@ -968,6 +973,10 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
_exit = true;
|
||||
|
||||
if (_status_error != null && !_canceled && getMain_panel().getDownload_manager().no_transferences() && getMain_panel().getUpload_manager().no_transferences() && (!getMain_panel().getDownload_manager().getTransference_finished_queue().isEmpty() || !getMain_panel().getUpload_manager().getTransference_finished_queue().isEmpty()) && getMain_panel().getView().getAuto_close_menu().isSelected()) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
synchronized (_progress_watchdog_lock) {
|
||||
_progress_watchdog_lock.notifyAll();
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class DownloadManager extends TransferenceManager {
|
||||
@Override
|
||||
public void closeAllFinished() {
|
||||
|
||||
_transference_finished_queue.stream().filter((t) -> ((!t.isStatusError() || ((Download) t).getStatus_error().equals("FILE WITH SAME NAME AND SIZE ALREADY EXISTS")) && !t.isCanceled())).map((t) -> {
|
||||
_transference_finished_queue.stream().filter((t) -> (!t.isCanceled())).map((t) -> {
|
||||
_transference_finished_queue.remove(t);
|
||||
return t;
|
||||
}).forEachOrdered((t) -> {
|
||||
|
@ -38,8 +38,6 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import static java.util.concurrent.Executors.newCachedThreadPool;
|
||||
@ -60,7 +58,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "7.49";
|
||||
public static final String VERSION = "7.50";
|
||||
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
|
||||
@ -302,43 +300,6 @@ public final class MainPanel {
|
||||
|
||||
THREAD_POOL.execute((_clipboardspy = new ClipboardSpy()));
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
Object timer_lock = new Object();
|
||||
|
||||
Timer timer = new Timer();
|
||||
|
||||
TimerTask task = new TimerTask() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (timer_lock) {
|
||||
|
||||
timer_lock.notify();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
timer.schedule(task, 0, 5000);
|
||||
|
||||
while (true) {
|
||||
|
||||
synchronized (timer_lock) {
|
||||
|
||||
try {
|
||||
|
||||
if (_download_manager.no_transferences() && _upload_manager.no_transferences() && (!_download_manager.getTransference_finished_queue().isEmpty() || !_upload_manager.getTransference_finished_queue().isEmpty()) && getView().getAuto_close_menu().isSelected()) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
timer_lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
LOG.log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
_streamserver = new KissVideoStreamServer(this);
|
||||
_streamserver.start(STREAMER_PORT, "/video");
|
||||
|
@ -115,6 +115,20 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="clean_all_up_menuActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem1">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="18" style="0"/>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/images/icons8-minus-30.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="CANCEL ALL DOWNLOADS"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem1ActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator2">
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="hide_tray_menu">
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -267,7 +267,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
public void closeAllFinished() {
|
||||
|
||||
_transference_finished_queue.stream().filter((t) -> (!t.isStatusError() && !t.isCanceled())).map((t) -> {
|
||||
_transference_finished_queue.stream().filter((t) -> !t.isCanceled()).map((t) -> {
|
||||
_transference_finished_queue.remove(t);
|
||||
return t;
|
||||
}).forEachOrdered((t) -> {
|
||||
@ -305,6 +305,33 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
secureNotify();
|
||||
}
|
||||
|
||||
public void cancelAllTransferences() {
|
||||
_transference_preprocess_queue.clear();
|
||||
|
||||
_transference_preprocess_global_queue.clear();
|
||||
|
||||
_transference_provision_queue.clear();
|
||||
|
||||
_transference_remove_queue.addAll(new ArrayList(getTransference_waitstart_queue()));
|
||||
|
||||
getTransference_waitstart_queue().clear();
|
||||
|
||||
for (Transference t : this.getTransference_running_list()) {
|
||||
|
||||
if (t instanceof Download) {
|
||||
((Download) t).setGlobal_cancel(true);
|
||||
}
|
||||
|
||||
t.stop();
|
||||
}
|
||||
|
||||
synchronized (getWait_queue_lock()) {
|
||||
getWait_queue_lock().notifyAll();
|
||||
}
|
||||
|
||||
secureNotify();
|
||||
}
|
||||
|
||||
public void topWaitQueue(Transference t) {
|
||||
|
||||
synchronized (getWait_queue_lock()) {
|
||||
@ -613,7 +640,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
_clean_all_menu.getComponent().setEnabled(!_transference_preprocess_queue.isEmpty() || !_transference_provision_queue.isEmpty() || !getTransference_waitstart_queue().isEmpty());
|
||||
|
||||
if (!_transference_finished_queue.isEmpty() && _isOKFinishedInQueue()) {
|
||||
if (!_transference_finished_queue.isEmpty()) {
|
||||
|
||||
_close_all_button.setText(LabelTranslatorSingleton.getInstance().translate("Clear finished"));
|
||||
|
||||
|
@ -1088,6 +1088,10 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
_exit = true;
|
||||
|
||||
if (_status_error != null && !_canceled && getMain_panel().getDownload_manager().no_transferences() && getMain_panel().getUpload_manager().no_transferences() && (!getMain_panel().getDownload_manager().getTransference_finished_queue().isEmpty() || !getMain_panel().getUpload_manager().getTransference_finished_queue().isEmpty()) && getMain_panel().getView().getAuto_close_menu().isSelected()) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
synchronized (_progress_watchdog_lock) {
|
||||
_progress_watchdog_lock.notifyAll();
|
||||
}
|
||||
|
BIN
src/main/resources/images/pica_roja_big.png_chat
Normal file
BIN
src/main/resources/images/pica_roja_big.png_chat
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Loading…
x
Reference in New Issue
Block a user