Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kebekus committed Nov 24, 2024
1 parent dcf2db9 commit 0a4c43f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 83 deletions.
21 changes: 4 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,17 @@ endif()
add_compile_definitions(GIT_COMMIT="${GIT_COMMIT}")


if(IOS)
set(PRODUCT_BUNDLE_IDENTIFIER de.akafliegfreiburg.addhoursandminutes)
# set(CMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "XXXXX")

#set Icon
set(CMAKE_XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon)
endif()


# Include required packages
find_package(Qt6 6.6 REQUIRED COMPONENTS Core LinguistTools Quick QuickControls2 Svg)
set(QT_VERSION ${Qt6Core_VERSION})
set(QT_QML_GENERATE_QMLLS_INI ON)

if(${QT_VERSION} VERSION_GREATER_EQUAL "6.7.0")
qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES de es fr it pl)
else()
qt_standard_project_setup()
endif()
qt_standard_project_setup(I18N_TRANSLATED_LANGUAGES de es fr it pl)

qt_policy(SET QTP0001 NEW)
if ((CMAKE_SYSTEM_NAME STREQUAL "Android") OR ((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME STREQUAL "Windows")))
qt_policy(SET QTP0002 NEW)
endif ()
qt_policy(SET QTP0002 NEW)
qt_policy(SET QTP0004 NEW)


# Subdirectories
add_subdirectory(generatedSources)
Expand Down
4 changes: 2 additions & 2 deletions src/AndroidManifest.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
android:versionCode="${PROJECT_VERSION_CODE}${ABI_CODE}"
android:installLocation="auto">
<uses-sdk
android:minSdkVersion="23"
android:targetSdkVersion="35"/>
android:minSdkVersion="28"
android:targetSdkVersion="34"/>
<uses-permission
android:name="android.permission.VIBRATE"/>
<supports-screens
Expand Down
92 changes: 36 additions & 56 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,29 @@ qt_add_resources(${PROJECT_NAME} "programicons"
FILES
${CMAKE_SOURCE_DIR}/metadata/de.akaflieg_freiburg.cavok.add_hours_and_minutes.svg
${CMAKE_SOURCE_DIR}/generatedSources/metadata/de.akaflieg_freiburg.cavok.add_hours_and_minutes.png

)


if(${QT_VERSION} VERSION_GREATER_EQUAL "6.7.0")
qt_add_lrelease(
TS_FILES
addhoursandminutes_de.ts
addhoursandminutes_es.ts
addhoursandminutes_fr.ts
addhoursandminutes_it.ts
addhoursandminutes_pl.ts
QM_FILES_OUTPUT_VARIABLE qmFiles
)
qt_add_resources(
${PROJECT_NAME}
translations_addhoursandminutes
BASE
${CMAKE_CURRENT_BINARY_DIR}
PREFIX
i18n
FILES
${qmFiles}
)
else()
qt_add_translations(${PROJECT_NAME}
TS_FILES
addhoursandminutes_de.ts
addhoursandminutes_es.ts
addhoursandminutes_fr.ts
addhoursandminutes_it.ts
addhoursandminutes_pl.ts
)
endif()
qt_add_lrelease(
TS_FILES
addhoursandminutes_de.ts
addhoursandminutes_es.ts
addhoursandminutes_fr.ts
addhoursandminutes_it.ts
addhoursandminutes_pl.ts
QM_FILES_OUTPUT_VARIABLE qmFiles
)
qt_add_resources(
${PROJECT_NAME}
translations_addhoursandminutes
BASE
${CMAKE_CURRENT_BINARY_DIR}
PREFIX
i18n
FILES
${qmFiles}
)



#
Expand All @@ -94,7 +83,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
set_target_properties(${PROJECT_NAME} PROPERTIES
QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/android"
QT_ANDROID_TARGET_SDK_VERSION 34
QT_ANDROID_MIN_SDK_VERSION 26
QT_ANDROID_MIN_SDK_VERSION 28
)

endif ()
Expand All @@ -117,32 +106,23 @@ endif ()
#

