Skip to content

Commit

Permalink
2.35
Browse files Browse the repository at this point in the history
Urldecode
Dialog font
Race condition (lazy init)
  • Loading branch information
tonikelope committed Nov 29, 2017
1 parent 36fdba6 commit b088897
Show file tree
Hide file tree
Showing 27 changed files with 468 additions and 495 deletions.
10 changes: 5 additions & 5 deletions src/megabasterd/AboutDialog.form
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<Component class="javax.swing.JLabel" name="title_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="48" style="1"/>
<Font name="Dialog" size="48" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="MegaBasterd X.X"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
Expand Down Expand Up @@ -121,7 +121,7 @@
<Component class="javax.swing.JLabel" name="subtitle_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="18" style="1"/>
<Font name="Dialog" size="18" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="66" red="66" type="rgb"/>
Expand All @@ -147,7 +147,7 @@
<Component class="javax.swing.JButton" name="mcdown_url_button">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="18" style="1"/>
<Font name="Dialog" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Copy MegaBasterd download URL"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
Expand All @@ -159,7 +159,7 @@
<Component class="javax.swing.JLabel" name="author_webpage_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="16" style="1"/>
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="66" green="66" red="66" type="rgb"/>
Expand Down Expand Up @@ -191,7 +191,7 @@
<Component class="javax.swing.JButton" name="check_version_button">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="14" style="1"/>
<Font name="Dialog" size="14" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Check version"/>
</Properties>
Expand Down
10 changes: 5 additions & 5 deletions src/megabasterd/AboutDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void initComponents() {
setIconImage(null);
setResizable(false);

title_label.setFont(new java.awt.Font("Ubuntu", 1, 48)); // NOI18N
title_label.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N
title_label.setText("MegaBasterd X.X");
title_label.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
title_label.setDoubleBuffered(true);
Expand All @@ -69,7 +69,7 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
}
});

subtitle_label.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
subtitle_label.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
subtitle_label.setForeground(new java.awt.Color(102, 102, 102));
subtitle_label.setText("(Made with love by tonikelope)");
subtitle_label.setDoubleBuffered(true);
Expand All @@ -83,7 +83,7 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
}
});

mcdown_url_button.setFont(new java.awt.Font("Ubuntu", 1, 18)); // NOI18N
mcdown_url_button.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
mcdown_url_button.setText("Copy MegaBasterd download URL");
mcdown_url_button.setDoubleBuffered(true);
mcdown_url_button.addActionListener(new java.awt.event.ActionListener() {
Expand All @@ -92,7 +92,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});

author_webpage_label.setFont(new java.awt.Font("Ubuntu", 1, 16)); // NOI18N
author_webpage_label.setFont(new java.awt.Font("Dialog", 1, 16)); // NOI18N
author_webpage_label.setForeground(new java.awt.Color(102, 102, 102));
author_webpage_label.setText("http://toni.world");
author_webpage_label.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Expand All @@ -112,7 +112,7 @@ public void mouseReleased(java.awt.event.MouseEvent evt) {
}
});

check_version_button.setFont(new java.awt.Font("Ubuntu", 1, 14)); // NOI18N
check_version_button.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
check_version_button.setText("Check version");
check_version_button.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Expand Down
50 changes: 14 additions & 36 deletions src/megabasterd/Download.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package megabasterd;

import java.awt.Color;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
Expand Down Expand Up @@ -51,8 +52,8 @@ public final class Download implements Transference, Runnable, SecureSingleThrea
public static final int WATCHDOG_SMART_PROXY_TIMEOUT = 3600;

private final MainPanel _main_panel;
private volatile DownloadView _view = null; //lazy init
private volatile ProgressMeter _progress_meter = null; //lazy init;
private volatile DownloadView _view;
private volatile ProgressMeter _progress_meter;
private final Object _secure_notify_lock;
private final Object _workers_lock;
private final Object _chunkid_lock;
Expand Down Expand Up @@ -133,13 +134,22 @@ public Download(MainPanel main_panel, MegaAPI ma, String url, String download_pa
_partialProgressQueue = new ConcurrentLinkedQueue<>();
_rejectedChunkIds = new ConcurrentLinkedQueue<>();
_thread_pool = newCachedThreadPool();
_view = new DownloadView(this);
_progress_meter = new ProgressMeter(this);
}

