[qt] refactor: qt_common lib (#94)

This is part of a series of PRs made in preparation for the QML rewrite. this PR specifically moves a bunch of utility functions from main.cpp into qt_common, with the biggest benefit being that QML can reuse the exact same code through ctx passthrough.

Also, QtCommon::Frontend is an abstraction layer over several previously Widgets-specific stuff like QMessageBox that gets used everywhere. The idea is that once QML is implemented, these functions can have a Quick version implemented for systems that don't work well with Widgets (sun) or for those on Plasma 6+ (reduces memory usage w/o Widgets linkage) although Quick from C++ is actually anal, but whatever.

Other than that this should also just kinda reduce the size of main.cpp which is a 6000-line behemoth rn, and clangd straight up gives up with it for me (likely caused by the massive amount of headers, which this DOES reduce).

In the future, I probably want to create a common strings lookup table that both Qt and QML can reference--though I'm not sure how much linguist likes that--which should give us a way to keep language consistent (use frozen-map).

TODO: Docs for Qt stuff

Co-authored-by: MaranBr <maranbr@outlook.com>
Reviewed-on: #94
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev>
This commit is contained in:
crueter 2025-09-15 17:21:18 +02:00
parent 4c5d03f5de
commit f4386423e8
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6
111 changed files with 2235 additions and 1544 deletions

View file

@ -150,12 +150,8 @@ add_executable(yuzu
configuration/configure_web.ui
configuration/input_profiles.cpp
configuration/input_profiles.h
configuration/shared_translation.cpp
configuration/shared_translation.h
configuration/shared_widget.cpp
configuration/shared_widget.h
configuration/qt_config.cpp
configuration/qt_config.h
debugger/console.cpp
debugger/console.h
debugger/controller.cpp
@ -205,12 +201,8 @@ add_executable(yuzu
play_time_manager.cpp
play_time_manager.h
precompiled_headers.h
qt_common.cpp
qt_common.h
startup_checks.cpp
startup_checks.h
uisettings.cpp
uisettings.h
util/clickable_label.cpp
util/clickable_label.h
util/controller_navigation.cpp
@ -396,14 +388,17 @@ elseif(WIN32)
endif()
endif()
target_link_libraries(yuzu PRIVATE common core input_common frontend_common network video_core)
target_link_libraries(yuzu PRIVATE nlohmann_json::nlohmann_json)
target_link_libraries(yuzu PRIVATE common core input_common frontend_common network video_core qt_common)
target_link_libraries(yuzu PRIVATE Boost::headers glad Qt6::Widgets)
target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
if (NOT WIN32)
target_include_directories(yuzu PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
endif()
target_link_libraries(yuzu PRIVATE Vulkan::Headers)
if (UNIX AND NOT APPLE)
target_link_libraries(yuzu PRIVATE Qt6::DBus)
@ -501,8 +496,4 @@ if (YUZU_ROOM)
target_link_libraries(yuzu PRIVATE yuzu-room)
endif()
# Extra deps
add_subdirectory(externals)
target_link_libraries(yuzu PRIVATE QuaZip::QuaZip)
create_target_directory_groups(yuzu)