ActivityLoader
Manages activity instantiation with configurable loading strategies.
| Declared in | src/libs/libactivity/activity/ActivityLoader.hpp |
| Inherits | QObject |
| Group | navigation |
Detailed description
ActivityLoader provides a declarative way to register and load activities with support for chunked loading (for smooth splash animations) and lazy loading (for rarely-used activities).
Basic Usage
ActivityLoader loader(activityStack);
// Shorthand with configure lambda
loader.add<MapActivity>([hub](auto& a) { a.configure(hub); });
// With custom flags
loader.add<MessagePromptActivity>().flags(false, false, false);
// With animation break
loader.add<HeavyActivity>([hub](auto& a) { a.configure(hub); })
.delayBefore(750);
// Lazy loading
loader.add<RareActivity>([hub](auto& a) { a.configure(hub); })
.lazy();
// Start loading
loader.load(ActivityLoader::Strategy::Chunked);
Loading Strategies
- Sequential - Blocking, no yields. Safe fallback identical to manually creating activities one by one.
- Chunked - Loads N activities per event loop cycle, allowing animations to run smoothly.
Safety Guarantees
- All widget creation happens on the main thread - Activities are always instantiated in registration order - Strategy::Sequential exactly replicates traditional behavior
See also ActivityStack, octomy::activity::Activity.