$ show juzzlin/Heimer
Heimer is a cross-platform desktop mind map editor built with Qt (C++17). It provides a graphical interface for creating, editing, and organizing mind maps with features like adjustable grid, automatic layout optimization, undo/redo, copy/paste, image embedding, and export to PNG/SVG. The architecture follows a layered design: domain layer (Graph, MindMapData, LayoutOptimizer), application layer (services, state machine, settings proxy), view layer (Qt widgets, QGraphicsScene/View, dialogs), and infrastructure layer (file I/O, XML serialization). Key entry points include main.cpp, Application class, MainWindow, EditorView, and EditorService. Data flows from user interactions through EditorView to EditorService, which manipulates the MindMapData (graph) and triggers serialization via AlzFileIO. External dependencies are limited to Qt (5 or 6) and two bundled small libraries (SimpleLogger for logging, Argengine for CLI argument parsing). The layout optimizer uses simulated annealing to arrange nodes, and undo/redo is implemented via snapshot-based state capture. The codebase demonstrates solid engineering practices with unit tests, CI/CD pipelines, and multi-language support.
The LLM identified 5 files worth highlighting for reuse:
Implements a simulated annealing algorithm for automatic node layout optimization in mind maps. It calculates a cost function based on edge lengths and node overlaps, then iteratively perturbs node positions to minimize cost. The algorithm is self-contained, parameterized (aspect ratio, min edge length, progress callback), and could be extracted for use in other graph visualization or layout projects.
Provides a generic undo/redo mechanism using snapshots of the entire MindMapData state. It stores a stack of deep copies and supports undo/redo with configurable depth. The implementation is decoupled from specific domain logic and could be reused in any application requiring state-based undo/redo.
A lightweight XML reader that parses XML strings into a tree of nodes with attributes and text content. It is self-contained, does not depend on Qt's XML module, and provides a simple API for traversing and querying the parsed tree. Could be reused in any project needing basic XML parsing without external dependencies.
Implements a finite state machine for controlling application flow (e.g., idle, opening file, saving, exporting, color dialog). It defines states and actions, and transitions between states based on events. The pattern is generic and could be extracted for use in other Qt applications requiring structured state management.
Calculates an optimal zoom level to fit all visible items (nodes and edges) within the viewport, considering item density and margins. It is a self-contained utility that could be reused in any QGraphicsView-based application for automatic zoom-to-fit functionality.