qtui: Split off dialog window code from main_window.cc.