Add preferences dialog

* moved authentification-related stuff to preferences panel
* refactored code to accomodate preferences concept
* improved market restart (after preferences have changed) logic