Skip to content

Commit

Permalink
7.29
Browse files Browse the repository at this point in the history
-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
  • Loading branch information
tonikelope committed Oct 18, 2020
1 parent 0f6eb9b commit cef89f7
Show file tree
Hide file tree
Showing 27 changed files with 920 additions and 837 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
18 changes: 10 additions & 8 deletions src/main/java/com/tonikelope/megabasterd/AboutDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,19 @@ public AboutDialog(MainPanelView parent, boolean modal) {

super(parent, modal);

initComponents();
MiscTools.GUIRunAndWait(() -> {
initComponents();

updateFonts(this, GUI_FONT, parent.getMain_panel().getZoom_factor());
updateFonts(this, GUI_FONT, parent.getMain_panel().getZoom_factor());

translateLabels(this);
translateLabels(this);

if (MainPanel.getNew_version() != null) {
mcdown_url_button.setEnabled(true);
}
if (MainPanel.getNew_version() != null) {
mcdown_url_button.setEnabled(true);
}

pack();
pack();
});
}

/**
Expand Down Expand Up @@ -255,7 +257,7 @@ private void check_version_buttonActionPerformed(java.awt.event.ActionEvent evt)
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);
Expand Down
56 changes: 28 additions & 28 deletions src/main/java/com/tonikelope/megabasterd/Download.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -241,7 +241,7 @@ public void enableTurboMode() {
if (!_finalizing) {
Download tthis = this;

swingInvoke(() -> {
MiscTools.GUIRun(() -> {

getView().getSpeed_label().setForeground(new Color(255, 102, 0));

Expand All @@ -260,7 +260,7 @@ public void enableTurboMode() {

}

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getSlots_spinner().setValue(Transference.MAX_WORKERS);

getView().getSlots_spinner().setEnabled(true);
Expand Down Expand Up @@ -528,7 +528,7 @@ public long getFile_size() {
@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);
Expand Down Expand Up @@ -622,7 +622,7 @@ public void run() {
_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);
Expand All @@ -637,7 +637,7 @@ public void run() {

_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);
}
Expand All @@ -647,7 +647,7 @@ public void run() {

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);
Expand Down Expand Up @@ -721,7 +721,7 @@ public void run() {

_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);
Expand Down Expand Up @@ -759,7 +759,7 @@ public void run() {

getView().printStatusNormal("Checking file integrity, please wait...");

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getStop_button().setVisible(true);

getView().getStop_button().setText(LabelTranslatorSingleton.getInstance().translate("CANCEL CHECK"));
Expand All @@ -785,7 +785,7 @@ public void run() {

}

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getStop_button().setVisible(false);
});

Expand Down Expand Up @@ -909,15 +909,15 @@ public void run() {

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());
});

getMain_panel().getDownload_manager().secureNotify();

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getClose_button().setVisible(true);

if ((_status_error != null || _canceled) && isProvision_ok()) {
Expand All @@ -934,7 +934,7 @@ public void run() {
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 {
Expand Down Expand Up @@ -963,7 +963,7 @@ public void provisionIt(boolean retry) throws APIException {

getView().printStatusNormal("Provisioning download, please wait...");

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getCopy_link_button().setVisible(true);
getView().getOpen_folder_button().setVisible(true);
});
Expand Down Expand Up @@ -1039,7 +1039,7 @@ public void provisionIt(boolean retry) throws APIException {
}

if (_file_name != null) {
swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getFile_name_label().setVisible(true);

getView().getFile_name_label().setText(truncateText(_download_path + "/" + _file_name, 100));
Expand All @@ -1056,7 +1056,7 @@ public void provisionIt(boolean retry) throws APIException {

getView().printStatusError(_status_error);

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getClose_button().setVisible(true);
});

Expand All @@ -1066,7 +1066,7 @@ public void provisionIt(boolean retry) throws APIException {

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));
Expand All @@ -1078,7 +1078,7 @@ public void provisionIt(boolean retry) throws APIException {
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);
Expand All @@ -1098,7 +1098,7 @@ public void pause_worker() {

getView().printStatusNormal("Download paused!");

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME DOWNLOAD"));
getView().getPause_button().setEnabled(true);
});
Expand All @@ -1111,7 +1111,7 @@ public void pause_worker_mono() {

getView().printStatusNormal("Download paused!");

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME DOWNLOAD"));
getView().getPause_button().setEnabled(true);
});
Expand Down Expand Up @@ -1204,7 +1204,7 @@ public void stopLastStartedSlot() {

if (!_chunkworkers.isEmpty()) {

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getSlots_spinner().setEnabled(false);
});

Expand Down Expand Up @@ -1246,14 +1246,14 @@ public void stopThisSlot(ChunkDownloader chunkdownloader) {

_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);
});
}
Expand All @@ -1265,7 +1265,7 @@ public void stopThisSlot(ChunkDownloader chunkdownloader) {

getView().printStatusNormal("Download paused!");

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getPause_button().setText(LabelTranslatorSingleton.getInstance().translate("RESUME DOWNLOAD"));

getView().getPause_button().setEnabled(true);
Expand Down Expand Up @@ -1461,7 +1461,7 @@ public String[] getMegaFileMetadata(String link, MainPanelView panel, boolean re

_retrying_request = true;

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getMain_panel().getView().getNew_download_menu().setEnabled(true);

getView().getStop_button().setVisible(true);
Expand Down Expand Up @@ -1496,7 +1496,7 @@ public String[] getMegaFileMetadata(String link, MainPanelView panel, boolean re

_auto_retry_on_error = true;

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getStop_button().setText(LabelTranslatorSingleton.getInstance().translate("CANCEL DOWNLOAD"));
getView().getStop_button().setVisible(false);
});
Expand Down Expand Up @@ -1542,7 +1542,7 @@ public String getMegaFileDownloadUrl(String link) throws IOException, Interrupte

_retrying_request = true;

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getStop_button().setVisible(true);

getView().getStop_button().setText(LabelTranslatorSingleton.getInstance().translate("CANCEL RETRY"));
Expand All @@ -1569,7 +1569,7 @@ public String getMegaFileDownloadUrl(String link) throws IOException, Interrupte

_auto_retry_on_error = true;

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getView().getStop_button().setText(LabelTranslatorSingleton.getInstance().translate("CANCEL DOWNLOAD"));
getView().getStop_button().setVisible(false);
});
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/tonikelope/megabasterd/DownloadManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

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;
Expand All @@ -29,7 +28,7 @@ public void remove(Transference[] downloads) {

for (final Transference d : downloads) {

swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getScroll_panel().remove(((Download) d).getView());
});

Expand Down Expand Up @@ -66,7 +65,7 @@ public void remove(Transference[] downloads) {

@Override
public void provision(final Transference download) {
swingInvoke(() -> {
MiscTools.GUIRun(() -> {
getScroll_panel().add(((Download) download).getView());
});

Expand Down
Loading

0 comments on commit cef89f7

Please sign in to comment.