# geming400/showunlistedlevelsinlevelcells architecture

> Architecture diagram of the GitHub repository geming400/showunlistedlevelsinlevelcells, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/geming400/showunlistedlevelsinlevelcells
- Repository: https://github.com/geming400/showunlistedlevelsinlevelcells

## Overview

##### Project Context & Queueing Purpose
- This mod is written in C++ and aims to mark and display unlisted or friends-only levels. One of its key functionalities is that upon discovering or uploading levels, it inserts them into a “queue” for further checking (e.g., determining if the level is friends only).

##### Main Components of the Queueing Part
- Discovery Component (Input Source): This represents where levels are discovered (e.g., during the level search or saved levels view). The discovery process (from src/search/gdLevelSearch.[cpp/hpp] or level discovery routines) triggers a “queue” insertion.
- Queue Manager: This is your central module for handling queued level requests. It’s implemented primarily by the files in src/queue/queueRequests.cpp / .hpp. This component is responsible for adding levels to the queue, managing the queue’s processing, and delegating tasks.
- Level Checker/Processor: This part represents the logic for checking the level’s status (friends only or unlisted). Although the queue only deals with “friends only” checks as noted, it is part of the overall processing flow.
- Settings & Configuration Influences: In src/settings/ you have files like onQueueRequestsTimingChange.cpp and stopQueue.cpp which imply that the behavior of the queue (e.g., timing adjustments, or pausing the queue) can be altered via mod settings. This module interacts with the Queue Manager to modify the queue processing.
- Utility and Scheduling Helpers: Files in src/utils (and perhaps src/include/NewTaskScheduler.[cpp/hpp]) support asynchronous operations or scheduling tasks required in processing queue items.

- Optionally, include a “Utility/Scheduler” component (e.g., referencing NewTaskScheduler) that assists the Queue Manager in handling delays or task scheduling.

##### Architectural Patterns & Design Principles
- Modularity: Emphasize the decoupling of the discovery logic, queuing, and UI feedback.
- Configurability: Show the interaction between the mod’s settings components and the queueing logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Components
    subgraph "Input Components"
        LD("Level Discovery (src/search/gdLevelSearch)"):::datasource
    end

    %% Queueing Components
    subgraph "Queueing Components"
        QM("QueueRequests Manager (src/queue/queueRequests)"):::processing
        LC("Level Status Checker"):::processing
    end

    %% Configuration & Utility Components
    subgraph "Configuration & Utility Components"
        SC("Settings Controller (src/settings)"):::config
        US("Utility Scheduler (src/include/NewTaskScheduler)"):::utility
    end

    %% Output Components
    subgraph "Output Components"
        UIN("UI Notification (Clock Icon)"):::ui
    end

    %% Flow Connections
    LD -->|"NewLevelEvent"| QM
    QM -->|"ProcessQueueItem"| LC
    LC -->|"ReturnStatus"| QM
    QM -->|"TriggersUIUpdate"| UIN
    SC -->|"StopQueue"| QM
    SC -->|"UpdateTiming"| QM
    US -->|"AssistScheduling"| QM

    %% Click Events for Component Mapping
    click LD "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/search/gdLevelSearch.cpp"
    click LD "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/search/gdLevelSearch.hpp"
    click QM "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/queue/queueRequests.cpp"
    click QM "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/queue/queueRequests.hpp"
    click SC "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/settings/onQueueRequestsTimingChange.cpp"
    click SC "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/settings/resetCurrentQueue.cpp"
    click SC "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/settings/resetSavedInfos.cpp"
    click SC "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/settings/stopQueue.cpp"
    click US "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/include/NewTaskScheduler.cpp"
    click US "https://github.com/geming400/showunlistedlevelsinlevelcells/blob/main/src/include/NewTaskScheduler.hpp"

    %% Styles
    classDef datasource fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef processing fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef config fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef utility fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef ui fill:#FFFF99,stroke:#000,stroke-width:2px;
```
