2024-07-30 11:42:36 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
|
|
|
// SPDX-License-Identifier: GPL-3.0+
|
2023-05-25 16:24:01 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-10-20 15:25:59 +00:00
|
|
|
#include <QtGui/QStandardItemModel>
|
2024-10-20 15:39:09 +00:00
|
|
|
#include <QtCore/QSortFilterProxyModel>
|
2023-05-25 16:24:01 +00:00
|
|
|
|
|
|
|
#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:
|
2024-10-20 15:25:59 +00:00
|
|
|
void onCheatListItemDoubleClicked(const QModelIndex& index);
|
|
|
|
void onCheatListItemChanged(QStandardItem* item);
|
2023-05-25 16:24:01 +00:00
|
|
|
void onReloadClicked();
|
|
|
|
void updateListEnabled();
|
2024-01-07 07:35:41 +00:00
|
|
|
void reloadList();
|
2023-05-25 16:24:01 +00:00
|
|
|
|
|
|
|
private:
|
2024-10-20 15:25:59 +00:00
|
|
|
QStandardItem* getTreeViewParent(const std::string_view parent);
|
|
|
|
QList<QStandardItem*> populateTreeViewRow(const Patch::PatchInfo& pi, bool enabled);
|
2023-05-25 16:24:01 +00:00
|
|
|
void setCheatEnabled(std::string name, bool enabled, bool save_and_reload_settings);
|
|
|
|
void setStateForAll(bool enabled);
|
2024-10-20 15:25:59 +00:00
|
|
|
void setStateRecursively(QStandardItem* parent, bool enabled);
|
2023-05-25 16:24:01 +00:00
|
|
|
|
|
|
|
Ui::GameCheatSettingsWidget m_ui;
|
2023-10-14 08:45:09 +00:00
|
|
|
SettingsWindow* m_dialog;
|
2024-10-20 15:25:59 +00:00
|
|
|
QStandardItemModel* m_model = nullptr;
|
2024-10-20 15:39:09 +00:00
|
|
|
QSortFilterProxyModel* m_model_proxy = nullptr;
|
2023-05-25 16:24:01 +00:00
|
|
|
|
2024-10-20 15:25:59 +00:00
|
|
|
UnorderedStringMap<QStandardItem*> m_parent_map;
|
2023-05-25 16:24:01 +00:00
|
|
|
std::vector<Patch::PatchInfo> m_patches;
|
|
|
|
std::vector<std::string> m_enabled_patches;
|
|
|
|
};
|