mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-12-06 07:12:28 +01:00
Qt/patches: optimize patch_manager_dialog::handle_item_changed
This commit is contained in:
parent
3926889c97
commit
c69d7bc758
|
|
@ -735,17 +735,13 @@ void patch_manager_dialog::handle_item_changed(QTreeWidgetItem* item, int /*colu
|
|||
// Get checkstate of the item
|
||||
const bool enabled = item->checkState(0) == Qt::CheckState::Checked;
|
||||
|
||||
// Get patch identifiers stored in item data
|
||||
// Uncheck other patches with the same patch_group if this patch was enabled
|
||||
if (const auto node = item->parent(); node && enabled)
|
||||
{
|
||||
const node_level level = static_cast<node_level>(item->data(0, node_level_role).toInt());
|
||||
const std::string hash = item->data(0, hash_role).toString().toStdString();
|
||||
const std::string title = item->data(0, title_role).toString().toStdString();
|
||||
const std::string serial = item->data(0, serial_role).toString().toStdString();
|
||||
const std::string app_version = item->data(0, app_version_role).toString().toStdString();
|
||||
const std::string description = item->data(0, description_role).toString().toStdString();
|
||||
const std::string patch_group = item->data(0, patch_group_role).toString().toStdString();
|
||||
|
||||
// Uncheck other patches with the same patch_group if this patch was enabled
|
||||
if (const auto node = item->parent(); node && enabled && !patch_group.empty() && level == node_level::patch_level)
|
||||
if (!patch_group.empty() && level == node_level::patch_level)
|
||||
{
|
||||
for (int i = 0; i < node->childCount(); i++)
|
||||
{
|
||||
|
|
@ -760,19 +756,30 @@ void patch_manager_dialog::handle_item_changed(QTreeWidgetItem* item, int /*colu
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Enable/disable the patch for this item and show its metadata
|
||||
const std::string hash = item->data(0, hash_role).toString().toStdString();
|
||||
if (m_map.contains(hash))
|
||||
{
|
||||
auto& info = m_map[hash].patch_info_map;
|
||||
const std::string description = item->data(0, description_role).toString().toStdString();
|
||||
|
||||
if (info.contains(description))
|
||||
{
|
||||
const std::string title = item->data(0, title_role).toString().toStdString();
|
||||
const std::string serial = item->data(0, serial_role).toString().toStdString();
|
||||
const std::string app_version = item->data(0, app_version_role).toString().toStdString();
|
||||
|
||||
info[description].titles[title][serial][app_version].enabled = enabled;
|
||||
|
||||
if (item->isSelected())
|
||||
{
|
||||
handle_item_selected(item, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void patch_manager_dialog::handle_config_value_changed(double value)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue