diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/CMakeLists.txt b/CMakeLists.txt index 57ce8d0..c95315c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,6 +155,37 @@ foreach(library IN LISTS BOOST_COMPONENTS) endif() endforeach() +# Create code filters + # For source code +file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.h" "src/*.ui") +foreach(SOURCE ${SOURCES}) + get_filename_component(SOURCE_DIR "${SOURCE}" DIRECTORY) + file(RELATIVE_PATH SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${SOURCE_DIR}) + string(REPLACE "src" "Source Files" SOURCE_PATH "${SOURCE_PATH}") + source_group("${SOURCE_PATH}" FILES ${SOURCE}) +endforeach() + # For resources +file(GLOB_RECURSE SOURCES "*.rc" "*.qrc") +foreach(SOURCE ${SOURCES}) + source_group("Resources" FILES ${SOURCE}) +endforeach() +source_group("Resources" FILES + "${CMAKE_BINARY_DIR}/.rcc/resources.qrc" + "${CMAKE_BINARY_DIR}/.rcc/qrc_resources.cpp") + + # For autogenerated by Qt ui_[name].h files for every src/*.ui file +file(GLOB_RECURSE SOURCES "src/*.ui") +foreach(SOURCE ${SOURCES}) + get_filename_component(FILE_NAME ${SOURCE} NAME_WE) # Extract file name without extension + file(RELATIVE_PATH SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${SOURCE}) + string(REPLACE "${FILE_NAME}.ui" "" FILE_PATH "${SOURCE_PATH}" ) + source_group("Autogen/ui/${FILE_NAME}" FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include_Debug/${FILE_PATH}ui_${FILE_NAME}.h" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include_MinSizeRel/${FILE_PATH}ui_${FILE_NAME}.h" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include_Release/${FILE_PATH}ui_${FILE_NAME}.h" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include_RelWithDebInfo/${FILE_PATH}ui_${FILE_NAME}.h") +endforeach() + # Resources include(cmake/Resources.cmake) string(REPLACE "-" "_" QML_URI "${PROJECT_NAME}") @@ -171,6 +202,29 @@ else() FILES ${RESOURCES}) endif() + # For autogenerated by Qt stamp files +source_group("Autogen/autouic" FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_LIB_autogen/autouic_Debug.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_LIB_autogen/autouic_MinSizeRel.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_LIB_autogen/autouic_Release.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_LIB_autogen/autouic_RelWithDebInfo.stamp" ) + + # For autogenerated by Qt stamp files +source_group("Autogen/autouic" FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/autouic_Debug.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/autouic_MinSizeRel.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/autouic_Release.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/autouic_RelWithDebInfo.stamp" ) + + # For autogenerated by Qt MOC files +source_group("Autogen/moc" FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation_Debug.cpp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation_MinSizeRel.cpp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation_Release.cpp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation_RelWithDebInfo.cpp") + +source_group("CMake Rules" FILES "CMakeLists.txt") + # Provide alias to library for if(${PROJECT_NAME}_BUILD_EXECUTABLE) add_executable(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) diff --git a/README.md b/README.md index bab15df..6e2f4de 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ Example: set(BOOST_COMPONENTS filesystem) ``` -Modify `CMakeLists.txt` and after `include(cmake/Modules.cmake)` add following code: +Modify `CMakeLists.txt` and after line `7`: `include(cmake/Modules.cmake)` add following code: ```cmake foreach(library IN LISTS {NEW_VARIABLE_WITH_COMPONENTS}) @@ -209,7 +209,7 @@ foreach(library IN LISTS BOOST_COMPONENTS) endforeach() ``` -In the **same file**, after `# Link libraries` add following code: +In the **same file**, after line `135`: `# Link libraries` add following code: ```cmake foreach(library IN LISTS {NEW_VARIABLE_WITH_COMPONENTS}) @@ -231,7 +231,7 @@ foreach(library IN LISTS BOOST_COMPONENTS) endforeach() ``` -You should also link the library to the **test** projects. To do that, modify `test/CMakeLists.txt` and after `# Link libraries` add following code: +You should also link the library to the **test** projects. To do that, modify `test/CMakeLists.txt` and after line `53`: `# Link libraries` add following code: ```cmake foreach(library IN LISTS {NEW_VARIABLE_WITH_COMPONENTS}) @@ -382,7 +382,7 @@ conan profile new default --detect Put your **icon image** in **PNG** format into a folder `icon/` and **rename** it, so it matches this convention: -```ini +``` icon_[width]x[height].png ``` @@ -433,7 +433,7 @@ sudo apt install icnsutils
-
Docs shouldn't contain private members +
Docs shouldn't contain private members and source code If your project is a library, you might not want to add the **private** and **protected** members to your documentation. Editing one line in `.github/workflows/doxygen.yml` can change this behaviour. Find this step: @@ -462,6 +462,107 @@ And change it to:
+
"/bin/bash^M: bad interpreter: No such file or directory" + +If you downloaded the project on *Windows* and try to run these scripts in Unix, you might encounter: +*`-bash: ./createIcns.sh: /bin/bash^M: bad interpreter: No such file or directory`* + +Run `icon/WinScripts/fixUnixScripts.ps1` +Or some tool like **dos2unix**. +On *Ubuntu* you can install it by: + +```bash +sudo apt install dos2unix +``` + +And then simply run (assuming you are at `qt-template/`): + +```bash +dos2unix ./icon/UnixScripts/*.sh +``` + +
+
+ +
Add/change/remove custom filter + +At line `174` of `CMakeLists.txt` you can modify following code for **filters** to change or remove them: + +
The code + +```cmake +# Create code filters + # For source code +file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.h" "src/*.ui") +foreach(SOURCE ${SOURCES}) + get_filename_component(SOURCE_DIR "${SOURCE}" DIRECTORY) + file(RELATIVE_PATH SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${SOURCE_DIR}) + string(REPLACE "src" "Source Files" SOURCE_PATH "${SOURCE_PATH}") + source_group("${SOURCE_PATH}" FILES ${SOURCE}) +endforeach() + # For resources +file(GLOB_RECURSE SOURCES "*.rc" "*.qrc") +foreach(SOURCE ${SOURCES}) + source_group("Resources" FILES ${SOURCE}) +endforeach() +source_group("Resources" FILES + "${CMAKE_BINARY_DIR}/.rcc/resources.qrc" + "${CMAKE_BINARY_DIR}/.rcc/qrc_resources.cpp") + + # For autogenerated by Qt ui_[name].h files for every src/*.ui file +file(GLOB_RECURSE SOURCES "src/*.ui") +foreach(SOURCE ${SOURCES}) + get_filename_component(FILE_NAME ${SOURCE} NAME_WE) # Extract file name without extension + file(RELATIVE_PATH SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${SOURCE}) + string(REPLACE "${FILE_NAME}.ui" "" FILE_PATH "${SOURCE_PATH}" ) + source_group("Autogen/ui/${FILE_NAME}" FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include_Debug/${FILE_PATH}ui_${FILE_NAME}.h" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include_MinSizeRel/${FILE_PATH}ui_${FILE_NAME}.h" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include_Release/${FILE_PATH}ui_${FILE_NAME}.h" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/include_RelWithDebInfo/${FILE_PATH}ui_${FILE_NAME}.h") +endforeach() + + # For autogenerated by Qt stamp files +source_group("Autogen/autouic" FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_LIB_autogen/autouic_Debug.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_LIB_autogen/autouic_MinSizeRel.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_LIB_autogen/autouic_Release.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_LIB_autogen/autouic_RelWithDebInfo.stamp" ) + + # For autogenerated by Qt stamp files +source_group("Autogen/autouic" FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/autouic_Debug.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/autouic_MinSizeRel.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/autouic_Release.stamp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/autouic_RelWithDebInfo.stamp" ) + + # For autogenerated by Qt MOC files +source_group("Autogen/moc" FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation_Debug.cpp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation_MinSizeRel.cpp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation_Release.cpp" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}_autogen/mocs_compilation_RelWithDebInfo.cpp") + +source_group("CMake Rules" FILES "CMakeLists.txt") +``` + +
+ +You can add your own filters after line `226` in `CMakeLists.txt`, by adding: + +```cmake +source_group("[FILTER_NAME]" FILES "[FILE_PATHS]") +``` + +Example: + +```cmake +source_group("birds" FILES "src/flamingo.ui" "src/Birds/crow.h") +``` + +
+
+ ## Contributing This project follows these [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines), and it would be fun if you followed them too. If you don't, someone will correct your code. An ugly contribution is better than no contribution. **Thanks**! diff --git a/cmake/Resources.cmake b/cmake/Resources.cmake index 83b65ac..98b82ee 100644 --- a/cmake/Resources.cmake +++ b/cmake/Resources.cmake @@ -8,7 +8,9 @@ foreach(QML_FILE ${QML_FILES}) QT_RESOURCE_ALIAS ${QML_FILE_PATH}) endforeach() -set(RESOURCES icon/icon_32x32.png) +set(RESOURCES + icon/icon_32x32.png + icon/icon_64x64.png) # Prepend "../" to each path foreach(Resource ${RESOURCES}) diff --git a/conanLibrariesInstall.bat b/conanLibrariesInstall.bat new file mode 100644 index 0000000..586202e --- /dev/null +++ b/conanLibrariesInstall.bat @@ -0,0 +1,3 @@ +conan install conan/ --build=missing --settings=build_type=Debug +conan install conan/ --build=missing --settings=build_type=Release +pause \ No newline at end of file diff --git a/conanLibrariesInstall.sh b/conanLibrariesInstall.sh new file mode 100644 index 0000000..eb8598e --- /dev/null +++ b/conanLibrariesInstall.sh @@ -0,0 +1,3 @@ +#!/bin/bash +conan install conan/ --build=missing --settings=build_type=Debug +conan install conan/ --build=missing --settings=build_type=Release diff --git a/doxygen/Doxyfile_dev b/doxygen/Doxyfile_dev index d5a97e7..672e0b2 100644 --- a/doxygen/Doxyfile_dev +++ b/doxygen/Doxyfile_dev @@ -1161,13 +1161,13 @@ FORTRAN_COMMENT_AFTER = 72 # also VERBATIM_HEADERS is set to NO. # The default value is: NO. -SOURCE_BROWSER = YES +SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. # The default value is: NO. -INLINE_SOURCES = YES +INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any # special comment blocks from generated source code fragments. Normal C, C++ and @@ -1180,7 +1180,7 @@ STRIP_CODE_COMMENTS = YES # entity all documented functions referencing it will be listed. # The default value is: NO. -REFERENCED_BY_RELATION = YES +REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES then for each documented function # all documented entities called/used by that function will be listed. @@ -1285,7 +1285,7 @@ CLANG_DATABASE_PATH = # classes, structs, unions or interfaces. # The default value is: YES. -ALPHABETICAL_INDEX = NO +ALPHABETICAL_INDEX = YES # The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) # that should be ignored while generating the index headers. The IGNORE_PREFIX diff --git a/icon/WinScripts/fixUnixScripts.ps1 b/icon/WinScripts/fixUnixScripts.ps1 new file mode 100644 index 0000000..6460290 --- /dev/null +++ b/icon/WinScripts/fixUnixScripts.ps1 @@ -0,0 +1,43 @@ +$targetPaths = @( + "..\UnixScripts", + "..\..\conanLibrariesInstall.sh" +) + +foreach ($targetPath in $targetPaths) { + if (-not (Test-Path -Path $targetPath)) { + Write-Host "The target path '$targetPath' does not exist." + continue + } + + if ((Get-Item $targetPath).PSIsContainer) { + # Process a directory + Get-ChildItem -Path $targetPath | ForEach-Object { + $file = $_.FullName + Write-Host "Processing file: $file" + + # Read the content of the file and replace carriage return characters with empty strings + $content = Get-Content -Path $file -Raw + $content = $content -replace "\r", "" + + # Write the modified content back to the same file without adding a newline at the end + Set-Content -Path $file -Value $content -NoNewline + } + + Write-Host "All carriage return characters removed from files in $targetPath." + } + else { + # Process a single file + $file = $targetPath + Write-Host "Processing file: $file" + + # Read the content of the file and replace carriage return characters with empty strings + $content = Get-Content -Path $file -Raw + $content = $content -replace "\r", "" + + # Write the modified content back to the same file without adding a newline at the end + Set-Content -Path $file -Value $content -NoNewline + + Write-Host "All carriage return characters removed from $file." + } +} +Pause diff --git a/src/Exceptions.cpp b/src/Exceptions/Exceptions.cpp similarity index 99% rename from src/Exceptions.cpp rename to src/Exceptions/Exceptions.cpp index 1cf3328..d7f34e9 100644 --- a/src/Exceptions.cpp +++ b/src/Exceptions/Exceptions.cpp @@ -1,4 +1,4 @@ -#include "Exceptions.h" +#include "Exceptions.h" //QML //QObject* AppException::exceptionMessage = nullptr; diff --git a/src/Exceptions.h b/src/Exceptions/Exceptions.h similarity index 99% rename from src/Exceptions.h rename to src/Exceptions/Exceptions.h index e6a9e4d..c9e28b6 100644 --- a/src/Exceptions.h +++ b/src/Exceptions/Exceptions.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include diff --git a/src/main.cpp b/src/main.cpp index 26c0302..d46a350 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,7 +3,7 @@ #include #include -#include "Exceptions.h" +#include "Exceptions/Exceptions.h" int main(int argc, char* argv[]) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c7b8263..9527cf9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3,7 +3,7 @@ #include -#include "Exceptions.h" +#include "Exceptions/Exceptions.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), diff --git a/src/mainwindow.h b/src/mainwindow.h index df74ee2..5b7a28d 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include QT_BEGIN_NAMESPACE diff --git a/src/qml/Here you should place your qml files b/src/qml/Here you should place your qml files new file mode 100644 index 0000000..e69de29