Remove legacy patch support

This commit is contained in:
Megamouse 2021-01-08 18:36:12 +01:00
parent e05f1c37ad
commit a692adefd7
5 changed files with 15 additions and 159 deletions

View file

@ -62,14 +62,13 @@ patch_manager_dialog::patch_manager_dialog(std::shared_ptr<gui_settings> gui_set
setModal(true);
// Load config for special settings
patch_engine::load_config(m_legacy_patches_enabled);
patch_engine::load_config();
// Load gui settings
m_show_owned_games_only = m_gui_settings->GetValue(gui::pm_show_owned).toBool();
// Initialize gui controls
ui->patch_filter->setText(QString::fromStdString(search_term));
ui->cb_enable_legacy_patches->setChecked(m_legacy_patches_enabled);
ui->cb_owned_games_only->setChecked(m_show_owned_games_only);
ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)->setText(tr("Download latest patches"));
@ -81,7 +80,6 @@ patch_manager_dialog::patch_manager_dialog(std::shared_ptr<gui_settings> gui_set
connect(ui->patch_tree, &QTreeWidget::currentItemChanged, this, &patch_manager_dialog::handle_item_selected);
connect(ui->patch_tree, &QTreeWidget::itemChanged, this, &patch_manager_dialog::handle_item_changed);
connect(ui->patch_tree, &QTreeWidget::customContextMenuRequested, this, &patch_manager_dialog::handle_custom_context_menu_requested);
connect(ui->cb_enable_legacy_patches, &QCheckBox::stateChanged, this, &patch_manager_dialog::handle_legacy_patches_enabled);
connect(ui->cb_owned_games_only, &QCheckBox::stateChanged, this, &patch_manager_dialog::handle_show_owned_games_only);
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close);
connect(ui->buttonBox, &QDialogButtonBox::clicked, [this](QAbstractButton* button)
@ -204,22 +202,11 @@ void patch_manager_dialog::populate_tree()
for (const auto& [hash, container] : m_map)
{
// Don't show legacy patches, because you can't configure them anyway
if (container.is_legacy)
{
continue;
}
const QString q_hash = QString::fromStdString(hash);
// Add patch items
for (const auto& [description, patch] : container.patch_info_map)
{
if (patch.is_legacy)
{
continue;
}
const QString q_patch_group = QString::fromStdString(patch.patch_group);
for (const auto& [title, serials] : patch.titles)
@ -374,7 +361,7 @@ void patch_manager_dialog::populate_tree()
void patch_manager_dialog::save_config()
{
patch_engine::save_config(m_map, m_legacy_patches_enabled);
patch_engine::save_config(m_map);
}
void patch_manager_dialog::filter_patches(const QString& term)
@ -475,7 +462,7 @@ void patch_manager_dialog::handle_item_selected(QTreeWidgetItem *current, QTreeW
{
const auto& container = m_map.at(hash);
if (!container.is_legacy && container.patch_info_map.find(description) != container.patch_info_map.end())
if (container.patch_info_map.find(description) != container.patch_info_map.end())
{
const auto& found_info = container.patch_info_map.at(description);
info.author = QString::fromStdString(found_info.author);
@ -553,7 +540,7 @@ void patch_manager_dialog::handle_item_changed(QTreeWidgetItem *item, int /*colu
{
auto& container = m_map[hash];
if (!container.is_legacy && container.patch_info_map.find(description) != container.patch_info_map.end())
if (container.patch_info_map.find(description) != container.patch_info_map.end())
{
m_map[hash].patch_info_map[description].titles[title][serial][app_version] = enabled;
handle_item_selected(item, nullptr);
@ -585,9 +572,9 @@ void patch_manager_dialog::handle_custom_context_menu_requested(const QPoint &po
{
const auto& container = m_map.at(hash);
if (!container.is_legacy && container.patch_info_map.find(description) != container.patch_info_map.end())
if (container.patch_info_map.find(description) != container.patch_info_map.end())
{
const auto info = container.patch_info_map.at(description);
const auto& info = container.patch_info_map.at(description);
QAction* open_filepath = new QAction(tr("Show Patch File"));
menu->addAction(open_filepath);
@ -798,11 +785,6 @@ void patch_manager_dialog::dropEvent(QDropEvent* event)
}
}
void patch_manager_dialog::handle_legacy_patches_enabled(int state)
{
m_legacy_patches_enabled = state == Qt::CheckState::Checked;
}
void patch_manager_dialog::handle_show_owned_games_only(int state)
{
m_show_owned_games_only = state == Qt::CheckState::Checked;