Main GUI program

The loading point for the GUI is src/qt/main.cpp. main() calls GuiMain() from src/qt/bitcoin.cpp, passing along any program arguments with it. GuiMain starts by calling SetupEnvironment() which amongst other things, configures the runtime locale and charset.

Next an empty NodeContext is set up, which is then populated into a fully-fledged node interface via being passed to interfaces::MakeNode(), which returns an interfaces::Node. Recall that in wallet component initialization we also saw the wallet utilizing a NodeContext as part of its WalletInitInterface. In both cases the NodeContext is being used to pass chain and network references around without needing to create globals.

After some QT setup, command-line and application arguments are parsed. What follows can be outlined from the code comments:

  1. Application identification

  2. Initialization of translations, so that intro dialogue is in user’s language

  3. Now that settings and translations are available, ask user for data directory

  4. Determine availability of data directory and parse bitcoin.conf

  5. Determine network (and switch to network specific options)

  6. URI IPC sending

  7. Main GUI initialization

GUI initialisation

After configuration the GUI is initialized. Here the Node object created earlier is passed to app.SetNode() before a window is created and the application executed.

The bulk of the Qt GUI classes are defined in src/qt/bitcoingui.{h|cpp}.