diff options
| author | crueter <crueter@eden-emu.dev> | 2026-04-21 04:01:39 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-04-21 04:01:39 +0200 |
| commit | 0257a8d49123948c0f9b3d091aaf8b6a1641c913 (patch) | |
| tree | d4540c686b0b0f2f53c498cd26b3779db7916d18 /src/yuzu/data_dialog.cpp | |
| parent | 6c76908ddbf67854fd45fdbfa73edb440f420f14 (diff) | |
[desktop] Change data manager to use tabs instead of a list (#3856)
Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3856
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/yuzu/data_dialog.cpp')
| -rw-r--r-- | src/yuzu/data_dialog.cpp | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/yuzu/data_dialog.cpp b/src/yuzu/data_dialog.cpp index bbe5d43e05..8d50843eb3 100644 --- a/src/yuzu/data_dialog.cpp +++ b/src/yuzu/data_dialog.cpp @@ -23,27 +23,18 @@ DataDialog::DataDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique<U // TODO: Should we make this a single widget that pulls data from a model? #define WIDGET(label, name) \ - ui->page->addWidget(new DataWidget(FrontendCommon::DataManager::DataDir::name, \ - QtCommon::StringLookup::DataManager##name##Tooltip, \ - QStringLiteral(#name), this)); \ - ui->labels->addItem(label); + ui->pages->addTab(new DataWidget(FrontendCommon::DataManager::DataDir::name, \ + QtCommon::StringLookup::DataManager##name##Tooltip, \ + QStringLiteral(#name), this), \ + label); WIDGET(tr("Shaders"), Shaders) - WIDGET(tr("UserNAND"), UserNand) - WIDGET(tr("SysNAND"), SysNand) + WIDGET(tr("User NAND"), UserNand) + WIDGET(tr("System NAND"), SysNand) WIDGET(tr("Mods"), Mods) WIDGET(tr("Saves"), Saves) #undef WIDGET - - connect(ui->labels, &QListWidget::itemSelectionChanged, this, [this]() { - const auto items = ui->labels->selectedItems(); - if (items.isEmpty()) { - return; - } - - ui->page->setCurrentIndex(ui->labels->row(items[0])); - }); } DataDialog::~DataDialog() = default; @@ -71,25 +62,29 @@ DataWidget::DataWidget(FrontendCommon::DataManager::DataDir data_dir, } void DataWidget::clear() { - std::string user_id = selectProfile(); - QtCommon::Content::ClearDataDir(m_dir, user_id); + std::optional<std::string> user_id = selectProfile(); + if (!user_id) return; + QtCommon::Content::ClearDataDir(m_dir, user_id.value()); scan(); } void DataWidget::open() { - std::string user_id = selectProfile(); + std::optional<std::string> user_id = selectProfile(); + if (!user_id) return; QDesktopServices::openUrl(QUrl::fromLocalFile( - QString::fromStdString(FrontendCommon::DataManager::GetDataDirString(m_dir, user_id)))); + QString::fromStdString(FrontendCommon::DataManager::GetDataDirString(m_dir, user_id.value())))); } void DataWidget::upload() { - std::string user_id = selectProfile(); - QtCommon::Content::ExportDataDir(m_dir, user_id, m_exportName); + std::optional<std::string> user_id = selectProfile(); + if (!user_id) return; + QtCommon::Content::ExportDataDir(m_dir, user_id.value(), m_exportName); } void DataWidget::download() { - std::string user_id = selectProfile(); - QtCommon::Content::ImportDataDir(m_dir, user_id, std::bind(&DataWidget::scan, this)); + std::optional<std::string> user_id = selectProfile(); + if (!user_id) return; + QtCommon::Content::ImportDataDir(m_dir, user_id.value(), std::bind(&DataWidget::scan, this)); } void DataWidget::scan() { @@ -108,10 +103,11 @@ void DataWidget::scan() { QtConcurrent::run([this]() { return FrontendCommon::DataManager::DataDirSize(m_dir); })); } -std::string DataWidget::selectProfile() { +std::optional<std::string> DataWidget::selectProfile() { std::string user_id{}; if (m_dir == FrontendCommon::DataManager::DataDir::Saves) { user_id = GetProfileIDString(); + if (user_id.empty()) return std::nullopt; } return user_id; |
