mirror of
https://git.citron-emu.org/citron/emulator
synced 2026-02-02 15:43:35 +00:00
fix(ui): Add SVG support and fallback icons for Surprise Me button
Added Qt6::Svg to CMake configuration and implemented fallback icon chain. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -567,7 +567,7 @@ endif()
|
||||
|
||||
function(set_citron_qt_components)
|
||||
# Best practice is to ask for all components at once, so they are from the same version
|
||||
set(CITRON_QT_COMPONENTS2 Core Widgets Concurrent)
|
||||
set(CITRON_QT_COMPONENTS2 Core Widgets Concurrent Svg)
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
list(APPEND CITRON_QT_COMPONENTS2 DBus GuiPrivate)
|
||||
endif()
|
||||
|
||||
@@ -457,7 +457,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 Qt6::Widgets Qt6::Network)
|
||||
target_link_libraries(citron PRIVATE Boost::headers glad Qt6::Widgets Qt6::Network Qt6::Svg)
|
||||
target_link_libraries(citron PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||
|
||||
# Add libarchive for updater functionality
|
||||
|
||||
@@ -892,7 +892,18 @@ play_time_manager{play_time_manager_}, system{system_} {
|
||||
|
||||
// Surprise Me button - positioned after sort button
|
||||
btn_surprise_me = new QToolButton(toolbar);
|
||||
btn_surprise_me->setIcon(QIcon(QStringLiteral(":/dist/dice.svg")));
|
||||
QIcon surprise_icon(QStringLiteral(":/dist/dice.svg"));
|
||||
if (surprise_icon.isNull() || surprise_icon.availableSizes().isEmpty()) {
|
||||
// Fallback to theme icon or standard icon on Windows where SVG may not load
|
||||
surprise_icon = QIcon::fromTheme(QStringLiteral("media-playlist-shuffle"));
|
||||
if (surprise_icon.isNull()) {
|
||||
surprise_icon = QIcon::fromTheme(QStringLiteral("roll"));
|
||||
}
|
||||
if (surprise_icon.isNull()) {
|
||||
surprise_icon = style()->standardIcon(QStyle::SP_BrowserReload);
|
||||
}
|
||||
}
|
||||
btn_surprise_me->setIcon(surprise_icon);
|
||||
btn_surprise_me->setToolTip(tr("Surprise Me! (Choose Random Game)"));
|
||||
btn_surprise_me->setAutoRaise(true);
|
||||
btn_surprise_me->setIconSize(QSize(16, 16));
|
||||
|
||||
Reference in New Issue
Block a user