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;
}
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);
}
Aggregations