Esempio n. 1
0
  /** Cancels the language selection. */
  private void cancel() {
    dispose();
    // Cancel was pressed, revert to the default language
    Language.loadAndActivateLanguage(Settings.DEFAULT_APP_LANGUAGE);
    Settings.remove(Settings.KEY_SETTINGS_VOICE);

    synchronized (WelcomeFrame.this) {
      Sounds.playSoundSample(Sounds.SAMPLE_THANK_YOU, false);
      WelcomeFrame.this.notify(); // Notify the main thread to continue starting the application
    }
  }
Esempio n. 2
0
  /** Performs post update tasks. */
  private static void performPostUpdateTasks() {
    // TODO review on each release!

    // Set default enabled plugins: add the Build Orders Table plugin (but does not disable other
    // ones...)
    final Set<String> enabledPluginSet = new HashSet<String>(Settings.getEnabledPluginSet());
    enabledPluginSet.add("hu.belicza.andras.buildorderstableplugin.BuildOrdersTablePlugin");
    Settings.setEnabledPluginSet(enabledPluginSet);

    // MD5 hash symbol has been introduced:
    {
      final String autoSaveNameTemplateSetting =
          Settings.getString(Settings.KEY_SETTINGS_MISC_REP_AUTO_SAVE_NAME_TEMPLATE);
      if ("/D./e".equals(autoSaveNameTemplateSetting)) // The old default value
      Settings.set(
            Settings.KEY_SETTINGS_MISC_REP_AUTO_SAVE_NAME_TEMPLATE,
            Settings.getDefaultString(
                Settings.KEY_SETTINGS_MISC_REP_AUTO_SAVE_NAME_TEMPLATE)); // Set the new default
    }

    // Player full name has been removed:
    {
      final String autoSaveNameTemplateSetting =
          Settings.getString(Settings.KEY_SETTINGS_MISC_REP_AUTO_SAVE_NAME_TEMPLATE);
      if (autoSaveNameTemplateSetting != null)
        Settings.set(
            Settings.KEY_SETTINGS_MISC_REP_AUTO_SAVE_NAME_TEMPLATE,
            autoSaveNameTemplateSetting.replace("/P", "/p").replace("/Q", "/q"));
      final String replayRenameTemplateSetting =
          Settings.getString(Settings.KEY_REP_SEARCH_RESULTS_RENAME_TEMPLATE);
      if (replayRenameTemplateSetting != null)
        Settings.set(
            Settings.KEY_REP_SEARCH_RESULTS_RENAME_TEMPLATE,
            replayRenameTemplateSetting.replace("/P", "/p").replace("/Q", "/q"));
      final String predefinedAutoSaveNameTemplatesSetting =
          Settings.getString(PredefinedList.REP_AUTO_SAVE_TEMPLATE.settingsKey);
      if (predefinedAutoSaveNameTemplatesSetting != null)
        Settings.set(
            PredefinedList.REP_AUTO_SAVE_TEMPLATE.settingsKey,
            predefinedAutoSaveNameTemplatesSetting.replace("/P", "/p").replace("/Q", "/q"));
      final String repRenameTemplatesSetting =
          Settings.getString(PredefinedList.REP_RENAME_TEMPLATE.settingsKey);
      if (repRenameTemplatesSetting != null)
        Settings.set(
            PredefinedList.REP_RENAME_TEMPLATE.settingsKey,
            repRenameTemplatesSetting.replace("/P", "/p").replace("/Q", "/q"));
      Settings.rebuildPredefinedLists();
    }

    // Remove keys of changed/removed settings
    Settings.remove("settings.misc.useInMemoryReplayCache");
    Settings.remove("module.repAnalyzer.charts.mapView.hotAreasCount");
    Settings.remove("module.repAnalyzer.charts.mapView.iconSizesCS");

    // If replay site list has changed/rearranged:
    Settings.remove(Settings.KEY_SHARE_REP_REPLAY_SITE);

    // The initial default value of the pre-defined replay list had a typo: "battlecuriser" instead
    // of "battlecruiser"
    final String repAnalFilterSetting =
        Settings.getString(PredefinedList.REP_ANAL_FILTER.settingsKey);
    if (repAnalFilterSetting != null) {
      if (repAnalFilterSetting.contains("battlecuriser"))
        Settings.set(
            PredefinedList.REP_ANAL_FILTER.settingsKey,
            repAnalFilterSetting.replace("battlecuriser", "battlecruiser"));
      Settings.rebuildPredefinedLists();
    }

    // Removed LaFs: Napkin and EaSynthLookAndFeel
    if ("Napkin".equals(Settings.getString(Settings.KEY_SETTINGS_LAF)))
      Settings.remove(Settings.KEY_SETTINGS_LAF);
    if ("EaSynthLookAndFeel".equals(Settings.getString(Settings.KEY_SETTINGS_LAF)))
      Settings.remove(Settings.KEY_SETTINGS_LAF);

    // Save changes
    Settings.saveProperties();

    // If profile cache version changed:
    hu.belicza.andras.sc2gears.util.ProfileCache.emptyCache(null);
  }