$ show danpla/dpscreenocr
dpScreenOCR is a cross-platform desktop application for recognizing text from a selected screen region. It is built in C++ using the Tesseract OCR engine and Qt 5/6 for the graphical interface. The application runs as a system-tray utility: the user triggers a screen selection via a global hotkey, captures a portion of the screen, processes the image (grayscale conversion, upscaling, unsharp masking), and feeds it to Tesseract. Recognized text can be copied to the clipboard, added to a persistent history, or passed to an external executable. The architecture is modular, with separate libraries for OCR (dpso_ocr), system interaction (dpso_sys), image processing (dpso_img), network requests (dpso_net), sound playback (dpso_sound), configuration and history (dpso_ext), and a suite of cross-platform utilities (dpso_utils). Each module exposes a C API for C/C++ interoperability and includes platform-specific backends for X11 and Windows. The Qt UI provides a main window with recognition controls, a language manager for installing/updating Tesseract language packs, and export functionality for history. The project also packages a built-in gettext-compatible internationalization library (dp_intl) and supports 16 languages through Weblate. This is a pure application repository with no data analysis or machine learning training components. The code demonstrates solid engineering practices: clear separation of concerns, RAII resource management, comprehensive error handling, and an extensive CMake-based build system supporting multiple packaging formats (Unix bundle, Windows MSIX, Inno Setup). The test suite covers utility functions, geometry, SHA-256, version comparison, and platform-specific components, though the OCR pipeline itself has limited direct unit tests.
The LLM identified 3 files worth highlighting for reuse:
Defines an abstract base class for byte-oriented input/output streams with read/write/close operations. Accompanied by concrete implementations (FileStream, OutNewlineConversionStream) that are self-contained and could be extracted into any project needing file or newline-aware streaming I/O.
A generic template class that wraps any value with a mutex, providing RAII locked access via operator-> and operator*. It is minimal, header-only, and demonstrates a clean pattern for thread-safe shared state reusable across projects.
A self-contained, vendored internationalization library that parses GNU gettext MO files, handles plural forms, and provides a locale-aware translation API. It is fully independent of the host project and can be embedded in any C++ application that needs localization without external dependencies.