[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
This commit is contained in:
crueter 2026-02-06 19:51:01 +01:00
parent 69aff83ef4
commit b9e052b3a7
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
19 changed files with 517 additions and 122 deletions

View file

@ -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();