Add settings dialog

1. add settings dialog for configure  global settings.
2. move all code about preference to SettingsManager.js
3. add comment to clear jkhint warning.
4. refactor some code.