C

Qt Quick Ultralite Thermostat Demo

cmake_minimum_required (VERSION 3.15)

project(thermo VERSION 0.0.1 LANGUAGES C CXX ASM)
if (NOT TARGET Qul::QuickUltralite)
    find_package(Qul)
endif()

set(QUL_FONTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/fonts,${QUL_FONTS_DIR}")
set(QUL_DEFAULT_FONT_FAMILY "Roboto")

set(UNIT_SYSTEM "metric" CACHE STRING "Thermostat Demo Unit System")

# Set FreeRTOS heap size to 1.5 MB (needed for stats view)
if (OS STREQUAL "FreeRTOS")
    add_compile_definitions(configTOTAL_HEAP_SIZE=1572864)
endif()

set(COMMON_QML_FILES
    thermo.qml TopBar.qml BottomBar.qml PlacesView.qml Card.qml CardRow.qml PowerSwitch.qml
    ScheduleView.qml RoomSchedule.qml StatsView.qml RoomView.qml RoomControlButton.qml
    AnimatedDigit.qml WeatherStatus.qml ThermoView.qml
    TimeIntervalSlider.qml TimeIntervalSliderHandle.qml FanControlButton.qml LanguageDialog.qml
    LanguageButton.qml)
set(MODULE_QML_FILES
    imports/Thermo/ColorStyle.qml
    imports/Thermo/Rooms.qml
    imports/Thermo/Room.qml)

add_executable(thermo_small)

qul_add_resource(thermo_small
    BASE small
    FILES
        small/qt-logo.png
        small/JAPAN.png
        small/temp-down-pressed.png
        small/switch-handle.png
        small/popup-bg.png
        small/scrollbar-temperature-track.png
        small/radiobutton-checked-pressed.png
        small/digitMaskBottom.png
        small/switch-i.png
        small/btn-bg-big-on.png
        small/radiobutton-pressed.png
        small/pressed-bg-up.png
        small/selected.png
        small/eco-on.png
        small/streamer-on-small.png
        small/page-indicator.png
        small/jog-off.png
        small/status-small.png
        small/dryer-on-small.png
        small/dryer-on.png
        small/close.png
        small/auto-card.png
        small/toggle-year.png
        small/eco-on-small.png
        small/separator-line.png
        small/radiobutton-checked.png
        small/streamer-on.png
        small/btn-bg-down.png
        small/slider-handle.png
        small/thermo-handle.png
        small/switch-bg.png
        small/pressed-bg-down.png
        small/main-bg.png
        small/auto-on.png
        small/place-back.png
        small/UK.png
        small/radiobutton.png
        small/baseline-arrow-back.png
        small/digitMaskTop.png
        small/switch-o.png
        small/power-on.png
        small/temp-up-pressed.png
        small/btn-bg-big-off.png
        small/toggle-month.png
        small/jog.png
        small/GERMANY.png
        small/change-language.png
        small/scrollbar-off-track.png
        small/weather/w_06.png
        small/weather/w_01.png
        small/weather/w_02.png
        small/weather/w_07.png
        small/weather/w_05.png
        small/weather/w_04.png
        small/weather/w_03.png
)

qul_add_resource(thermo_small
    FILES
        images/inner-circle.png
        images/card-back-topleft.png
        images/card-back-bottomleft.png
        images/card-back-topright.png
        images/card-back-bottomright.png
)

qul_target_qml_sources(thermo_small ${COMMON_QML_FILES})

qul_add_qml_module(thermo_small_module
    URI Thermo
    QML_FILES
        ${MODULE_QML_FILES}
        small/Theme.qml
        ${UNIT_SYSTEM}/Units.qml
    OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thermo_small_module
)
qul_add_resource(thermo_small_module
    BASE small
    FILES
        small/fan-off.png
        small/fan-off-small.png
        small/fan-1-on.png
        small/fan-1-on-small.png
        small/fan-2-on.png
        small/fan-2-on-small.png
        small/fan-3-on.png
        small/fan-3-on-small.png
        small/fan-4-on.png
        small/fan-4-on-small.png
)

qul_target_embed_translations(thermo_small_module thermo.de_DE.ts thermo.ja_JP.ts)
qul_target_embed_translations(thermo_small thermo.de_DE.ts thermo.ja_JP.ts)

target_link_libraries(thermo_small thermo_small_module Qul::QuickUltralite Qul::QuickUltraliteTemplates Qul::QuickUltraliteCharts)
app_target_setup_os(thermo_small)
app_target_default_main(thermo_small thermo)

# FIXME: the if below should be changed to
# if (NOT "thermo_big" IN_LIST EXCLUDED_DEMOS)
# Assets currently too big for devices (except stm32s)
string(TOLOWER ${QUL_PLATFORM} QUL_PLATFORM_LOWERCASE)
if(QUL_PLATFORM STREQUAL "Qt" OR QUL_PLATFORM_LOWERCASE MATCHES "^stm32f7" OR QUL_PLATFORM_LOWERCASE MATCHES "^stm32f4")
    add_executable(thermo_big)

    qul_add_resource(thermo_big
        BASE big
        FILES
            big/qt-logo.png
            big/JAPAN.png
            big/temp-down-pressed.png
            big/switch-handle.png
            big/popup-bg.png
            big/scrollbar-temperature-track.png
            big/radiobutton-checked-pressed.png
            big/digitMaskBottom.png
            big/switch-i.png
            big/btn-bg-big-on.png
            big/radiobutton-pressed.png
            big/pressed-bg-up.png
            big/selected.png
            big/eco-on.png
            big/streamer-on-small.png
            big/page-indicator.png
            big/jog-off.png
            big/status-small.png
            big/dryer-on-small.png
            big/dryer-on.png
            big/close.png
            big/auto-card.png
            big/toggle-year.png
            big/eco-on-small.png
            big/separator-line.png
            big/radiobutton-checked.png
            big/streamer-on.png
            big/radiobutton-disabled.png
            big/btn-bg-down.png
            big/slider-handle.png
            big/thermo-handle.png
            big/switch-bg.png
            big/pressed-bg-down.png
            big/main-bg.png
            big/auto-on.png
            big/place-back.png
            big/UK.png
            big/radiobutton.png
            big/baseline-arrow-back.png
            big/digitMaskTop.png
            big/switch-o.png
            big/power-on.png
            big/temp-up-pressed.png
            big/btn-bg-big-off.png
            big/toggle-month.png
            big/jog.png
            big/GERMANY.png
            big/change-language.png
            big/scrollbar-off-track.png
            big/weather/w_06.png
            big/weather/w_01.png
            big/weather/w_02.png
            big/weather/w_07.png
            big/weather/w_05.png
            big/weather/w_04.png
            big/weather/w_03.png
    )

    qul_add_resource(thermo_big
        FILES
            images/inner-circle.png
            images/card-back-topleft.png
            images/card-back-bottomleft.png
            images/card-back-topright.png
            images/card-back-bottomright.png
    )

    qul_target_qml_sources(thermo_big ${COMMON_QML_FILES})

    qul_add_qml_module(thermo_big_module
        URI Thermo
        QML_FILES
            ${MODULE_QML_FILES}
            big/Theme.qml
            ${UNIT_SYSTEM}/Units.qml
        OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/thermo_big_module
    )
    qul_add_resource(thermo_big_module
        BASE big
        FILES
            big/fan-off.png
            big/fan-off-small.png
            big/fan-1-on.png
            big/fan-1-on-small.png
            big/fan-2-on.png
            big/fan-2-on-small.png
            big/fan-3-on.png
            big/fan-3-on-small.png
            big/fan-4-on.png
            big/fan-4-on-small.png
    )

    qul_target_embed_translations(thermo_big_module thermo.de_DE.ts thermo.ja_JP.ts)
    qul_target_embed_translations(thermo_big thermo.de_DE.ts thermo.ja_JP.ts)

    target_link_libraries(thermo_big thermo_big_module Qul::QuickUltralite Qul::QuickUltraliteTemplates Qul::QuickUltraliteCharts)
    app_target_setup_os(thermo_big)
    app_target_default_main(thermo_big thermo)
endif()