-Minor changes
This commit is contained in:
tonikelope 2017-03-16 14:08:16 +01:00
parent aa1ad8187c
commit 0b72eb959a
22 changed files with 214 additions and 240 deletions

View File

@ -105,7 +105,7 @@ public class ChunkUploader implements Runnable, SecureSingleThreadNotifiable {
@Override
public void run() {
System.out.println("ChunkUploader " + getId() + " hello! "+ getUpload().getFile_name());
System.out.println("ChunkUploader " + getId() + " hello! " + getUpload().getFile_name());
String worker_url = _upload.getUl_url();
Chunk chunk;
@ -238,9 +238,9 @@ public class ChunkUploader implements Runnable, SecureSingleThreadNotifiable {
if (response.length() > 0) {
if (MegaAPI.checkMEGAError(response) != 0) {
System.out.println("UPLOAD FAILED! (MEGA ERROR: " + MegaAPI.checkMEGAError(response) + ")");
error = true;
} else {

View File

@ -46,7 +46,7 @@ public class ChunkUploaderMono extends ChunkUploader {
@Override
public void run() {
System.out.println("ChunkUploaderMONO " + getId() + " hello! "+ getUpload().getFile_name());
System.out.println("ChunkUploaderMONO " + getId() + " hello! " + getUpload().getFile_name());
String worker_url = getUpload().getUl_url();
Chunk chunk;
@ -165,9 +165,9 @@ public class ChunkUploaderMono extends ChunkUploader {
} else if (!error) {
System.out.println(" Worker " + getId() + " ha subido chunk " + chunk.getId());
System.out.println(chunk.getOffset()+" "+ tot_bytes_up + " "+ getUpload().getFile_size());
System.out.println(chunk.getOffset() + " " + tot_bytes_up + " " + getUpload().getFile_size());
if (chunk.getOffset() + tot_bytes_up < getUpload().getFile_size()) {
getUpload().getMac_generator().getChunk_queue().put(chunk.getId(), chunk);
@ -246,7 +246,7 @@ public class ChunkUploaderMono extends ChunkUploader {
getUpload().getMac_generator().secureNotify();
}
} else {
throw new IOException("UPLOAD FAILED! (UPLOAD RESPONSE IS EMPTY)");
}
}

View File

@ -74,7 +74,6 @@ public final class ChunkWriter implements Runnable, SecureSingleThreadNotifiable
}
}
public byte[] getByte_file_key() {
return _byte_file_key;
}

View File

@ -85,7 +85,6 @@ public final class ClipboardSpy implements Runnable, ClipboardOwner, SecureSingl
}
}
@Override
public void run() {

View File

@ -58,7 +58,7 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
public static final Object CBC_LOCK = new Object();
public static final boolean USE_SLOTS_DEFAULT = false;
public static final int WORKERS_DEFAULT = 6;
private final MainPanel _main_panel;
private volatile DownloadView _view = null; //lazy init
private volatile SpeedMeter _speed_meter = null; //lazy init
@ -1011,13 +1011,13 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
_finishing_download = true;
if(_use_slots) {
if (_use_slots) {
swingReflectionInvoke("setEnabled", getView().getSlots_spinner(), false);
swingReflectionInvokeAndWait("setValue", getView().getSlots_spinner(), (int) swingReflectionInvokeAndWaitForReturn("getValue", getView().getSlots_spinner()) - 1);
}
} else if (!_finishing_download && _use_slots) {
swingReflectionInvoke("setEnabled", getView().getSlots_spinner(), true);
@ -1031,8 +1031,8 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
swingReflectionInvoke("setEnabled", getView().getPause_button(), true);
}
if(_use_slots) {
if (_use_slots) {
getView().updateSlotsStatus();
}
}
@ -1417,8 +1417,6 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
}
}
@Override
public void setProgress(long progress) {

View File

@ -328,10 +328,10 @@ public final class DownloadView extends javax.swing.JPanel implements Transferen
@Override
public void run() {
if(_download.isUse_slots()) {
_download.checkSlotsAndWorkers();
if (_download.isUse_slots()) {
_download.checkSlotsAndWorkers();
}
}
});
}//GEN-LAST:event_slots_spinnerStateChanged

View File

@ -48,8 +48,6 @@ public final class GlobalSpeedMeter implements Runnable, SecureSingleThreadNotif
}
}
public void attachSpeedMeter(SpeedMeter speed) {
_speedmeters.add(speed);
}

View File

