Package me.mabra.hellonzb.util

Examples of me.mabra.hellonzb.util.StringLocaler


  }
 
  private void handleSaveButton()
  {
    JFrame jframe = this.prefMain.mainApp.getJFrame();
    StringLocaler localer = prefMain.mainApp.getLocaler();
    String errorTitle = localer.getBundleText("PopupErrorTitle");

    prefMain.savePreferences();

    // par2 check checkbox set?
    String pref = prefMain.prefMap.get("DownloadSettingsPar2Check");
    if(pref.equals("true"))
    {
      // then check whether or not the location textfield is filled
      String loc = prefMain.prefMap.get("DownloadSettingsPar2ExeLocation");

      if(loc.isEmpty())
      {
        // not filled!
        String msg = localer.getBundleText("PopupPar2LocationNotSet");
        JOptionPane.showMessageDialog(jframe, msg, errorTitle, JOptionPane.ERROR_MESSAGE);
        return;
      }
     
      // also check whether or not the selected file is an executable program file
      File file = new File(loc);
      if(!file.exists() || file.isDirectory() || !file.canExecute())
      {
        // no executable file!
        String msg = localer.getBundleText("PopupPar2IsNotExecutable");
        JOptionPane.showMessageDialog(jframe, msg, errorTitle, JOptionPane.ERROR_MESSAGE);
        return;
      }
    }

    // user has to set either both timed download start and stop, or none
    String startTime = prefMain.prefMap.get("DownloadSettingsTimedDownloadStart");
    if(startTime != null && startTime.isEmpty())
      startTime = null;
    String stopTime = prefMain.prefMap.get("DownloadSettingsTimedDownloadStop");
    if(stopTime != null && stopTime.isEmpty())
      stopTime = null;
    if((startTime == null && stopTime != null) || (startTime != null && stopTime == null))
    {
      String msg = localer.getBundleText("PopupErrorEnterBothTimedDownloadTimes");
      JOptionPane.showMessageDialog(jframe, msg, errorTitle, JOptionPane.ERROR_MESSAGE);
      return;
    }

    if(startTime != null && stopTime != null)
    {
      // both timed download times must be either null or in format hh:mm
      if(!startTime.matches("^[0-9]{1,2}:[0-9]{1,2}$") || !stopTime.matches("^[0-9]{1,2}:[0-9]{1,2}$"))
      {
        String msg = localer.getBundleText("PopupErrorEnterTimedDownloadTimesInCorrectFormat");
        JOptionPane.showMessageDialog(jframe, msg, errorTitle, JOptionPane.ERROR_MESSAGE);
        return;
      }

      // also check for valid auto. download times (hours and minutes in correct range)
      String [] startTimes = startTime.split(":");
      String [] stopTimes = stopTime.split(":");
      int startHour = Integer.parseInt(startTimes[0]);
      int stopHour = Integer.parseInt(stopTimes[0]);
      int startMinute = Integer.parseInt(startTimes[1]);
      int stopMinute = Integer.parseInt(stopTimes[1]);
      ifstartHour < 0 || startHour > 23 || stopHour < 0 || stopHour > 23 ||
        startMinute < 0 || startMinute > 59 || stopMinute < 0 || stopMinute > 59)
      {
        String msg = localer.getBundleText("PopupErrorEnterValidTimedDownloadTimes");
        JOptionPane.showMessageDialog(jframe, msg, errorTitle, JOptionPane.ERROR_MESSAGE);
        return;
      }
    }

    prefMain.prefDialog.setVisible(false);
    prefMain.mainApp.resetThreadView();
    prefMain.mainApp.setConnSpeedLimit();
   
    // system tray icon
    pref = prefMain.prefMap.get("GeneralSettingsShowTrayIcon");
    prefMain.mainApp.setTrayIcon(Boolean.valueOf(pref));
   
    // language setting changed?
    if(!prefMain.tmpLang.equals(prefMain.prefMap.get("ExtendedSettingsChooseLanguage")))
    {
      String title = localer.getBundleText("PopupInfoTitle");
      String msg   = localer.getBundleText("PopupRestartForNewLocale");
      JOptionPane.showMessageDialog(jframe, msg, title, JOptionPane.INFORMATION_MESSAGE);
    }
   
    // usage statistics
    prefMain.mainApp.activateUsageStats();
View Full Code Here


  public void actionPerformed(ActionEvent e)
  {
    if(HelloNzbConstants.BETA_VERSION)
      return;

    StringLocaler localer = mainApp.getLocaler();

    // set background progress bar
    mainApp.getTaskManager().updateCheck(true);

    boolean updAvail = HelloNzbToolkit.isUpdateAvailable(HelloNzb.VERSION);
View Full Code Here

TOP

Related Classes of me.mabra.hellonzb.util.StringLocaler

Copyright © 2018 www.massapicom. 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.