Added a basic preferences dialog.
Added a preferences dialog.
Merged in upstream changes.