Refactor mainwindow. Add connection and file dialog.