diff --git a/src/megabasterd/FileGrabberDialog.form b/src/megabasterd/FileGrabberDialog.form index ef23ec2c7..5d06b3ee7 100644 --- a/src/megabasterd/FileGrabberDialog.form +++ b/src/megabasterd/FileGrabberDialog.form @@ -56,7 +56,7 @@ - + @@ -66,7 +66,7 @@ - + @@ -91,7 +91,7 @@ - + diff --git a/src/megabasterd/FileGrabberDialog.java b/src/megabasterd/FileGrabberDialog.java index 7e2714a16..77528442d 100644 --- a/src/megabasterd/FileGrabberDialog.java +++ b/src/megabasterd/FileGrabberDialog.java @@ -106,6 +106,8 @@ public final class FileGrabberDialog extends javax.swing.JDialog { swingReflectionInvoke("setEnabled", total_file_size_label, false); swingReflectionInvoke("setEnabled", skip_button, false); swingReflectionInvoke("setEnabled", skip_rest_button, false); + swingReflectionInvoke("setEnabled", dance_button, false); + swingReflectionInvoke("setEnabled", file_tree, false); _main_panel = ((MainPanelView)parent).getMain_panel(); @@ -116,13 +118,10 @@ public final class FileGrabberDialog extends javax.swing.JDialog { account_combobox.addItem((String)o); } - } else - { + } else { swingReflectionInvoke("setText", used_space_label, "No MEGA accounts available!!"); - swingReflectionInvoke("setEnabled", dance_button, false); swingReflectionInvoke("setEnabled", add_files_button, false); swingReflectionInvoke("setEnabled", add_folder_button, false); - swingReflectionInvoke("setEnabled", file_tree, false); swingReflectionInvoke("setEnabled", dir_name_textfield, false); } @@ -174,7 +173,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog { ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(file_tree_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 290, Short.MAX_VALUE) + .addComponent(file_tree_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE) ); upload_name_label.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N @@ -324,7 +323,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog { .addContainerGap() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(total_file_size_label) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) @@ -333,7 +332,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog { .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(skip_rest_button) .addComponent(skip_button)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(18, 18, 18) .addComponent(dance_button) .addContainerGap()) ); @@ -376,6 +375,10 @@ public final class FileGrabberDialog extends javax.swing.JDialog { _genFileList(); file_tree.setRootVisible(root.getChildCount() > 0); + + swingReflectionInvoke("setEnabled", dance_button, true); + + swingReflectionInvoke("setEnabled", file_tree, true); } }//GEN-LAST:event_add_files_buttonActionPerformed @@ -406,6 +409,10 @@ public final class FileGrabberDialog extends javax.swing.JDialog { _genFileList(); file_tree.setRootVisible(root.getChildCount() > 0); + + swingReflectionInvoke("setEnabled", dance_button, true); + + swingReflectionInvoke("setEnabled", file_tree, true); } }//GEN-LAST:event_add_folder_buttonActionPerformed @@ -541,17 +548,16 @@ public final class FileGrabberDialog extends javax.swing.JDialog { } swingReflectionInvoke("setText", used_space_label, formatBytes(quota[0])+" / "+formatBytes(quota[1])); - - swingReflectionInvoke("setEnabled", dance_button, true); swingReflectionInvoke("setEnabled", add_files_button, true); swingReflectionInvoke("setEnabled", add_folder_button, true); - swingReflectionInvoke("setEnabled", file_tree, true); swingReflectionInvoke("setEnabled", dir_name_textfield, true); - swingReflectionInvoke("setEnabled", total_file_size_label, true); - swingReflectionInvoke("setEnabled", skip_button, true); - swingReflectionInvoke("setEnabled", skip_rest_button, true); - swingReflectionInvoke("setEnabled", warning_label, true); swingReflectionInvoke("setEnabled", account_combobox, true); + swingReflectionInvoke("setEnabled", warning_label, ((TreeNode)file_tree.getModel().getRoot()).getChildCount()>0); + swingReflectionInvoke("setEnabled", dance_button, ((TreeNode)file_tree.getModel().getRoot()).getChildCount()>0); + swingReflectionInvoke("setEnabled", file_tree, ((TreeNode)file_tree.getModel().getRoot()).getChildCount()>0); + swingReflectionInvoke("setEnabled", total_file_size_label, ((TreeNode)file_tree.getModel().getRoot()).getChildCount()>0); + swingReflectionInvoke("setEnabled", skip_button, ((TreeNode)file_tree.getModel().getRoot()).getChildCount()>0); + swingReflectionInvoke("setEnabled", skip_rest_button, ((TreeNode)file_tree.getModel().getRoot()).getChildCount()>0); } else { @@ -666,23 +672,14 @@ public final class FileGrabberDialog extends javax.swing.JDialog { } swingReflectionInvoke("setText", total_file_size_label, "["+formatBytes(_total_space)+"]"); - - if(conta_files == 0) { - swingReflectionInvoke("setEnabled", dance_button, false); - swingReflectionInvoke("setEnabled", warning_label, false); - swingReflectionInvoke("setEnabled", skip_button, false); - swingReflectionInvoke("setEnabled", skip_rest_button, false); - swingReflectionInvoke("setEnabled", total_file_size_label, false); + swingReflectionInvoke("setEnabled", dance_button, conta_files > 0); + swingReflectionInvoke("setEnabled", warning_label, conta_files > 0); + swingReflectionInvoke("setEnabled", skip_button, conta_files > 0); + swingReflectionInvoke("setEnabled", skip_rest_button, conta_files > 0); + swingReflectionInvoke("setEnabled", total_file_size_label, conta_files > 0); + swingReflectionInvoke("setEnabled", file_tree, conta_files > 0); - } else { - - swingReflectionInvoke("setEnabled", dance_button, true); - swingReflectionInvoke("setEnabled", warning_label, true); - swingReflectionInvoke("setEnabled", skip_button, true); - swingReflectionInvoke("setEnabled", skip_rest_button, true); - swingReflectionInvoke("setEnabled", total_file_size_label, true); - } } // Variables declaration - do not modify//GEN-BEGIN:variables diff --git a/src/megabasterd/MainPanel.java b/src/megabasterd/MainPanel.java index b625b3e20..68416af4d 100644 --- a/src/megabasterd/MainPanel.java +++ b/src/megabasterd/MainPanel.java @@ -1,6 +1,7 @@ package megabasterd; import java.awt.AWTException; +import java.awt.Color; import static java.awt.EventQueue.invokeLater; import java.awt.Font; import static java.awt.Font.BOLD; @@ -60,7 +61,7 @@ import static megabasterd.Transference.MAX_TRANSFERENCE_SPEED_DEFAULT; */ public final class MainPanel { - public static final String VERSION="1.16"; + public static final String VERSION="1.17"; public static final int CONNECTION_TIMEOUT = 30000; public static final int THROTTLE_SLICE_SIZE=16*1024; public static final int STREAMER_PORT = 1337; @@ -139,6 +140,10 @@ public final class MainPanel { THREAD_POOL.execute((_clipboardspy = new ClipboardSpy())); + swingReflectionInvoke("setForeground", getView().getGlobal_speed_down_label(), _limit_download_speed?new Color(255,0,0):new Color(0,128,255)); + + swingReflectionInvoke("setForeground", getView().getGlobal_speed_up_label(), _limit_upload_speed?new Color(255,0,0):new Color(0,128,255)); + resumeDownloads(); resumeUploads(); @@ -348,7 +353,7 @@ public final class MainPanel { _limit_download_speed = LIMIT_TRANSFERENCE_SPEED_DEFAULT; } - + String limit_ul_speed = selectSettingValueFromDB("limit_upload_speed"); if(limit_ul_speed != null) { @@ -359,6 +364,7 @@ public final class MainPanel { _limit_upload_speed = LIMIT_TRANSFERENCE_SPEED_DEFAULT; } + String max_download_speed = selectSettingValueFromDB("max_download_speed"); @@ -367,7 +373,7 @@ public final class MainPanel { } else { _max_dl_speed=MAX_TRANSFERENCE_SPEED_DEFAULT; } - + String max_upload_speed = selectSettingValueFromDB("max_upload_speed"); if(max_upload_speed != null) { @@ -398,6 +404,7 @@ public final class MainPanel { Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex); } } + } public void _byebye() { diff --git a/src/megabasterd/MainPanelView.java b/src/megabasterd/MainPanelView.java index d6e87c5cb..007d39bcf 100644 --- a/src/megabasterd/MainPanelView.java +++ b/src/megabasterd/MainPanelView.java @@ -148,8 +148,6 @@ public final class MainPanelView extends javax.swing.JFrame { swingReflectionInvoke("setVisible", global_speed_down_label, false); swingReflectionInvoke("setVisible", global_speed_up_label, false); - swingReflectionInvoke("setForeground", global_speed_down_label, getMain_panel().isLimit_download_speed()?new Color(255,0,0):new Color(0,128,255)); - swingReflectionInvoke("setForeground", global_speed_up_label, getMain_panel().isLimit_upload_speed()?new Color(255,0,0):new Color(0,128,255)); swingReflectionInvoke("setVisible", close_all_finished_down_button, false); swingReflectionInvoke("setVisible", close_all_finished_up_button, false); swingReflectionInvoke("setVisible", pause_all_down_button, false); @@ -615,18 +613,38 @@ public final class MainPanelView extends javax.swing.JFrame { _main_panel.loadUserSettings(); - _main_panel.getStream_supervisor().setMaxBytesPerSecInput(_main_panel.isLimit_download_speed()?_main_panel.getMax_dl_speed()*1024:0); + if(_main_panel.isLimit_download_speed()) { - _main_panel.getStream_supervisor().setMaxBytesPerSecOutput( _main_panel.isLimit_upload_speed()?_main_panel.getMax_up_speed()*1024:0); - - swingReflectionInvoke("setForeground", global_speed_down_label, _main_panel.isLimit_download_speed()?new Color(255,0,0):new Color(0,128,255)); - - swingReflectionInvoke("setForeground", global_speed_up_label, _main_panel.isLimit_upload_speed()?new Color(255,0,0):new Color(0,128,255)); + _main_panel.getStream_supervisor().setMaxBytesPerSecInput(_main_panel.getMax_dl_speed()*1024); + + swingReflectionInvoke("setForeground", getGlobal_speed_down_label(), new Color(255,0,0)); + } else { + + _main_panel.getStream_supervisor().setMaxBytesPerSecInput(0); + + swingReflectionInvoke("setForeground", getGlobal_speed_down_label(), new Color(0,128,255)); + + } + + if(_main_panel.isLimit_upload_speed()) { + + _main_panel.getStream_supervisor().setMaxBytesPerSecOutput(_main_panel.getMax_up_speed()*1024); + + swingReflectionInvoke("setForeground", getGlobal_speed_up_label(), new Color(255,0,0)); + + } else { + + _main_panel.getStream_supervisor().setMaxBytesPerSecOutput(0); + + swingReflectionInvoke("setForeground", getGlobal_speed_up_label(), new Color(0,128,255)); + + } + _main_panel.getDownload_manager().setMax_running_trans(_main_panel.getMax_dl()); - + _main_panel.getUpload_manager().setMax_running_trans(_main_panel.getMax_ul()); - + _main_panel.getDownload_manager().secureNotify(); _main_panel.getUpload_manager().secureNotify();