Package: qleany
Qleany - Clean Architecture Framework for C++/Qt6 ProjectsQleany is a streamlined framework designed to integrate Clean Architecture principles within C++ Qt6 applications. It is built on three core components:Qleany C++/Qt Library: Provides a range of common and generic tools and classes essential for implementing Clean Architecture in C++/Qt projects.Python/Jinja2 Project Structure Generator: Features a dedicated user interface developed using PySide. This generator facilitates the creation of a structured project environment based on the principles of Clean Architecture.Examples and Documentation: A collection of examples to guide users in implementing the framework effectively.Important NoticesPlease avoid using Qt Design Studio version 4.3 (which utilizes Qt 6.6) due to a known issue that impacts Qt versions 6.5.3 and 6.6. This bug can cause crashes in previews (qml2puppet) when working with QML mocks generated by Qleany. We recommend using Qt Design Studio LTS version 4.1 instead, as it is based on Qt 6.5.1 and does not exhibit this problem. Qt Design Studio 4.4 preview seems to run well with Qleany.Framework's ObjectiveQleany's primary goal is to automate the generation of a structured project environment for C++/Qt6 applications. This is achieved by interpreting a simple manifest file, namedqleany.yaml, located at the root of the project. The framework generates a comprehensive structure including folders, CMakeLists.txt, and essential C++ files. The generated projects support both QWidget and QML GUIs or a combination of both. Upon initial generation, the projects are immediately compilable, requiring developers only to design GUIs and implement custom use cases.The framework acknowledges the repetitive nature of file creation in Clean Architecture and addresses this by automating the generation of similar files. Additional features include:An asynchronous undo-redo system based on the command pattern.A SQLite-based database layer for data persistence.Support for custom use cases with user-defined DTOs (Data Transfer Objects) for inputs and outputs.The ability to define both soft and hard relationships between entities, including one-to-one and one-to-many (unordered or ordered) associations.Entities within the framework handle cascade deletion. Additionally, the implementation of soft-deletion (recoverable trash binning) is currently in progress.Framework StructureMany developers are likely familiar with the following depiction of Clean Architecture:It's important to note that this conceptual representation needs to be tailored to fit the specific requirements of the language and project at hand. Qleany presents a distinct interpretation of Clean Architecture, uniquely adapted and structured to suit its specific use cases and environment.Domain: Contains entities and is encapsulated in a library nameddomain.Application: Groups use cases by functionalities, organized within a library calledapplication.Persistence: Manages internal data persistence. It includes a 'repository' wrapper for SQLite database interactions, with each entity having its repository in theRepositoryProviderclass.Contracts: A common library for most other components, housing all interfaces frompersistence,gateway, andinfrastructure. This design minimizes tight coupling and circular dependencies.DTO Libraries: Each functionality has its DTO library, facilitating communication with theapplicationlayer. DTOs are used for both input and output in interactions with the outer layers, such as interactors.Gateway: Optional library for handling remote connections and services. It can be manually added by the developer and is used similarly to repositories in use cases.Infrastructure: Optional. Handles actions like file management, local settings, and system queries. It's injected into use cases similar to repositories and gateways.Interactor: Acts as an internal API to invoke use cases, streamlining the interaction between the user interface and application logic.Presenter: Maintains Qt models and representations of unique entities (referred to asSingles), enhancing their integration and usage within the GUI.Registration: Each component (persistence,gateway,infrastructure,interactor) initializes its classes in a correspondingname_registration.cpp file, typically called together in the main.cpp.Project dependencies:Example of project structure:Utilizing the Qleany GUI InterfaceQleany tooling can be installed usingpip install qleany.To access Qleany's user-friendly graphical interface, runqleanyin a terminal. This interface allows developers to efficiently manage file generation. This is the recommended way to generate files.Run the Qleany GUI:Launch Qleany's graphical user interface by executing the scriptgenerator/qleany_generator_ui.py.Select theqleany.yamlFile:Begin by choosing your project'sqleany.yamlfile. This configuration file is essential for the GUI to operate correctly.List Available Files:In the GUI, use the "list" button for each component. This will generate a list of files that can be created for that component.Select Files to Generate:Choose the files you want to generate from the provided list, depending on your project requirements.Preview Files:Opt for the "preview" feature to generate and inspect the selected files in a "preview" folder. The location of this folder is defined in yourqleany.yamlfile.Generate Files:After previewing, proceed to generate the files by clicking the "generate" button. This will create the files in their designated locations within your project.Overwrite Confirmation:Should the file generation process require overwriting existing files, a warning message will appear. This alert ensures you are informed about and agree to the upcoming changes to your current files.Alternatively, you can list and generate all the files of the project.Qleany YAML Configuration RulesTheqleany.yamlfile is the core configuration file for the Qleany framework. A working example can be foound inexample/simple/qleany.yaml. Below are the rules and structure for defining the configuration:Global Settingsglobal:application_name:SimpleExampleapplication_cpp_domain_name:Simpleorganisation:name:simpleexampledomain:qleany.euEntities DefinitionDefines entities and their properties. Setting parent to EntityBase (provided by Qleany) offers the "id" field of type "int". It's mandatory to use EntityBase as heritage.entities:list:-name:EntityNameparent:ParentEntityonly_for_heritage:true/falsefields:# basic:-type:DataTypename:fieldNamehidden: true/false (default:false)# one-to-one relationship:-type:OtherEntityNamename:fieldNamestrong:true/falsehidden: true/false (default:false)# one-to-many relationship:-type:QList<OtherEntityName>name:fieldNamestrong:true/falseordered:true/falsehidden: true/false (default:false)# other fields ...# other entitiesexport:EXPORT_MACRO_NAMEexport_header_file:header_file_name.hfolder_path:path/to/entity/folderRepositories ConfigurationSpecifies settings for entity repositories.repositories:list:-entity_name:EntityNamelazy_loaders:true/false# other repositories, typically one for each entityinterface_path:path/to/interfaceexport:EXPORT_MACRO_NAMEexport_header_file:header_file_name.hrepository_folder_path:path/to/repository/folderbase_folder_path:path/to/base/folderInteractor SettingsConfigures interactor-specific settings.interactor:folder_path:path/to/interactor/folderexport:EXPORT_MACRO_NAMEexport_header_file:header_file_name.hcreate_undo_redo_interactor:true/falseApplication Layer ConfigurationDefines application-specific settings and CRUD operations.application:common_cmake_folder_path:path/to/application/folderfeatures:-name:FeatureNameDTO:dto_identical_to_entity:enabled:true/falseentity_mappable_with:EntityNameCRUD:enabled: true/false (default:false)entity_mappable_with:EntityNameget:enabled:true/falseget_all:enabled:true/falseget_with_details:enabled:true/falsecreate:enabled:true/falseremove:enabled:true/falseupdate:enabled:true/falseinsert_relation:enabled:true/falseremove_relation:enabled:true/falsecommands:-name:CommandNameentities:-EntityNamevalidator:enabled:true/falseundo:true/falsedto:in:enabled: true/false (default:true)type_prefix:CommandNamefields:-type:DataTypename:fieldNameout:enabled: true/false (default:true)type_prefix:CommandNameReplyfields:-type:DataTypename:fieldNamequeries:-name:QueryNameentities:-EntityNamevalidator:enabled:true/falseundo:false (useless for queries)dto:in:enabled: true/false (default:true)type_prefix:QueryNamefields:-type:DataTypename:fieldNameout:type_prefix:QueryNameReplyfields:-type:DataTypename:fieldNameDTOs (Data Transfer Objects) ConfigurationDTOs:common_cmake_folder_path:path/to/dtos/folderContracts ConfigurationDefines settings for contracts in the application.contracts:inverted_app_domain:domain.identifierfolder_path:path/to/contracts/folderexport:EXPORT_MACRO_NAMEexport_header_file:header_file_name.hPresenter SettingsConfigures presenter-specific settings. Note: thenamecan be set toautopresenter:folder_path:path/to/presenter/folderexport:EXPORT_MACRO_NAMEexport_header_file:header_file_name.hcreate_undo_and_redo_singles:true/false (default false)singles:-name:SingleName (or "auto")entity:EntityNameread_only: true/false (default:false)# Additional singles...list_models:-name:ListModelName (or auto)entity:EntityNamedisplayed_field:fieldNamein_relation_of:RelationEntityrelation_field_name:relationFieldNameread_only: true/false (default:false)# Additional list models...QML ConfigurationSpecifies paths for QML folder. The folders mock_imports and real_imports will be created in it.qml:folder_path:path/to/qml/folderMIT LicenseCopyright (c) 2023 Cyril JacquetPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.