How praveenkumar76/hashtrace works
Project Type & Purpose
• This is a desktop full-stack application.
• Frontend: Qt Quick (QML files: Main.qml, FileCard.qml).
• Backend: C++ modules (Preprocessor, Rabin-Karp, FileReader, Backend class).
File Structure & Components
Top-level source files (ignore the build/ folder):
• main.cpp: entry point, sets up QML engine and exposes C++ backend.
• FileCard.qml & Main.qml: UI components for file list, comparison view.
• filereader.cpp/.h: reads raw text from files.
• Preprocessor.cpp/.h: strips comments, blank lines, reserved keywords.
• Rabin_karp.cpp/.h: implements rolling-hash fingerprinting.
• backend.cpp/.h: QObject subclass with Q_INVOKABLE methods coordinating the pipeline.
README Insights
• Workflow: Preprocessing → Hashing → Comparison → Visualization.
• Tech stack: Qt6/QML (UI), C++17 (logic), CMake (build), Rabin-Karp algorithm.
Main Components & Interactions
a. Components
• UI Layer (QML)
• Backend Controller (QObject in backend.cpp)
• File I/O (FileReader)
• Preprocessor Module
• Hashing Module (Rabin-Karp)
• Comparison Engine (takes two hash streams, computes matches & similarity score)
• Data Model & Results (structures holding matched segments & scores)
• File System (external service)
b. Relationships & Data Flow
1. User drags files into QML UI → emits QML signal.
2. QML signal invokes C++ Backend API (Q_INVOKABLE).
3. Backend calls FileReader → returns raw text.
4. Backend passes text to Preprocessor → returns cleaned text.
5. Backend passes cleaned text to Rabin-Karp → returns hash sequences.
6. Backend Comparison Engine compares hash sequences → builds match data + similarity %.
7. Backend emits Qt signal / returns result to QML.
8. QML UI binds to result model → renders highlighted blocks side-by-side.
c. Architectural Patterns
• MVC/MVVM flavor: QML = View, C++ backend = Model/Controller.
• Pipeline pattern: sequential modules (Preprocessor → Hash → Compare).
• Signal-Slot / Q_INVOKABLE for async interactions between UI and backend.
d. Key Technologies
• Qt Quick (QML), Qt C++ (QtCore, QtQml)
• C++17 standard library
• CMake build definitions
• Rabin-Karp Rolling Hash algorithm
Putting It All Together
[Tier 1: QML UI] ←→ [Tier 2: C++ Backend Pipeline] ←→ [Tier 3: File System]
• Inside Tier 2, horizontally chain: FileReader → Preprocessor → RabinKarp → ComparisonEngine → ResultModel.