mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-01 15:14:29 +02:00
7.29
-swinginvoke in constructors -> less RC -DL CHUNK SIZE 20MB -> Increased average download speed -SmartProxy bad proxy block time 120 sec -> 90 sec -Default font noto -Default zoom 80% Let's dance
This commit is contained in:
parent
0f6eb9b3c9
commit
cef89f77b8
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.tonikelope</groupId>
|
||||
<artifactId>MegaBasterd</artifactId>
|
||||
<version>7.28</version>
|
||||
<version>7.29</version>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -25,6 +25,7 @@ public class AboutDialog extends javax.swing.JDialog {
|
||||
|
||||
super(parent, modal);
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, parent.getMain_panel().getZoom_factor());
|
||||
@ -36,6 +37,7 @@ public class AboutDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
pack();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -255,7 +257,7 @@ public class AboutDialog extends javax.swing.JDialog {
|
||||
THREAD_POOL.execute(() -> {
|
||||
final String new_version = checkNewVersion(MEGABASTERD_URL);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
if (new_version != null) {
|
||||
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("MegaBasterd NEW VERSION is available! -> ") + new_version);
|
||||
|
@ -49,7 +49,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
public static final boolean USE_SLOTS_DEFAULT = true;
|
||||
public static final int WORKERS_DEFAULT = 6;
|
||||
public static final boolean USE_MEGA_ACCOUNT_DOWN = false;
|
||||
public static final int CHUNK_SIZE_MULTI = 10;
|
||||
public static final int CHUNK_SIZE_MULTI = 20;
|
||||
private static final Logger LOG = Logger.getLogger(Download.class.getName());
|
||||
|
||||
private final MainPanel _main_panel;
|
||||
@ -241,7 +241,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
if (!_finalizing) {
|
||||
Download tthis = this;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
|
||||
getView().getSpeed_label().setForeground(new Color(255, 102, 0));
|
||||
|
||||
@ -260,7 +260,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getSlots_spinner().setValue(Transference.MAX_WORKERS);
|
||||
|
||||
getView().getSlots_spinner().setEnabled(true);
|
||||
@ -528,7 +528,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getQueue_down_button().setVisible(false);
|
||||
getView().getQueue_up_button().setVisible(false);
|
||||
getView().getQueue_top_button().setVisible(false);
|
||||
@ -622,7 +622,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
_thread_pool.execute(c);
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
for (JComponent c : new JComponent[]{getView().getSlots_label(), getView().getSlots_spinner(), getView().getSlot_status_label()}) {
|
||||
|
||||
c.setVisible(true);
|
||||
@ -637,7 +637,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
_thread_pool.execute(c);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
for (JComponent c1 : new JComponent[]{getView().getSlots_label(), getView().getSlots_spinner(), getView().getSlot_status_label()}) {
|
||||
c1.setVisible(false);
|
||||
}
|
||||
@ -647,7 +647,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusNormal(LabelTranslatorSingleton.getInstance().translate("Downloading file from mega ") + (_ma.getFull_email() != null ? "(" + _ma.getFull_email() + ")" : "") + " ...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
for (JComponent c : new JComponent[]{getView().getPause_button(), getView().getProgress_pbar()}) {
|
||||
|
||||
c.setVisible(true);
|
||||
@ -721,7 +721,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
_output_stream.close();
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
for (JComponent c : new JComponent[]{getView().getSpeed_label(), getView().getPause_button(), getView().getStop_button(), getView().getSlots_label(), getView().getSlots_spinner(), getView().getKeep_temp_checkbox()}) {
|
||||
|
||||
c.setVisible(false);
|
||||
@ -759,7 +759,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusNormal("Checking file integrity, please wait...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStop_button().setVisible(true);
|
||||
|
||||
getView().getStop_button().setText(LabelTranslatorSingleton.getInstance().translate("CANCEL CHECK"));
|
||||
@ -785,7 +785,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStop_button().setVisible(false);
|
||||
});
|
||||
|
||||
@ -909,7 +909,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getMain_panel().getDownload_manager().getTransference_finished_queue().add(this);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getMain_panel().getDownload_manager().getScroll_panel().remove(getView());
|
||||
|
||||
getMain_panel().getDownload_manager().getScroll_panel().add(getView());
|
||||
@ -917,7 +917,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getMain_panel().getDownload_manager().secureNotify();
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getClose_button().setVisible(true);
|
||||
|
||||
if ((_status_error != null || _canceled) && isProvision_ok()) {
|
||||
@ -934,7 +934,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
THREAD_POOL.execute(() -> {
|
||||
for (int i = 3; !_closed && i > 0; i--) {
|
||||
final int j = i;
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getRestart_button().setText("Restart (" + String.valueOf(j) + " secs...)");
|
||||
});
|
||||
try {
|
||||
@ -963,7 +963,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusNormal("Provisioning download, please wait...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getCopy_link_button().setVisible(true);
|
||||
getView().getOpen_folder_button().setVisible(true);
|
||||
});
|
||||
@ -1039,7 +1039,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
}
|
||||
|
||||
if (_file_name != null) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getFile_name_label().setVisible(true);
|
||||
|
||||
getView().getFile_name_label().setText(truncateText(_download_path + "/" + _file_name, 100));
|
||||
@ -1056,7 +1056,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusError(_status_error);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getClose_button().setVisible(true);
|
||||
});
|
||||
|
||||
@ -1066,7 +1066,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusNormal(_frozen ? "(FROZEN) Waiting to start..." : "Waiting to start...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getFile_name_label().setVisible(true);
|
||||
|
||||
getView().getFile_name_label().setText(truncateText(_download_path + "/" + _file_name, 100));
|
||||
@ -1078,7 +1078,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
getView().getFile_size_label().setText(formatBytes(_file_size));
|
||||
});
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getClose_button().setVisible(true);
|
||||
getView().getQueue_up_button().setVisible(true);
|
||||
getView().getQueue_down_button().setVisible(true);
|
||||
@ -1098,7 +1098,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusNormal("Download paused!");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME DOWNLOAD"));
|
||||
getView().getPause_button().setEnabled(true);
|
||||
});
|
||||
@ -1111,7 +1111,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusNormal("Download paused!");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME DOWNLOAD"));
|
||||
getView().getPause_button().setEnabled(true);
|
||||
});
|
||||
@ -1204,7 +1204,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
if (!_chunkworkers.isEmpty()) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getSlots_spinner().setEnabled(false);
|
||||
});
|
||||
|
||||
@ -1246,14 +1246,14 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
_finalizing = true;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getSlots_spinner().setEnabled(false);
|
||||
|
||||
getView().getSlots_spinner().setValue((int) getView().getSlots_spinner().getValue() - 1);
|
||||
});
|
||||
|
||||
} else if (!_finalizing) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getSlots_spinner().setEnabled(true);
|
||||
});
|
||||
}
|
||||
@ -1265,7 +1265,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
getView().printStatusNormal("Download paused!");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME DOWNLOAD"));
|
||||
|
||||
getView().getPause_button().setEnabled(true);
|
||||
@ -1461,7 +1461,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
_retrying_request = true;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getMain_panel().getView().getNew_download_menu().setEnabled(true);
|
||||
|
||||
getView().getStop_button().setVisible(true);
|
||||
@ -1496,7 +1496,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
_auto_retry_on_error = true;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStop_button().setText(LabelTranslatorSingleton.getInstance().translate("CANCEL DOWNLOAD"));
|
||||
getView().getStop_button().setVisible(false);
|
||||
});
|
||||
@ -1542,7 +1542,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
_retrying_request = true;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStop_button().setVisible(true);
|
||||
|
||||
getView().getStop_button().setText(LabelTranslatorSingleton.getInstance().translate("CANCEL RETRY"));
|
||||
@ -1569,7 +1569,7 @@ public class Download implements Transference, Runnable, SecureSingleThreadNotif
|
||||
|
||||
_auto_retry_on_error = true;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStop_button().setText(LabelTranslatorSingleton.getInstance().translate("CANCEL DOWNLOAD"));
|
||||
getView().getStop_button().setVisible(false);
|
||||
});
|
||||
|
@ -2,7 +2,6 @@ package com.tonikelope.megabasterd;
|
||||
|
||||
import static com.tonikelope.megabasterd.DBTools.*;
|
||||
import static com.tonikelope.megabasterd.MainPanel.*;
|
||||
import static com.tonikelope.megabasterd.MiscTools.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
@ -29,7 +28,7 @@ public class DownloadManager extends TransferenceManager {
|
||||
|
||||
for (final Transference d : downloads) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove(((Download) d).getView());
|
||||
});
|
||||
|
||||
@ -66,7 +65,7 @@ public class DownloadManager extends TransferenceManager {
|
||||
|
||||
@Override
|
||||
public void provision(final Transference download) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().add(((Download) download).getView());
|
||||
});
|
||||
|
||||
|
@ -7,6 +7,7 @@ import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import static java.lang.Integer.MAX_VALUE;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JButton;
|
||||
@ -103,14 +104,18 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
public DownloadView(Download download) {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, download.getMain_panel().getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
DownloadView tthis = this;
|
||||
|
||||
_download = download;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(tthis, GUI_FONT, download.getMain_panel().getZoom_factor());
|
||||
|
||||
translateLabels(tthis);
|
||||
|
||||
slots_spinner.setModel(new SpinnerNumberModel(_download.getMain_panel().getDefault_slots_down(), Download.MIN_WORKERS, Download.MAX_WORKERS, 1));
|
||||
|
||||
((JSpinner.DefaultEditor) slots_spinner.getEditor()).getTextField().setEditable(false);
|
||||
@ -126,12 +131,13 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
c.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void hideAllExceptStatus() {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{speed_label, slots_spinner, slots_label, slot_status_label, slot_status_label, pause_button, stop_button, progress_pbar, keep_temp_checkbox}) {
|
||||
|
||||
c.setVisible(false);
|
||||
@ -463,7 +469,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_download.upWaitQueue();
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
queue_up_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -476,7 +482,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_download.downWaitQueue();
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
queue_down_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -489,7 +495,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_download.topWaitQueue();
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
queue_top_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -502,7 +508,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_download.bottomWaitQueue();
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
queue_bottom_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -513,7 +519,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
printStatusNormal("Pausing download ...");
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(false);
|
||||
@ -531,7 +537,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
printStatusNormal("Downloading file from mega ...");
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(true);
|
||||
@ -553,7 +559,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
printStatusNormal(status);
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, keep_temp_checkbox, stop_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(false);
|
||||
@ -565,7 +571,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void updateSpeed(final String speed, final Boolean visible) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
if (speed != null) {
|
||||
speed_label.setText(speed);
|
||||
}
|
||||
@ -579,14 +585,14 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void updateProgressBar(final long progress, final double bar_rate) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
progress_pbar.setValue((int) Math.floor(bar_rate * progress));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(final int value) {
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
progress_pbar.setValue(value);
|
||||
});
|
||||
}
|
||||
@ -594,7 +600,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void printStatusError(final String message) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
status_label.setForeground(Color.red);
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -603,7 +609,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void printStatusOK(final String message) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
status_label.setForeground(new Color(0, 170, 0));
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -612,7 +618,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
@Override
|
||||
public void printStatusNormal(final String message) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
status_label.setForeground(new Color(102, 102, 102));
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -630,7 +636,7 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
final String status = conta_error > 0 ? "(" + String.valueOf(conta_error) + ")" : "";
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
slot_status_label.setForeground(Color.RED);
|
||||
slot_status_label.setText(status);
|
||||
});
|
||||
@ -639,12 +645,26 @@ public class DownloadView extends javax.swing.JPanel implements TransferenceView
|
||||
|
||||
@Override
|
||||
public int getSlots() {
|
||||
return (int) swingInvokeAndWaitForReturn((Callable) getSlots_spinner()::getValue);
|
||||
try {
|
||||
return (int) (MiscTools.futureRun((Callable) getSlots_spinner()::getValue).get());
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(DownloadView.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (ExecutionException ex) {
|
||||
Logger.getLogger(DownloadView.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean isKeepTempFileSelected() {
|
||||
|
||||
return (boolean) swingInvokeAndWaitForReturn((Callable) getKeep_temp_checkbox()::isSelected);
|
||||
try {
|
||||
return (boolean) (MiscTools.futureRun((Callable) getKeep_temp_checkbox()::isSelected).get());
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(DownloadView.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (ExecutionException ex) {
|
||||
Logger.getLogger(DownloadView.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
@ -17,6 +17,8 @@ import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JCheckBox;
|
||||
@ -88,6 +90,15 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
_quota_ok = false;
|
||||
|
||||
_total_space = 0L;
|
||||
_base_path = null;
|
||||
_upload = false;
|
||||
_inserting_mega_accounts = false;
|
||||
_remember_master_pass = true;
|
||||
_files = new ArrayList<>();
|
||||
_last_selected_index = -1;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
@ -153,25 +164,21 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
}
|
||||
);
|
||||
|
||||
_total_space = 0L;
|
||||
_base_path = null;
|
||||
_upload = false;
|
||||
_inserting_mega_accounts = false;
|
||||
_remember_master_pass = true;
|
||||
_files = new ArrayList<>();
|
||||
_last_selected_index = -1;
|
||||
|
||||
dir_name_textfield.addMouseListener(new ContextMenuMouseListener());
|
||||
|
||||
pack();
|
||||
|
||||
});
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
|
||||
if (_drag_drop_files != null) {
|
||||
|
||||
_file_drop_notify(_drag_drop_files);
|
||||
}
|
||||
|
||||
if (_main_panel.getMega_accounts().size() > 0) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
if (!_main_panel.getMega_active_accounts().isEmpty()) {
|
||||
_inserting_mega_accounts = true;
|
||||
|
||||
@ -200,7 +207,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
pack();
|
||||
});
|
||||
} else {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
used_space_label.setForeground(Color.red);
|
||||
used_space_label.setEnabled(true);
|
||||
used_space_label.setText(LabelTranslatorSingleton.getInstance().translate("No MEGA accounts available (Go to Settings > Accounts)"));
|
||||
@ -515,7 +522,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_genFileList();
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
add_files_button.setEnabled(true);
|
||||
|
||||
add_folder_button.setEnabled(true);
|
||||
@ -591,7 +598,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
if (filechooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION && filechooser.getSelectedFile().canRead()) {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
total_file_size_label.setText("[0 B]");
|
||||
|
||||
_base_path = filechooser.getSelectedFile().getAbsolutePath();
|
||||
@ -605,11 +612,11 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(filechooser.getSelectedFile().getAbsolutePath());
|
||||
_genFileTree(filechooser.getSelectedFile().getAbsolutePath(), root, null);
|
||||
DefaultTreeModel tree_model = new DefaultTreeModel(sortTree(root));
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
file_tree.setModel(tree_model);
|
||||
});
|
||||
_genFileList();
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
add_files_button.setEnabled(true);
|
||||
|
||||
add_folder_button.setEnabled(true);
|
||||
@ -717,7 +724,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
}
|
||||
final String quota_m = LabelTranslatorSingleton.getInstance().translate("Quota used: ") + formatBytes(quota[0]) + "/" + formatBytes(quota[1]);
|
||||
_quota_ok = true;
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
boolean root_childs = ((TreeNode) file_tree.getModel().getRoot()).getChildCount() > 0;
|
||||
|
||||
used_space_label.setText(quota_m);
|
||||
@ -735,7 +742,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
account_combobox.setEnabled(true);
|
||||
account_label.setEnabled(true);
|
||||
account_combobox.setSelectedIndex(-1);
|
||||
@ -759,7 +766,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
account_combobox.setEnabled(true);
|
||||
account_label.setEnabled(true);
|
||||
account_combobox.setSelectedIndex(-1);
|
||||
@ -863,11 +870,12 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
private void _genFileList() {
|
||||
|
||||
try {
|
||||
_files.clear();
|
||||
|
||||
_total_space = 0L;
|
||||
|
||||
DefaultTreeModel tree_model = (DefaultTreeModel) swingInvokeAndWaitForReturn((Callable) file_tree::getModel);
|
||||
DefaultTreeModel tree_model = (DefaultTreeModel) (MiscTools.futureRun((Callable) file_tree::getModel).get());
|
||||
|
||||
DefaultMutableTreeNode root = (DefaultMutableTreeNode) tree_model.getRoot();
|
||||
|
||||
@ -901,9 +909,14 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
total_file_size_label.setText("[" + formatBytes(_total_space) + "]");
|
||||
});
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(FileGrabberDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (ExecutionException ex) {
|
||||
Logger.getLogger(FileGrabberDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -931,7 +944,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
private void _file_drop_notify(List<File> files) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
add_files_button.setEnabled(false);
|
||||
add_folder_button.setEnabled(false);
|
||||
warning_label.setEnabled(false);
|
||||
@ -947,7 +960,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
_base_path = (files.size() == 1 && files.get(0).isDirectory()) ? files.get(0).getAbsolutePath() : files.get(0).getParentFile().getAbsolutePath();
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
dir_name_textfield.setText(((files.size() == 1 && files.get(0).isDirectory()) ? files.get(0).getName() : files.get(0).getParentFile().getName()) + "_" + genID(10));
|
||||
|
||||
dir_name_textfield.setEnabled(true);
|
||||
@ -957,7 +970,7 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(_base_path);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
dance_button.setText(LabelTranslatorSingleton.getInstance().translate("Loading files, please wait..."));
|
||||
});
|
||||
|
||||
@ -965,13 +978,13 @@ public class FileGrabberDialog extends javax.swing.JDialog {
|
||||
|
||||
DefaultTreeModel tree_model = new DefaultTreeModel(sortTree(root));
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
file_tree.setModel(tree_model);
|
||||
});
|
||||
|
||||
_genFileList();
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
dance_button.setText(LabelTranslatorSingleton.getInstance().translate("Let's dance, baby"));
|
||||
|
||||
if (_last_selected_index != -1 && _quota_ok) {
|
||||
|
@ -18,7 +18,6 @@ package com.tonikelope.megabasterd;
|
||||
|
||||
import static com.tonikelope.megabasterd.MainPanel.GUI_FONT;
|
||||
import static com.tonikelope.megabasterd.MainPanel.THREAD_POOL;
|
||||
import static com.tonikelope.megabasterd.MiscTools.swingInvoke;
|
||||
import static com.tonikelope.megabasterd.MiscTools.translateLabels;
|
||||
import static com.tonikelope.megabasterd.MiscTools.truncateText;
|
||||
import static com.tonikelope.megabasterd.MiscTools.updateFonts;
|
||||
@ -56,6 +55,8 @@ public class FileMergerDialog extends javax.swing.JDialog {
|
||||
public FileMergerDialog(MainPanelView parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
_main_panel = parent.getMain_panel();
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
initComponents();
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
translateLabels(this);
|
||||
@ -66,6 +67,7 @@ public class FileMergerDialog extends javax.swing.JDialog {
|
||||
jProgressBar2.setVisible(false);
|
||||
|
||||
pack();
|
||||
});
|
||||
}
|
||||
|
||||
private boolean _mergeFile() throws IOException {
|
||||
@ -82,7 +84,7 @@ public class FileMergerDialog extends javax.swing.JDialog {
|
||||
|
||||
_progress += rfile.length();
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
jProgressBar2.setValue((int) Math.floor((MAX_VALUE / (double) _file_size) * _progress));
|
||||
});
|
||||
}
|
||||
@ -359,7 +361,7 @@ public class FileMergerDialog extends javax.swing.JDialog {
|
||||
if (delete_parts_checkbox.isSelected()) {
|
||||
_deleteParts();
|
||||
}
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("File successfully merged!"));
|
||||
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
@ -376,7 +378,7 @@ public class FileMergerDialog extends javax.swing.JDialog {
|
||||
});
|
||||
} else {
|
||||
_file_parts.clear();
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
file_name_label.setText("");
|
||||
|
||||
file_size_label.setText("");
|
||||
|
@ -18,7 +18,6 @@ package com.tonikelope.megabasterd;
|
||||
|
||||
import static com.tonikelope.megabasterd.MainPanel.GUI_FONT;
|
||||
import static com.tonikelope.megabasterd.MainPanel.THREAD_POOL;
|
||||
import static com.tonikelope.megabasterd.MiscTools.swingInvoke;
|
||||
import static com.tonikelope.megabasterd.MiscTools.translateLabels;
|
||||
import static com.tonikelope.megabasterd.MiscTools.truncateText;
|
||||
import static com.tonikelope.megabasterd.MiscTools.updateFonts;
|
||||
@ -58,6 +57,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
super(parent, modal);
|
||||
_main_panel = parent.getMain_panel();
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
@ -84,6 +84,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
split_size_text.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
|
||||
|
||||
pack();
|
||||
});
|
||||
}
|
||||
|
||||
private boolean _splitFile() throws IOException {
|
||||
@ -101,8 +102,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
int position = 0;
|
||||
int conta_split = 1;
|
||||
|
||||
try (RandomAccessFile sourceFile = new RandomAccessFile(this._file.getAbsolutePath(), "r");
|
||||
FileChannel sourceChannel = sourceFile.getChannel()) {
|
||||
try (RandomAccessFile sourceFile = new RandomAccessFile(this._file.getAbsolutePath(), "r"); FileChannel sourceChannel = sourceFile.getChannel()) {
|
||||
|
||||
for (; position < numSplits; position++, conta_split++) {
|
||||
_writePartToFile(bytesPerSplit, position * bytesPerSplit, sourceChannel, conta_split, numSplits + (remainingBytes > 0 ? 1 : 0));
|
||||
@ -119,15 +119,14 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
private void _writePartToFile(long byteSize, long position, FileChannel sourceChannel, int conta_split, long num_splits) throws IOException {
|
||||
|
||||
Path fileName = Paths.get(this._output_dir.getAbsolutePath() + "/" + this._file.getName() + ".part" + String.valueOf(conta_split) + "-" + String.valueOf(num_splits));
|
||||
try (RandomAccessFile toFile = new RandomAccessFile(fileName.toFile(), "rw");
|
||||
FileChannel toChannel = toFile.getChannel()) {
|
||||
try (RandomAccessFile toFile = new RandomAccessFile(fileName.toFile(), "rw"); FileChannel toChannel = toFile.getChannel()) {
|
||||
sourceChannel.position(position);
|
||||
toChannel.transferFrom(sourceChannel, 0, byteSize);
|
||||
}
|
||||
|
||||
_progress += byteSize;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
jProgressBar2.setValue((int) Math.floor((MAX_VALUE / (double) _file.length()) * _progress));
|
||||
});
|
||||
|
||||
@ -370,7 +369,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
THREAD_POOL.execute(() -> {
|
||||
try {
|
||||
if (_splitFile()) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("File successfully splitted!"));
|
||||
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
@ -388,7 +387,7 @@ public class FileSplitterDialog extends javax.swing.JDialog {
|
||||
} else {
|
||||
_file = null;
|
||||
_output_dir = null;
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
file_name_label.setText("");
|
||||
|
||||
output_folder_label.setText("");
|
||||
|
@ -58,18 +58,20 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
||||
|
||||
super(parent, modal);
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, parent.getMain_panel().getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
_mega_error = 0;
|
||||
_total_space = 0L;
|
||||
_download = false;
|
||||
_download_links = new ArrayList<>();
|
||||
_link = link;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, parent.getMain_panel().getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
folder_link_label.setText(link);
|
||||
|
||||
restore_button.setVisible(false);
|
||||
@ -83,24 +85,34 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
||||
|
||||
_genDownloadLiks();
|
||||
|
||||
MiscTools.GUIRun(() -> {
|
||||
|
||||
dance_button.setText(LabelTranslatorSingleton.getInstance().translate("Let's dance, baby"));
|
||||
|
||||
pack();
|
||||
});
|
||||
|
||||
} else if (_mega_error == -18) {
|
||||
|
||||
MiscTools.GUIRun(() -> {
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("MEGA LINK TEMPORARILY UNAVAILABLE!"), "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
setVisible(false);
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
MiscTools.GUIRun(() -> {
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("MEGA LINK ERROR!"), "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
setVisible(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
pack();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -307,7 +319,7 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
||||
THREAD_POOL.execute(() -> {
|
||||
_loadMegaDirTree();
|
||||
_genDownloadLiks();
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
restore_button.setVisible(false);
|
||||
restore_button.setText(LabelTranslatorSingleton.getInstance().translate("Restore folder data"));
|
||||
boolean root_childs = ((TreeNode) file_tree.getModel().getRoot()).getChildCount() > 0;
|
||||
@ -324,7 +336,7 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
||||
private void _loadMegaDirTree() {
|
||||
|
||||
try {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
});
|
||||
|
||||
@ -404,7 +416,7 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
||||
|
||||
final MegaMutableTreeNode roott = root;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
ftree.setModel(new DefaultTreeModel(sortTree(roott)));
|
||||
|
||||
ftree.setRootVisible(roott != null ? roott.getChildCount() > 0 : false);
|
||||
@ -427,7 +439,7 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
||||
_mega_error = 1;
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
});
|
||||
|
||||
@ -435,7 +447,7 @@ public class FolderLinkDialog extends javax.swing.JDialog {
|
||||
|
||||
private void _genDownloadLiks() {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
|
||||
String folder_id = findFirstRegex("#F!([^!]+)", _link, 1);
|
||||
|
@ -28,6 +28,8 @@ public class Get2FACode extends javax.swing.JDialog {
|
||||
public Get2FACode(java.awt.Frame parent, boolean modal, String email, MainPanel main_panel) {
|
||||
super(parent, modal);
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, main_panel.getZoom_factor());
|
||||
@ -42,6 +44,8 @@ public class Get2FACode extends javax.swing.JDialog {
|
||||
|
||||
pack();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,13 +59,6 @@ public class GetMasterPasswordDialog extends javax.swing.JDialog {
|
||||
*/
|
||||
public GetMasterPasswordDialog(java.awt.Frame parent, boolean modal, String current_pass_hash, String salt, MainPanel main_panel) {
|
||||
super(parent, modal);
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
_current_pass_hash = current_pass_hash;
|
||||
|
||||
_pass_ok = false;
|
||||
@ -73,8 +66,15 @@ public class GetMasterPasswordDialog extends javax.swing.JDialog {
|
||||
_pass = null;
|
||||
|
||||
_salt = salt;
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
pack();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ public class GetMasterPasswordDialog extends javax.swing.JDialog {
|
||||
try {
|
||||
byte[] pass = CryptTools.PBKDF2HMACSHA256(new String(current_pass_textfield.getPassword()), BASE642Bin(_salt), CryptTools.MASTER_PASSWORD_PBKDF2_ITERATIONS, CryptTools.MASTER_PASSWORD_PBKDF2_OUTPUT_BIT_LENGTH);
|
||||
String pass_hash = Bin2BASE64(HashBin("SHA-1", pass));
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
if (!pass_hash.equals(_current_pass_hash)) {
|
||||
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("BAD PASSWORD!"), "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
@ -62,12 +62,6 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
|
||||
_main_panel = parent.getMain_panel();
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
_download = false;
|
||||
|
||||
_download_path = Paths.get(download_path).toAbsolutePath().normalize().toString();
|
||||
@ -76,12 +70,20 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
|
||||
_clipboardspy = clipboardspy;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
download_dir_label.setText(truncateText(_download_path, 80));
|
||||
|
||||
if (_main_panel.isUse_mega_account_down() && _main_panel.getMega_accounts().size() > 0) {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
String mega_default_down = _main_panel.getMega_account_down();
|
||||
|
||||
use_mega_account_down_combobox.addItem(mega_default_down);
|
||||
@ -103,6 +105,7 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
}
|
||||
|
||||
pack();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -334,7 +337,7 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
}
|
||||
}
|
||||
if (!links.isEmpty()) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
links_textarea.setText("");
|
||||
|
||||
for (Iterator<String> i = links.iterator(); i.hasNext();) {
|
||||
@ -353,7 +356,7 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
} catch (IOException ex) {
|
||||
LOG.log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
dlc_button.setText(LabelTranslatorSingleton.getInstance().translate("Load DLC container"));
|
||||
|
||||
dlc_button.setEnabled(true);
|
||||
@ -411,11 +414,11 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
use_account = false;
|
||||
}
|
||||
if (!use_account) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
use_mega_account_down_combobox.setSelectedIndex(_main_panel.getMega_accounts().size());
|
||||
});
|
||||
}
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getUse_mega_account_down_combobox().setEnabled(true);
|
||||
|
||||
getDance_button().setText(LabelTranslatorSingleton.getInstance().translate("Let's dance, baby"));
|
||||
@ -447,7 +450,7 @@ public class LinkGrabberDialog extends javax.swing.JDialog implements ClipboardC
|
||||
@Override
|
||||
public void notifyClipboardChange() {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
String current_text = links_textarea.getText();
|
||||
|
||||
links_textarea.append((current_text.length() > 0 ? "\n\n" : "") + extractMegaLinksFromString(extractStringFromClipboardContents(_clipboardspy.getContents())));
|
||||
|
@ -60,7 +60,7 @@ import javax.swing.UIManager;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "7.28";
|
||||
public static final String VERSION = "7.29";
|
||||
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;
|
||||
@ -71,8 +71,8 @@ public final class MainPanel {
|
||||
public static final String DEFAULT_LANGUAGE = "EN";
|
||||
public static final boolean DEFAULT_SMART_PROXY = false;
|
||||
public static final double FORCE_GARBAGE_COLLECTION_MAX_MEMORY_PERCENT = 0.7;
|
||||
public static Font GUI_FONT = createAndRegisterFont("/fonts/Kalam-Light.ttf");
|
||||
public static final float ZOOM_FACTOR = 1.0f;
|
||||
public static Font GUI_FONT = createAndRegisterFont("/fonts/NotoSansCJK-Regular.ttc");
|
||||
public static final float ZOOM_FACTOR = 0.8f;
|
||||
public static final String DEFAULT_USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0";
|
||||
public static final String ICON_FILE = "/images/pica_roja_big.png";
|
||||
public static final ExecutorService THREAD_POOL = newCachedThreadPool();
|
||||
@ -104,7 +104,7 @@ public final class MainPanel {
|
||||
PrintStream fileOut;
|
||||
|
||||
try {
|
||||
fileOut = new PrintStream(new FileOutputStream(System.getProperty("user.home") + "/megabasterd_DEBUG.log"));
|
||||
fileOut = new PrintStream(new FileOutputStream(System.getProperty("user.home") + "/.MEGABASTERD_DEBUG.log"));
|
||||
|
||||
System.setOut(fileOut);
|
||||
System.setErr(fileOut);
|
||||
@ -365,7 +365,7 @@ public final class MainPanel {
|
||||
} else {
|
||||
_mega_proxy_server = null;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().updateMCReverseStatus("MC reverse mode: OFF");
|
||||
});
|
||||
|
||||
@ -387,7 +387,7 @@ public final class MainPanel {
|
||||
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getGlobal_speed_down_label().setForeground(_limit_download_speed ? new Color(255, 0, 0) : new Color(0, 128, 255));
|
||||
|
||||
getView().getGlobal_speed_up_label().setForeground(_limit_upload_speed ? new Color(255, 0, 0) : new Color(0, 128, 255));
|
||||
@ -398,7 +398,7 @@ public final class MainPanel {
|
||||
while (true) {
|
||||
long used_memory = instance.totalMemory() - instance.freeMemory();
|
||||
long max_memory = instance.maxMemory();
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
_view.getMemory_status().setText(MiscTools.formatBytes(used_memory) + " / " + MiscTools.formatBytes(max_memory));
|
||||
});
|
||||
try {
|
||||
@ -658,16 +658,16 @@ public final class MainPanel {
|
||||
if (_font != null) {
|
||||
if (_font.equals("DEFAULT")) {
|
||||
|
||||
GUI_FONT = createAndRegisterFont("/fonts/Kalam-Light.ttf");
|
||||
GUI_FONT = createAndRegisterFont("/fonts/NotoSansCJK-Regular.ttc");
|
||||
|
||||
} else {
|
||||
|
||||
GUI_FONT = createAndRegisterFont("/fonts/NotoSansCJK-Regular.ttc");
|
||||
GUI_FONT = createAndRegisterFont("/fonts/Kalam-Light.ttf");
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
GUI_FONT = createAndRegisterFont("/fonts/Kalam-Light.ttf");
|
||||
GUI_FONT = createAndRegisterFont("/fonts/NotoSansCJK-Regular.ttc");
|
||||
}
|
||||
|
||||
String def_slots = selectSettingValue("default_slots_down");
|
||||
@ -1087,7 +1087,7 @@ public final class MainPanel {
|
||||
}
|
||||
if (!download.getChunkworkers().isEmpty()) {
|
||||
wait = true;
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
download.getView().printStatusNormal("Stopping download safely before exit MegaBasterd, please wait...");
|
||||
download.getView().getSlots_spinner().setEnabled(false);
|
||||
download.getView().getPause_button().setEnabled(false);
|
||||
@ -1111,7 +1111,7 @@ public final class MainPanel {
|
||||
}
|
||||
if (!upload.getChunkworkers().isEmpty()) {
|
||||
wait = true;
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
upload.getView().printStatusNormal("Stopping upload safely before exit MegaBasterd, please wait...");
|
||||
upload.getView().getSlots_spinner().setEnabled(false);
|
||||
upload.getView().getPause_button().setEnabled(false);
|
||||
@ -1207,7 +1207,7 @@ public final class MainPanel {
|
||||
while (true) {
|
||||
try {
|
||||
socket.accept();
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().setExtendedState(NORMAL);
|
||||
|
||||
getView().setVisible(true);
|
||||
@ -1232,7 +1232,7 @@ public final class MainPanel {
|
||||
|
||||
if (!getResume_downloads()) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStatus_down_label().setText(LabelTranslatorSingleton.getInstance().translate("Checking if there are previous downloads, please wait..."));
|
||||
});
|
||||
|
||||
@ -1329,7 +1329,7 @@ public final class MainPanel {
|
||||
|
||||
_download_manager.setSort_wait_start_queue(false);
|
||||
getDownload_manager().secureNotify();
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getjTabbedPane1().setSelectedIndex(0);
|
||||
});
|
||||
|
||||
@ -1337,7 +1337,7 @@ public final class MainPanel {
|
||||
setResume_downloads(true);
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStatus_down_label().setText("");
|
||||
});
|
||||
});
|
||||
@ -1359,7 +1359,7 @@ public final class MainPanel {
|
||||
MenuItem messageItem = new MenuItem(LabelTranslatorSingleton.getInstance().translate("Restore window"));
|
||||
|
||||
messageItem.addActionListener((ActionEvent e) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().setExtendedState(NORMAL);
|
||||
|
||||
getView().setVisible(true);
|
||||
@ -1390,7 +1390,7 @@ public final class MainPanel {
|
||||
menu.add(closeItem);
|
||||
|
||||
ActionListener actionListener = (ActionEvent e) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
if (!getView().isVisible()) {
|
||||
getView().setExtendedState(NORMAL);
|
||||
getView().setVisible(true);
|
||||
@ -1422,7 +1422,7 @@ public final class MainPanel {
|
||||
|
||||
if (!getResume_uploads()) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStatus_up_label().setText(LabelTranslatorSingleton.getInstance().translate("Checking if there are previous uploads, please wait..."));
|
||||
});
|
||||
|
||||
@ -1530,14 +1530,14 @@ public final class MainPanel {
|
||||
|
||||
_upload_manager.setSort_wait_start_queue(false);
|
||||
getUpload_manager().secureNotify();
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getjTabbedPane1().setSelectedIndex(1);
|
||||
});
|
||||
} else {
|
||||
setResume_uploads(true);
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getStatus_up_label().setText("");
|
||||
});
|
||||
});
|
||||
|
@ -242,9 +242,9 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jTabbedPane1" alignment="1" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="343" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="283" max="32767" attributes="0"/>
|
||||
<Component id="unfreeze_transferences_button" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="343" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="282" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="kiss_server_status" pref="191" max="32767" attributes="0"/>
|
||||
@ -268,7 +268,7 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="unfreeze_transferences_button" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jTabbedPane1" max="32767" attributes="0"/>
|
||||
<Component id="jTabbedPane1" pref="469" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Component id="logo_label" min="-2" max="-2" attributes="0"/>
|
||||
@ -342,7 +342,7 @@
|
||||
<Properties>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="20" style="1"/>
|
||||
<Font name="Dialog" size="24" style="1"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
@ -387,7 +387,7 @@
|
||||
<Component id="status_down_label" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane_down" pref="295" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane_down" pref="288" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="down_remtime_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
@ -522,7 +522,7 @@
|
||||
<Component id="status_up_label" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane_up" pref="295" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane_up" pref="288" max="32767" attributes="0"/>
|
||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="up_remtime_label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
@ -625,7 +625,7 @@
|
||||
<Color blue="ff" green="ff" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="18" style="1"/>
|
||||
<Font name="Dialog" size="24" style="1"/>
|
||||
</Property>
|
||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="99" red="0" type="rgb"/>
|
||||
|
@ -153,7 +153,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
public void updateKissStreamServerStatus(final String status) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
String old_status = getKiss_server_status().getText();
|
||||
|
||||
if (!old_status.equals(status + " ")) {
|
||||
@ -170,7 +170,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
public void updateSmartProxyStatus(final String status) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
String old_status = getSmart_proxy_status().getText();
|
||||
|
||||
if (!old_status.equals(status + " ")) {
|
||||
@ -187,7 +187,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
public void updateMCReverseStatus(final String status) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
|
||||
String old_status = getMc_reverse_status().getText();
|
||||
|
||||
@ -397,6 +397,8 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
|
||||
_main_panel = main_panel;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
@ -479,6 +481,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
}
|
||||
|
||||
pack();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -556,7 +559,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
memory_status.setDoubleBuffered(true);
|
||||
|
||||
jTabbedPane1.setDoubleBuffered(true);
|
||||
jTabbedPane1.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
|
||||
jTabbedPane1.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
|
||||
|
||||
global_speed_down_label.setFont(new java.awt.Font("Dialog", 1, 54)); // NOI18N
|
||||
global_speed_down_label.setText("Speed");
|
||||
@ -618,7 +621,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
.addComponent(close_all_finished_down_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(status_down_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane_down, javax.swing.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane_down, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(down_remtime_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
@ -688,7 +691,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
.addComponent(close_all_finished_up_button, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(status_up_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane_up, javax.swing.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane_up, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(up_remtime_label)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
@ -700,7 +703,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
jTabbedPane1.addTab("Uploads", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-upload-to-ftp-30.png")), uploads_panel); // NOI18N
|
||||
|
||||
unfreeze_transferences_button.setBackground(new java.awt.Color(255, 255, 255));
|
||||
unfreeze_transferences_button.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
|
||||
unfreeze_transferences_button.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
|
||||
unfreeze_transferences_button.setForeground(new java.awt.Color(0, 153, 255));
|
||||
unfreeze_transferences_button.setText("UNFREEZE WAITING TRANSFERENCES");
|
||||
unfreeze_transferences_button.setDoubleBuffered(true);
|
||||
@ -861,9 +864,9 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 343, Short.MAX_VALUE)
|
||||
.addGap(0, 283, Short.MAX_VALUE)
|
||||
.addComponent(unfreeze_transferences_button)
|
||||
.addGap(0, 343, Short.MAX_VALUE))
|
||||
.addGap(0, 282, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(kiss_server_status, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
@ -882,7 +885,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
.addContainerGap()
|
||||
.addComponent(unfreeze_transferences_button)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(jTabbedPane1)
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(logo_label)
|
||||
|
@ -23,7 +23,6 @@ import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.InetSocketAddress;
|
||||
@ -52,7 +51,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -413,6 +411,76 @@ public class MiscTools {
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(data);
|
||||
}
|
||||
|
||||
public static void pausar(long pause) {
|
||||
try {
|
||||
Thread.sleep(pause);
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void GUIRun(Runnable r) {
|
||||
|
||||
boolean ok;
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
|
||||
try {
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
SwingUtilities.invokeLater(r);
|
||||
} else {
|
||||
r.run();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ok = false;
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
MiscTools.pausar(250);
|
||||
}
|
||||
|
||||
} while (!ok);
|
||||
}
|
||||
|
||||
public static void GUIRunAndWait(Runnable r) {
|
||||
|
||||
boolean ok;
|
||||
|
||||
do {
|
||||
ok = true;
|
||||
try {
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
SwingUtilities.invokeAndWait(r);
|
||||
} else {
|
||||
r.run();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ok = false;
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, null, ex);
|
||||
MiscTools.pausar(250);
|
||||
}
|
||||
} while (!ok);
|
||||
}
|
||||
|
||||
public static void threadRun(Runnable r) {
|
||||
|
||||
Thread hilo = new Thread(r);
|
||||
|
||||
hilo.start();
|
||||
|
||||
}
|
||||
|
||||
public static FutureTask futureRun(Callable c) {
|
||||
|
||||
FutureTask f = new FutureTask(c);
|
||||
|
||||
Thread hilo = new Thread(f);
|
||||
|
||||
hilo.start();
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
public static long getWaitTimeExpBackOff(int retryCount) {
|
||||
|
||||
long waitTime = ((long) Math.pow(EXP_BACKOFF_BASE, retryCount) * EXP_BACKOFF_SECS_RETRY);
|
||||
@ -420,73 +488,6 @@ public class MiscTools {
|
||||
return Math.min(waitTime, EXP_BACKOFF_MAX_WAIT_TIME);
|
||||
}
|
||||
|
||||
public static void swingInvoke(Runnable r) {
|
||||
|
||||
_swingInvokeIt(r, false);
|
||||
}
|
||||
|
||||
public static void swingInvokeAndWait(Runnable r) {
|
||||
|
||||
_swingInvokeIt(r, true);
|
||||
}
|
||||
|
||||
public static Object swingInvokeAndWaitForReturn(Callable c) {
|
||||
|
||||
return _swingInvokeItAndWaitForReturn(c);
|
||||
}
|
||||
|
||||
private static void _swingInvokeIt(Runnable r, boolean wait) {
|
||||
|
||||
if (wait) {
|
||||
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
|
||||
r.run();
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
/* OJO!!! El thread que lanza esto NO PUEDE poseer locks que necesite el EDT o se producirá un DEADLOCK */
|
||||
SwingUtilities.invokeAndWait(r);
|
||||
|
||||
} catch (InterruptedException | InvocationTargetException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
SwingUtilities.invokeLater(r);
|
||||
}
|
||||
}
|
||||
|
||||
private static Object _swingInvokeItAndWaitForReturn(Callable c) {
|
||||
Object ret = null;
|
||||
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
|
||||
try {
|
||||
ret = c.call();
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
FutureTask<Object> futureTask = new FutureTask<>(c);
|
||||
|
||||
SwingUtilities.invokeLater(futureTask);
|
||||
|
||||
try {
|
||||
ret = futureTask.get();
|
||||
} catch (InterruptedException | ExecutionException ex) {
|
||||
Logger.getLogger(MiscTools.class.getName()).log(Level.SEVERE, ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static String bin2hex(byte[] b) {
|
||||
|
||||
BigInteger bi = new BigInteger(1, b);
|
||||
|
@ -52,12 +52,6 @@ public class SetMasterPasswordDialog extends javax.swing.JDialog {
|
||||
|
||||
super(parent, modal);
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
_pass_ok = false;
|
||||
|
||||
_new_pass = null;
|
||||
@ -66,7 +60,16 @@ public class SetMasterPasswordDialog extends javax.swing.JDialog {
|
||||
|
||||
_salt = salt;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
pack();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -219,7 +222,7 @@ public class SetMasterPasswordDialog extends javax.swing.JDialog {
|
||||
THREAD_POOL.execute(() -> {
|
||||
try {
|
||||
if (Arrays.equals(new_pass_textfield.getPassword(), confirm_pass_textfield.getPassword())) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate("Processing your password, please wait..."));
|
||||
});
|
||||
if (new_pass_textfield.getPassword().length > 0) {
|
||||
@ -229,11 +232,11 @@ public class SetMasterPasswordDialog extends javax.swing.JDialog {
|
||||
_new_pass_hash = Bin2BASE64(HashBin("SHA-1", _new_pass));
|
||||
}
|
||||
_pass_ok = true;
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
tthis.setVisible(false);
|
||||
});
|
||||
} else {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("Passwords does not match!"), "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
status_label.setText("");
|
||||
|
@ -31,7 +31,7 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jTabbedPane1" pref="1071" max="32767" attributes="0"/>
|
||||
<Component id="panel_tabs" pref="1071" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="status" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
@ -48,7 +48,7 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jTabbedPane1" pref="474" max="32767" attributes="0"/>
|
||||
<Component id="panel_tabs" pref="474" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
@ -93,11 +93,11 @@
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancel_buttonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">
|
||||
<Container class="javax.swing.JTabbedPane" name="panel_tabs">
|
||||
<Properties>
|
||||
<Property name="doubleBuffered" type="boolean" value="true"/>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Dialog" size="20" style="1"/>
|
||||
<Font name="Dialog" size="24" style="1"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
|
@ -80,6 +80,16 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
_main_panel = parent.getMain_panel();
|
||||
|
||||
_remember_master_pass = true;
|
||||
|
||||
_deleted_mega_accounts = new HashSet();
|
||||
|
||||
_deleted_elc_accounts = new HashSet();
|
||||
|
||||
_settings_ok = false;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
@ -90,13 +100,13 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
jTabbedPane1.setTitleAt(0, LabelTranslatorSingleton.getInstance().translate("Downloads"));
|
||||
panel_tabs.setTitleAt(0, LabelTranslatorSingleton.getInstance().translate("Downloads"));
|
||||
|
||||
jTabbedPane1.setTitleAt(1, LabelTranslatorSingleton.getInstance().translate("Uploads"));
|
||||
panel_tabs.setTitleAt(1, LabelTranslatorSingleton.getInstance().translate("Uploads"));
|
||||
|
||||
jTabbedPane1.setTitleAt(2, LabelTranslatorSingleton.getInstance().translate("Accounts"));
|
||||
panel_tabs.setTitleAt(2, LabelTranslatorSingleton.getInstance().translate("Accounts"));
|
||||
|
||||
jTabbedPane1.setTitleAt(3, LabelTranslatorSingleton.getInstance().translate("Advanced"));
|
||||
panel_tabs.setTitleAt(3, LabelTranslatorSingleton.getInstance().translate("Advanced"));
|
||||
|
||||
downloads_scrollpane.getVerticalScrollBar().setUnitIncrement(20);
|
||||
|
||||
@ -571,15 +581,8 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
custom_proxy_textarea.setText(custom_proxy_list);
|
||||
}
|
||||
|
||||
_remember_master_pass = true;
|
||||
|
||||
_deleted_mega_accounts = new HashSet();
|
||||
|
||||
_deleted_elc_accounts = new HashSet();
|
||||
|
||||
_settings_ok = false;
|
||||
|
||||
pack();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -595,7 +598,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
jProgressBar1 = new javax.swing.JProgressBar();
|
||||
save_button = new javax.swing.JButton();
|
||||
cancel_button = new javax.swing.JButton();
|
||||
jTabbedPane1 = new javax.swing.JTabbedPane();
|
||||
panel_tabs = new javax.swing.JTabbedPane();
|
||||
downloads_scrollpane = new javax.swing.JScrollPane();
|
||||
downloads_panel = new javax.swing.JPanel();
|
||||
megacrypter_reverse_warning_label = new javax.swing.JLabel();
|
||||
@ -718,8 +721,8 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
}
|
||||
});
|
||||
|
||||
jTabbedPane1.setDoubleBuffered(true);
|
||||
jTabbedPane1.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
|
||||
panel_tabs.setDoubleBuffered(true);
|
||||
panel_tabs.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
|
||||
|
||||
downloads_scrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153)));
|
||||
|
||||
@ -981,7 +984,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
downloads_scrollpane.setViewportView(downloads_panel);
|
||||
|
||||
jTabbedPane1.addTab("Downloads", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-download-from-ftp-30.png")), downloads_scrollpane); // NOI18N
|
||||
panel_tabs.addTab("Downloads", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-download-from-ftp-30.png")), downloads_scrollpane); // NOI18N
|
||||
|
||||
uploads_scrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153)));
|
||||
|
||||
@ -1070,7 +1073,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
uploads_scrollpane.setViewportView(uploads_panel);
|
||||
|
||||
jTabbedPane1.addTab("Uploads", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-upload-to-ftp-30.png")), uploads_scrollpane); // NOI18N
|
||||
panel_tabs.addTab("Uploads", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-upload-to-ftp-30.png")), uploads_scrollpane); // NOI18N
|
||||
|
||||
accounts_panel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153)));
|
||||
|
||||
@ -1264,7 +1267,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
jTabbedPane1.addTab("Accounts", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-customer-30.png")), accounts_panel); // NOI18N
|
||||
panel_tabs.addTab("Accounts", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-customer-30.png")), accounts_panel); // NOI18N
|
||||
|
||||
advanced_scrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153)));
|
||||
|
||||
@ -1585,7 +1588,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
advanced_scrollpane.setViewportView(advanced_panel);
|
||||
|
||||
jTabbedPane1.addTab("Advanced", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-administrative-tools-30.png")), advanced_scrollpane); // NOI18N
|
||||
panel_tabs.addTab("Advanced", new javax.swing.ImageIcon(getClass().getResource("/images/icons8-administrative-tools-30.png")), advanced_scrollpane); // NOI18N
|
||||
|
||||
status.setFont(new java.awt.Font("Dialog", 3, 14)); // NOI18N
|
||||
status.setForeground(new java.awt.Color(102, 102, 102));
|
||||
@ -1597,7 +1600,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1071, Short.MAX_VALUE)
|
||||
.addComponent(panel_tabs, javax.swing.GroupLayout.DEFAULT_SIZE, 1071, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(6, 6, 6)
|
||||
@ -1610,7 +1613,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 474, Short.MAX_VALUE)
|
||||
.addComponent(panel_tabs, javax.swing.GroupLayout.DEFAULT_SIZE, 474, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
@ -1632,6 +1635,8 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
|
||||
panel_tabs.setEnabled(false);
|
||||
|
||||
try {
|
||||
|
||||
if (proxy_host_textfield.getText().isEmpty()) {
|
||||
@ -2056,7 +2061,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
String email_error_s = "";
|
||||
email_error_s = email_error.stream().map((s) -> s + "\n").reduce(email_error_s, String::concat);
|
||||
final String final_email_error = email_error_s;
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
status.setText("");
|
||||
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("There were errors with some accounts (email and/or password are/is wrong). Please, check them:\n\n") + final_email_error, "Mega Account Check Error", JOptionPane.ERROR_MESSAGE);
|
||||
@ -2065,6 +2070,8 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
cancel_button.setEnabled(true);
|
||||
|
||||
panel_tabs.setEnabled(true);
|
||||
|
||||
remove_mega_account_button.setEnabled(mega_accounts_table.getModel().getRowCount() > 0);
|
||||
|
||||
remove_elc_account_button.setEnabled(elc_accounts_table.getModel().getRowCount() > 0);
|
||||
@ -2087,7 +2094,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
_main_panel.getMega_accounts().entrySet().stream().map((entry) -> entry.getKey()).filter((email) -> (!new_valid_mega_accounts.contains(email))).forEachOrdered((email) -> {
|
||||
_deleted_mega_accounts.add(email);
|
||||
});
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
status.setText("");
|
||||
JOptionPane.showMessageDialog(tthis, LabelTranslatorSingleton.getInstance().translate("Settings successfully saved!"), LabelTranslatorSingleton.getInstance().translate("Settings saved"), JOptionPane.INFORMATION_MESSAGE);
|
||||
_settings_ok = true;
|
||||
@ -2285,7 +2292,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
final Dialog tthis = this;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
GetMasterPasswordDialog dialog = new GetMasterPasswordDialog((Frame) getParent(), true, _main_panel.getMaster_pass_hash(), _main_panel.getMaster_pass_salt(), _main_panel);
|
||||
|
||||
dialog.setLocationRelativeTo(tthis);
|
||||
@ -2462,7 +2469,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
|
||||
final Dialog tthis = this;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
SetMasterPasswordDialog dialog = new SetMasterPasswordDialog((Frame) getParent(), true, _main_panel.getMaster_pass_salt(), _main_panel);
|
||||
|
||||
dialog.setLocationRelativeTo(tthis);
|
||||
@ -2884,7 +2891,6 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
private javax.swing.JSeparator jSeparator7;
|
||||
private javax.swing.JSeparator jSeparator8;
|
||||
private javax.swing.JSeparator jSeparator9;
|
||||
private javax.swing.JTabbedPane jTabbedPane1;
|
||||
private javax.swing.JComboBox<String> language_combo;
|
||||
private javax.swing.JCheckBox limit_download_speed_checkbox;
|
||||
private javax.swing.JCheckBox limit_upload_speed_checkbox;
|
||||
@ -2904,6 +2910,7 @@ public class SettingsDialog extends javax.swing.JDialog {
|
||||
private javax.swing.JSpinner megacrypter_reverse_port_spinner;
|
||||
private javax.swing.JLabel megacrypter_reverse_warning_label;
|
||||
private javax.swing.JCheckBox multi_slot_down_checkbox;
|
||||
private javax.swing.JTabbedPane panel_tabs;
|
||||
private javax.swing.JPanel proxy_auth_panel;
|
||||
private javax.swing.JLabel proxy_host_label;
|
||||
private javax.swing.JTextField proxy_host_textfield;
|
||||
|
@ -25,8 +25,8 @@ import java.util.logging.Logger;
|
||||
public final class SmartMegaProxyManager {
|
||||
|
||||
public static String DEFAULT_SMART_PROXY_URL = "";
|
||||
public static final int PROXY_BLOCK_TIME = 120;
|
||||
public static final int PROXY_AUTO_REFRESH_SLEEP_TIME = 15;
|
||||
public static final int PROXY_BLOCK_TIME = 90;
|
||||
public static final int PROXY_AUTO_REFRESH_SLEEP_TIME = 60;
|
||||
private static final Logger LOG = Logger.getLogger(SmartMegaProxyManager.class.getName());
|
||||
private volatile String _proxy_list_url;
|
||||
private final LinkedHashMap<String, Long[]> _proxy_list;
|
||||
|
@ -48,22 +48,24 @@ public class StreamerDialog extends javax.swing.JDialog implements ClipboardChan
|
||||
|
||||
_main_panel = parent.getMain_panel();
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
_clipboardspy = clipboardspy;
|
||||
|
||||
_selected_item = null;
|
||||
|
||||
_mainPanelView = parent;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, _main_panel.getZoom_factor());
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
if (_main_panel.isUse_mega_account_down() && _main_panel.getMega_accounts().size() > 0) {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
String mega_default_down = _main_panel.getMega_account_down();
|
||||
|
||||
use_mega_account_down_combobox.addItem(mega_default_down);
|
||||
@ -85,6 +87,7 @@ public class StreamerDialog extends javax.swing.JDialog implements ClipboardChan
|
||||
}
|
||||
|
||||
pack();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,11 +288,11 @@ public class StreamerDialog extends javax.swing.JDialog implements ClipboardChan
|
||||
use_account = false;
|
||||
}
|
||||
if (!use_account) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
use_mega_account_down_combobox.setSelectedIndex(_main_panel.getMega_accounts().size());
|
||||
});
|
||||
}
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getUse_mega_account_down_combobox().setEnabled(true);
|
||||
|
||||
getDance_button().setText(LabelTranslatorSingleton.getInstance().translate("Let's dance, baby"));
|
||||
@ -307,7 +310,7 @@ public class StreamerDialog extends javax.swing.JDialog implements ClipboardChan
|
||||
@Override
|
||||
public void notifyClipboardChange() {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
String link = extractFirstMegaLinkFromString(extractStringFromClipboardContents(_clipboardspy.getContents()));
|
||||
|
||||
if (!link.contains("/#F!")) {
|
||||
|
@ -16,7 +16,7 @@ public interface Transference {
|
||||
int HTTP_READ_TIMEOUT = 60000;
|
||||
int MAX_SIM_TRANSFERENCES = 20;
|
||||
int SIM_TRANSFERENCES_DEFAULT = 4;
|
||||
int PROGRESS_WATCHDOG_TIMEOUT = 300;
|
||||
int PROGRESS_WATCHDOG_TIMEOUT = 600;
|
||||
boolean LIMIT_TRANSFERENCE_SPEED_DEFAULT = false;
|
||||
int MAX_TRANSFERENCE_SPEED_DEFAULT = 5;
|
||||
int MAX_WAIT_WORKERS_SHUTDOWN = 15;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.tonikelope.megabasterd;
|
||||
|
||||
import static com.tonikelope.megabasterd.MainPanel.*;
|
||||
import static com.tonikelope.megabasterd.MiscTools.*;
|
||||
import java.awt.Component;
|
||||
import java.awt.TrayIcon;
|
||||
import java.util.ArrayList;
|
||||
@ -328,13 +327,13 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
getTransference_waitstart_queue().addAll(wait_array);
|
||||
|
||||
getTransference_waitstart_queue().forEach((t1) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t1.getView());
|
||||
getScroll_panel().add((Component) t1.getView());
|
||||
});
|
||||
});
|
||||
getTransference_finished_queue().forEach((t1) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t1.getView());
|
||||
getScroll_panel().add((Component) t1.getView());
|
||||
});
|
||||
@ -366,13 +365,13 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
getTransference_waitstart_queue().addAll(wait_array);
|
||||
|
||||
getTransference_waitstart_queue().forEach((t1) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t1.getView());
|
||||
getScroll_panel().add((Component) t1.getView());
|
||||
});
|
||||
});
|
||||
getTransference_finished_queue().forEach((t1) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t1.getView());
|
||||
getScroll_panel().add((Component) t1.getView());
|
||||
});
|
||||
@ -411,13 +410,13 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
getTransference_waitstart_queue().addAll(wait_array);
|
||||
|
||||
getTransference_waitstart_queue().forEach((t1) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t1.getView());
|
||||
getScroll_panel().add((Component) t1.getView());
|
||||
});
|
||||
});
|
||||
getTransference_finished_queue().forEach((t1) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t1.getView());
|
||||
getScroll_panel().add((Component) t1.getView());
|
||||
});
|
||||
@ -456,13 +455,13 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
getTransference_waitstart_queue().addAll(wait_array);
|
||||
|
||||
getTransference_waitstart_queue().forEach((t1) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t1.getView());
|
||||
getScroll_panel().add((Component) t1.getView());
|
||||
});
|
||||
});
|
||||
getTransference_finished_queue().forEach((t2) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t2.getView());
|
||||
getScroll_panel().add((Component) t2.getView());
|
||||
});
|
||||
@ -524,7 +523,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
_paused_all = true;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
|
||||
_pause_all_button.setText("RESUME ALL");
|
||||
_pause_all_button.setEnabled(true);
|
||||
@ -549,7 +548,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
_paused_all = false;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
|
||||
_pause_all_button.setText("PAUSE ALL");
|
||||
|
||||
@ -594,7 +593,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
|
||||
private void _updateView() {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
if (_paused_all) {
|
||||
_pause_all_button.setText("RESUME ALL");
|
||||
} else {
|
||||
@ -779,7 +778,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
getTransference_waitstart_aux_queue().clear();
|
||||
|
||||
getTransference_waitstart_queue().forEach((t) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t.getView());
|
||||
getScroll_panel().add((Component) t.getView());
|
||||
});
|
||||
@ -788,7 +787,7 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
|
||||
sortTransferenceQueue(getTransference_finished_queue());
|
||||
|
||||
getTransference_finished_queue().forEach((t) -> {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove((Component) t.getView());
|
||||
getScroll_panel().add((Component) t.getView());
|
||||
});
|
||||
|
@ -426,7 +426,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
}
|
||||
|
||||
if (_file_name != null) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getFile_name_label().setVisible(true);
|
||||
|
||||
getView().getFile_name_label().setText(_file_name);
|
||||
@ -445,7 +445,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
getView().printStatusError(_status_error);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getRestart_button().setVisible(true);
|
||||
});
|
||||
|
||||
@ -453,7 +453,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
getView().printStatusNormal(LabelTranslatorSingleton.getInstance().translate(_frozen ? "(FROZEN) Waiting to start (" : "Waiting to start (") + _ma.getFull_email() + ") ...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getFile_name_label().setVisible(true);
|
||||
|
||||
getView().getFile_name_label().setText(_file_name);
|
||||
@ -469,7 +469,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getClose_button().setVisible(true);
|
||||
getView().getQueue_down_button().setVisible(true);
|
||||
getView().getQueue_up_button().setVisible(true);
|
||||
@ -638,7 +638,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
if (!_chunkworkers.isEmpty()) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getSlots_spinner().setEnabled(false);
|
||||
});
|
||||
|
||||
@ -679,7 +679,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
LOG.log(Level.INFO, "{0} Uploader hello! {1}", new Object[]{Thread.currentThread().getName(), this.getFile_name()});
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getQueue_down_button().setVisible(false);
|
||||
getView().getQueue_up_button().setVisible(false);
|
||||
getView().getQueue_top_button().setVisible(false);
|
||||
@ -750,7 +750,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
_byte_file_iv = i32a2bin(file_iv);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getClose_button().setVisible(false);
|
||||
|
||||
getView().getCbc_label().setVisible(true);
|
||||
@ -789,7 +789,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
_thread_pool.execute(c);
|
||||
}
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getSlots_label().setVisible(true);
|
||||
|
||||
getView().getSlots_spinner().setVisible(true);
|
||||
@ -801,7 +801,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
getView().printStatusNormal(LabelTranslatorSingleton.getInstance().translate("Uploading file to mega (") + _ma.getFull_email() + ") ...");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getPause_button().setVisible(true);
|
||||
|
||||
getView().getProgress_pbar().setVisible(true);
|
||||
@ -868,7 +868,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
getMain_panel().getGlobal_up_speed().detachTransference(this);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
for (JComponent c : new JComponent[]{getView().getSpeed_label(), getView().getCbc_label(), getView().getPause_button(), getView().getStop_button(), getView().getSlots_label(), getView().getSlots_spinner()}) {
|
||||
c.setVisible(false);
|
||||
}
|
||||
@ -931,7 +931,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
_file_link = _ma.getPublicFileLink(_fid, i32a2bin(node_key));
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getFile_link_button().setEnabled(true);
|
||||
});
|
||||
|
||||
@ -1045,7 +1045,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
getMain_panel().getUpload_manager().getTransference_finished_queue().add(this);
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getMain_panel().getUpload_manager().getScroll_panel().remove(getView());
|
||||
|
||||
getMain_panel().getUpload_manager().getScroll_panel().add(getView());
|
||||
@ -1053,7 +1053,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
getMain_panel().getUpload_manager().secureNotify();
|
||||
});
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getClose_button().setVisible(true);
|
||||
|
||||
if (_status_error != null || _canceled) {
|
||||
@ -1069,7 +1069,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
THREAD_POOL.execute(() -> {
|
||||
for (int i = 3; !_closed && i > 0; i--) {
|
||||
final int j = i;
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getRestart_button().setText("Restart (" + String.valueOf(j) + " secs...)");
|
||||
});
|
||||
try {
|
||||
@ -1102,7 +1102,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
getView().printStatusNormal("Upload paused!");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME UPLOAD"));
|
||||
getView().getPause_button().setEnabled(true);
|
||||
});
|
||||
@ -1116,7 +1116,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
getView().printStatusNormal("Upload paused!");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME UPLOAD"));
|
||||
getView().getPause_button().setEnabled(true);
|
||||
});
|
||||
@ -1133,14 +1133,14 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
_finalizing = true;
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getSlots_spinner().setEnabled(false);
|
||||
|
||||
getView().getSlots_spinner().setValue((int) getView().getSlots_spinner().getValue() - 1);
|
||||
});
|
||||
|
||||
} else if (!_finalizing) {
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getSlots_spinner().setEnabled(true);
|
||||
});
|
||||
}
|
||||
@ -1149,7 +1149,7 @@ public class Upload implements Transference, Runnable, SecureSingleThreadNotifia
|
||||
|
||||
getView().printStatusNormal("Upload paused!");
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME UPLOAD"));
|
||||
getView().getPause_button().setEnabled(true);
|
||||
});
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.tonikelope.megabasterd;
|
||||
|
||||
import static com.tonikelope.megabasterd.MiscTools.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
@ -53,7 +52,7 @@ public class UploadManager extends TransferenceManager {
|
||||
|
||||
for (final Transference u : uploads) {
|
||||
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
getScroll_panel().remove(((Upload) u).getView());
|
||||
});
|
||||
|
||||
|
@ -6,6 +6,8 @@ import static com.tonikelope.megabasterd.Transference.*;
|
||||
import java.awt.Color;
|
||||
import static java.lang.Integer.MAX_VALUE;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
@ -99,6 +101,9 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
}
|
||||
|
||||
public UploadView(Upload upload) {
|
||||
_upload = upload;
|
||||
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
|
||||
initComponents();
|
||||
|
||||
@ -106,8 +111,6 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
translateLabels(this);
|
||||
|
||||
_upload = upload;
|
||||
|
||||
slots_spinner.setModel(new SpinnerNumberModel(_upload.getMain_panel().getDefault_slots_up(), MIN_WORKERS, MAX_WORKERS, 1));
|
||||
|
||||
((JSpinner.DefaultEditor) slots_spinner.getEditor()).getTextField().setEditable(false);
|
||||
@ -124,6 +127,8 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
c.setVisible(false);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -417,7 +422,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
public void hideAllExceptStatus() {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{speed_label, slots_spinner, slots_label, slot_status_label, pause_button, stop_button, progress_pbar, cbc_label}) {
|
||||
|
||||
c.setVisible(false);
|
||||
@ -464,7 +469,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_upload.upWaitQueue();
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
queue_up_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -477,7 +482,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_upload.downWaitQueue();
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
queue_down_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -489,7 +494,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_upload.topWaitQueue();
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
queue_top_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -502,7 +507,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
THREAD_POOL.execute(() -> {
|
||||
_upload.bottomWaitQueue();
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
queue_bottom_button.setEnabled(true);
|
||||
});
|
||||
});
|
||||
@ -510,7 +515,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
public void updateCBC(String status) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
cbc_label.setText(status);
|
||||
});
|
||||
}
|
||||
@ -520,7 +525,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
printStatusNormal("Pausing upload ...");
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(false);
|
||||
@ -538,7 +543,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
printStatusNormal(status);
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, stop_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(false);
|
||||
@ -551,7 +556,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
printStatusNormal("Uploading file to mega ...");
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
for (JComponent c : new JComponent[]{pause_button, speed_label, slots_label, slots_spinner, progress_pbar, file_name_label, file_size_label}) {
|
||||
|
||||
c.setEnabled(true);
|
||||
@ -570,7 +575,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void updateSpeed(final String speed, final Boolean visible) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
if (speed != null) {
|
||||
speed_label.setText(speed);
|
||||
}
|
||||
@ -584,14 +589,14 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void updateProgressBar(final long progress, final double bar_rate) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
progress_pbar.setValue((int) Math.floor(bar_rate * progress));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(final int value) {
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
progress_pbar.setValue(value);
|
||||
});
|
||||
}
|
||||
@ -599,7 +604,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void printStatusError(final String message) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
status_label.setForeground(Color.red);
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -608,7 +613,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void printStatusOK(final String message) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
status_label.setForeground(new Color(0, 170, 0));
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -617,7 +622,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
@Override
|
||||
public void printStatusNormal(final String message) {
|
||||
|
||||
swingInvokeAndWait(() -> {
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
status_label.setForeground(new Color(102, 102, 102));
|
||||
status_label.setText(LabelTranslatorSingleton.getInstance().translate(message));
|
||||
});
|
||||
@ -634,7 +639,7 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
conta_error = _upload.getChunkworkers().stream().filter((c) -> (c.isError_wait())).map((_item) -> 1).reduce(conta_error, Integer::sum);
|
||||
|
||||
final String status = conta_error > 0 ? "(" + String.valueOf(conta_error) + ")" : "";
|
||||
swingInvoke(() -> {
|
||||
MiscTools.GUIRun(() -> {
|
||||
slot_status_label.setForeground(Color.RED);
|
||||
slot_status_label.setText(status);
|
||||
});
|
||||
@ -643,7 +648,14 @@ public class UploadView extends javax.swing.JPanel implements TransferenceView {
|
||||
|
||||
@Override
|
||||
public int getSlots() {
|
||||
return (int) swingInvokeAndWaitForReturn((Callable) getSlots_spinner()::getValue);
|
||||
try {
|
||||
return (int) (MiscTools.futureRun((Callable) getSlots_spinner()::getValue).get());
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(UploadView.class.getName()).log(Level.SEVERE, null, ex);
|
||||
} catch (ExecutionException ex) {
|
||||
Logger.getLogger(UploadView.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
|
@ -35,6 +35,7 @@ public class WarningExitMessage extends javax.swing.JDialog {
|
||||
*/
|
||||
public WarningExitMessage(java.awt.Frame parent, boolean modal, MainPanel main_panel, boolean restart) {
|
||||
super(parent, modal);
|
||||
MiscTools.GUIRunAndWait(() -> {
|
||||
initComponents();
|
||||
|
||||
updateFonts(this, GUI_FONT, main_panel.getZoom_factor());
|
||||
@ -46,6 +47,7 @@ public class WarningExitMessage extends javax.swing.JDialog {
|
||||
_restart = restart;
|
||||
|
||||
pack();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user