Add d-pointer for Component
General code improvements
Add d-pointer for MainWindow
Improve code formatting