duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

cheatmanagerwindow.h (1938B)


      1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
      2 // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
      3 
      4 #pragma once
      5 
      6 #include "ui_cheatmanagerwindow.h"
      7 
      8 #include "core/cheats.h"
      9 
     10 #include <QtCore/QTimer>
     11 #include <QtWidgets/QComboBox>
     12 #include <QtWidgets/QLabel>
     13 #include <QtWidgets/QPushButton>
     14 #include <QtWidgets/QTableWidget>
     15 #include <QtWidgets/QWidget>
     16 #include <optional>
     17 
     18 class CheatManagerWindow : public QWidget
     19 {
     20   Q_OBJECT
     21 
     22 public:
     23   CheatManagerWindow();
     24   ~CheatManagerWindow();
     25 
     26 Q_SIGNALS:
     27   void closed();
     28 
     29 protected:
     30   void showEvent(QShowEvent* event);
     31   void closeEvent(QCloseEvent* event);
     32   void resizeEvent(QResizeEvent* event);
     33   void resizeColumns();
     34 
     35 private Q_SLOTS:
     36   CheatList* getCheatList() const;
     37   void updateCheatList();
     38   void saveCheatList();
     39   void cheatListCurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
     40   void cheatListItemActivated(QTreeWidgetItem* item);
     41   void cheatListItemChanged(QTreeWidgetItem* item, int column);
     42   void activateCheat(u32 index);
     43   void setCheatCheckState(u32 index, bool checked);
     44   void newCategoryClicked();
     45   void addCodeClicked();
     46   void editCodeClicked();
     47   void deleteCodeClicked();
     48   void activateCodeClicked();
     49   void importClicked();
     50   void importFromFileTriggered();
     51   void importFromTextTriggered();
     52   void exportClicked();
     53   void clearClicked();
     54   void resetClicked();
     55 
     56 private:
     57   enum : int
     58   {
     59     MAX_DISPLAYED_SCAN_RESULTS = 5000
     60   };
     61 
     62   void connectUi();
     63   void fillItemForCheatCode(QTreeWidgetItem* item, u32 index, const CheatCode& code);
     64 
     65   QTreeWidgetItem* getItemForCheatIndex(u32 index) const;
     66   QTreeWidgetItem* getItemForCheatGroup(const QString& group_name) const;
     67   QTreeWidgetItem* createItemForCheatGroup(const QString& group_name) const;
     68   QStringList getCheatGroupNames() const;
     69   int getSelectedCheatIndex() const;
     70 
     71   Ui::CheatManagerWindow m_ui;
     72 
     73   QTimer* m_update_timer = nullptr;
     74 };