This commit is contained in:
tonikelope 2016-10-07 14:19:48 +02:00
parent 31a1550d2e
commit a563690027
4 changed files with 67 additions and 45 deletions

View File

@ -56,7 +56,7 @@
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/> <Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/> <Component id="jPanel1" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="total_file_size_label" min="-2" max="-2" attributes="0"/> <Component id="total_file_size_label" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
@ -66,7 +66,7 @@
<Component id="skip_rest_button" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="skip_rest_button" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="skip_button" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="skip_button" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace max="32767" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="dance_button" min="-2" max="-2" attributes="0"/> <Component id="dance_button" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -91,7 +91,7 @@
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="file_tree_scrollpane" alignment="0" pref="290" max="32767" attributes="0"/> <Component id="file_tree_scrollpane" alignment="0" pref="275" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>

View File

@ -106,6 +106,8 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
swingReflectionInvoke("setEnabled", total_file_size_label, false); swingReflectionInvoke("setEnabled", total_file_size_label, false);
swingReflectionInvoke("setEnabled", skip_button, false); swingReflectionInvoke("setEnabled", skip_button, false);
swingReflectionInvoke("setEnabled", skip_rest_button, false); swingReflectionInvoke("setEnabled", skip_rest_button, false);
swingReflectionInvoke("setEnabled", dance_button, false);
swingReflectionInvoke("setEnabled", file_tree, false);
_main_panel = ((MainPanelView)parent).getMain_panel(); _main_panel = ((MainPanelView)parent).getMain_panel();
@ -116,13 +118,10 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
account_combobox.addItem((String)o); account_combobox.addItem((String)o);
} }
} else } else {
{
swingReflectionInvoke("setText", used_space_label, "No MEGA accounts available!!"); swingReflectionInvoke("setText", used_space_label, "No MEGA accounts available!!");
swingReflectionInvoke("setEnabled", dance_button, false);
swingReflectionInvoke("setEnabled", add_files_button, false); swingReflectionInvoke("setEnabled", add_files_button, false);
swingReflectionInvoke("setEnabled", add_folder_button, false); swingReflectionInvoke("setEnabled", add_folder_button, false);
swingReflectionInvoke("setEnabled", file_tree, false);
swingReflectionInvoke("setEnabled", dir_name_textfield, false); swingReflectionInvoke("setEnabled", dir_name_textfield, false);
} }
@ -174,7 +173,7 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
); );
jPanel1Layout.setVerticalGroup( jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 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 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() .addContainerGap()
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .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) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(total_file_size_label) .addComponent(total_file_size_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .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) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(skip_rest_button) .addComponent(skip_rest_button)
.addComponent(skip_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) .addComponent(dance_button)
.addContainerGap()) .addContainerGap())
); );
@ -376,6 +375,10 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
_genFileList(); _genFileList();
file_tree.setRootVisible(root.getChildCount() > 0); file_tree.setRootVisible(root.getChildCount() > 0);
swingReflectionInvoke("setEnabled", dance_button, true);
swingReflectionInvoke("setEnabled", file_tree, true);
} }
}//GEN-LAST:event_add_files_buttonActionPerformed }//GEN-LAST:event_add_files_buttonActionPerformed
@ -406,6 +409,10 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
_genFileList(); _genFileList();
file_tree.setRootVisible(root.getChildCount() > 0); file_tree.setRootVisible(root.getChildCount() > 0);
swingReflectionInvoke("setEnabled", dance_button, true);
swingReflectionInvoke("setEnabled", file_tree, true);
} }
}//GEN-LAST:event_add_folder_buttonActionPerformed }//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("setText", used_space_label, formatBytes(quota[0])+" / "+formatBytes(quota[1]));
swingReflectionInvoke("setEnabled", dance_button, true);
swingReflectionInvoke("setEnabled", add_files_button, true); swingReflectionInvoke("setEnabled", add_files_button, true);
swingReflectionInvoke("setEnabled", add_folder_button, true); swingReflectionInvoke("setEnabled", add_folder_button, true);
swingReflectionInvoke("setEnabled", file_tree, true);
swingReflectionInvoke("setEnabled", dir_name_textfield, 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", 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 { } else {
@ -666,23 +672,14 @@ public final class FileGrabberDialog extends javax.swing.JDialog {
} }
swingReflectionInvoke("setText", total_file_size_label, "["+formatBytes(_total_space)+"]"); swingReflectionInvoke("setText", total_file_size_label, "["+formatBytes(_total_space)+"]");
if(conta_files == 0) {
swingReflectionInvoke("setEnabled", dance_button, false); swingReflectionInvoke("setEnabled", dance_button, conta_files > 0);
swingReflectionInvoke("setEnabled", warning_label, false); swingReflectionInvoke("setEnabled", warning_label, conta_files > 0);
swingReflectionInvoke("setEnabled", skip_button, false); swingReflectionInvoke("setEnabled", skip_button, conta_files > 0);
swingReflectionInvoke("setEnabled", skip_rest_button, false); swingReflectionInvoke("setEnabled", skip_rest_button, conta_files > 0);
swingReflectionInvoke("setEnabled", total_file_size_label, false); 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 // Variables declaration - do not modify//GEN-BEGIN:variables

View File

@ -1,6 +1,7 @@
package megabasterd; package megabasterd;
import java.awt.AWTException; import java.awt.AWTException;
import java.awt.Color;
import static java.awt.EventQueue.invokeLater; import static java.awt.EventQueue.invokeLater;
import java.awt.Font; import java.awt.Font;
import static java.awt.Font.BOLD; import static java.awt.Font.BOLD;
@ -60,7 +61,7 @@ import static megabasterd.Transference.MAX_TRANSFERENCE_SPEED_DEFAULT;
*/ */
public final class MainPanel { 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 CONNECTION_TIMEOUT = 30000;
public static final int THROTTLE_SLICE_SIZE=16*1024; public static final int THROTTLE_SLICE_SIZE=16*1024;
public static final int STREAMER_PORT = 1337; public static final int STREAMER_PORT = 1337;
@ -139,6 +140,10 @@ public final class MainPanel {
THREAD_POOL.execute((_clipboardspy = new ClipboardSpy())); 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(); resumeDownloads();
resumeUploads(); resumeUploads();
@ -348,7 +353,7 @@ public final class MainPanel {
_limit_download_speed = LIMIT_TRANSFERENCE_SPEED_DEFAULT; _limit_download_speed = LIMIT_TRANSFERENCE_SPEED_DEFAULT;
} }
String limit_ul_speed = selectSettingValueFromDB("limit_upload_speed"); String limit_ul_speed = selectSettingValueFromDB("limit_upload_speed");
if(limit_ul_speed != null) { if(limit_ul_speed != null) {
@ -359,6 +364,7 @@ public final class MainPanel {
_limit_upload_speed = LIMIT_TRANSFERENCE_SPEED_DEFAULT; _limit_upload_speed = LIMIT_TRANSFERENCE_SPEED_DEFAULT;
} }
String max_download_speed = selectSettingValueFromDB("max_download_speed"); String max_download_speed = selectSettingValueFromDB("max_download_speed");
@ -367,7 +373,7 @@ public final class MainPanel {
} else { } else {
_max_dl_speed=MAX_TRANSFERENCE_SPEED_DEFAULT; _max_dl_speed=MAX_TRANSFERENCE_SPEED_DEFAULT;
} }
String max_upload_speed = selectSettingValueFromDB("max_upload_speed"); String max_upload_speed = selectSettingValueFromDB("max_upload_speed");
if(max_upload_speed != null) { if(max_upload_speed != null) {
@ -398,6 +404,7 @@ public final class MainPanel {
Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
} }
} }
} }
public void _byebye() { public void _byebye() {

View File

@ -148,8 +148,6 @@ public final class MainPanelView extends javax.swing.JFrame {
swingReflectionInvoke("setVisible", global_speed_down_label, false); swingReflectionInvoke("setVisible", global_speed_down_label, false);
swingReflectionInvoke("setVisible", global_speed_up_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_down_button, false);
swingReflectionInvoke("setVisible", close_all_finished_up_button, false); swingReflectionInvoke("setVisible", close_all_finished_up_button, false);
swingReflectionInvoke("setVisible", pause_all_down_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.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); _main_panel.getStream_supervisor().setMaxBytesPerSecInput(_main_panel.getMax_dl_speed()*1024);
swingReflectionInvoke("setForeground", global_speed_down_label, _main_panel.isLimit_download_speed()?new Color(255,0,0):new Color(0,128,255)); swingReflectionInvoke("setForeground", getGlobal_speed_down_label(), new Color(255,0,0));
swingReflectionInvoke("setForeground", global_speed_up_label, _main_panel.isLimit_upload_speed()?new Color(255,0,0):new Color(0,128,255));
} 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.getDownload_manager().setMax_running_trans(_main_panel.getMax_dl());
_main_panel.getUpload_manager().setMax_running_trans(_main_panel.getMax_ul()); _main_panel.getUpload_manager().setMax_running_trans(_main_panel.getMax_ul());
_main_panel.getDownload_manager().secureNotify(); _main_panel.getDownload_manager().secureNotify();
_main_panel.getUpload_manager().secureNotify(); _main_panel.getUpload_manager().secureNotify();