qt: Move initialization/shutdown to a thread

Move AppInit2 and Shutdown to a thread.

This allows a more responsive splash screen, prevents 'process does not respond'
messages from the window system and will allow for showing a user friendly
window while shutting down.
qt: Show window while shutting down

Makes it clear to the user that the application is still wrapping up
and the computer should not be turned off until it is finished.
qt: Remove global references in bitcoin.cpp

Remove the need for global references `guiref` and
`splashref` by making the BitcoinGUI and SplashScreen
classes register for the UI interface signals themselves.
qt: Stop shutdown detection timer during shutdown

Stop the shutdown timer from exiting the main loop
when shutdown is already in progress.

Fixes seeming hanging window after typing 'stop' in debug console.

Also hide the debug console during shutdown as it is useless without
a core to connect to.
Merge pull request #3493

9a2305a qt: Stop shutdown detection timer during shutdown (Wladimir J. van der Laan)
35ecf85 qt: Remove global references in bitcoin.cpp (Wladimir J. van der Laan)
55fe4de qt: Show window while shutting down (Wladimir J. van der Laan)
202d853 qt: Move initialization/shutdown to a thread (Wladimir J. van der Laan)