Search in sources :

Example 21 with SpeedManagerLimitEstimate

use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.

the class SpeedTestSetLimitPanel method determineRateSettingEx.

public int determineRateSettingEx(int measuredRate, boolean testRan, boolean isUpload) {
    int retVal = measuredRate;
    // get speed-manager setting.
    SpeedManagerLimitEstimate est;
    if (isUpload) {
        est = speedManager.getEstimatedUploadCapacityBytesPerSec();
    } else {
        est = speedManager.getEstimatedDownloadCapacityBytesPerSec();
    }
    int kinb = DisplayFormatters.getKinB();
    // Use previous value if no test of this type ran.
    if (!testRan) {
        retVal = est.getBytesPerSec() / kinb;
    }
    // if the previous set to Manually use that value.
    if (est.getEstimateType() == SpeedManagerLimitEstimate.TYPE_MANUAL) {
        retVal = est.getBytesPerSec() / kinb;
    }
    return retVal;
}
Also used : SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)

Example 22 with SpeedManagerLimitEstimate

use of com.biglybt.core.speedmanager.SpeedManagerLimitEstimate in project BiglyBT by BiglySoftware.

the class SpeedTestFinishPanel method show.

/**
 */
@Override
public void show() {
    String title = MessageText.getString("SpeedTestWizard.finish.panel.title");
    wizard.setTitle(title);
    Composite rootPanel = wizard.getPanel();
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    rootPanel.setLayout(layout);
    Composite panel = new Composite(rootPanel, SWT.NULL);
    GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
    panel.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    layout.makeColumnsEqualWidth = true;
    panel.setLayout(layout);
    Label label = new Label(panel, SWT.WRAP);
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    gridData.widthHint = 380;
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "SpeedTestWizard.finish.panel.click.close");
    int kinb = DisplayFormatters.getKinB();
    // show the setting for upload speed
    SpeedManagerLimitEstimate upEst = speedManager.getEstimatedUploadCapacityBytesPerSec();
    int maxUploadKbs = upEst.getBytesPerSec() / kinb;
    SpeedManagerLimitEstimate downEst = speedManager.getEstimatedDownloadCapacityBytesPerSec();
    int maxDownloadKbs = downEst.getBytesPerSec() / kinb;
    // boolean setting.
    boolean autoSpeedEnabled = COConfigurationManager.getBooleanParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY);
    boolean autoSpeedSeedingEnabled = COConfigurationManager.getBooleanParameter(TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY);
    // spacer 2
    Label s2 = new Label(panel, SWT.NULL);
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    s2.setLayoutData(gridData);
    String autoSpeed = MessageText.getString("SpeedTestWizard.finish.panel.auto.speed");
    createStatusLine(panel, autoSpeed, autoSpeedEnabled);
    String autoSpeedWhileSeeding = MessageText.getString("SpeedTestWizard.finish.panel.auto.speed.seeding");
    createStatusLine(panel, autoSpeedWhileSeeding, autoSpeedSeedingEnabled);
    // spacer 1
    Label s1 = new Label(panel, SWT.NULL);
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    s1.setLayoutData(gridData);
    // displays a bytes/sec column and a bits/sec column
    createHeaderLine(panel);
    String maxUploadLbl = MessageText.getString("SpeedView.stats.estupcap");
    createDataLine(panel, maxUploadLbl, maxUploadKbs, upEst);
    String maxDownloadLbl = MessageText.getString("SpeedView.stats.estdowncap");
    createDataLine(panel, maxDownloadLbl, maxDownloadKbs, downEst);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) SpeedManagerLimitEstimate(com.biglybt.core.speedmanager.SpeedManagerLimitEstimate) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label)

Aggregations

SpeedManagerLimitEstimate (com.biglybt.core.speedmanager.SpeedManagerLimitEstimate)22 SpeedManagerAlgorithmProviderAdapter (com.biglybt.core.speedmanager.impl.SpeedManagerAlgorithmProviderAdapter)9 SpeedManagerPingMapper (com.biglybt.core.speedmanager.SpeedManagerPingMapper)7 SpeedManager (com.biglybt.core.speedmanager.SpeedManager)6 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 LogEvent (com.biglybt.core.logging.LogEvent)1 PEPeerManager (com.biglybt.core.peer.PEPeerManager)1 PEPeerManagerStats (com.biglybt.core.peer.PEPeerManagerStats)1 LimitToTextHelper (com.biglybt.core.speedmanager.LimitToTextHelper)1 SpeedManagerListener (com.biglybt.core.speedmanager.SpeedManagerListener)1 Parameter (com.biglybt.pif.ui.config.Parameter)1 TransferStatsView (com.biglybt.ui.swt.views.stats.TransferStatsView)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1