refactor(arch): split the app into a logic core and per-screen pages

All the business logic now lives in AppCore (providers, workers,
history, plugins, sudo and pacman-lock handling), freed from any widget
so it runs headless and is testable on its own. The Qt window becomes a
thin frame around one file per screen under pages/, wired through a
common Page contract and a shared ui-kit. CMake gains the app-core-test
target, which links Qt Core only to enforce the headless guarantee.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
BlackAngelTV committed 2026-09-13 11:45:48 +02:00
1 parent 576daf2fae
commit 897c174925
24 files changed
+4322 -3056

No files matched your search

+38 -1
View File
@@ -32,6 +32,18 @@ set(SOURCES
src/package-model.cpp
src/update-manager.cpp
src/app-logging.cpp
# Logic layer: background workers and the controller the screens delegate to.
src/workers.cpp
src/app-core.cpp
# Interface: one file per screen under pages/, on top of the logic layer.
pages/page.cpp
pages/ui-kit.cpp
pages/dashboard-page.cpp
pages/browse-page.cpp
pages/cleanup-page.cpp
pages/history-page.cpp
pages/logs-page.cpp
pages/plugins-page.cpp
resources/resources.qrc
)
@@ -45,11 +57,21 @@ set(HEADERS
include/package-model.h
include/update-manager.h
include/app-logging.h
include/workers.h
include/app-core.h
pages/page.h
pages/ui-kit.h
pages/dashboard-page.h
pages/browse-page.h
pages/cleanup-page.h
pages/history-page.h
pages/logs-page.h
pages/plugins-page.h
)
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_include_directories(${PROJECT_NAME} PRIVATE include)
target_include_directories(${PROJECT_NAME} PRIVATE include pages)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets Qt6::Network)
target_compile_definitions(${PROJECT_NAME} PRIVATE
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}")
@@ -134,6 +156,21 @@ add_test(NAME aur-manager-test COMMAND aur-manager-test)
# UpdateManager::isNewerVersion is pure logic, but the file also pulls in Qt
# Network, so the test links Core + Network (no display needed).
# The logic layer runs without a display: it is exercised on its own (no
# QtWidgets), which is exactly the guarantee the view/core split is for.
# The Q_OBJECT headers are listed explicitly so AUTOMOC generates their moc
# file for this target (same reason as update-manager-test below).
add_executable(app-core-test tests/app-core.test.cpp
src/app-core.cpp src/workers.cpp src/pacman-manager.cpp
src/plugin-manager.cpp src/history-manager.cpp src/update-manager.cpp
src/app-logging.cpp
include/app-core.h include/workers.h include/update-manager.h)
target_include_directories(app-core-test PRIVATE include)
target_link_libraries(app-core-test PRIVATE Qt6::Core Qt6::Network)
target_compile_definitions(app-core-test PRIVATE
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}")
add_test(NAME app-core-test COMMAND app-core-test)
add_executable(update-manager-test tests/update-manager.test.cpp
src/update-manager.cpp src/app-logging.cpp include/update-manager.h)
target_include_directories(update-manager-test PRIVATE include)