rewrite mainwindow class