ui: Fix GUI initialization order

Fixes at least #3478.

Splits and documents the phases:
1. Parse command-line options. These take precedence over anything else.
2. Basic Qt initialization (not dependent on parameters or configuration)
3. Application identification
4. Initialization of translations
5. Now that settings and translations are available, ask user for data directory
6. Determine availability of data directory and parse bitcoin.conf
7. URI IPC sending
8. Main GUI initialization

Splits command line parsing logic from ipcSendCommandLine into
ipcParseCommandLine, as isTestNet() can only be overridden in the early
stages before choosing a data directory. Sending however needs to happen
after choosing a data directory.
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.