From e700d8f0bd8460b8d2465d8a2f378f25090af7bc Mon Sep 17 00:00:00 2001 From: Emeric Date: Thu, 28 Nov 2024 19:05:44 +0100 Subject: [PATCH] Work on CI builds --- .github/workflows/builds_desktop_cmake.yml | 34 +++++++---------- CMakeLists.txt | 25 +++++------- i18n/README.md | 44 ++++++++++++++++++++++ qml/ScreenAbout.qml | 4 +- 4 files changed, 68 insertions(+), 39 deletions(-) create mode 100644 i18n/README.md diff --git a/.github/workflows/builds_desktop_cmake.yml b/.github/workflows/builds_desktop_cmake.yml index c4e2579..6ca45c0 100644 --- a/.github/workflows/builds_desktop_cmake.yml +++ b/.github/workflows/builds_desktop_cmake.yml @@ -33,12 +33,6 @@ jobs: with: submodules: recursive - # Install Qt - - name: Install Qt - uses: jurplel/install-qt-action@v4 - with: - version: ${{env.QT_VERSION}} - # Install dependencies (from package manager) - name: Install dependencies (from package manager) run: | @@ -46,14 +40,16 @@ jobs: sudo apt-get install cmake ninja-build pkgconf libtool -y; sudo apt-get install appstream -y; - # Setup env - - name: Setup env - run: | - cmake --version + # Install Qt + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: ${{env.QT_VERSION}} # Build application - name: Build application run: | + cmake --version cmake -B build/ -DCMAKE_BUILD_TYPE=Release -G Ninja cmake --build build/ --config Release @@ -138,13 +134,6 @@ jobs: with: arch: x86_64 - # Install Qt - - name: Install Qt - uses: jurplel/install-qt-action@v4 - with: - version: ${{env.QT_VERSION}} - arch: 'win64_msvc2019_64' - # Install NSIS (already installed in 'windows-2022') #- name: Install NSIS # run: | @@ -152,14 +141,17 @@ jobs: # scoop bucket add extras # scoop install nsis - # Setup env - - name: Setup env - run: | - cmake --version + # Install Qt + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: ${{env.QT_VERSION}} + arch: 'win64_msvc2019_64' # Build application - name: Build application run: | + cmake --version cmake -B build/ -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" cd build/ nmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 899189d..42dd0d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,8 +83,6 @@ qt_add_qml_module(${CMAKE_PROJECT_NAME} qml/popups/PopupTime.qml ) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE src/) - ################################################################################ qt_standard_project_setup( @@ -134,7 +132,7 @@ target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE thirdparty/) ################################################################################ ## Android -if (CMAKE_SYSTEM_NAME STREQUAL "Android") +if(CMAKE_SYSTEM_NAME STREQUAL "Android") set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES #QT_ANDROID_ABIS "armeabi-v7a;arm64-v8a;x86;x86_64" #QT_ANDROID_BUILD_ALL_ABIS ON @@ -144,7 +142,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Android") ) endif() -#if (APPLE) +#if(APPLE) # set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO") # set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "") # set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "") @@ -152,18 +150,13 @@ endif() #endif() ## macOS -if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") #set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64") set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0") set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES MACOSX_BUNDLE ON MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/assets/macos/Info.plist" - # Old way (???) - MACOSX_BUNDLE_GUI_IDENTIFIER "io.emeric.qmlapptemplate" - MACOSX_BUNDLE_BUNDLE_NAME ${CMAKE_PROJECT_NAME} - MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION} - MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} # New Xcode attributes (???) XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "io.emeric.qmlapptemplate" XCODE_ATTRIBUTE_PRODUCT_NAME ${CMAKE_PROJECT_NAME} @@ -174,7 +167,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() ## iOS -if (CMAKE_SYSTEM_NAME STREQUAL "iOS") +if(CMAKE_SYSTEM_NAME STREQUAL "iOS") #set(assets_catalog_path "${CMAKE_SOURCE_DIR}/assets/ios/Assets.xcassets") #target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${assets_catalog_path}) #set_source_files_properties(${assets_catalog_path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) @@ -204,7 +197,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") endif() ## Release build? Set "no debug" macros -if (CMAKE_BUILD_TYPE STREQUAL Release) +if(CMAKE_BUILD_TYPE STREQUAL Release) target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE NDEBUG QT_NO_DEBUG @@ -222,9 +215,9 @@ set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES ) # Output? -#install(TARGETS ${CMAKE_PROJECT_NAME} -# BUNDLE DESTINATION bin/ -# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -#) +install(TARGETS ${CMAKE_PROJECT_NAME} + BUNDLE DESTINATION "${CMAKE_SOURCE_DIR}/bin" + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) ################################################################################ diff --git a/i18n/README.md b/i18n/README.md new file mode 100644 index 0000000..2288e62 --- /dev/null +++ b/i18n/README.md @@ -0,0 +1,44 @@ +Internationalization quick guide +-------------------------------- + +You can work on translations using one of two ways: +- [Using GitHub](https://github.com/firstcontributions/first-contributions/blob/master/README.md) by forking, branching, translating and creating a pull request. +- Directly, by downloading, translating and emailing the translation files back. It's a way more straightforward workflow, don't bother with GitHub if you don't know how to use it. + +##### Step 1: Add the language to the project (if it's a new language) + +Edit the Qt project file (_CMakeLists.txt_) and add a new language file entry to the I18N_TRANSLATED_LANGUAGES section. +You'll need to use an [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) two letter code (ex: _i18n/QmlAppTemplate_fr.ts_). + +> qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES de fr xx) + +##### Step 2: Create / update the language file + +To create (or update) the actual translation file, from the project root directory, run the following command: + +``` +cmake --build build/ --target lupdate +``` + +This will scrape the source code and add/update the strings that need to be translated into the language files. +If you are not able to run that command, you can simply open a GitHub issue and ask me for a new translation file in the langugage file you want. + +##### Step 3: Translating + +Translate by editing the .ts file using Qt Linguist. + +- Remember to match upper/lower case letters, punctuation and trailing spaces! +- You don't have to translate everything, missing strings will fall back to English. +- If you're not sure about a word or sentence, leave the "unfinished" tag, so other people can have a second look at it. + +> Qt Linguist manual: https://doc.qt.io/qt-6/linguist-translators.html + +> Qt Linguist standalone downloads: https://github.com/thurask/Qt-Linguist/releases + +> Qt Linguist standalone downloads: https://github.com/lelegard/qtlinguist-installers/releases + +##### Step 4: Publish it! + +Send the file(s) back to the project, using email or a GitHub pull request. +If you want to be credited in the application (and in this file) please be sure to mention it, and provide a name/pseudo, and wished an email/GitHub page. +It's useful in case a person wants to contact you about the translation, or if you want to be contacted when a new version of the project will be released and a translation update is needed. diff --git a/qml/ScreenAbout.qml b/qml/ScreenAbout.qml index 306ed2f..ff79e16 100644 --- a/qml/ScreenAbout.qml +++ b/qml/ScreenAbout.qml @@ -118,7 +118,7 @@ Loader { text: qsTr("SUPPORT") source: "qrc:/IconLibrary/material-symbols/support.svg" sourceSize: 22 - onClicked: Qt.openUrlExternally("https://emeric.io/") + onClicked: Qt.openUrlExternally("https://github.com/emericg/QmlAppTemplate/issues") } ButtonSolid { @@ -172,7 +172,7 @@ Loader { text: qsTr("SUPPORT") source: "qrc:/IconLibrary/material-symbols/support.svg" sourceSize: 22 - onClicked: Qt.openUrlExternally("https://emeric.io/") + onClicked: Qt.openUrlExternally("https://github.com/emericg/QmlAppTemplate/issues") } }