📄 progresspanel.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: ProgressPanel.java
package org.gudy.azureus2.ui.swt.maketorrent;
import com.aelitis.azureus.core.AzureusCore;
import java.io.File;
import java.net.URL;
import java.util.*;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.global.GlobalManager;
import org.gudy.azureus2.core3.internat.LocaleTorrentUtil;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.logging.LogAlert;
import org.gudy.azureus2.core3.logging.Logger;
import org.gudy.azureus2.core3.torrent.*;
import org.gudy.azureus2.core3.tracker.host.TRHost;
import org.gudy.azureus2.core3.tracker.host.TRHostException;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.ui.swt.wizard.*;
// Referenced classes of package org.gudy.azureus2.ui.swt.maketorrent:
// NewTorrentWizard
public class ProgressPanel extends AbstractWizardPanel
implements TOTorrentProgressListener
{
Text tasks;
ProgressBar progress;
Display display;
public ProgressPanel(NewTorrentWizard _wizard, IWizardPanel _previousPanel)
{
super(_wizard, _previousPanel);
}
public void show()
{
display = wizard.getDisplay();
wizard.setTitle(MessageText.getString("wizard.progresstitle"));
wizard.setCurrentInfo("");
wizard.setPreviousEnabled(false);
Composite rootPanel = wizard.getPanel();
GridLayout layout = new GridLayout();
layout.numColumns = 1;
rootPanel.setLayout(layout);
Composite panel = new Composite(rootPanel, 0);
GridData gridData = new GridData(772);
panel.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 1;
panel.setLayout(layout);
tasks = new Text(panel, 2058);
tasks.setBackground(display.getSystemColor(1));
gridData = new GridData(1808);
gridData.heightHint = 120;
tasks.setLayoutData(gridData);
progress = new ProgressBar(panel, 0);
progress.setMinimum(0);
progress.setMaximum(0);
gridData = new GridData(768);
progress.setLayoutData(gridData);
}
public void finish()
{
Thread t = new AEThread("Torrent Maker") {
final ProgressPanel this$0;
public void runSupport()
{
makeTorrent();
}
{
this$0 = ProgressPanel.this;
super(x0);
}
};
t.setPriority(1);
t.setDaemon(true);
t.start();
}
public void makeTorrent()
{
NewTorrentWizard _wizard = (NewTorrentWizard)wizard;
int tracker_type = _wizard.getTrackerType();
if (tracker_type == 2)
TrackersUtil.getInstance().addTracker(_wizard.trackerURL);
File f;
if (_wizard.create_from_dir)
f = new File(_wizard.directoryPath);
else
f = new File(_wizard.singlePath);
try
{
URL url = new URL(_wizard.trackerURL);
TOTorrent torrent;
if (_wizard.getPieceSizeComputed())
{
_wizard.creator = TOTorrentFactory.createFromFileOrDirWithComputedPieceLength(f, url, _wizard.getAddOtherHashes());
_wizard.creator.addListener(this);
torrent = _wizard.creator.create();
} else
{
TOTorrentCreator c = TOTorrentFactory.createFromFileOrDirWithFixedPieceLength(f, url, _wizard.getAddOtherHashes(), _wizard.getPieceSizeManual());
c.addListener(this);
torrent = c.create();
}
if (tracker_type == 3)
TorrentUtils.setDecentralised(torrent);
torrent.setComment(_wizard.getComment());
TorrentUtils.setDHTBackupEnabled(torrent, _wizard.permitDHT);
TorrentUtils.setPrivate(torrent, _wizard.privateTorrent);
LocaleTorrentUtil.setDefaultTorrentEncoding(torrent);
File save_dir;
if (_wizard.create_from_dir)
save_dir = f;
else
save_dir = f.getParentFile();
if (_wizard.useMultiTracker)
{
reportCurrentTask(MessageText.getString("wizard.addingmt"));
TorrentUtils.listToAnnounceGroups(((NewTorrentWizard)wizard).trackers, torrent);
}
if (_wizard.useWebSeed && _wizard.webseeds.size() > 0)
{
reportCurrentTask(MessageText.getString("wizard.webseed.adding"));
Map ws = _wizard.webseeds;
List getright = (List)ws.get("getright");
if (getright.size() > 0)
{
for (int i = 0; i < getright.size(); i++)
reportCurrentTask((new StringBuilder()).append(" GetRight: ").append(getright.get(i)).toString());
torrent.setAdditionalListProperty("url-list", new ArrayList(getright));
}
List webseed = (List)ws.get("webseed");
if (webseed.size() > 0)
{
for (int i = 0; i < webseed.size(); i++)
reportCurrentTask((new StringBuilder()).append(" WebSeed: ").append(webseed.get(i)).toString());
torrent.setAdditionalListProperty("httpseeds", new ArrayList(webseed));
}
}
reportCurrentTask(MessageText.getString("wizard.savingfile"));
File torrent_file = new File(((NewTorrentWizard)wizard).savePath);
torrent.serialiseToBEncodedFile(torrent_file);
reportCurrentTask(MessageText.getString("wizard.filesaved"));
wizard.switchToClose();
if (((NewTorrentWizard)wizard).autoOpen)
(new AEThread(save_dir) ).start();
}
catch (Exception e)
{
if (e instanceof TOTorrentException)
{
TOTorrentException te = (TOTorrentException)e;
if (te.getReason() != 9)
{
reportCurrentTask(MessageText.getString("wizard.operationfailed"));
reportCurrentTask(TorrentUtils.exceptionToText(te));
}
} else
{
Debug.printStackTrace(e);
reportCurrentTask(MessageText.getString("wizard.operationfailed"));
reportCurrentTask(Debug.getStackTrace(e));
}
wizard.switchToClose();
}
}
public void reportCurrentTask(final String task_description)
{
if (display != null && !display.isDisposed())
display.asyncExec(new AERunnable() {
final String val$task_description;
final ProgressPanel this$0;
public void runSupport()
{
if (tasks != null && !tasks.isDisposed())
tasks.append((new StringBuilder()).append(task_description).append(Text.DELIMITER).toString());
}
{
this$0 = ProgressPanel.this;
task_description = s;
super();
}
});
}
public void reportProgress(final int percent_complete)
{
if (display != null && !display.isDisposed())
display.asyncExec(new AERunnable() {
final int val$percent_complete;
final ProgressPanel this$0;
public void runSupport()
{
if (progress != null && !progress.isDisposed())
progress.setSelection(percent_complete);
}
{
this$0 = ProgressPanel.this;
percent_complete = i;
super();
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -