optimize some code.
	modified:   mainwindow.cpp