How tis2024-fmfi/smelyzajko-gui works
Project Type and Purpose
• This is a full-stack C++ desktop application (smelyzajko-gui) whose purpose is to gather visual outputs from multiple robot modules into a single Dear ImGui window. It supports three operating modes—configuration, operation, and replay—and uses YAML config files and JSON templates.
File Structure
• Top‐level directories:
• src/ – application core: module management, GUI, operating modes, widgets
• templates/ – JSON files defining default layout or behavior
• config-files/ – example YAML config files
• libs/ – third-party libraries: ImGui, GLFW, yaml-cpp, JSON header
• TestModules/ – example modules (Counter, Map, Ultrasonic, Text) and their graphics variants
• Build scripts: CMakeLists.txt, setup_project.sh
• README and INSTALL.md outline usage and dependencies.
README Insights
• Describes three modes (--config, --operate, --replay)
• Highlights use of Dear ImGui and underlying GLFW + OpenGL context
• Notes modular design: separate modules each produce sensor or algorithmic outputs.
Main Components
a. Core Application
• ModuleManager
• OperatingMode, ConfigurationMode, ReplayMode
• TemplateManager and Shortcuts/ToastNotification managers
b. Module Plugins
• Sensor/algorithm modules (CounterModule, MapModule, etc.)
• Each has a “Graphics” class that knows how to render data via ImGui
c. GUI Layer
• Dear ImGui + GLFW window + custom widgets under src/widgets/
• ImGuiFileDialog for file selection
d. External Libraries
• ImGui (core, backends)
• GLFW (window, input, OpenGL context)
• yaml-cpp (parsing config YAML)
• nlohmann/json.hpp (optional JSON parsing for templates)
e. File System
• Config-files directory for user YAML
• templates directory for JSON templates
• Logs recorded in replay mode (not shown in code tree but implied)
Relationships and Data Flow
• On launch, the CLI parser (in main.cpp) selects a Mode.
• ConfigurationMode reads a YAML config via yaml-cpp → populates ModuleManager → GUI shows config panels.
• ReplayMode reads session logs (files) → feeds modules as if live → same rendering pipeline.
• ModuleManager controls module lifecycle; GUI pulls module graphics each frame.
• TemplateManager loads JSON layouts → GUI arranges ImGui windows accordingly.
• ShortcutsManager and ToastNotificationManager handle user interactions/events at GUI level.
Architectural Patterns and Principles
• Plugin‐like architecture: modules implement a common interface (Module + ModuleGraphics).
• MVC flavor: Modules = Model, Graphics + Widgets = View, ModuleManager/OperatingMode = Controller.
• Single‐window aggregate view: uses ImGui docking and custom widgets for layout flexibility.
• Separation of concerns: parsing (yaml-cpp), rendering (ImGui/GLFW), module logic.
Essential Elements
• Every component’s label and role (e.g., “ModuleManager: lifecycle & orchestration”)
• Notes on patterns (e.g., “MVC”, “Plugin Interface”)