diff --git a/pom.xml b/pom.xml index 80b0f73b1..e6ba8b315 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.tonikelope MegaBasterd - 8.9 + 8.10 jar diff --git a/src/main/java/com/tonikelope/megabasterd/MainPanel.java b/src/main/java/com/tonikelope/megabasterd/MainPanel.java index 4b54288e8..9b16ae53c 100644 --- a/src/main/java/com/tonikelope/megabasterd/MainPanel.java +++ b/src/main/java/com/tonikelope/megabasterd/MainPanel.java @@ -70,7 +70,7 @@ */ public final class MainPanel { - public static final String VERSION = "8.9"; + public static final String VERSION = "8.10"; 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; diff --git a/src/main/java/com/tonikelope/megabasterd/MainPanelView.java b/src/main/java/com/tonikelope/megabasterd/MainPanelView.java index 71b25c85e..ea6df5163 100644 --- a/src/main/java/com/tonikelope/megabasterd/MainPanelView.java +++ b/src/main/java/com/tonikelope/megabasterd/MainPanelView.java @@ -221,18 +221,19 @@ private void _new_upload_dialog(FileGrabberDialog dialog) { if (dialog.isUpload() && dialog.getFiles().size() > 0) { - MiscTools.GUIRun(() -> { - upload_status_bar.setIndeterminate(true); - upload_status_bar.setMaximum(getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().size() + dialog.getFiles().size()); - upload_status_bar.setVisible(true); - }); - getMain_panel().resumeUploads(); getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().addAll(dialog.getFiles()); getMain_panel().getUpload_manager().secureNotify(); + MiscTools.GUIRun(() -> { + upload_status_bar.setIndeterminate(true); + upload_status_bar.setValue(upload_status_bar.getMinimum()); + upload_status_bar.setMaximum(getMain_panel().getUpload_manager().getTransference_preprocess_global_queue().size() + getMain_panel().getUpload_manager().getTransference_preprocess_queue().size() + getMain_panel().getUpload_manager().getTransference_provision_queue().size()); + upload_status_bar.setVisible(true); + }); + final String mega_account = (String) dialog.getAccount_combobox().getSelectedItem(); final String base_path = dialog.getBase_path(); @@ -376,25 +377,12 @@ private void _new_upload_dialog(FileGrabberDialog dialog) { LOG.log(SEVERE, null, ex); } - - MiscTools.GUIRun(() -> { - upload_status_bar.setIndeterminate(false); - upload_status_bar.setValue(upload_status_bar.getValue() + 1); - }); - } } catch (Exception ex) { LOG.log(SEVERE, null, ex); } - - if (getMain_panel().getUpload_manager().getTransference_preprocess_queue().isEmpty()) { - MiscTools.GUIRun(() -> { - upload_status_bar.setValue(upload_status_bar.getMinimum()); - upload_status_bar.setVisible(false); - }); - } }; getMain_panel().getUpload_manager().getTransference_preprocess_queue().add(run); @@ -1100,11 +1088,6 @@ private void new_download_menuActionPerformed(java.awt.event.ActionEvent evt) {/ }); if (!urls.isEmpty()) { - MiscTools.GUIRun(() -> { - download_status_bar.setIndeterminate(true); - download_status_bar.setMaximum(getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().size() + urls.size()); - download_status_bar.setVisible(true); - }); Set folder_file_links = new HashSet(findAllRegex("(?:https?|mega)://[^\r\n]+#F\\*[^\r\n!]*?![^\r\n!]+![^\\?\r\n/]+", link_data, 0)); @@ -1112,6 +1095,13 @@ private void new_download_menuActionPerformed(java.awt.event.ActionEvent evt) {/ getMain_panel().getDownload_manager().secureNotify(); + MiscTools.GUIRun(() -> { + download_status_bar.setIndeterminate(true); + download_status_bar.setValue(download_status_bar.getMinimum()); + download_status_bar.setMaximum(getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().size() + getMain_panel().getDownload_manager().getTransference_preprocess_queue().size() + getMain_panel().getDownload_manager().getTransference_provision_queue().size()); + download_status_bar.setVisible(true); + }); + if (!folder_file_links.isEmpty()) { ArrayList nlinks = ma.GENERATE_N_LINKS(folder_file_links); @@ -1244,19 +1234,8 @@ private void new_download_menuActionPerformed(java.awt.event.ActionEvent evt) {/ Logger.getLogger(MainPanelView.class.getName()).log(Level.SEVERE, ex.getMessage()); } - MiscTools.GUIRun(() -> { - download_status_bar.setIndeterminate(false); - download_status_bar.setValue(upload_status_bar.getValue() + 1); - }); - } - if (getMain_panel().getDownload_manager().getTransference_preprocess_global_queue().isEmpty()) { - MiscTools.GUIRun(() -> { - download_status_bar.setValue(download_status_bar.getMinimum()); - download_status_bar.setVisible(false); - }); - } } else { MiscTools.GUIRun(() -> { new_download_menu.setEnabled(true); diff --git a/src/main/java/com/tonikelope/megabasterd/TransferenceManager.java b/src/main/java/com/tonikelope/megabasterd/TransferenceManager.java index 7bf601a9d..be886207c 100644 --- a/src/main/java/com/tonikelope/megabasterd/TransferenceManager.java +++ b/src/main/java/com/tonikelope/megabasterd/TransferenceManager.java @@ -30,8 +30,8 @@ */ abstract public class TransferenceManager implements Runnable, SecureSingleThreadNotifiable { - public static final int MAX_WAIT_QUEUE = 1000; - public static final int MAX_PROVISION_WORKERS = 25; + public static final int MAX_WAIT_QUEUE = 10000; + public static final int MAX_PROVISION_WORKERS = 50; private static final Logger LOG = Logger.getLogger(TransferenceManager.class.getName()); protected final ConcurrentLinkedQueue _transference_preprocess_global_queue; @@ -680,24 +680,6 @@ private void _updateView() { _status.setText(_genStatus()); - /*if (_transference_preprocess_queue.isEmpty() && !_transference_provision_queue.isEmpty()) { - - if (this instanceof DownloadManager) { - this._main_panel.getView().getDownload_status_bar().setIndeterminate(true); - this._main_panel.getView().getDownload_status_bar().setVisible(true); - } else { - this._main_panel.getView().getUpload_status_bar().setIndeterminate(true); - this._main_panel.getView().getUpload_status_bar().setVisible(true); - } - } else if (_transference_preprocess_queue.isEmpty()) { - if (this instanceof DownloadManager) { - this._main_panel.getView().getDownload_status_bar().setIndeterminate(false); - this._main_panel.getView().getDownload_status_bar().setVisible(false); - } else { - this._main_panel.getView().getUpload_status_bar().setIndeterminate(false); - this._main_panel.getView().getUpload_status_bar().setVisible(false); - } - }*/ _main_panel.getView().getUnfreeze_transferences_button().setVisible(_main_panel.getDownload_manager().hasFrozenTransferences() || _main_panel.getUpload_manager().hasFrozenTransferences()); _main_panel.getView().revalidate(); @@ -832,6 +814,24 @@ public void run() { try { bounded_executor.submitTask(() -> { provision(transference); + + if (this instanceof DownloadManager) { + MiscTools.GUIRun(() -> { + + _main_panel.getView().getDownload_status_bar().setIndeterminate(false); + _main_panel.getView().getDownload_status_bar().setValue(_main_panel.getView().getDownload_status_bar().getValue() + 1); + _main_panel.getView().getDownload_status_bar().setVisible((_main_panel.getView().getDownload_status_bar().getValue() < _main_panel.getView().getDownload_status_bar().getMaximum())); + + }); + } else { + MiscTools.GUIRun(() -> { + + _main_panel.getView().getUpload_status_bar().setIndeterminate(false); + _main_panel.getView().getUpload_status_bar().setValue(_main_panel.getView().getUpload_status_bar().getValue() + 1); + _main_panel.getView().getUpload_status_bar().setVisible((_main_panel.getView().getUpload_status_bar().getValue() < _main_panel.getView().getUpload_status_bar().getMaximum())); + + }); + } }); } catch (InterruptedException ex) { Logger.getLogger(TransferenceManager.class.getName()).log(Level.SEVERE, null, ex); diff --git a/src/main/resources/images/mbasterd_screen.png b/src/main/resources/images/mbasterd_screen.png index 02bd61a86..8ab844976 100644 Binary files a/src/main/resources/images/mbasterd_screen.png and b/src/main/resources/images/mbasterd_screen.png differ