Files
vdm/gui/CMakeLists.txt
T
samiandClaude Sonnet 5 a71d904a1f gui: finish Add URL -> File Info -> Progress dialog flow
Wires up the three dialogs from build order step 5 (docs/03-gui-spec.md
§§2-3) and the MainWindow slots that were declared but never implemented:

- AddUrlDialog: clipboard prefill is the explicit path docs/06 R2 calls
  for (no passive monitoring, not advertised).
- FileInfoDialog: async download.probe never blocks the UI; ends by
  calling download.add itself (Now / Later / Add to Queue). buildSpec()
  is a pure static so the optional-field-omission logic is unit-testable
  without touching a widget.
- ProgressDialog: non-modal, WA_DeleteOnClose, driven by the taskProgress/
  taskStateChanged signals RpcClient already re-broadcasts; download.get
  seeds state once for a dialog opened mid-transfer. Hosts SegmentBarsWidget
  and SpeedGraphWidget.

MainWindow: openAddUrlDialog/openPropertiesForSelection/showTableContextMenu
now have bodies; category.list/queue.list responses are cached so File Info
can populate its category combo and queue menu without a second round trip.
The row context menu covers what already exists (Resume/Pause/Stop/Delete/
Properties) and deliberately leaves out Open/Open With/Move-Rename/
Redownload/Add to Queue — those need dialogs later build-order steps haven't
reached yet.

util/Format.hpp: pulled the bytes/rate/eta formatting out of MainWindow and
DownloadTableModel once the dialogs wanted the same strings a third time.

Verified end-to-end against a running mockd (category.list/queue.list,
download.probe, download.add, download.get, and live event.task.progress/
event.task.state) under ASan+UBSan: all three dialogs render correctly
against real fixture data and the flow runs clean with no leaks or
sanitizer reports.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NSCdCWFXBTSBBK3MzWtJiC
2026-09-11 12:11:13 +04:00

61 lines
2.4 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 — enforced by tests/ (see the
# gui_no_download_logic test).
#
# The root CMakeLists.txt add_subdirectory()s this unconditionally once the file exists,
# so it must stay configurable even if veloxproto is ever absent again. Until that target
# exists we announce and bail.
if(NOT TARGET veloxproto)
message(STATUS "velox-gui: libveloxproto target missing — GUI target skipped. "
"It builds automatically once core/ provides the veloxproto target (ADR 0009).")
return()
endif()
set(CMAKE_AUTOMOC ON)
# Everything except main() lives in a static lib so the tests can link the real widgets
# and models rather than a reimplementation.
add_library(velox-gui-lib STATIC
src/rpc/RpcConnection.cpp
src/rpc/RpcClient.cpp
src/models/DownloadTableModel.cpp
src/models/DownloadFilterProxy.cpp
src/widgets/ProgressDelegate.cpp
src/widgets/SegmentBarsWidget.cpp
src/widgets/SpeedGraphWidget.cpp
src/dialogs/AddUrlDialog.cpp
src/dialogs/FileInfoDialog.cpp
src/dialogs/ProgressDialog.cpp
src/mainwindow/CategoryPanel.cpp
src/mainwindow/MainWindow.cpp
)
target_include_directories(velox-gui-lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_compile_features(velox-gui-lib PUBLIC cxx_std_23)
target_compile_options(velox-gui-lib PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_link_libraries(velox-gui-lib PUBLIC
velox::proto
Qt6::Widgets
Qt6::Svg
Qt6::Network
)
add_executable(velox-gui src/main.cpp)
target_compile_options(velox-gui PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_link_libraries(velox-gui PRIVATE velox-gui-lib)
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), exercised by tests/tst_rtl. lrelease also drops the .qm at
# ${CMAKE_CURRENT_BINARY_DIR}/velox_ar.qm, which the RTL test loads by path.
qt_add_translations(velox-gui TS_FILES i18n/velox_ar.ts)
# --- tests ---------------------------------------------------------------------------
if(VELOX_BUILD_TESTS)
add_subdirectory(tests)
endif()