mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-31 16:38:33 -04:00
feat: Implement Qt6 migration with aqtinstall 3.3.0
- Migrate from Qt5 to Qt6.7.3 using aqtinstall v3.3.0 - Add comprehensive Qt6 API compatibility updates - Implement responsive UI with High DPI scaling support - Add MSVC runtime library configuration for consistency - Update touch/mouse event handling for Qt6 APIs - Fix locale handling (countryToString → territoryToString) - Update string size methods (count() → size()) - Remove deprecated Qt5 high DPI attributes - Add new CopyCitronQt6Deps.cmake for Qt6 dependency management - Update CMake configuration for Qt6-only approach - Add aqt_config.ini with mirror configuration for reliable downloads Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -389,11 +389,7 @@ if (APPLE)
|
||||
|
||||
elseif(WIN32)
|
||||
# compile as a win32 gui application instead of a console application
|
||||
if (QT_VERSION VERSION_GREATER_EQUAL 6)
|
||||
target_link_libraries(citron PRIVATE Qt6::EntryPointPrivate)
|
||||
else()
|
||||
target_link_libraries(citron PRIVATE Qt5::WinMain)
|
||||
endif()
|
||||
target_link_libraries(citron PRIVATE Qt6::EntryPointPrivate)
|
||||
if(MSVC)
|
||||
target_link_libraries(citron PRIVATE version.lib)
|
||||
set_target_properties(citron PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
|
||||
@@ -426,7 +422,7 @@ else()
|
||||
target_link_libraries(citron PRIVATE common core input_common frontend_common network video_core)
|
||||
endif()
|
||||
|
||||
target_link_libraries(citron PRIVATE Boost::headers glad Qt${QT_MAJOR_VERSION}::Widgets Qt${QT_MAJOR_VERSION}::Network)
|
||||
target_link_libraries(citron PRIVATE Boost::headers glad Qt6::Widgets)
|
||||
target_link_libraries(citron PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||
|
||||
# Add libarchive for updater functionality
|
||||
@@ -437,10 +433,10 @@ endif()
|
||||
|
||||
target_link_libraries(citron PRIVATE Vulkan::Headers)
|
||||
if (NOT WIN32)
|
||||
target_include_directories(citron PRIVATE ${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS})
|
||||
target_include_directories(citron PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
|
||||
endif()
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(citron PRIVATE Qt${QT_MAJOR_VERSION}::DBus)
|
||||
target_link_libraries(citron PRIVATE Qt6::DBus)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(citron PRIVATE
|
||||
@@ -471,7 +467,7 @@ if (USE_DISCORD_PRESENCE)
|
||||
discord_impl.cpp
|
||||
discord_impl.h
|
||||
)
|
||||
target_link_libraries(citron PRIVATE DiscordRPC::discord-rpc httplib::httplib Qt${QT_MAJOR_VERSION}::Network)
|
||||
target_link_libraries(citron PRIVATE DiscordRPC::discord-rpc httplib::httplib Qt6::Network)
|
||||
target_compile_definitions(citron PRIVATE -DUSE_DISCORD_PRESENCE)
|
||||
endif()
|
||||
|
||||
@@ -480,12 +476,12 @@ if (ENABLE_WEB_SERVICE)
|
||||
endif()
|
||||
|
||||
if (CITRON_USE_QT_MULTIMEDIA)
|
||||
target_link_libraries(citron PRIVATE Qt${QT_MAJOR_VERSION}::Multimedia)
|
||||
target_link_libraries(citron PRIVATE Qt6::Multimedia)
|
||||
target_compile_definitions(citron PRIVATE -DCITRON_USE_QT_MULTIMEDIA)
|
||||
endif ()
|
||||
|
||||
if (CITRON_USE_QT_WEB_ENGINE)
|
||||
target_link_libraries(citron PRIVATE Qt${QT_MAJOR_VERSION}::WebEngineCore Qt${QT_MAJOR_VERSION}::WebEngineWidgets)
|
||||
target_link_libraries(citron PRIVATE Qt6::WebEngineCore Qt6::WebEngineWidgets)
|
||||
target_compile_definitions(citron PRIVATE -DCITRON_USE_QT_WEB_ENGINE)
|
||||
endif ()
|
||||
|
||||
@@ -498,9 +494,9 @@ if (WIN32 AND QT_VERSION VERSION_GREATER_EQUAL 6)
|
||||
add_custom_command(TARGET citron POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} "${CITRON_EXE_DIR}/citron.exe" --dir "${CITRON_EXE_DIR}" --libdir "${CITRON_EXE_DIR}" --plugindir "${CITRON_EXE_DIR}/plugins" --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler --no-translations --verbose 0)
|
||||
endif()
|
||||
|
||||
if (CITRON_USE_BUNDLED_QT AND QT_VERSION VERSION_LESS 6)
|
||||
include(CopyCitronQt5Deps)
|
||||
copy_citron_Qt5_deps(citron)
|
||||
if (CITRON_USE_BUNDLED_QT)
|
||||
include(CopyCitronQt6Deps)
|
||||
copy_citron_Qt6_deps(citron)
|
||||
endif()
|
||||
|
||||
if (ENABLE_SDL2)
|
||||
|
||||
@@ -738,19 +738,19 @@ void GRenderWindow::wheelEvent(QWheelEvent* event) {
|
||||
}
|
||||
|
||||
void GRenderWindow::TouchBeginEvent(const QTouchEvent* event) {
|
||||
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
|
||||
QList<QTouchEvent::TouchPoint> touch_points = event->points();
|
||||
for (const auto& touch_point : touch_points) {
|
||||
const auto [x, y] = ScaleTouch(touch_point.pos());
|
||||
const auto [x, y] = ScaleTouch(touch_point.position());
|
||||
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
|
||||
input_subsystem->GetTouchScreen()->TouchPressed(touch_x, touch_y, touch_point.id());
|
||||
}
|
||||
}
|
||||
|
||||
void GRenderWindow::TouchUpdateEvent(const QTouchEvent* event) {
|
||||
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
|
||||
QList<QTouchEvent::TouchPoint> touch_points = event->points();
|
||||
input_subsystem->GetTouchScreen()->ClearActiveFlag();
|
||||
for (const auto& touch_point : touch_points) {
|
||||
const auto [x, y] = ScaleTouch(touch_point.pos());
|
||||
const auto [x, y] = ScaleTouch(touch_point.position());
|
||||
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
|
||||
input_subsystem->GetTouchScreen()->TouchMoved(touch_x, touch_y, touch_point.id());
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ void TouchScreenPreview::mouseMoveEvent(QMouseEvent* event) {
|
||||
if (!coord_label) {
|
||||
return;
|
||||
}
|
||||
const auto pos = MapToDeviceCoords(event->x(), event->y());
|
||||
const auto pos = MapToDeviceCoords(event->position().x(), event->position().y());
|
||||
if (pos) {
|
||||
coord_label->setText(QStringLiteral("X: %1, Y: %2").arg(pos->x()).arg(pos->y()));
|
||||
} else {
|
||||
@@ -523,7 +523,7 @@ void TouchScreenPreview::mousePressEvent(QMouseEvent* event) {
|
||||
if (event->button() != Qt::MouseButton::LeftButton) {
|
||||
return;
|
||||
}
|
||||
const auto pos = MapToDeviceCoords(event->x(), event->y());
|
||||
const auto pos = MapToDeviceCoords(event->position().x(), event->position().y());
|
||||
if (pos) {
|
||||
emit DotAdded(*pos);
|
||||
}
|
||||
@@ -539,7 +539,7 @@ bool TouchScreenPreview::eventFilter(QObject* obj, QEvent* event) {
|
||||
emit DotSelected(obj->property(PropId).toInt());
|
||||
|
||||
drag_state.dot = qobject_cast<QLabel*>(obj);
|
||||
drag_state.start_pos = mouse_event->globalPos();
|
||||
drag_state.start_pos = mouse_event->globalPosition().toPoint();
|
||||
return true;
|
||||
}
|
||||
case QEvent::Type::MouseMove: {
|
||||
@@ -549,13 +549,13 @@ bool TouchScreenPreview::eventFilter(QObject* obj, QEvent* event) {
|
||||
const auto mouse_event = static_cast<QMouseEvent*>(event);
|
||||
if (!drag_state.active) {
|
||||
drag_state.active =
|
||||
(mouse_event->globalPos() - drag_state.start_pos).manhattanLength() >=
|
||||
(mouse_event->globalPosition().toPoint() - drag_state.start_pos).manhattanLength() >=
|
||||
QApplication::startDragDistance();
|
||||
if (!drag_state.active) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto current_pos = mapFromGlobal(mouse_event->globalPos());
|
||||
auto current_pos = mapFromGlobal(mouse_event->globalPosition().toPoint());
|
||||
current_pos.setX(std::clamp(current_pos.x(), contentsMargins().left(),
|
||||
contentsMargins().left() + contentsRect().width() - 1));
|
||||
current_pos.setY(std::clamp(current_pos.y(), contentsMargins().top(),
|
||||
|
||||
@@ -259,7 +259,7 @@ void ConfigureUi::InitializeLanguageComboBox() {
|
||||
locale.truncate(locale.lastIndexOf(QLatin1Char{'.'}));
|
||||
locale.remove(0, locale.lastIndexOf(QLatin1Char{'/'}) + 1);
|
||||
const QString lang = QLocale::languageToString(QLocale(locale).language());
|
||||
const QString country = QLocale::countryToString(QLocale(locale).country());
|
||||
const QString country = QLocale::territoryToString(QLocale(locale).territory());
|
||||
ui->language_combobox->addItem(QStringLiteral("%1 (%2)").arg(lang, country), locale);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ void GameList::FilterGridView(const QString& filter_text) {
|
||||
const QString file_name = file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} + file_title;
|
||||
|
||||
should_show = ContainsAllWords(file_name, filter_text) ||
|
||||
(file_program_id.count() == 16 && file_program_id.contains(filter_text));
|
||||
(file_program_id.size() == 16 && file_program_id.contains(filter_text));
|
||||
}
|
||||
|
||||
if (should_show) {
|
||||
@@ -331,7 +331,7 @@ void GameList::FilterTreeView(const QString& filter_text) {
|
||||
file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} +
|
||||
file_title;
|
||||
if (ContainsAllWords(file_name, filter_text) ||
|
||||
(file_program_id.count() == 16 && file_program_id.contains(filter_text))) {
|
||||
(file_program_id.size() == 16 && file_program_id.contains(filter_text))) {
|
||||
tree_view->setRowHidden(j, folder_index, false);
|
||||
++result_count;
|
||||
} else {
|
||||
|
||||
@@ -108,7 +108,7 @@ void PerformanceOverlay::resizeEvent(QResizeEvent* event) {
|
||||
void PerformanceOverlay::mousePressEvent(QMouseEvent* event) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
is_dragging = true;
|
||||
drag_start_pos = event->globalPos();
|
||||
drag_start_pos = event->globalPosition().toPoint();
|
||||
widget_start_pos = this->pos();
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ void PerformanceOverlay::mousePressEvent(QMouseEvent* event) {
|
||||
|
||||
void PerformanceOverlay::mouseMoveEvent(QMouseEvent* event) {
|
||||
if (is_dragging) {
|
||||
QPoint delta = event->globalPos() - drag_start_pos;
|
||||
QPoint delta = event->globalPosition().toPoint() - drag_start_pos;
|
||||
move(widget_start_pos + delta);
|
||||
}
|
||||
QWidget::mouseMoveEvent(event);
|
||||
|
||||
@@ -260,14 +260,14 @@ void VramOverlay::resizeEvent(QResizeEvent* event) {
|
||||
void VramOverlay::mousePressEvent(QMouseEvent* event) {
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
is_dragging = true;
|
||||
drag_start_pos = event->globalPos();
|
||||
drag_start_pos = event->globalPosition().toPoint();
|
||||
widget_start_pos = pos();
|
||||
}
|
||||
}
|
||||
|
||||
void VramOverlay::mouseMoveEvent(QMouseEvent* event) {
|
||||
if (is_dragging) {
|
||||
QPoint delta = event->globalPos() - drag_start_pos;
|
||||
QPoint delta = event->globalPosition().toPoint() - drag_start_pos;
|
||||
move(widget_start_pos + delta);
|
||||
has_been_moved = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user