Examples of SpeedScaleShell


Examples of org.gudy.azureus2.ui.swt.shells.SpeedScaleShell

      if (dataReceive >= 1024) {
        maxBandwidth = dataReceive / 1024;
      }
    }

    SpeedScaleShell speedScale = new SpeedScaleShell() {
      public String getStringValue(int value, String sValue) {
        if (sValue != null) {
          return prefix + ": " + sValue;
        }
        if (value == 0) {
          return MessageText.getString("MyTorrentsView.menu.setSpeed.unlimited");
        }
        if (value == -1) {
          return MessageText.getString("ConfigView.auto");
        }
        return prefix
            + ": "
            + (value == 0 ? MessageText.getString("ConfigView.unlimited")
                : DisplayFormatters.formatByteCountToKiBEtcPerSec(
                    getValue() * 1024, true));
      }
    };
    int max = unlim ? (isUpSpeed ? 100 : 800) : maxBandwidth * 5;
    if (max < 50) {
      max = 50;
    }
    speedScale.setMaxValue(max);
    speedScale.setMaxTextValue(9999999);

    final String config_prefix = "config.ui.speed.partitions.manual."
        + (isUpSpeed ? "upload" : "download") + ".";
    int lastValue = COConfigurationManager.getIntParameter(config_prefix
        + "last", -10);

    Integer[] speed_limits;
    if (COConfigurationManager.getBooleanParameter(config_prefix + "enabled",
        false)) {
      speed_limits = parseSpeedPartitionString(COConfigurationManager.getStringParameter(
          config_prefix + "values", ""));
    } else {
      speed_limits = getGenericSpeedList(6, maxBandwidth);
    }
    if (speed_limits != null) {
      for (int i = 0; i < speed_limits.length; i++) {
        int value = speed_limits[i].intValue();
        if (value > 0) {
          speedScale.addOption(DisplayFormatters.formatByteCountToKiBEtcPerSec(
              value * 1024, true), value);
          if (value == lastValue) {
            lastValue = -10;
          }
        }
      }
    }
    speedScale.addOption(
        MessageText.getString("MyTorrentsView.menu.setSpeed.unlimited"), 0);
    speedScale.addOption(MessageText.getString("ConfigView.auto"), -1);

    if (lastValue > 0) {
      speedScale.addOption(DisplayFormatters.formatByteCountToKiBEtcPerSec(
          lastValue * 1024, true), lastValue);
    }

    // SWT BUG: on windows/linux, if mouse is down on shell open, all mouse events
    // will not reflect this
    if (speedScale.open(auto ? -1 : maxBandwidth, Constants.isWindows
        || Constants.isLinux)) {
      int value = speedScale.getValue();

      if (!speedScale.wasMenuChosen() || lastValue == value) {
        COConfigurationManager.setParameter(config_prefix + "last",
            maxBandwidth);
      }

      if (value >= 0) {
View Full Code Here

Examples of org.jmule.ui.swt.common.SpeedScaleShell

  protected void checkSubclass() {
    }
 
  private void showDownSpeedLimitScaleWindow() {
    SpeedScaleShell speedScaleWidget = new SpeedScaleShell(_._("mainwindow.statusbar.speed_scale.download") + " :");
    long down_limit = 0;
    try {
      down_limit = config_manager.getDownloadLimit() / 1024;
    } catch (ConfigurationManagerException e) {
      e.printStackTrace();
    }
    speedScaleWidget.setMaxValue(down_limit+500);
    speedScaleWidget.setMaxTextValue(down_limit+500);
    speedScaleWidget.addOption(_._("mainwindow.statusbar.speed_scale.no_limit"), 0);
   
    List<Long> sets = getDefaultSpeedValues(down_limit);
   
    for(Long v : sets) {
      speedScaleWidget.addOption(SpeedFormatter.formatByteCountToKiBEtcPerSec(v * 1024,true), v);
    }
   
    boolean result = speedScaleWidget.open(down_limit, JMConstants.isWindows);
    if (result) {
      long value = speedScaleWidget.getValue();
      value*=1024;
      try {
        config_manager.setDownloadLimit(value);
      } catch (ConfigurationManagerException e) {
        e.printStackTrace();
View Full Code Here

Examples of org.jmule.ui.swt.common.SpeedScaleShell

      }
    }
  }
 
  private void showUpSpeedLimitScaleWindow() {
    SpeedScaleShell speedScaleWidget = new SpeedScaleShell(_._("mainwindow.statusbar.speed_scale.upload") + " :");
    long up_limit = 0;
    try {
      up_limit = config_manager.getUploadLimit() / 1024;
    } catch (ConfigurationManagerException e) {
   
      e.printStackTrace();
    }
    speedScaleWidget.setMaxValue(up_limit+500);
    speedScaleWidget.setMaxTextValue(up_limit+500);
    speedScaleWidget.addOption(_._("mainwindow.statusbar.speed_scale.no_limit"), 0);
   
    List<Long> sets = getDefaultSpeedValues(up_limit);
   
    for(Long v : sets) {
      speedScaleWidget.addOption(SpeedFormatter.formatByteCountToKiBEtcPerSec(v * 1024,true), v);
    }
   
    boolean result = speedScaleWidget.open(up_limit, JMConstants.isWindows);
    if (result) {
      long value = speedScaleWidget.getValue();
      value*=1024;
      try {
        config_manager.setUploadLimit(value);
      } catch (ConfigurationManagerException e) {
        e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.