2020-10-19 15:14:49 +00:00
|
|
|
#pragma once
|
|
|
|
#include "core/cheats.h"
|
|
|
|
#include "ui_cheatmanagerdialog.h"
|
|
|
|
#include <QtCore/QTimer>
|
|
|
|
#include <QtWidgets/QComboBox>
|
|
|
|
#include <QtWidgets/QDialog>
|
|
|
|
#include <QtWidgets/QLabel>
|
|
|
|
#include <QtWidgets/QPushButton>
|
|
|
|
#include <QtWidgets/QTableWidget>
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
class CheatManagerDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
CheatManagerDialog(QWidget* parent);
|
|
|
|
~CheatManagerDialog();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent* event);
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void resizeColumns();
|
|
|
|
|
|
|
|
CheatList* getCheatList() const;
|
|
|
|
void updateCheatList();
|
|
|
|
void saveCheatList();
|
|
|
|
void cheatListCurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
|
|
|
|
void cheatListItemActivated(QTreeWidgetItem* item);
|
|
|
|
void cheatListItemChanged(QTreeWidgetItem* item, int column);
|
|
|
|
void activateCheat(u32 index);
|
2021-08-25 16:59:30 +00:00
|
|
|
void setCheatCheckState(u32 index, bool checked);
|
2020-10-19 15:14:49 +00:00
|
|
|
void newCategoryClicked();
|
|
|
|
void addCodeClicked();
|
|
|
|
void editCodeClicked();
|
|
|
|
void deleteCodeClicked();
|
|
|
|
void activateCodeClicked();
|
|
|
|
void importClicked();
|
2020-11-07 14:22:04 +00:00
|
|
|
void importFromFileTriggered();
|
|
|
|
void importFromTextTriggered();
|
2020-10-19 15:14:49 +00:00
|
|
|
void exportClicked();
|
2021-02-11 14:20:04 +00:00
|
|
|
void clearClicked();
|
|
|
|
void resetClicked();
|
2020-10-19 15:14:49 +00:00
|
|
|
|
|
|
|
void addToWatchClicked();
|
2020-12-18 09:04:31 +00:00
|
|
|
void addManualWatchAddressClicked();
|
2020-10-19 15:14:49 +00:00
|
|
|
void removeWatchClicked();
|
|
|
|
void scanCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
|
|
|
|
void watchCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
|
|
|
|
void scanItemChanged(QTableWidgetItem* item);
|
|
|
|
void watchItemChanged(QTableWidgetItem* item);
|
|
|
|
void updateScanValue();
|
|
|
|
void updateScanUi();
|
|
|
|
|
|
|
|
private:
|
2020-10-21 11:36:13 +00:00
|
|
|
enum : int
|
|
|
|
{
|
|
|
|
MAX_DISPLAYED_SCAN_RESULTS = 5000
|
|
|
|
};
|
|
|
|
|
2020-10-19 15:14:49 +00:00
|
|
|
void setupAdditionalUi();
|
|
|
|
void connectUi();
|
|
|
|
void setUpdateTimerEnabled(bool enabled);
|
|
|
|
void updateResults();
|
|
|
|
void updateResultsValues();
|
|
|
|
void updateWatch();
|
|
|
|
void updateWatchValues();
|
2020-10-21 11:08:34 +00:00
|
|
|
void fillItemForCheatCode(QTreeWidgetItem* item, u32 index, const CheatCode& code);
|
2020-10-19 15:14:49 +00:00
|
|
|
|
|
|
|
QTreeWidgetItem* getItemForCheatIndex(u32 index) const;
|
2020-10-21 11:30:23 +00:00
|
|
|
QTreeWidgetItem* getItemForCheatGroup(const QString& group_name) const;
|
|
|
|
QTreeWidgetItem* createItemForCheatGroup(const QString& group_name) const;
|
|
|
|
QStringList getCheatGroupNames() const;
|
2020-10-19 15:14:49 +00:00
|
|
|
int getSelectedCheatIndex() const;
|
2021-08-06 11:24:14 +00:00
|
|
|
int getSelectedResultIndexFirst() const;
|
|
|
|
int getSelectedResultIndexLast() const;
|
|
|
|
int getSelectedWatchIndexFirst() const;
|
|
|
|
int getSelectedWatchIndexLast() const;
|
2020-10-19 15:14:49 +00:00
|
|
|
|
|
|
|
Ui::CheatManagerDialog m_ui;
|
|
|
|
|
|
|
|
MemoryScan m_scanner;
|
|
|
|
MemoryWatchList m_watch;
|
|
|
|
|
|
|
|
QTimer* m_update_timer = nullptr;
|
|
|
|
};
|