@ -97,8 +97,6 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
}
}
public void start(int port, String context) throws IOException {
swingReflectionInvoke("setForeground", _main_panel.getView().getKiss_server_status(), new Color(0, 128, 0));
@ -149,16 +147,16 @@ public final class KissVideoStreamServer implements HttpHandler, SecureSingleThr
}
String status;
if(conta_info > 0 || conta_connect > 0 || conta_stream > 0 || conta_retry > 0) {
if (conta_info > 0 || conta_connect > 0 || conta_stream > 0 || conta_retry > 0) {
status = "Kissvideostreamer on localhost:" + STREAMER_PORT + " Info: " + conta_info + " / Conn: " + conta_connect + " / Stream: " + conta_stream + " / Retry: " + conta_retry;
} else {
status = "Kissvideostreamer on localhost:" + STREAMER_PORT + " (Waiting for request...)";
}
swingReflectionInvoke("setText", _main_panel.getView().getKiss_server_status(), status);
}

View File

@ -61,7 +61,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
*/
public final class MainPanel {
public static final String VERSION = "1.78";
public static final String VERSION = "1.79";
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int STREAMER_PORT = 1337;
public static final int WATCHDOG_PORT = 1338;

View File

@ -260,7 +260,7 @@ public final class MiscTools {
}
public static void updateFont(javax.swing.JComponent label, Font font, int layout) {
label.setFont(font.deriveFont(layout, (float)Math.floor(label.getFont().getSize()*FONT_ZOOM_DEFAULT)));
label.setFont(font.deriveFont(layout, (float) Math.floor(label.getFont().getSize() * FONT_ZOOM_DEFAULT)));
}
public static String HashString(String algo, String data) throws NoSuchAlgorithmException, UnsupportedEncodingException {

View File

@ -51,7 +51,6 @@ public final class ProgressMeter implements Runnable, SecureSingleThreadNotifiab
}
}
@Override
public void run() {
System.out.println("ProgressMeter hello!");

View File

@ -104,44 +104,47 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jSeparator1" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jSeparator3" max="32767" attributes="0"/>
<Component id="jSeparator1" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="change_download_dir_button" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="default_dir_label" max="32767" attributes="0"/>
</Group>
<Component id="jSeparator2" alignment="0" max="32767" attributes="0"/>
<Component id="jSeparator3" alignment="0" max="32767" attributes="0"/>
<Component id="jSeparator4" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="verify_file_down_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="max_down_speed_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="limit_download_speed_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
<Component id="max_down_speed_spinner" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="max_downloads_label" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="79" max="-2" attributes="0"/>
<Component id="max_downloads_spinner" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="default_slots_down_label" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="default_slots_down_spinner" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="down_dir_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="multi_slot_down_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="rec_download_slots_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="limit_download_speed_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="max_downloads_label" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="120" max="-2" attributes="0"/>
<Component id="max_downloads_spinner" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="max_down_speed_label" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="max_down_speed_spinner" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="default_slots_down_label" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="default_slots_down_spinner" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</Group>
<EmptySpace min="0" pref="221" max="32767" attributes="0"/>
</Group>
@ -169,7 +172,7 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator2" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="multi_slot_down_checkbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@ -181,19 +184,17 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator3" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="limit_download_speed_checkbox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="max_down_speed_label" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="max_down_speed_spinner" min="-2" max="-2" attributes="0"/>
<Component id="limit_download_speed_checkbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="max_down_speed_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="max_down_speed_label" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator4" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="verify_file_down_checkbox" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="139" max="32767" attributes="0"/>
<EmptySpace pref="151" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -324,7 +325,7 @@
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="DejaVu Sans" size="16" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Note: it is recommended to disable MULTI SLOT."/>
<Property name="text" type="java.lang.String" value="Note: it is recommended not to enable MULTI SLOT."/>
</Properties>
</Component>
</SubComponents>
@ -348,27 +349,28 @@
<Component id="jSeparator6" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="multi_slot_up_checkbox" min="-2" max="-2" attributes="0"/>
<Component id="rec_upload_slots_label" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="multi_slot_up_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Component id="rec_upload_slots_label" alignment="0" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="default_slots_up_label" min="-2" max="-2" attributes="0"/>
<Component id="max_uploads_label" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
<Component id="default_slots_up_label" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="default_slots_up_spinner" min="-2" max="-2" attributes="0"/>
<Component id="max_uploads_spinner" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="default_slots_up_spinner" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="max_uploads_label" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="120" max="-2" attributes="0"/>
<Component id="max_uploads_spinner" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="limit_upload_speed_checkbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
<Component id="max_up_speed_label" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="174" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="98" max="-2" attributes="0"/>
<Component id="max_up_speed_spinner" min="-2" pref="100" max="-2" attributes="0"/>
</Group>
<Component id="limit_upload_speed_checkbox" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="285" max="32767" attributes="0"/>
</Group>
@ -387,12 +389,12 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator5" min="-2" pref="10" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="multi_slot_up_checkbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="default_slots_up_label" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="default_slots_up_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="default_slots_up_label" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="rec_upload_slots_label" min="-2" max="-2" attributes="0"/>
@ -405,7 +407,7 @@
<Component id="max_up_speed_label" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="max_up_speed_spinner" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="278" max="32767" attributes="0"/>
<EmptySpace pref="290" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -769,7 +771,7 @@
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="proxy_panel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="299" max="32767" attributes="0"/>
<EmptySpace pref="327" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -999,7 +1001,7 @@
<Font name="Dialog" size="20" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="9" green="7e" red="eb" type="rgb"/>
<Color blue="eb" green="6d" red="9" type="rgb"/>
</Property>
<Property name="doubleBuffered" type="boolean" value="true"/>
</Properties>

View File

@ -599,44 +599,46 @@ public final class SettingsDialog extends javax.swing.JDialog {
default_dir_label.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
rec_download_slots_label.setFont(new java.awt.Font("DejaVu Sans", 0, 16)); // NOI18N
rec_download_slots_label.setText("Note: it is recommended to disable MULTI SLOT.");
rec_download_slots_label.setText("Note: it is recommended not to enable MULTI SLOT.");
javax.swing.GroupLayout downloads_panelLayout = new javax.swing.GroupLayout(downloads_panel);
downloads_panel.setLayout(downloads_panelLayout);
downloads_panelLayout.setHorizontalGroup(
downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, downloads_panelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSeparator3)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, downloads_panelLayout.createSequentialGroup()
.addComponent(change_download_dir_button)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(default_dir_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jSeparator2)
.addComponent(jSeparator3)
.addComponent(jSeparator4)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, downloads_panelLayout.createSequentialGroup()
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(verify_file_down_checkbox)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(max_down_speed_label)
.addComponent(limit_download_speed_checkbox))
.addGap(34, 34, 34)
.addComponent(max_down_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(down_dir_label)
.addComponent(multi_slot_down_checkbox)
.addComponent(rec_download_slots_label)
.addComponent(limit_download_speed_checkbox)
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addComponent(max_downloads_label)
.addGap(79, 79, 79)
.addGap(120, 120, 120)
.addComponent(max_downloads_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(downloads_panelLayout.createSequentialGroup()
.addComponent(default_slots_down_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(default_slots_down_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(down_dir_label)
.addComponent(multi_slot_down_checkbox)
.addComponent(rec_download_slots_label))
.addGap(12, 12, 12)
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addComponent(max_down_speed_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(max_down_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(downloads_panelLayout.createSequentialGroup()
.addComponent(default_slots_down_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(default_slots_down_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addGap(0, 221, Short.MAX_VALUE)))
.addContainerGap())
);
@ -657,7 +659,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addComponent(max_downloads_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(8, 8, 8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(multi_slot_down_checkbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
@ -668,17 +670,16 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(4, 4, 4)
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(downloads_panelLayout.createSequentialGroup()
.addComponent(limit_download_speed_checkbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(max_down_speed_label))
.addComponent(max_down_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(15, 15, 15)
.addComponent(limit_download_speed_checkbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(downloads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(max_down_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(max_down_speed_label))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(3, 3, 3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(verify_file_down_checkbox)
.addContainerGap(139, Short.MAX_VALUE))
.addContainerGap(151, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Downloads", downloads_panel);
@ -734,22 +735,24 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addComponent(jSeparator6)
.addGroup(uploads_panelLayout.createSequentialGroup()
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(rec_upload_slots_label)
.addComponent(multi_slot_up_checkbox)
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(rec_upload_slots_label, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(uploads_panelLayout.createSequentialGroup()
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(default_slots_up_label)
.addComponent(max_uploads_label))
.addGap(12, 12, 12)
.addComponent(default_slots_up_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(default_slots_up_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(max_uploads_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(limit_upload_speed_checkbox)
.addComponent(default_slots_up_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(uploads_panelLayout.createSequentialGroup()
.addComponent(max_uploads_label)
.addGap(120, 120, 120)
.addComponent(max_uploads_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(uploads_panelLayout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(max_up_speed_label)
.addGap(174, 174, 174)
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(98, 98, 98)
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(limit_upload_speed_checkbox))
.addGap(0, 285, Short.MAX_VALUE)))
.addContainerGap())
);
@ -762,12 +765,12 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addComponent(max_uploads_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(2, 2, 2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(multi_slot_up_checkbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(default_slots_up_label)
.addComponent(default_slots_up_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(default_slots_up_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(default_slots_up_label))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rec_upload_slots_label)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -778,7 +781,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addGroup(uploads_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(max_up_speed_label)
.addComponent(max_up_speed_spinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(278, Short.MAX_VALUE))
.addContainerGap(290, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Uploads", uploads_panel);
@ -1100,13 +1103,13 @@ public final class SettingsDialog extends javax.swing.JDialog {
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(proxy_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(299, Short.MAX_VALUE))
.addContainerGap(327, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Advanced", jPanel1);
status.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
status.setForeground(new java.awt.Color(235, 126, 9));
status.setForeground(new java.awt.Color(9, 109, 235));
status.setDoubleBuffered(true);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
@ -1382,7 +1385,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
password = Bin2BASE64(CryptTools.aes_cbc_encrypt_pkcs7(pass.getBytes(), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
password_aes = Bin2BASE64(CryptTools.aes_cbc_encrypt_pkcs7(i32a2bin(ma.getPassword_aes()), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
user_hash = Bin2BASE64(CryptTools.aes_cbc_encrypt_pkcs7(MiscTools.UrlBASE642Bin(ma.getUser_hash()), _main_panel.getMaster_pass(), CryptTools.AES_ZERO_IV));
}
@ -1556,19 +1559,6 @@ public final class SettingsDialog extends javax.swing.JDialog {
}
}//GEN-LAST:event_limit_download_speed_checkboxStateChanged
private void limit_upload_speed_checkboxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_limit_upload_speed_checkboxStateChanged
if (!limit_upload_speed_checkbox.isSelected()) {
max_up_speed_label.setEnabled(false);
max_up_speed_spinner.setEnabled(false);
} else {
max_up_speed_label.setEnabled(true);
max_up_speed_spinner.setEnabled(true);
}
}//GEN-LAST:event_limit_upload_speed_checkboxStateChanged
private void encrypt_pass_checkboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_encrypt_pass_checkboxActionPerformed
encrypt_pass_checkbox.setEnabled(false);
@ -1963,10 +1953,23 @@ public final class SettingsDialog extends javax.swing.JDialog {
}//GEN-LAST:event_use_proxy_checkboxStateChanged
private void limit_upload_speed_checkboxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_limit_upload_speed_checkboxStateChanged
if (!limit_upload_speed_checkbox.isSelected()) {
max_up_speed_label.setEnabled(false);
max_up_speed_spinner.setEnabled(false);
} else {
max_up_speed_label.setEnabled(true);
max_up_speed_spinner.setEnabled(true);
}
}//GEN-LAST:event_limit_upload_speed_checkboxStateChanged
private void multi_slot_up_checkboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multi_slot_up_checkboxActionPerformed
// TODO add your handling code here:
if (!multi_slot_up_checkbox.isSelected()) {
if (!multi_slot_up_checkbox.isSelected()) {
default_slots_up_spinner.setEnabled(false);
default_slots_up_label.setEnabled(false);
@ -1976,7 +1979,7 @@ public final class SettingsDialog extends javax.swing.JDialog {
default_slots_up_spinner.setEnabled(true);
default_slots_up_label.setEnabled(true);
}
}//GEN-LAST:event_multi_slot_up_checkboxActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables

View File

@ -54,8 +54,6 @@ public final class SpeedMeter implements Runnable, SecureSingleThreadNotifiable
}
}
public void setExit(boolean exit) {
_exit = exit;
}

View File

@ -22,21 +22,21 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureMultiThr
private volatile int _maxBytesPerSecInput;
private volatile int _maxBytesPerSecOutput;
private volatile boolean _queue_swapping;
private final Object _secure_notify_lock;
private final Object _timer_lock;
private final ConcurrentHashMap <Thread,Boolean> _notified_threads;
private final ConcurrentHashMap<Thread, Boolean> _notified_threads;
public StreamThrottlerSupervisor(int maxBytesPerSecInput, int maxBytesPerSecOutput, int slice_size) {
_secure_notify_lock = new Object();
_timer_lock = new Object();
_queue_swapping = false;
_maxBytesPerSecInput = maxBytesPerSecInput;
@ -48,7 +48,7 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureMultiThr
_input_slice_queue = new ConcurrentLinkedQueue<>();
_output_slice_queue = new ConcurrentLinkedQueue<>();
_notified_threads = new ConcurrentHashMap<>();
}
@ -80,20 +80,19 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureMultiThr
public boolean isQueue_swapping() {
return _queue_swapping;
}
@Override
public void secureWait() {
synchronized (_secure_notify_lock) {
Thread current_thread = Thread.currentThread();
if(!_notified_threads.containsKey(current_thread)) {
if (!_notified_threads.containsKey(current_thread)) {
_notified_threads.put(current_thread, false);
}
while (!_notified_threads.get(current_thread)) {
try {
@ -112,8 +111,8 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureMultiThr
synchronized (_secure_notify_lock) {
for(Map.Entry<Thread, Boolean> entry: _notified_threads.entrySet()) {
for (Map.Entry<Thread, Boolean> entry : _notified_threads.entrySet()) {
entry.setValue(true);
}
@ -123,55 +122,54 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureMultiThr
@Override
public void run() {
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run()
{
public void run() {
synchronized (_timer_lock) {
_timer_lock.notify();
}
}
};
ConcurrentLinkedQueue<Integer> old_input_queue, new_input_queue, old_output_queue, new_output_queue;
old_input_queue = new ConcurrentLinkedQueue<>();
old_output_queue = new ConcurrentLinkedQueue<>();
new_input_queue = _resetSliceQueue(old_input_queue, _maxBytesPerSecInput);
new_output_queue = _resetSliceQueue(old_output_queue, _maxBytesPerSecOutput);
timer.schedule(task, 0, 1000);
while (true) {
_queue_swapping = true;
old_input_queue = _input_slice_queue;
old_output_queue = _output_slice_queue;
_input_slice_queue = new_input_queue;
_output_slice_queue = new_output_queue;
_queue_swapping = false;
secureNotifyAll();
new_input_queue = _resetSliceQueue(old_input_queue, _maxBytesPerSecInput);
new_output_queue = _resetSliceQueue(old_output_queue, _maxBytesPerSecOutput);
synchronized (_timer_lock) {
try {
_timer_lock.wait();
} catch (InterruptedException ex) {
@ -180,11 +178,11 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureMultiThr
}
}
}
private ConcurrentLinkedQueue<Integer> _resetSliceQueue(ConcurrentLinkedQueue<Integer> queue, int max_bytes) {
if(max_bytes > 0) {
if (max_bytes > 0) {
queue.clear();
int slice_num = (int) Math.floor((double) max_bytes / _slice_size);
@ -198,8 +196,8 @@ public final class StreamThrottlerSupervisor implements Runnable, SecureMultiThr
queue.add(max_bytes % _slice_size);
}
}
return queue;
}
}

View File

@ -4,15 +4,12 @@ import java.awt.Dialog;
import java.awt.Font;
import java.awt.event.WindowEvent;
import static java.awt.event.WindowEvent.WINDOW_CLOSING;
import java.io.IOException;
import java.util.HashSet;
import java.util.logging.Level;
import java.util.logging.Logger;
import static java.util.logging.Logger.getLogger;
import javax.swing.JOptionPane;
import static megabasterd.MainPanel.FONT_DEFAULT;
import static megabasterd.MainPanel.THREAD_POOL;
import static megabasterd.MiscTools.deflateURL;
import static megabasterd.MiscTools.extractFirstMegaLinkFromString;
import static megabasterd.MiscTools.extractStringFromClipboardContents;
import static megabasterd.MiscTools.findFirstRegex;
@ -188,19 +185,10 @@ public final class StreamerDialog extends javax.swing.JDialog implements Clipboa
} else {
try {
MiscTools.copyTextToClipboard(deflateURL(stream_link));
JOptionPane.showMessageDialog(tthis, "Streaming link was copied to clipboard!\n(Remember to keep MegaBasterd running in background while playing)");
dispose();
getParent().dispatchEvent(new WindowEvent(tthis, WINDOW_CLOSING));
} catch (IOException ex) {
Logger.getLogger(StreamerDialog.class.getName()).log(Level.SEVERE, null, ex);
}
MiscTools.copyTextToClipboard(stream_link);
JOptionPane.showMessageDialog(tthis, "Streaming link was copied to clipboard!\n(Remember to keep MegaBasterd running in background while playing)");
dispose();
getParent().dispatchEvent(new WindowEvent(tthis, WINDOW_CLOSING));
}
}

View File

@ -203,13 +203,13 @@ public final class ThrottledInputStream extends InputStream {
if (_slice_size != null && size < _slice_size) {
if(!_stream_supervisor.isQueue_swapping()) {
if (!_stream_supervisor.isQueue_swapping()) {
_stream_supervisor.getInput_slice_queue().add(_slice_size - size);
_stream_supervisor.secureNotifyAll();
}
_slice_size = size;
}
}

View File

@ -83,13 +83,13 @@ public final class ThrottledOutputStream extends OutputStream {
if (slice_size != null && size < slice_size) {
if(!_stream_supervisor.isQueue_swapping()) {
if (!_stream_supervisor.isQueue_swapping()) {
_stream_supervisor.getOutput_slice_queue().add(slice_size - size);
_stream_supervisor.secureNotifyAll();
}
slice_size = size;
}
}

View File

@ -146,8 +146,6 @@ abstract public class TransferenceManager implements Runnable, SecureSingleThrea
}
}
public MainPanel getMain_panel() {
return _main_panel;
}

View File

@ -367,8 +367,6 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
}
}
public void provisionIt() {
printStatus("Provisioning upload, please wait...");
@ -455,7 +453,7 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
} else {
printStatus("Waiting to start...");
printStatus("Waiting to start (" + _ma.getEmail() + ") ...");
swingReflectionInvoke("setVisible", getView().getFile_name_label(), true);
@ -598,7 +596,7 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
_chunkworkers.add(c);
try {
System.out.println("Lanzando chunkuploader desde startslot()...");
_thread_pool.execute(c);
@ -722,8 +720,8 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
_chunkworkers.add(c);
System.out.println("Lanzando chunkuploader"+t+" ...");
System.out.println("Lanzando chunkuploader" + t + " ...");
_thread_pool.execute(c);
}
@ -757,9 +755,9 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
swingReflectionInvoke("setVisible", getView().getProgress_pbar(), true);
secureWait();
System.out.println("Uploader llamando a shutdown del pool...");
_thread_pool.shutdown();
System.out.println("Chunkuploaders finished!");
@ -949,15 +947,15 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
public void stopThisSlot(ChunkUploader chunkuploader) {
synchronized (_workers_lock) {
if (_chunkworkers.remove(chunkuploader) && !_exit) {
if (!chunkuploader.isExit()) {
_finishing_upload = true;
if(_use_slots) {
if (_use_slots) {
swingReflectionInvoke("setEnabled", getView().getSlots_spinner(), false);
swingReflectionInvokeAndWait("setValue", getView().getSlots_spinner(), (int) swingReflectionInvokeAndWaitForReturn("getValue", getView().getSlots_spinner()) - 1);
@ -975,7 +973,7 @@ public final class Upload implements Transference, Runnable, SecureSingleThreadN
swingReflectionInvoke("setEnabled", getView().getPause_button(), true);
}
if(_use_slots) {
if (_use_slots) {
getView().updateSlotsStatus();
}
}

View File

@ -70,8 +70,6 @@ public final class UploadMACGenerator implements Runnable, SecureSingleThreadNot
}
}
public long getLast_chunk_id_read() {
return _last_chunk_id_read;
}
@ -173,7 +171,7 @@ public final class UploadMACGenerator implements Runnable, SecureSingleThreadNot
}
if (!_exit && (!_upload.isStopped() || !_upload.getChunkworkers().isEmpty()) && (_bytes_read < _upload.getFile_size() || (_upload.getFile_size() == 0 && _last_chunk_id_read < 1))) {
System.out.println(_bytes_read+"/"+_upload.getFile_size()+" METAMAC wait...");
System.out.println(_bytes_read + "/" + _upload.getFile_size() + " METAMAC wait...");
secureWait();
}
}

View File

@ -329,10 +329,10 @@ public final class UploadView extends javax.swing.JPanel implements Transference
@Override
public void run() {
if(_upload.isUse_slots()) {
if (_upload.isUse_slots()) {
_upload.checkSlotsAndWorkers();
}
}
});
}//GEN-LAST:event_slots_spinnerStateChanged