Refactor the settings dialog code into a class.