Refactoring of dialogs in mainwindow