# velox-gui — the Qt 6 Widgets client. Lane GUI.
#
# CLAUDE.md §3: zero download logic here. This target links libveloxproto (the wire
# types, ADR 0009) and NEVER libveloxcore — a grep for curl|pwrite|sqlite under gui/
# must come back empty.
#
# The root CMakeLists.txt add_subdirectory()s this unconditionally once the file exists,
# so it must stay configurable even before CORE has landed veloxproto. Until that target
# exists we announce and bail; the moment `core/` merges its libveloxproto, the GUI
# lights up with no edit here (same contract as the root file's EXISTS() guards).

if(NOT TARGET veloxproto)
    message(STATUS "velox-gui: libveloxproto has not landed yet — GUI target skipped. "
                   "It builds automatically once core/ merges the veloxproto target (ADR 0009).")
    return()
endif()

set(CMAKE_AUTOMOC ON)

add_executable(velox-gui
    src/main.cpp
    src/rpc/RpcConnection.cpp
    src/rpc/RpcClient.cpp
    src/models/DownloadTableModel.cpp
    src/widgets/ProgressDelegate.cpp
    src/mainwindow/MainWindow.cpp
)

target_include_directories(velox-gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

target_compile_features(velox-gui PRIVATE cxx_std_23)

# Warnings at target scope, not via CMAKE_CXX_FLAGS — the dev/tsan presets overwrite that
# cache variable wholesale (same rationale as core/CMakeLists.txt).
target_compile_options(velox-gui PRIVATE -Wall -Wextra -Wpedantic -Werror)

target_link_libraries(velox-gui PRIVATE
    velox::proto
    Qt6::Widgets
    Qt6::Svg
    Qt6::Network
)

set_target_properties(velox-gui PROPERTIES
    WIN32_EXECUTABLE OFF
    MACOSX_BUNDLE OFF
)

# --- i18n -------------------------------------------------------------------------------
# Every string in the GUI goes through tr(); the Arabic stub exists to prove the RTL
# layout survives (GUI DoD). lrelease/lupdate come from Qt6::LinguistTools, found by root.
qt_add_translations(velox-gui TS_FILES i18n/velox_ar.ts)

# --- tests ---------------------------------------------------------------------------
if(VELOX_BUILD_TESTS)
    add_subdirectory(tests)
endif()
