Search in sources :

Example 56 with DownloadManager

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

the class HealthItem method refresh.

@Override
public void refresh(TableCell cell) {
    if (tracker_host == null) {
        try {
            tracker_host = CoreFactory.getSingleton().getTrackerHost();
        } catch (Throwable t) {
        }
        if (tracker_host == null) {
            return;
        }
    }
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    int health;
    TRHostTorrent ht;
    if (dm == null) {
        health = 0;
        ht = null;
    } else {
        health = dm.getHealthStatus();
        ht = tracker_host.getHostTorrent(dm.getTorrent());
    }
    if (!cell.setSortValue(health + (ht == null ? 0 : 256)) && cell.isValid())
        return;
    String sHelpID = null;
    if (health == DownloadManager.WEALTH_KO) {
        sHelpID = "health.explain.red";
    } else if (health == DownloadManager.WEALTH_OK) {
        sHelpID = "health.explain.green";
    } else if (health == DownloadManager.WEALTH_NO_TRACKER) {
        sHelpID = "health.explain.blue";
    } else if (health == DownloadManager.WEALTH_NO_REMOTE) {
        sHelpID = "health.explain.yellow";
    } else if (health == DownloadManager.WEALTH_ERROR) {
    } else {
        sHelpID = "health.explain.grey";
    }
    String sToolTip = (health == DownloadManager.WEALTH_ERROR && dm != null) ? dm.getErrorDetails() : MessageText.getString(sHelpID);
    if (ht != null)
        sToolTip += "\n" + MessageText.getString("health.explain.share");
    cell.setToolTip(sToolTip);
}
Also used : TRHostTorrent(com.biglybt.core.tracker.host.TRHostTorrent) DownloadManager(com.biglybt.core.download.DownloadManager)

Example 57 with DownloadManager

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

the class IPFilterItem method refresh.

@Override
public void refresh(TableCell cell) {
    // String state = "";
    UISWTGraphic icon = null;
    int sort = 0;
    if (ipfilter == null) {
        ipfilter = IpFilterManagerFactory.getSingleton().getIPFilter();
    }
    if (ipfilter.isEnabled()) {
        if (tick_icon == null) {
            tick_icon = new UISWTGraphicImpl(ImageLoader.getInstance().getImage("tick_mark"));
            cross_icon = new UISWTGraphicImpl(ImageLoader.getInstance().getImage("cross_mark"));
        }
        DownloadManager dm = (DownloadManager) cell.getDataSource();
        if (dm != null) {
            boolean excluded = dm.getDownloadState().getFlag(DownloadManagerState.FLAG_DISABLE_IP_FILTER);
            if (excluded) {
                icon = cross_icon;
                sort = 1;
            // state = "\u2718";
            } else {
                icon = tick_icon;
                sort = 2;
            // state = "\u2714";
            }
        }
    }
    cell.setSortValue(sort);
    if (cell.getGraphic() != icon) {
        cell.setGraphic(icon);
    }
}
Also used : UISWTGraphicImpl(com.biglybt.ui.swt.pifimpl.UISWTGraphicImpl) UISWTGraphic(com.biglybt.ui.swt.pif.UISWTGraphic) DownloadManager(com.biglybt.core.download.DownloadManager)

Example 58 with DownloadManager

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

the class MergedDataItem method refresh.

@Override
public void refresh(TableCell cell) {
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    long value = (dm == null) ? 0 : dm.getDownloadState().getLongAttribute(DownloadManagerState.AT_MERGED_DATA);
    if (!cell.setSortValue(value) && cell.isValid())
        return;
    cell.setText(value == 0 ? "" : DisplayFormatters.formatByteCountToKiBEtc(value));
    String info = dm.isSwarmMerging();
    if (info == null) {
        info = "";
    }
    cell.setToolTip(info);
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Example 59 with DownloadManager

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

the class MinSRItem method refresh.

@Override
public void refresh(TableCell cell) {
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    int value = 0;
    if (dm != null) {
        value = dm.getDownloadState().getIntParameter(DownloadManagerState.PARAM_MIN_SHARE_RATIO);
    }
    if (!cell.setSortValue(value) && cell.isValid()) {
        return;
    }
    cell.setText(value == 0 ? "" : String.valueOf(value / 1000.0f));
}
Also used : DownloadManager(com.biglybt.core.download.DownloadManager)

Example 60 with DownloadManager

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

the class MoveOnCompleteItem method refresh.

@Override
public void refresh(TableCell cell) {
    DownloadManager dm = (DownloadManager) cell.getDataSource();
    String target = (dm == null) ? null : dm.getDownloadState().getAttribute(DownloadManagerState.AT_MOVE_ON_COMPLETE_DIR);
    if (target == null) {
        target = "";
    }
    if (!cell.setSortValue(target) && cell.isValid()) {
        return;
    }
    cell.setText(target);
}
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