Esempio n. 1
0
 /*
  * Writes the preferences to the disk.
  */
 private void writePreferences() {
   prefs.setFullscreen(fullscreen.isSelected());
   prefs.setBitrate(bitrate.getValue());
   prefs.setResolution((Resolution) resolution.getSelectedItem());
   prefs.setUseOpenGlRenderer(openGlRenderer.isSelected());
   prefs.setLocalAudio(localAudio.isSelected());
   PreferencesManager.writePreferences(prefs);
 }
 /**
  * Reads the user preferences from the preferences file and caches them
  *
  * @return the user preferences
  */
 public static Preferences getPreferences() {
   if (cachedPreferences == null) {
     LimeLog.info("Reading Preferences");
     File prefFile = SettingsManager.getInstance().getSettingsFile();
     Preferences savedPref =
         (Preferences) SettingsManager.readSettings(prefFile, Preferences.class);
     cachedPreferences = savedPref;
   }
   if (cachedPreferences == null) {
     LimeLog.warning("Unabled to get preferences, using default");
     cachedPreferences = new Preferences();
     writePreferences(cachedPreferences);
   }
   return cachedPreferences;
 }