edu.jhu.cs.oose.elevel.preferences
Class Preferences

java.lang.Object
  extended by edu.jhu.cs.oose.elevel.preferences.Preferences

public class Preferences
extends java.lang.Object

Stores preferences for the E-Level application, implementing QSettings.

Author:
H. Parker Shelton, Jesse Yates

Method Summary
 void changeExportLocation(com.trolltech.qt.gui.QWidget parent, java.lang.String text)
          Prompts the user for input if there is not a default directory
static Preferences getInstance()
          Get the singleton instance of this class
 java.util.List<java.lang.String> getPreviouslyOpenDecks()
          Returns a list of file locations for the previously open decks
 java.util.Map<java.lang.String,java.lang.String> getTestingPreferences()
          Returns a Map containing all the testing preferences
 java.lang.String getValue(java.lang.String key)
          Get the preference with the specified name
 boolean hasExportLocation()
          Returns whether or not the program has a default export location that exists on disk.
 void setDefault(boolean overwrite)
          Set the default settings on the first run
 void setDefaultLocation()
          Set the default export location to a platform-dependent location on disk
 void setValue(java.lang.String key, java.lang.String value)
          Set the preference represented by the specified key to the specified value, to be written on close
 void writeSettings()
          Write all the current settings out to a file on disk
 void writeSettings(java.util.List<Deck> openDecks)
          Write all the current settings out to a file on disk
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Preferences getInstance()
Get the singleton instance of this class

Returns:
an instance of this class

changeExportLocation

public void changeExportLocation(com.trolltech.qt.gui.QWidget parent,
                                 java.lang.String text)
Prompts the user for input if there is not a default directory


getTestingPreferences

public java.util.Map<java.lang.String,java.lang.String> getTestingPreferences()
Returns a Map containing all the testing preferences

Returns:
a Map containing all the testing preferences

getValue

public java.lang.String getValue(java.lang.String key)
Get the preference with the specified name

Parameters:
key - A String representing the name of the preference
Returns:
An Object representing the value of the specified preference

hasExportLocation

public boolean hasExportLocation()
Returns whether or not the program has a default export location that exists on disk.

Returns:
true if the program has a default export location and the directory exists on disk, false otherwise.

getPreviouslyOpenDecks

public java.util.List<java.lang.String> getPreviouslyOpenDecks()
Returns a list of file locations for the previously open decks


setDefault

public void setDefault(boolean overwrite)
Set the default settings on the first run


setDefaultLocation

public void setDefaultLocation()
Set the default export location to a platform-dependent location on disk


setValue

public void setValue(java.lang.String key,
                     java.lang.String value)
Set the preference represented by the specified key to the specified value, to be written on close

Parameters:
key - A String representing the name of a preference
value - A Object representing the value of the preference

writeSettings

public void writeSettings()
Write all the current settings out to a file on disk


writeSettings

public void writeSettings(java.util.List<Deck> openDecks)
Write all the current settings out to a file on disk