public boolean isUse_smart_proxy() {
return _use_smart_proxy;
}

public void setUse_smart_proxy(boolean _use_smart_proxy) {

if (_use_smart_proxy) {
swingReflectionInvoke("setForeground", this.getView().getSpeed_label(), Color.ORANGE);
} else {
swingReflectionInvoke("setForeground", this.getView().getSpeed_label(), new Color(0, 128, 255));
}

this._use_smart_proxy = _use_smart_proxy;
}

Expand Down Expand Up @@ -251,45 +261,13 @@ public boolean isProvision_ok() {
@Override
public ProgressMeter getProgress_meter() {

ProgressMeter result = _progress_meter;

if (result == null) {

synchronized (this) {

result = _progress_meter;

if (result == null) {

_progress_meter = result = new ProgressMeter(this);

}
}
}

return result;
return this._progress_meter;
}

@Override
public DownloadView getView() {

DownloadView result = _view;

if (result == null) {

synchronized (this) {

result = _view;

if (result == null) {

_view = result = new DownloadView(this);

}
}
}

return result;
return this._view;
}

@Override
Expand Down
28 changes: 14 additions & 14 deletions src/megabasterd/DownloadView.form
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<Component class="javax.swing.JLabel" name="status_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="20" style="1"/>
<Font name="Dialog" size="20" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="status"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
Expand All @@ -127,7 +127,7 @@
<Component class="javax.swing.JLabel" name="slots_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="18" style="1"/>
<Font name="Dialog" size="18" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Slots"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
Expand All @@ -136,7 +136,7 @@
<Component class="javax.swing.JSpinner" name="slots_spinner">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="18" style="0"/>
<Font name="Dialog" size="18" style="0"/>
</Property>
<Property name="toolTipText" type="java.lang.String" value="Slots"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
Expand All @@ -148,7 +148,7 @@
<Component class="javax.swing.JLabel" name="speed_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="26" style="3"/>
<Font name="Dialog" size="26" style="3"/>
</Property>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="speed"/>
Expand All @@ -158,7 +158,7 @@
<Component class="javax.swing.JProgressBar" name="progress_pbar">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="18" style="1"/>
<Font name="Dialog" size="18" style="1"/>
</Property>
<Property name="doubleBuffered" type="boolean" value="true"/>
</Properties>
Expand All @@ -169,7 +169,7 @@
<Color blue="0" green="99" red="ff" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="16" style="1"/>
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="white" palette="1" red="ff" type="palette"/>
Expand All @@ -187,7 +187,7 @@
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="16" style="1"/>
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" id="white" palette="1" red="ff" type="palette"/>
Expand All @@ -202,7 +202,7 @@
<Component class="javax.swing.JCheckBox" name="keep_temp_checkbox">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="16" style="1"/>
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Keep temp file"/>
Expand All @@ -212,7 +212,7 @@
<Component class="javax.swing.JLabel" name="file_name_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="20" style="1"/>
<Font name="Dialog" size="20" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="33" red="33" type="rgb"/>
Expand All @@ -224,7 +224,7 @@
<Component class="javax.swing.JButton" name="close_button">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="16" style="1"/>
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Close"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
Expand All @@ -236,7 +236,7 @@
<Component class="javax.swing.JButton" name="copy_link_button">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="16" style="1"/>
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Copy link"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
Expand All @@ -251,7 +251,7 @@
<Color blue="ff" green="33" red="33" type="rgb"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="16" style="1"/>
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="ff" red="ff" type="rgb"/>
Expand All @@ -266,7 +266,7 @@
<Component class="javax.swing.JLabel" name="file_size_label">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="20" style="1"/>
<Font name="Dialog" size="20" style="1"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="ff" green="33" red="33" type="rgb"/>
Expand All @@ -286,7 +286,7 @@
<Component class="javax.swing.JButton" name="open_folder_button">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Ubuntu" size="16" style="1"/>
<Font name="Dialog" size="16" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="Open folder"/>
<Property name="doubleBuffered" type="boolean" value="true"/>
Expand Down
Loading

0 comments on commit b088897

Please sign in to comment.