diff options
| author | crueter <crueter@eden-emu.dev> | 2026-02-06 19:51:01 +0100 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-02-06 19:51:01 +0100 |
| commit | b9e052b3a7b9d3f265c16e9c5dacb68473b2bd4c (patch) | |
| tree | 9802fc76035552ad6137b580f7737576da1d92b3 /src/yuzu/main_window.cpp | |
| parent | 69aff83ef448b1f76fad1fa6ae46ff9f70b840c0 (diff) | |
[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 <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3479
Diffstat (limited to 'src/yuzu/main_window.cpp')
| -rw-r--r-- | src/yuzu/main_window.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
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 <boost/algorithm/string/split.hpp> +#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(); |
