mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-02 07:34:38 +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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.tonikelope</groupId>
|
<groupId>com.tonikelope</groupId>
|
||||||
<artifactId>MegaBasterd</artifactId>
|
<artifactId>MegaBasterd</artifactId>
|
||||||
<version>7.49</version>
|
<version>7.50</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -100,6 +100,11 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
|||||||
private volatile boolean _finalizing;
|
private volatile boolean _finalizing;
|
||||||
private final Object _progress_watchdog_lock;
|
private final Object _progress_watchdog_lock;
|
||||||
private final boolean _priority;
|
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() {
|
public String getStatus_error() {
|
||||||
return _status_error;
|
return _status_error;
|
||||||
@ -204,7 +209,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCanceled() {
|
public boolean isCanceled() {
|
||||||
return _canceled;
|
return (_canceled && !global_cancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTurbo() {
|
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 {
|
try {
|
||||||
deleteDownload(_url);
|
deleteDownload(_url);
|
||||||
@ -936,11 +941,11 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
|||||||
MiscTools.GUIRun(() -> {
|
MiscTools.GUIRun(() -> {
|
||||||
getView().getClose_button().setVisible(true);
|
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);
|
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")));
|
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;
|
_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) {
|
synchronized (_progress_watchdog_lock) {
|
||||||
_progress_watchdog_lock.notifyAll();
|
_progress_watchdog_lock.notifyAll();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ public class DownloadManager extends TransferenceManager {
|
|||||||
@Override
|
@Override
|
||||||
public void closeAllFinished() {
|
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);
|
_transference_finished_queue.remove(t);
|
||||||
return t;
|
return t;
|
||||||
}).forEachOrdered((t) -> {
|
}).forEachOrdered((t) -> {
|
||||||
|
@ -38,8 +38,6 @@ import java.util.Arrays;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import static java.util.concurrent.Executors.newCachedThreadPool;
|
import static java.util.concurrent.Executors.newCachedThreadPool;
|
||||||
@ -60,7 +58,7 @@ import javax.swing.UIManager;
|
|||||||
*/
|
*/
|
||||||
public final class MainPanel {
|
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 boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
|
||||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||||
public static final int DEFAULT_BYTE_BUFFER_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((_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 {
|
try {
|
||||||
_streamserver = new KissVideoStreamServer(this);
|
_streamserver = new KissVideoStreamServer(this);
|
||||||
_streamserver.start(STREAMER_PORT, "/video");
|
_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"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="clean_all_up_menuActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</MenuItem>
|
</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 class="javax.swing.JPopupMenu$Separator" name="jSeparator2">
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="hide_tray_menu">
|
<MenuItem class="javax.swing.JMenuItem" name="hide_tray_menu">
|
||||||
|
@ -530,6 +530,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
jSeparator4 = new javax.swing.JPopupMenu.Separator();
|
jSeparator4 = new javax.swing.JPopupMenu.Separator();
|
||||||
clean_all_down_menu = new javax.swing.JMenuItem();
|
clean_all_down_menu = new javax.swing.JMenuItem();
|
||||||
clean_all_up_menu = new javax.swing.JMenuItem();
|
clean_all_up_menu = new javax.swing.JMenuItem();
|
||||||
|
jMenuItem1 = new javax.swing.JMenuItem();
|
||||||
jSeparator2 = new javax.swing.JPopupMenu.Separator();
|
jSeparator2 = new javax.swing.JPopupMenu.Separator();
|
||||||
hide_tray_menu = new javax.swing.JMenuItem();
|
hide_tray_menu = new javax.swing.JMenuItem();
|
||||||
auto_close_menu = new javax.swing.JCheckBoxMenuItem();
|
auto_close_menu = new javax.swing.JCheckBoxMenuItem();
|
||||||
@ -805,6 +806,16 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
file_menu.add(clean_all_up_menu);
|
file_menu.add(clean_all_up_menu);
|
||||||
|
|
||||||
|
jMenuItem1.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
|
||||||
|
jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/icons8-minus-30.png"))); // NOI18N
|
||||||
|
jMenuItem1.setText("CANCEL ALL DOWNLOADS");
|
||||||
|
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
jMenuItem1ActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
file_menu.add(jMenuItem1);
|
||||||
file_menu.add(jSeparator2);
|
file_menu.add(jSeparator2);
|
||||||
|
|
||||||
hide_tray_menu.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
|
hide_tray_menu.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
|
||||||
@ -1445,6 +1456,24 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
JOptionPane.showMessageDialog(this, LabelTranslatorSingleton.getInstance().translate("ALL COPIED!"));
|
JOptionPane.showMessageDialog(this, LabelTranslatorSingleton.getInstance().translate("ALL COPIED!"));
|
||||||
}//GEN-LAST:event_jButton1ActionPerformed
|
}//GEN-LAST:event_jButton1ActionPerformed
|
||||||
|
|
||||||
|
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
|
||||||
|
// TODO add your handling code here:
|
||||||
|
Object[] options = {"No",
|
||||||
|
LabelTranslatorSingleton.getInstance().translate("Yes")};
|
||||||
|
|
||||||
|
int n = showOptionDialog(_main_panel.getView(),
|
||||||
|
LabelTranslatorSingleton.getInstance().translate("CANCEL ALL DOWNLOADS?"),
|
||||||
|
LabelTranslatorSingleton.getInstance().translate("Warning!"), YES_NO_CANCEL_OPTION, QUESTION_MESSAGE,
|
||||||
|
null,
|
||||||
|
options,
|
||||||
|
options[0]);
|
||||||
|
|
||||||
|
if (n == 1) {
|
||||||
|
_main_panel.getDownload_manager().closeAllPreProWaiting();
|
||||||
|
_main_panel.getDownload_manager().cancelAllTransferences();
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_jMenuItem1ActionPerformed
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JMenuItem about_menu;
|
private javax.swing.JMenuItem about_menu;
|
||||||
private javax.swing.JCheckBoxMenuItem auto_close_menu;
|
private javax.swing.JCheckBoxMenuItem auto_close_menu;
|
||||||
@ -1462,6 +1491,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
private javax.swing.JMenu help_menu;
|
private javax.swing.JMenu help_menu;
|
||||||
private javax.swing.JMenuItem hide_tray_menu;
|
private javax.swing.JMenuItem hide_tray_menu;
|
||||||
private javax.swing.JButton jButton1;
|
private javax.swing.JButton jButton1;
|
||||||
|
private javax.swing.JMenuItem jMenuItem1;
|
||||||
private javax.swing.JPanel jPanel_scroll_down;
|
private javax.swing.JPanel jPanel_scroll_down;
|
||||||
private javax.swing.JPanel jPanel_scroll_up;
|
private javax.swing.JPanel jPanel_scroll_up;
|
||||||
private javax.swing.JScrollPane jScrollPane_down;
|
private javax.swing.JScrollPane jScrollPane_down;
|
||||||
|
@ -267,7 +267,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
|||||||
|
|
||||||
public void closeAllFinished() {
|
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);
|
_transference_finished_queue.remove(t);
|
||||||
return t;
|
return t;
|
||||||
}).forEachOrdered((t) -> {
|
}).forEachOrdered((t) -> {
|
||||||
@ -305,6 +305,33 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
|||||||
secureNotify();
|
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) {
|
public void topWaitQueue(Transference t) {
|
||||||
|
|
||||||
synchronized (getWait_queue_lock()) {
|
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());
|
_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"));
|
_close_all_button.setText(LabelTranslatorSingleton.getInstance().translate("Clear finished"));
|
||||||
|
|
||||||
|
@ -1088,6 +1088,10 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
|||||||
|
|
||||||
_exit = true;
|
_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) {
|
synchronized (_progress_watchdog_lock) {
|
||||||
_progress_watchdog_lock.notifyAll();
|
_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