2023-12-22 11:57:49 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0+
|
2023-05-25 16:24:01 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QtWidgets/QWidget>
|
|
|
|
|
|
|
|
#include "ui_GameCheatSettingsWidget.h"
|
|
|
|
|
|
|
|
#include "pcsx2/Patch.h"
|
|
|
|
|
|
|
|
#include "common/HeterogeneousContainers.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <string_view>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace GameList
|
|
|
|
{
|
|
|
|
struct Entry;
|
|
|
|
}
|
|
|
|
|
2023-10-14 08:45:09 +00:00
|
|
|
class SettingsWindow;
|
2023-05-25 16:24:01 +00:00
|
|
|
|
|
|
|
class GameCheatSettingsWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-10-14 08:45:09 +00:00
|
|
|
GameCheatSettingsWidget(SettingsWindow* dialog, QWidget* parent);
|
2023-05-25 16:24:01 +00:00
|
|
|
~GameCheatSettingsWidget();
|
|
|
|
|
2024-01-07 03:05:09 +00:00
|
|
|
void disableAllCheats();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent* event) override;
|
|
|
|
|
2023-05-25 16:24:01 +00:00
|
|
|
private Q_SLOTS:
|
|
|
|
void onCheatListItemDoubleClicked(QTreeWidgetItem* item, int column);
|
|
|
|
void onCheatListItemChanged(QTreeWidgetItem* item, int column);
|
|
|
|
void onReloadClicked();
|
|
|
|
void updateListEnabled();
|
2024-01-07 07:35:41 +00:00
|
|
|
void reloadList();
|
2023-05-25 16:24:01 +00:00
|
|
|
|
|
|
|
private:
|
2024-05-14 23:42:40 +00:00
|
|
|
QTreeWidgetItem* getTreeWidgetParent(const std::string_view parent);
|
2023-05-25 16:24:01 +00:00
|
|
|
void populateTreeWidgetItem(QTreeWidgetItem* item, const Patch::PatchInfo& pi, bool enabled);
|
|
|
|
void setCheatEnabled(std::string name, bool enabled, bool save_and_reload_settings);
|
|
|
|
void setStateForAll(bool enabled);
|
|
|
|
void setStateRecursively(QTreeWidgetItem* parent, bool enabled);
|
|
|
|
|
|
|
|
Ui::GameCheatSettingsWidget m_ui;
|
2023-10-14 08:45:09 +00:00
|
|
|
SettingsWindow* m_dialog;
|
2023-05-25 16:24:01 +00:00
|
|
|
|
|
|
|
UnorderedStringMap<QTreeWidgetItem*> m_parent_map;
|
|
|
|
std::vector<Patch::PatchInfo> m_patches;
|
|
|
|
std::vector<std::string> m_enabled_patches;
|
|
|
|
};
|