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_uniquepage->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 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 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 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 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 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; diff --git a/src/yuzu/data_dialog.h b/src/yuzu/data_dialog.h index 7f988f6047..2915f00848 100644 --- a/src/yuzu/data_dialog.h +++ b/src/yuzu/data_dialog.h @@ -45,7 +45,7 @@ private: FrontendCommon::DataManager::DataDir m_dir; const QString m_exportName; - std::string selectProfile(); + std::optional selectProfile(); }; #endif // DATA_DIALOG_H diff --git a/src/yuzu/data_dialog.ui b/src/yuzu/data_dialog.ui index 02e674d856..1e33530774 100644 --- a/src/yuzu/data_dialog.ui +++ b/src/yuzu/data_dialog.ui @@ -27,31 +27,9 @@ - + - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - - 275 - 200 - - + -1