Files
vdm/gui/CMakeLists.txt
T
samiandClaude Sonnet 5 2a87abe96d gui: RPC client, download table model, and a live main window
First vertical slice of velox-gui, built entirely against tools/mockd
(no daemon dependency):

- rpc/: RpcConnection runs a QLocalSocket on a worker thread with
  newline-delimited JSON-RPC framing, drives the session.hello /
  session.subscribe handshake, and reconnects with exponential backoff
  (250 ms -> 8 s). RpcClient is the main-thread face: marshals calls onto
  the worker, delivers replies as main-thread callbacks, re-emits server
  notifications as typed Qt signals, and issues the one-shot download.list
  on reaching Connected.
- models/DownloadTableModel: QAbstractTableModel over TaskSummary. A
  progress batch is a row patch with a narrow dataChanged over the value
  columns only; beginResetModel() is reserved for the initial load and a
  reconnect resync.
- widgets/ProgressDelegate: in-cell progress bar for the Status column.
- mainwindow/MainWindow: the table, a status-bar connection dot, an
  offline banner instead of a modal, dialog-free pause/resume/stop
  actions, and QSettings column/geometry persistence.
- gui/CMakeLists.txt links velox::proto (never velox::core, ADR 0009) and
  self-guards on the veloxproto target so main keeps configuring if it is
  ever absent again.
- i18n from the first commit: every string via tr(), plus an Arabic .ts
  stub for the RTL check.
- tests/: headless QTest for the model — proves the progress patch is a
  narrow dataChanged and never resets the model.

Verified end-to-end against `mockd --tasks 300`: handshake, initial list,
live progress batches applied to the model, and a clean
Reconnecting -> Connected recovery when mockd is bounced mid-run.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Ne28kx4VreeBWZv82Nksd
2026-09-10 00:58:53 +04:00

58 lines
2.1 KiB
CMake

# 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()