• OctoMY API
  • OctoMY API Reference
  • C++ Classes
  • OctoMY
  • ActivityLoader
  • ActivityLoader Class

    Manages activity instantiation with configurable loading strategies. More...

    Header: #include <ActivityLoader>
    Since: 1.0
    Inherits: QObject

    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).

    \sectionusage 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);

    \sectionstrategies 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.

    \sectionsafety 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 and octomy::activity::Activity.