if (CMAKE_SYSTEM_NAME STREQUAL "iOS")
#Info.plist
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE TRUE)
set_target_properties(${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/ios/Info.plist")
set_target_properties(${PROJECT_NAME} PROPERTIES QT_IOS_LAUNCH_SCREEN "${CMAKE_CURRENT_SOURCE_DIR}/ios/LaunchScreen.storyboard")

#Assets catalog containing the App icon
set(asset_catalog_path "ios/Assets.xcassets")
target_sources(${PROJECT_NAME} PRIVATE "${asset_catalog_path}")
set_source_files_properties(${asset_catalog_path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

#Launchscreen
set_target_properties(${PROJECT_NAME} PROPERTIES QT_IOS_LAUNCH_SCREEN "${CMAKE_CURRENT_SOURCE_DIR}/ios/LaunchScreen.storyboard")
set(PRODUCT_BUNDLE_IDENTIFIER de.akafliegfreiburg.addhoursandminutes)
set(CMAKE_XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon)
set(privacy_manifest "${CMAKE_CURRENT_SOURCE_DIR}/ios/PrivacyInfo.xcprivacy")

#Platform specific functions
target_sources(${PROJECT_NAME} PRIVATE "${asset_catalog_path}")
target_sources(${PROJECT_NAME} PRIVATE ios/ObjCAdapter.mm)
target_sources(${PROJECT_NAME} PRIVATE ios/ObjCAdapter.h)


set(privacy_manifest "${CMAKE_CURRENT_SOURCE_DIR}/ios/PrivacyInfo.xcprivacy")
target_sources("${PROJECT_NAME}" PRIVATE "${privacy_manifest}")
set_property(TARGET "${PROJECT_NAME}" APPEND PROPERTY RESOURCE "${privacy_manifest}")

set_source_files_properties(${asset_catalog_path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

#target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/iosX/PrivacyInfo.xcprivacy")
#set_target_properties(${PROJECT_NAME} PROPERTIES
# _qt_privacy_manifest "${CMAKE_CURRENT_SOURCE_DIR}/iosX/PrivacyInfo.xcprivacy")

set_property(TARGET "${PROJECT_NAME}" APPEND PROPERTY RESOURCE "${privacy_manifest}")
endif()


Expand All @@ -159,13 +139,13 @@ if ((CMAKE_SYSTEM_NAME STREQUAL "Darwin") OR ((CMAKE_SYSTEM_NAME STREQUAL "Linux
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

# Generate the deployment script for the target ${PROJECT_NAME}.
qt_generate_deploy_qml_app_script(
TARGET ${PROJECT_NAME}
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)
# Generate the deployment script for the target ${PROJECT_NAME}.
qt_generate_deploy_qml_app_script(
TARGET ${PROJECT_NAME}
OUTPUT_SCRIPT deploy_script
NO_UNSUPPORTED_PLATFORM_ERROR
)

# Call the deployment script on "cmake --install".
install(SCRIPT ${deploy_script})
# Call the deployment script on "cmake --install".
install(SCRIPT ${deploy_script})
endif ()
8 changes: 0 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ auto main(int argc, char *argv[]) -> int
// Make screen available to QML
engine.rootContext()->setContextProperty(QStringLiteral("primaryScreen"), QGuiApplication::primaryScreen());

// Make font scaling factor available to QML engine; this scaling factor
// depends on the platform
#ifdef Q_OS_ANDROID
engine.rootContext()->setContextProperty(QStringLiteral("fontScale"), 1.5);
#else
engine.rootContext()->setContextProperty(QStringLiteral("fontScale"), 1.2);
#endif

// Now load the QML code
engine.load(QStringLiteral("qrc:/qt/qml/gui/qml/main.qml"));

Expand Down
2 changes: 2 additions & 0 deletions src/qml/Calculator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import QtCore
import QtQuick
import QtQuick.Controls

pragma ComponentBehavior: Bound


Rectangle {
id: hoursAndMinutes
Expand Down

0 comments on commit 0a4c43f

Please sign in to comment.