-
Notifications
You must be signed in to change notification settings - Fork 68
Program Overview
The program starts by initializing a custom class called AOApplication, which inherits from QApplication. The AOApp has three sub-components;
NetworkManager, static
Lobby, dynamic
Courtroom, dynamic
Static means that the component is constructed in AOApp's constuctor and lives for the lifetime of AOApp, while the dynamic components may be allocated and deallocated, controlled by AOApp through the functions
construct_lobby() destruct_lobby() construct_courtroom() destruct_courtroom()
The relation between between AOApplication and Courtroom/Lobby is, notably, not a child-parent relation.
Instead, AOApplication passes a pointer to itself when constructing courtroom and lobby, providing an access point back to the main app object. This pointer is then further passed onto the custom AO widgets(AOButton, AOImage etc.) so they also can access the app object, which is important for the program flow. An example would be in the constructor of courtroom, where something like this may pop up:
ui_objection = new AOButton(this, ao_app);
Where ao_app is the pointer to the application object. This establishes a child-parent relation between courtroom and ui_objection(see how/why on the AOButton page), which is useful for a number of reasons.