Search in sources :

Example 31 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class DescriptionItem method refresh.

@Override
public void refresh(TableCell cell) {
    if (cell.isDisposed()) {
        return;
    }
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    String desc = "";
    if (dm != null) {
        try {
            desc = PlatformTorrentUtils.getContentDescription(dm.getTorrent());
            if (desc == null) {
                desc = "";
            }
        } catch (Throwable e) {
        }
    }
    cell.setText(desc);
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Example 32 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class ETAItem method refresh.

@Override
public void refresh(TableCell cell) {
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    long value = (dm == null) ? 0 : dm.getStats().getETA();
    Long sortVal = value < 0 ? null : value;
    if (!cell.setSortValue(sortVal) && cell.isValid()) {
        return;
    }
    cell.setText(ViewUtils.formatETA(value, eta_absolute, cdf.getDateFormat()));
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Example 33 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class FileExtensionItem method refresh.

@Override
public void refresh(TableCell cell) {
    Object ds = cell.getDataSource();
    String text = "";
    DownloadManager dm;
    if (ds instanceof DownloadManager) {
        dm = (DownloadManager) ds;
        DiskManagerFileInfo prim = dm.getDownloadState().getPrimaryFile();
        text = prim == null ? "" : prim.getFile(true).getName();
    } else if (ds instanceof DiskManagerFileInfo) {
        DiskManagerFileInfo fileInfo = (DiskManagerFileInfo) ds;
        dm = fileInfo.getDownloadManager();
        text = fileInfo.getFile(true).getName();
    } else {
        return;
    }
    String incomp_suffix = dm == null ? null : dm.getDownloadState().getAttribute(DownloadManagerState.AT_INCOMP_FILE_SUFFIX);
    if (incomp_suffix != null && text.endsWith(incomp_suffix)) {
        text = text.substring(0, text.length() - incomp_suffix.length());
    }
    int pos = text.lastIndexOf(".");
    if (pos >= 0) {
        text = text.substring(pos + 1);
    } else {
        text = "";
    }
    cell.setText(text);
}
Also used : DiskManagerFileInfo(com.biglybt.core.disk.DiskManagerFileInfo) DownloadManager(com.biglybt.core.download.DownloadManager)

Example 34 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class FilesLinkedItem method refresh.

@Override
public void refresh(TableCell cell) {
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    int link_count = 0;
    if (dm != null) {
        link_count = dm.getDownloadState().getFileLinks().size();
    }
    if (!cell.setSortValue(link_count) && cell.isValid()) {
        return;
    }
    cell.setText(link_count == 0 ? "" : String.valueOf(link_count));
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Example 35 with DownloadManager

use of com.biglybt.core.download.DownloadManager in project BiglyBT by BiglySoftware.

the class PeerSourcesItem method refresh.

@Override
public void refresh(TableCell cell) {
    String ps = "";
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    if (dm != null) {
        String[] nets = dm.getDownloadState().getPeerSources();
        for (int i = 0; i < nets.length; i++) {
            ps += (i == 0 ? "" : ",") + nets[i];
        }
    }
    cell.setText(ps);
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Aggregations

DownloadManager (com.biglybt.core.download.DownloadManager)307 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)54 TOTorrent (com.biglybt.core.torrent.TOTorrent)35 GlobalManager (com.biglybt.core.global.GlobalManager)33 PEPeerManager (com.biglybt.core.peer.PEPeerManager)29 File (java.io.File)29 List (java.util.List)21 Core (com.biglybt.core.Core)17 Download (com.biglybt.pif.download.Download)17 Point (org.eclipse.swt.graphics.Point)17 UIFunctions (com.biglybt.ui.UIFunctions)16 Tag (com.biglybt.core.tag.Tag)15 UIInputReceiverListener (com.biglybt.pif.ui.UIInputReceiverListener)14 TOTorrentException (com.biglybt.core.torrent.TOTorrentException)13 ArrayList (java.util.ArrayList)13 DiskManager (com.biglybt.core.disk.DiskManager)12 DownloadManagerStats (com.biglybt.core.download.DownloadManagerStats)12 CoreRunningListener (com.biglybt.core.CoreRunningListener)11 DownloadManagerState (com.biglybt.core.download.DownloadManagerState)11 PEPeer (com.biglybt.core.peer.PEPeer)11