From b9e052b3a7b9d3f265c16e9c5dacb68473b2bd4c Mon Sep 17 00:00:00 2001 From: crueter Date: Fri, 6 Feb 2026 19:51:01 +0100 Subject: [desktop] Basic grid view implementation (#3479) Closes #3441 Basic impl of a grid view on the game list. The ideal solution here would be to use QSortFilterProxyModel and abstract the game list model out to a QStandardItemModel, but that is too much effort for me rn. Adapted the "card" design from QML, can 1000% be improved but QPainter is just such a pain to deal with. Implanting a Qt Quick scene into there would legitimately be easier. Anyways, margins and text sizes lgtm at all sizes, though please give feedback on both that and the general card design. Future TODOs: - [ ] Auto size mode - [ ] Refactor to use models Signed-off-by: crueter Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3479 --- src/yuzu/main_window.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/yuzu/main_window.cpp') diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index e44696b6a3..def24ef5d3 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -3,6 +3,7 @@ // Qt on macOS doesn't define VMA shit #include +#include "common/settings_enums.h" #include "frontend_common/settings_generator.h" #include "qt_common/qt_string_lookup.h" #if defined(QT_STATICPLUGIN) && !defined(__APPLE__) @@ -25,7 +26,7 @@ #include "install_dialog.h" #include "bootmanager.h" -#include "game_list.h" +#include "yuzu/game/game_list.h" #include "loading_screen.h" #include "ryujinx_dialog.h" #include "set_play_time_dialog.h" @@ -550,6 +551,9 @@ MainWindow::MainWindow(bool has_broken_vulkan) game_list->LoadCompatibilityList(); game_list->PopulateAsync(UISettings::values.game_dirs); + // Set up game list mode checkboxes. + SetGameListMode(UISettings::values.game_list_mode.GetValue()); + // make sure menubar has the arrow cursor instead of inheriting from this ui->menubar->setCursor(QCursor()); statusBar()->setCursor(QCursor()); @@ -1600,6 +1604,9 @@ void MainWindow::ConnectMenuEvents() { ui->action_Reset_Window_Size_900, ui->action_Reset_Window_Size_1080}); + connect_menu(ui->action_Grid_View, &MainWindow::SetGridView); + connect_menu(ui->action_Tree_View, &MainWindow::SetTreeView); + // Multiplayer connect(ui->action_View_Lobby, &QAction::triggered, multiplayer_state, &MultiplayerState::OnViewLobby); @@ -3373,6 +3380,22 @@ void MainWindow::ResetWindowSize1080() { ResetWindowSize(Layout::ScreenDocked::Width, Layout::ScreenDocked::Height); } +void MainWindow::SetGameListMode(Settings::GameListMode mode) { + ui->action_Grid_View->setChecked(mode == Settings::GameListMode::GridView); + ui->action_Tree_View->setChecked(mode == Settings::GameListMode::TreeView); + + UISettings::values.game_list_mode = mode; + game_list->ResetViewMode(); +} + +void MainWindow::SetGridView() { + SetGameListMode(Settings::GameListMode::GridView); +} + +void MainWindow::SetTreeView() { + SetGameListMode(Settings::GameListMode::TreeView); +} + void MainWindow::OnConfigure() { const auto old_theme = UISettings::values.theme; const bool old_discord_presence = UISettings::values.enable_discord_presence.GetValue(); -- cgit v1.2.3