diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 24 | ||||
-rw-r--r-- | asteroid-helloworld.pro | 9 | ||||
-rw-r--r-- | i18n/asteroid-helloworld.desktop.h | 3 | ||||
-rwxr-xr-x | i18n/generate-desktop.sh | 61 | ||||
-rw-r--r-- | src/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/main.cpp (renamed from main.cpp) | 0 | ||||
-rw-r--r-- | src/main.qml (renamed from main.qml) | 0 | ||||
-rw-r--r-- | src/resources.qrc (renamed from resources.qrc) | 0 |
9 files changed, 35 insertions, 71 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ffe58ac --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.6.0) + +project(asteroid-helloworld + VERSION 0.0.1 + DESCRIPTION "Sample application to get started on Asteroid") + +find_package(ECM REQUIRED NO_MODULE) +find_package(AsteroidApp REQUIRED) + +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ASTEROID_MODULE_PATH}) + +include(FeatureSummary) +include(GNUInstallDirs) +include(ECMQMLModules) +include(AsteroidCMakeSettings) +include(AsteroidTranslations) + +ecm_find_qmlmodule(QtSensors 5.11) + +add_subdirectory(src) + +generate_desktop(${CMAKE_SOURCE_DIR} asteroid-helloworld) + +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/asteroid-helloworld.pro b/asteroid-helloworld.pro deleted file mode 100644 index 0c98f1c..0000000 --- a/asteroid-helloworld.pro +++ /dev/null @@ -1,9 +0,0 @@ -TARGET = asteroid-helloworld -CONFIG += asteroidapp - -SOURCES += main.cpp -RESOURCES += resources.qrc -OTHER_FILES += main.qml - -lupdate_only{ SOURCES = i18n/$$TARGET.desktop.h } -TRANSLATIONS = $$files(i18n/$$TARGET.*.ts) diff --git a/i18n/asteroid-helloworld.desktop.h b/i18n/asteroid-helloworld.desktop.h index 0ca9be1..d9a8b02 100644 --- a/i18n/asteroid-helloworld.desktop.h +++ b/i18n/asteroid-helloworld.desktop.h @@ -2,4 +2,5 @@ * will be integrated to i18n/.ts files, translated on Weblate and then merged * back with the .desktop.template file into a single .desktop file. */ -QObject::tr("Hello World App"); +//% "Hello World App +qtTrId("id-app-launcher-name"); diff --git a/i18n/generate-desktop.sh b/i18n/generate-desktop.sh deleted file mode 100755 index f4c8a3e..0000000 --- a/i18n/generate-desktop.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# This script is used to extract the translated app names found inevery .ts file -# and gather those strings with the .desktop.template file in a single .desktop - -if [ "$#" -ne 2 ]; then - echo "usage: $0 src_directory output.desktop" - exit 1 -fi - -SRC_DIR=$1 -OUTPUT_DESKTOP_FILE=$2 -if [ ! -f "${SRC_DIR}/${OUTPUT_DESKTOP_FILE}.template" ]; then - echo "${SRC_DIR}/${OUTPUT_DESKTOP_FILE}.template not found" - exit 2 -fi -if [ ! -f "${SRC_DIR}/i18n/${OUTPUT_DESKTOP_FILE}.h" ]; then - echo "${SRC_DIR}/i18n/${OUTPUT_DESKTOP_FILE}.h not found" - exit 2 -fi - -DEFAULT_NAME=`grep -oP 'QObject::tr\("\K[^"]+(?="\);)' ${SRC_DIR}/i18n/${OUTPUT_DESKTOP_FILE}.h` -if [ -z "$DEFAULT_NAME" ]; then - echo "Default name can not be found in ${SRC_DIR}/i18n/${OUTPUT_DESKTOP_FILE}.h" - exit 3 -fi - -cat ${SRC_DIR}/${OUTPUT_DESKTOP_FILE}.template > ${OUTPUT_DESKTOP_FILE} -echo "Name=$DEFAULT_NAME" >> $OUTPUT_DESKTOP_FILE - -for FILE in ${SRC_DIR}/i18n/*.ts; do - echo "Processing $FILE..." - - PROCESSED_LANG=`grep -oP 'language="\K[^"]+(?=")' $FILE` - if [ -z "$PROCESSED_LANG" ]; then - echo "> Couldn't find a corresponding language id, aborting" - continue - fi - echo "> Language: $PROCESSED_LANG detected" - - TRANSLATION_LINE=`grep -A 2 '<location.*desktop\.h" ' $FILE | grep '<translation'` - if [ -z "$TRANSLATION_LINE" ]; then - echo "> Couldn't find a corresponding desktop.h translation, aborting" - continue - fi - - LINE_IS_UNFINISHED=`echo $TRANSLATION_LINE | grep unfinished` - if [ ! -z "$LINE_IS_UNFINISHED" ]; then - echo "> Translation line has been found but is marked as unfinished, aborting" - continue - fi - - TRANSLATED_NAME=`echo $TRANSLATION_LINE | grep -oP '>\K[^<]*(?=</translation>)'` - if [ -z "$TRANSLATED_NAME" ]; then - echo "> Translation is empty, aborting" - continue - fi - echo "> Translation '$TRANSLATED_NAME' found, filling $OUTPUT_DESKTOP_FILE" - - echo "Name[$PROCESSED_LANG]=$TRANSLATED_NAME" >> $OUTPUT_DESKTOP_FILE -done diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..ef093a5 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(asteroid-helloworld main.cpp resources.qrc) +set_target_properties(asteroid-helloworld PROPERTIES PREFIX "" SUFFIX "") + +target_link_libraries(asteroid-helloworld PUBLIC + AsteroidApp) + +install(TARGETS asteroid-helloworld + DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/resources.qrc b/src/resources.qrc index 5f6483a..5f6483a 100644 --- a/resources.qrc +++ b/src/resources.qrc |