How tira-mis-u/cnpm works
1. Project type and runtime
- This is a desktop application for managing student records, built in C++17 with Qt 6 Widgets.
- The app is organized as a classic MVC system and uses SQLite through Qt’s QSQLITE driver.
2. Top-level architecture
- The repository separates the app into three main layers:
- Views: Qt dialogs and the main window under src/views
- Controllers: application logic under src/controllers
- Models: domain entities under src/models
- A dedicated database layer under src/database handles database access.
3. User interface layer
- The UI is implemented with Qt Widgets and .ui files generated/maintained in Qt Designer.
- Main screens are:
- mainwindow
- logindialog
- studentdialog
- classdialog
- departmentdialog
- These views are the primary entry points for user actions and data editing.
4. Application flow
- The user interacts with a dialog or the main window.
- The view triggers a controller method.
- The controller coordinates validation and persistence.
- Models represent the data being edited or displayed.
- The database manager executes SQLite operations.
5. Controller layer
- Controllers exist for the core managed entities:
- studentcontroller
- classcontroller
- departmentcontroller
- This indicates the app likely supports CRUD-style operations for students, classes, and departments.
- Controllers form the boundary between UI events and storage logic.
6. Model layer
- The models mirror the core domain objects:
- student
- class_model
- department
- These are likely used to carry data between controllers, views, and database code.
- The separation suggests the application avoids putting database logic directly in the UI.
7. Database subsystem
- src/database/databasemanager.* is the central persistence component.
- It likely owns database connection setup and shared query execution against SQLite.
- This creates a single data-access boundary rather than letting each controller manage its own connection logic.
8. Data and schema assets
- docs/schema.sql provides the database schema definition, which is important for understanding the persistent data model.
- docs/design.md likely documents the intended architecture and domain design.
- Together, these docs are the best source for the logical entity relationships in the system.
9. Resources and packaging
- src/resources/resources.qrc bundles Qt resources used by the application.
- The deploy/ directory contains a packaged Windows executable and Qt runtime plugins such as platforms and sqldrivers, showing the app is prepared for desktop distribution.
- run.bat is a convenience launch script for local execution.
10. Build system
- The project uses CMake as the build system.
- The presence of build/ artifacts and Qt deployment files indicates the repo supports native desktop builds and packaging for Qt.
- CMakeLists.txt is the primary build definition for compiling the widgets app and linking Qt modules.
11. Boundary summary
- The most important architectural boundary is:
- UI/interaction in views
- business/action coordination in controllers
- data representation in models
- persistence in database
- This is a straightforward layered desktop architecture rather than a distributed or service-oriented system.
12. Diagram guidance
- For an architecture diagram, show:
- user → Qt views
- views → controllers
- controllers ↔ models
- controllers → database manager → SQLite database
- Treat docs/schema.sql as the source of the persistent entity structure, and deploy/ as packaging/runtime support rather than a runtime subsystem.
Main entry points: mainwindow.cpp Main window · studentcontroller.cpp Student controller · databasemanager.cpp DB manager · classcontroller.cpp Class controller
Components 19
UI layer
Qt Widgets screens and dialogs used for user interaction.
- Main window · Primary application shell for navigation and user actions.
src/views/mainwindow.cpp - Login dialog · Authentication or startup gate dialog.
src/views/logindialog.cpp - Student dialog · Student editing and detail dialog.
src/views/studentdialog.cpp - Class dialog · Class editing and detail dialog.
src/views/classdialog.cpp - Department dialog · Department editing and detail dialog.
src/views/departmentdialog.cpp
Application logic
Controllers and app entry that coordinate actions.
- App entry · Starts the Qt application and opens the main UI.
src/main.cpp - Student controller · Coordinates student-related actions and persistence.
src/controllers/studentcontroller.cpp - Class controller · Coordinates class-related actions and persistence.
src/controllers/classcontroller.cpp - Department controller · Coordinates department-related actions and persistence.
src/controllers/departmentcontroller.cpp
Domain model
Core student, class, and department entities.
- Student · Student domain entity used across the app.
src/models/student.cpp - Class · Class domain entity used across the app.
src/models/class_model.cpp - Department · Department domain entity used across the app.
src/models/department.cpp
Persistence
Database access, schema, and deployment/runtime support.
- DB manager · Central SQLite access and query coordination.
src/database/databasemanager.cpp - SQLite DB · Application data stored through the Qt SQL driver.
- Schema · Database schema definition for the persistent model.
docs/schema.sql - Design notes · Repository documentation for intended structure and domain rules.
docs/design.md - Qt resources · Bundled application resources referenced by Qt.
src/resources/resources.qrc - CMake · Build definition for compiling and linking the desktop app.
CMakeLists.txt - Deployment · Packaged executable and Qt runtime plugins for distribution.
deploy/QuanLyHoSoSinhVien.exe
Connections 21
- App entry → Main window: launches · Application entry creates and shows the main window.
- App entry → Login dialog: starts · Startup flow may present the login dialog first.
- Main window → Student dialog: opens · Main window opens student management screens.
- Main window → Class dialog: opens · Main window opens class management screens.
- Main window → Department dialog: opens · Main window opens department management screens.
- Login dialog → Student controller: auth flow · Login or startup actions route into application control.
- Student dialog → Student controller: uses · Student dialog delegates actions to the controller.
- Class dialog → Class controller: uses · Class dialog delegates actions to the controller.
- Department dialog → Department controller: uses · Department dialog delegates actions to the controller.
- Student controller → Student: reads/writes · Controller works with student domain objects.
- Class controller → Class: reads/writes · Controller works with class domain objects.
- Department controller → Department: reads/writes · Controller works with department domain objects.
- Student controller → DB manager: persists · Student operations are stored through the database manager.
- Class controller → DB manager: persists · Class operations are stored through the database manager.
- Department controller → DB manager: persists · Department operations are stored through the database manager.
- DB manager → SQLite DB: queries · Database manager executes SQL against SQLite.
- Schema → SQLite DB: defines · Schema document defines the persistent tables and relationships.
- Design notes → Student controller: guides · Design documentation informs the layered controller structure.
- Qt resources → Main window: supports · Qt resources are consumed by the UI layer.
- CMake → App entry: builds · CMake builds the application entry and linked modules.
- CMake → Deployment: packages · Build and deployment outputs are prepared for distribution.